Skip to content

Commit

Permalink
feat: add tier btn
Browse files Browse the repository at this point in the history
  • Loading branch information
noyyyy committed Dec 12, 2023
1 parent a3bbc9e commit cf730bf
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
File renamed without changes
36 changes: 36 additions & 0 deletions packages/client/src/components/PlayerTier.tsx
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>
);
};
2 changes: 2 additions & 0 deletions packages/client/src/ui/ChessMain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import shopPic from "/assets/shop.jpg";
import gameBarPic from "/assets/gameBar.jpg";
import chessPic from "/assets/chess.jpg";
import { Synergy } from "./Synergy";
import { PlayerTier } from "@/components/PlayerTier";

export interface boardInterface {
creatureId?: any;
Expand Down Expand Up @@ -165,6 +166,7 @@ const Game = () => {
</div>
<Synergy />
<PlayerList />
<PlayerTier />

<HeroInfo hero={acHero as HeroBaseAttr} />
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/ui/Chessboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

.handle-area {
height: calc(100vh - 140px);
margin-top: 2%;
margin-top: 0.5%;
display: flex;
justify-content: center;
align-items: flex-start;
Expand Down

0 comments on commit cf730bf

Please sign in to comment.