From 2459a9da2ffb4dffa15f21e0be17f87904689956 Mon Sep 17 00:00:00 2001
From: vivomo <929992114@qq.com>
Date: Sun, 22 Oct 2023 00:53:21 +0800
Subject: [PATCH 1/3] feat: update font style
---
packages/client/src/common.scss | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/client/src/common.scss b/packages/client/src/common.scss
index 81bcc348..e0259f7f 100644
--- a/packages/client/src/common.scss
+++ b/packages/client/src/common.scss
@@ -84,7 +84,7 @@ button {
padding: 20px;
font-size: 16px;
line-height: 2;
- //font-family: MISS, sans-serif;
+ font-family: MISS, sans-serif;
text-align: center;
color: #5D2E1C;
From acc2f1b46d4f125fe36298df43f46da9ee9fb7c9 Mon Sep 17 00:00:00 2001
From: vivomo <929992114@qq.com>
Date: Sun, 22 Oct 2023 01:03:37 +0800
Subject: [PATCH 2/3] feat: update getWinTreasureChest
---
.../src/components/TreasureChest/index.tsx | 8 +++---
packages/client/src/pages/game/index.tsx | 26 ++++++++++++++++---
2 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/packages/client/src/components/TreasureChest/index.tsx b/packages/client/src/components/TreasureChest/index.tsx
index 7c5a06b1..9552cda4 100644
--- a/packages/client/src/components/TreasureChest/index.tsx
+++ b/packages/client/src/components/TreasureChest/index.tsx
@@ -2,10 +2,10 @@ import React, { useState } from 'react';
import './styles.scss';
export interface ITreasureChest {
- id: number | string;
- x: number;
- y: number;
- gem: number;
+ id?: number | string;
+ x?: number;
+ y?: number;
+ gem?: number;
opening?: boolean;
}
diff --git a/packages/client/src/pages/game/index.tsx b/packages/client/src/pages/game/index.tsx
index 18dc22ee..280f786f 100644
--- a/packages/client/src/pages/game/index.tsx
+++ b/packages/client/src/pages/game/index.tsx
@@ -81,10 +81,7 @@ const Game = () => {
Congrats,you got {treasureChest[targetIndex].gem} gems!
-
+
@@ -100,6 +97,26 @@ const Game = () => {
}, 3000);
}
+ const getWinTreasureChest = (gem = 1) => {
+ const curPlayer = players.find((item) => item.id === curId);
+ curPlayer.gem += gem;
+ setContent(
+
+
+ Congrats,you got {gem} gems!
+
+
+
+
+
+
+
+
+
+ );
+ open();
+ }
+
const triggerVertexUpdate = (cur, before) => {
const xDegree = cur.x - before.x;
const yDegree = cur.y - before.y;
@@ -168,6 +185,7 @@ const Game = () => {
onPlayerMove: movePlayer,
treasureChest,
openTreasureChest,
+ getWinTreasureChest,
setStartBattleData
}}
>
From 7ec88f1b8b7940ce09c97aad8faa5e62443fc16e Mon Sep 17 00:00:00 2001
From: vivomo <929992114@qq.com>
Date: Sun, 22 Oct 2023 01:15:20 +0800
Subject: [PATCH 3/3] feat: update getWinTreasureChest
---
.../client/src/components/UserInfo/index.tsx | 14 +++++------
.../src/components/UserInfo/styles.scss | 7 ++++++
packages/client/src/pages/game/index.tsx | 24 +------------------
3 files changed, 15 insertions(+), 30 deletions(-)
diff --git a/packages/client/src/components/UserInfo/index.tsx b/packages/client/src/components/UserInfo/index.tsx
index 8de8ca88..dd5d3b1c 100644
--- a/packages/client/src/components/UserInfo/index.tsx
+++ b/packages/client/src/components/UserInfo/index.tsx
@@ -40,30 +40,30 @@ const UserInfo = (props: IProps) => {
-
+
- HP
- - 100100
+ - {minting ? 0 : 100}100
- Attack
- - 201
+ - {minting ? 0 : 20}1
- AttackRange
- - 51
+ - {minting ? 0 : 5}1
- Speed
- - 22
+ - {minting ? 0 : 2}2
- Strength
- - 201
+ - {minting ? 0 : 20}1
- Space
- - 101
+ - {minting ? 0 : 10}1
diff --git a/packages/client/src/components/UserInfo/styles.scss b/packages/client/src/components/UserInfo/styles.scss
index cd48fd4d..e9ae2161 100644
--- a/packages/client/src/components/UserInfo/styles.scss
+++ b/packages/client/src/components/UserInfo/styles.scss
@@ -77,7 +77,14 @@
color: #fff;
}
+ &.loaded {
+ .extra-attr {
+ visibility: visible;
+ }
+ }
+
.extra-attr {
+ visibility: hidden;
color: red;
&::before {
diff --git a/packages/client/src/pages/game/index.tsx b/packages/client/src/pages/game/index.tsx
index ef91ad3b..346b537e 100644
--- a/packages/client/src/pages/game/index.tsx
+++ b/packages/client/src/pages/game/index.tsx
@@ -53,29 +53,7 @@ const Game = () => {
console.log(e);
setStartBattleData(false);
if (e == 1) {
- console.log('win');
- const curPlayer = players.find((item) => item.id === curId);
- curPlayer.gem += 3;
- setPlayers([...players]);
- setContent(
-
-
- Congrats,you got 3 gems!
-
-
-
-
-
-
-
-
-
- );
- open();
+ getWinTreasureChest(3)
} else if (e == 2) {
console.log('lose');
}