From 36b3a9f3cc3ceb626e0dabb1c445cbd0e030d2d0 Mon Sep 17 00:00:00 2001 From: Tiyo Date: Wed, 8 Nov 2023 16:37:12 +0800 Subject: [PATCH] fix: fix bug --- .../client/src/components/Battle/index.tsx | 2 ++ packages/client/src/index.tsx | 24 +++++++++--------- packages/client/src/pages/test/index.jsx | 25 ++++++++++++++----- packages/contracts/worlds.json | 4 +-- 4 files changed, 35 insertions(+), 20 deletions(-) diff --git a/packages/client/src/components/Battle/index.tsx b/packages/client/src/components/Battle/index.tsx index 80cf1054..597836b8 100644 --- a/packages/client/src/components/Battle/index.tsx +++ b/packages/client/src/components/Battle/index.tsx @@ -161,12 +161,14 @@ export default function Battle(props) { }, [battleState]) const setSelectAction = (img: any, action: String) => { + if (battleState != 0) return setSelectActionData(img); let bt:any = confirmBattleData bt[0] = action setConfirmBattleData(bt) } const setSelectTactic = (img: any, tactic: number) => { + if (battleState != 0) return setSelectTacticData(img); let bt:any = confirmBattleData bt[1] = tactic diff --git a/packages/client/src/index.tsx b/packages/client/src/index.tsx index 5029c9e2..6cc50bdd 100644 --- a/packages/client/src/index.tsx +++ b/packages/client/src/index.tsx @@ -17,16 +17,16 @@ setup().then(async (result) => { ); - const { mount: mountDevTools } = await import("@latticexyz/dev-tools"); - mountDevTools({ - config: mudConfig, - publicClient: network.publicClient, - walletClient: network.walletClient, - latestBlock$: network.latestBlock$, - blockStorageOperations$: network.blockStorageOperations$, - worldAddress: network.worldContract.address, - worldAbi: network.worldContract.abi, - write$: network.write$, - recsWorld: network.world, - }); + // const { mount: mountDevTools } = await import("@latticexyz/dev-tools"); + // mountDevTools({ + // config: mudConfig, + // publicClient: network.publicClient, + // walletClient: network.walletClient, + // latestBlock$: network.latestBlock$, + // blockStorageOperations$: network.blockStorageOperations$, + // worldAddress: network.worldContract.address, + // worldAbi: network.worldContract.abi, + // write$: network.write$, + // recsWorld: network.world, + // }); }); diff --git a/packages/client/src/pages/test/index.jsx b/packages/client/src/pages/test/index.jsx index 855d0af8..fac71f19 100644 --- a/packages/client/src/pages/test/index.jsx +++ b/packages/client/src/pages/test/index.jsx @@ -23,10 +23,12 @@ let transfering = false -let boxData = [{x: 13, y: 1}, {x: 23, y: 5}, {x: 26, y: 8}, {x: 23, y: 18}, {x: 30, y: 20}, +let boxData1 = [{x: 13, y: 1}, {x: 23, y: 5}, {x: 26, y: 8}, {x: 23, y: 18}, {x: 30, y: 20}, {x: 8, y: 21}, {x: 5, y: 25}, {x: 30, y: 36}, {x: 19, y: 30}, {x: 3, y: 37}, {x: 28, y: 39}, {x: 36, y: 51}, {x: 40, y: 55}, {x: 27, y: 59}, {x: 13, y: 55}, - {x: 3, y: 49}, {x: 3, y: 40}, {x: 21, y: 29}, {x: 41, y: 26}, {x: 30, y: 20}] + {x: 3, y: 49}, {x: 3, y: 40}, {x: 21, y: 29}, {x: 41, y: 26}, {x: 59, y: 20}] + + let boxI = 0 const Test = () => { const [stepData, setStepData] = useState([]); @@ -140,7 +142,7 @@ const Test = () => { let box = getComponentValue(BoxList, entity) box.id = id.boxId.toString() return box; - }); + }).filter(e => !e.opened); console.log(boxs, 'boxs') // const GameConfig = useComponentValue(GameConfig, singletonEntity); @@ -315,8 +317,19 @@ const Test = () => { setBattlesData(battlesDataTemp) } - const CreateBoxFun = () => { - CreateBox(boxData[0], boxData[1]); + const CreateBoxFun = async (boxi) => { + if (boxi == undefined) boxi = 0 + let box = boxData1[boxi] + console.log(box, 'box', boxi,boxData1 ) + await CreateBox(box.x, box.y); + + if (boxi >= boxData1.length) { + // boxI = 0 + } else { + setTimeout(() => { + CreateBoxFun(boxi + 1) + }, 100) + } } const openBoxFun = () => { @@ -489,7 +502,7 @@ const Test = () => { boxChange(e, 0)} placeholder='x' /> boxChange(e, 1)} placeholder='y' /> -
确认
+
CreateBoxFun(0)}>确认
打开宝箱
diff --git a/packages/contracts/worlds.json b/packages/contracts/worlds.json index 159f70f8..50ad63a4 100644 --- a/packages/contracts/worlds.json +++ b/packages/contracts/worlds.json @@ -4,10 +4,10 @@ "blockNumber": 29582781 }, "31337": { - "address": "0x313F922BE1649cEc058EC0f076664500c78bdc0b" + "address": "0xd977422c9eE9B646f64A4C4389a6C98ad356d8C4" }, "33784": { - "address": "0xD1B2087d0317522df980050602CE91Ba37869139", + "address": "0xA99013b9ee90d226A585336043017Cf5c038BB41", "blockNumber": 82752 }, "421613": {