diff --git a/src/abi/main.json b/src/abi/main.json index 77f4317..d9d4e88 100644 --- a/src/abi/main.json +++ b/src/abi/main.json @@ -94,90 +94,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "_address", - "type": "address" - } - ], - "name": "boomerBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "boomerKillCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "boomerMaxSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "boomerPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "boomerSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "boomerSurvivorCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "mailbomb", @@ -319,6 +235,90 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_address", + "type": "address" + } + ], + "name": "unaboomerBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "unaboomerMaxSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "unaboomerPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "unaboomerSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "unaboomerSurvivorCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "unaboomersKilled", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "withdraw", diff --git a/src/styles/sections.css b/src/styles/sections.css index 7b00737..e1adb4c 100644 --- a/src/styles/sections.css +++ b/src/styles/sections.css @@ -87,17 +87,17 @@ } .dots { - width: 6px; - height: 6px; + width: 7px; + height: 7px; position: absolute; border-radius: 50%; filter: drop-shadow(0 0 4px rgb(255, 230, 0, .5)); - animation: pulse .75s ease-out infinite alternate; + animation: pulse .75s ease infinite alternate; } @keyframes pulse { - 0% { opacity: .3 } - 25% { opacity: .5} + 0% { opacity: .5 } + 25% { opacity: .65} 50% { opacity: .7 } 75% { opacity: .9 } 100% { opacity: 1 } diff --git a/src/template/Sections.jsx b/src/template/Sections.jsx index 6cdfc36..3753344 100644 --- a/src/template/Sections.jsx +++ b/src/template/Sections.jsx @@ -75,18 +75,32 @@ export function Section2() { class GenerateBombOverlay extends React.Component { constructor(props) { super(props); + let bombCoords = this.generateCoords(props.amount); + this.state = {coords: bombCoords, color: props.color}; + } + + generateCoords(amt) { let bombCoords = []; - for (let i = 0; i < props.amount; i++) { - let min = Math.ceil(0); - let randX = Math.floor(Math.random() * (Math.floor(100) - min) + min); - let randY = Math.floor(Math.random() * (Math.floor(100) - min) + min); + for (let i = 0; i < amt; i++) { + let randX = Math.floor(Math.random() * 100); + let randY = Math.floor(Math.random() * 100); let o = { x: `${randX}%`, y: `${randY}%` } bombCoords.push(o); } - this.state = {coords: bombCoords, color: this.props.color}; + return bombCoords; + } + + componentDidUpdate(prevProps) { + if (this.props.amount !== prevProps.amount) { + console.log('updating game map'); + let bombCoords = this.generateCoords(this.props.amount); + this.setState({ + coords: bombCoords + }); + } } render() { @@ -97,6 +111,24 @@ class GenerateBombOverlay extends React.Component { class GameMap extends React.Component { constructor(props) { super(props); + this.state = { + bombSupply: 0, + bombBalance: 0, + bombsExploded: 0 + } + } + + componentDidUpdate(prevProps) { + if ( + (this.props.bombSupply !== prevProps.bombSupply) || + (this.props.bombBalance !== prevProps.bombBalance) + ) { + this.setState({ + bombSupply: this.props.bombSupply, + bombBalance: this.props.bombBalance, + bombsExploded: this.props.bombsExploded + }); + } } render() { @@ -106,11 +138,11 @@ class GameMap extends React.Component {
{/* show active bombs held by other players */} - + {/* show bombs that have exploded */} - + {/* show player bombs */} - +
) @@ -132,7 +164,7 @@ function Section3() { unaboomersKilled: 0 }); const handleStateChange = (obj) =>{ - setOptions(preState => ({...preState , obj})) + setOptions(preState => ({...preState , ...obj})) } const { isConnected, address } = useAccount(); useContractReads({ @@ -189,7 +221,7 @@ function Section3() { } ], watch: true, - cacheTime: 5000, + cacheTime: 5, onSuccess(data) { handleStateChange({ unaboomerPrice: data[0].toString(), @@ -201,7 +233,6 @@ function Section3() { bombsExploded: data[6].toString(), unaboomersKilled: data[7].toString(), }); - console.log(options) } }); const radicalizeBoomersPrepare = usePrepareContractWrite({