-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { useMUD } from "@/MUDContext"; | ||
import { initEntity } from "@/constant"; | ||
import { useComponentValue } from "@latticexyz/react"; | ||
import { Tooltip } from "antd"; | ||
|
||
export const PlayerTier = () => { | ||
const { | ||
network: { playerEntity }, | ||
components: { Player, GameConfig }, | ||
systemCalls: { buyExp }, | ||
} = useMUD(); | ||
|
||
const playerData = useComponentValue(Player, playerEntity); | ||
const tier = playerData?.tier + 1; | ||
const gameConfig = useComponentValue(GameConfig, initEntity); | ||
|
||
console.log("gameConfig?.expUpgrade: ", gameConfig?.expUpgrade); | ||
return ( | ||
<div className="fixed top-[42rem] left-[12rem]"> | ||
<Tooltip title="EXP +4 , COST 4"> | ||
<div | ||
className=" bg-[url('/assets/up_level.png')] bg-contain bg-no-repeat w-28 h-14" | ||
onClick={buyExp} | ||
> | ||
<div className="relative left-14 top-1"> | ||
{"Lv. "} | ||
{tier} | ||
<div className="-mt-1 left-0.5"> | ||
{playerData?.exp} / {gameConfig?.expUpgrade[tier]} | ||
</div> | ||
</div> | ||
</div> | ||
</Tooltip> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters