master
lza_menace 2 years ago
parent 8630bc443c
commit b0f1c22096

@ -27,7 +27,7 @@ const { connectors } = getDefaultWallets({
}); });
const wagmiClient = createClient({ const wagmiClient = createClient({
autoConnect: false, autoConnect: true,
connectors, connectors,
provider, provider,
webSocketProvider webSocketProvider

@ -1,5 +1,11 @@
@font-face {
font-family: 'SummerPixel';
src: url('../../public/SummerPixel22Regular-jE0W7.ttf');
}
* { * {
font-family: 'Times New Roman', Times, serif; font-family: 'SummerPixel';
font-weight: 400; font-weight: 400;
font-style: normal; font-style: normal;
} }

@ -19,8 +19,8 @@
} }
#heroText { #heroText {
padding-top: 12vh; padding-top: 14vh;
font-size: 4em; font-size: 3.5em;
width: 80%; width: 80%;
text-align: center; text-align: center;
margin: 0 auto; margin: 0 auto;
@ -28,7 +28,7 @@
#heroImage { #heroImage {
max-width: 240px; max-width: 240px;
margin: 1em auto; margin: .5em auto;
animation: fadeIn 4s ease-in; animation: fadeIn 4s ease-in;
} }

@ -86,15 +86,38 @@ class GenerateBombOverlay extends React.Component {
} }
bombCoords.push(o); bombCoords.push(o);
} }
this.state = {coords: bombCoords}; this.state = {coords: bombCoords, color: this.props.color};
} }
render() { render() {
return this.state.coords.map((obj) => <div className="dots" style={{top: obj.y, left: obj.x, backgroundColor: this.props.color}} />) return this.state.coords.map((obj) => <div className="dots" style={{top: obj.y, left: obj.x, backgroundColor: this.state.color}} />)
} }
} }
export function Section3() { class GameMap extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<>
<h1 id="gameMapTitle">Game Map</h1>
<div className="map">
<img src={Map} />
{/* show active bombs held by other players */}
<GenerateBombOverlay amount={this.props.bombSupply - this.props.bombBalance - this.props.bombsExploded} color={'white'} />
{/* show bombs that have exploded */}
<GenerateBombOverlay amount={this.props.bombsExploded} color={'red'} />
{/* show player bombs */}
<GenerateBombOverlay amount={this.props.bombBalance} color={'yellow'} />
</div>
</>
)
}
}
function Section3() {
const [boomerAmount, setBoomerAmount] = useState(1); const [boomerAmount, setBoomerAmount] = useState(1);
const [bombAmount, setBombAmount] = useState(1); const [bombAmount, setBombAmount] = useState(1);
const [sendBombAmount, setSendBombAmount] = useState(1); const [sendBombAmount, setSendBombAmount] = useState(1);
@ -104,7 +127,7 @@ export function Section3() {
const [bombBalance, setBombBalance] = useState(0); const [bombBalance, setBombBalance] = useState(0);
const [bombSupply, setBombSupply] = useState(0); const [bombSupply, setBombSupply] = useState(0);
const [boomerSupply, setBoomerSupply] = useState(0); const [boomerSupply, setBoomerSupply] = useState(0);
const [bombExploded, setBombExploded] = useState(0); const [bombsExploded, setBombsExploded] = useState(0);
const [boomerKillCount, setBoomerKillCount] = useState(0); const [boomerKillCount, setBoomerKillCount] = useState(0);
const { isConnected, address } = useAccount(); const { isConnected, address } = useAccount();
useContractReads({ useContractReads({
@ -161,7 +184,6 @@ export function Section3() {
} }
], ],
watch: true, watch: true,
cacheTime: 5000,
onSuccess(data) { onSuccess(data) {
setBoomerPrice(data[0].toString()); setBoomerPrice(data[0].toString());
setBombPrice(data[1].toString()); setBombPrice(data[1].toString());
@ -169,7 +191,7 @@ export function Section3() {
setBombBalance(data[3].toString()); setBombBalance(data[3].toString());
setBoomerSupply(data[4].toString()); setBoomerSupply(data[4].toString());
setBombSupply(data[5].toString()); setBombSupply(data[5].toString());
setBombExploded(data[6].toString()); setBombsExploded(data[6].toString());
setBoomerKillCount(data[7].toString()); setBoomerKillCount(data[7].toString());
} }
}); });
@ -208,6 +230,7 @@ export function Section3() {
return ( return (
<section className="section"> <section className="section">
{isConnected && {isConnected &&
<>
<div className="mintContainer"> <div className="mintContainer">
<div className="mintItem"> <div className="mintItem">
<h1>Radicalize a Boomer</h1> <h1>Radicalize a Boomer</h1>
@ -245,13 +268,9 @@ export function Section3() {
</p> </p>
<Slider className="slider" min={1} max={30} onChange={v => setSendBombAmount(v)} /> <Slider className="slider" min={1} max={30} onChange={v => setSendBombAmount(v)} />
</div> </div>
<div className="map">
<img src={Map} />
<GenerateBombOverlay amount={bombSupply - bombBalance - bombExploded} color={'white'} />
<GenerateBombOverlay amount={bombExploded} color={'red'} />
<GenerateBombOverlay amount={bombBalance} color={'yellow'} />
</div>
</div> </div>
<GameMap bombSupply={bombSupply} bombBalance={bombBalance} bombsExploded={bombsExploded} />
</>
|| ||
<div id="heroText"> <div id="heroText">
<h1>connect your wallet to play</h1> <h1>connect your wallet to play</h1>

Loading…
Cancel
Save