Skip to content

Commit

Permalink
fix: fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
TiyoSheng committed Nov 8, 2023
1 parent 60b261b commit 36b3a9f
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 20 deletions.
2 changes: 2 additions & 0 deletions packages/client/src/components/Battle/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 12 additions & 12 deletions packages/client/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ setup().then(async (result) => {
<App />
</MUDProvider>
);
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,
// });
});
25 changes: 19 additions & 6 deletions packages/client/src/pages/test/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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([]);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 = () => {
Expand Down Expand Up @@ -489,7 +502,7 @@ const Test = () => {
<input type="text" onChange={(e) => boxChange(e, 0)} placeholder='x' />
<input type="text" onChange={(e) => boxChange(e, 1)} placeholder='y' />
</div>
<div className="btn" onClick={CreateBoxFun}>确认</div>
<div className="btn" onClick={() => CreateBoxFun(0)}>确认</div>
</div>
<div className="section">
<div className="title">打开宝箱</div>
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/worlds.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"blockNumber": 29582781
},
"31337": {
"address": "0x313F922BE1649cEc058EC0f076664500c78bdc0b"
"address": "0xd977422c9eE9B646f64A4C4389a6C98ad356d8C4"
},
"33784": {
"address": "0xD1B2087d0317522df980050602CE91Ba37869139",
"address": "0xA99013b9ee90d226A585336043017Cf5c038BB41",
"blockNumber": 82752
},
"421613": {
Expand Down

0 comments on commit 36b3a9f

Please sign in to comment.