Skip to content

Commit

Permalink
fix:fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
TiyoSheng committed Oct 30, 2023
1 parent 36eb063 commit 72330c8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/client/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const root = ReactDOM.createRoot(rootElement);


// https://vitejs.dev/guide/env-and-mode.html
// if (import.meta.env.DEV) {
if (true) {
const { mount: mountDevTools } = await import("@latticexyz/dev-tools");
const comp = [];
network.world.components.forEach((c) => {
Expand All @@ -46,4 +46,4 @@ const root = ReactDOM.createRoot(rootElement);
write$: network.write$,
recsWorld: network.world,
});
// }
}
1 change: 1 addition & 0 deletions packages/client/src/pages/game/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ const Game = () => {
if (curPlayer && curPlayer.addr) {
console.log(curPlayer, 'curPlayer')
localStorage.setItem('curPlayer', JSON.stringify(toObject(curPlayer)))
localStorage.setItem('worldContractAddress', network.worldContract.address)
}
const battles = useEntityQuery([Has(BattleList)]).map((entity) => {
let id = decodeEntity({ battleId: "uint256" }, entity);
Expand Down
6 changes: 4 additions & 2 deletions packages/client/src/pages/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ const Home = () => {

const play = () => {
let curPlayer = localStorage.getItem('curPlayer') || null;

if (curPlayer) {
let worldContractAddress = localStorage.getItem('worldContractAddress') || null;
if (curPlayer && curPlayer.addr == network.account && worldContractAddress == network.worldContract.address) {
curPlayer = JSON.parse(curPlayer);
// to /game
navigate('/game', {
Expand All @@ -245,6 +245,8 @@ const Home = () => {
});
return;
} else {
localStorage.removeItem('curPlayer');
localStorage.removeItem('worldContractAddress');
createWallet();
}
}
Expand Down

0 comments on commit 72330c8

Please sign in to comment.