Commit 37415155 authored by timel's avatar timel

fix: small

parent 3acc1431
......@@ -75,7 +75,7 @@ export const matStore: MatState = proxy<MatState>({
hint: { code: -1 },
currentPlayer: -1,
phase: {
currentPhase: ygopro.StocGameMessage.MsgNewPhase.PhaseType.UNKNOWN, // TODO 当前的阶段 应该改成enum
currentPhase: ygopro.StocGameMessage.MsgNewPhase.PhaseType.UNKNOWN,
enableBp: false, // 允许进入战斗阶段
enableM2: false, // 允许进入M2阶段
enableEp: false, // 允许回合结束
......
......@@ -30,6 +30,6 @@
font-weight: bold;
}
.life {
font-size: 2rem;
font-size: 1.8rem;
}
}
......@@ -4,18 +4,28 @@ import React from "react";
import { useSnapshot } from "valtio";
import { matStore, playerStore } from "@/stores";
import classNames from "classnames";
export const LifeBar: React.FC = () => {
const snap = useSnapshot(matStore.initInfo);
const snapPlayer = useSnapshot(playerStore);
const { currentPlayer } = useSnapshot(matStore);
return (
<div id="life-bar-container">
<div className="life-bar">
<div
className={classNames("life-bar", {
"life-bar-activated": matStore.isMe(currentPlayer),
})}
>
<div className="name">{snapPlayer.getOpPlayer().name}</div>
<div className="life">{snap.op.life}</div>
</div>
<div className="life-bar">
<div
className={classNames("life-bar", {
"life-bar-activated": matStore.isMe(currentPlayer),
})}
>
<div className="name">{snapPlayer.getMePlayer().name}</div>
<div className="life">{snap.me.life}</div>
</div>
......
......@@ -36,6 +36,12 @@ export const Menu = () => {
const { currentPlayer } = useSnapshot(matStore);
const currentPhase = snapPhase.currentPhase;
const clearAllIdleInteractivities = () => {
for (const card of cardStore.inner) {
card.idleInteractivities = [];
}
};
const endResponse = [
PhaseType.BATTLE_START,
PhaseType.BATTLE_STEP,
......@@ -46,28 +52,24 @@ export const Menu = () => {
? 3
: 7;
const clearAllIdleInteractivities = () => {
for (const card of cardStore.inner) {
card.idleInteractivities = [];
}
};
const phaseBind: [PhaseType, string, number][] = [
[PhaseType.DRAW, "抽卡阶段", -1],
[PhaseType.STANDBY, "准备阶段", -1],
[PhaseType.MAIN1, "主要阶段 1", -1],
[PhaseType.BATTLE, "战斗阶段", 6],
// [PhaseType.BATTLE_START, "战斗开始", 3],
// [PhaseType.BATTLE_STEP, "战斗步骤", 3],
// [PhaseType.DAMAGE, "伤害步骤", 3],
// [PhaseType.DAMAGE_GAL, "伤害步骤(伤害计算)", 3],
[PhaseType.MAIN2, "主要阶段 2", 2],
[PhaseType.END, "结束阶段", endResponse],
// [PhaseType.UNKNOWN, "未知阶段", response],
// PhaseType, 中文, response, 是否显示
const phaseBind: [PhaseType, string, number, boolean][] = [
[PhaseType.DRAW, "抽卡阶段", -1, true],
[PhaseType.STANDBY, "准备阶段", -1, true],
[PhaseType.MAIN1, "主要阶段 1", -1, true],
[PhaseType.BATTLE, "战斗阶段", 6, true],
[PhaseType.BATTLE_START, "战斗开始", 3, false],
[PhaseType.BATTLE_STEP, "战斗步骤", 3, false],
[PhaseType.DAMAGE, "伤害步骤", 3, false],
[PhaseType.DAMAGE_GAL, "伤害步骤(伤害计算)", 3, false],
[PhaseType.MAIN2, "主要阶段 2", 2, true],
[PhaseType.END, "结束阶段", endResponse, true],
[PhaseType.UNKNOWN, "未知阶段", -1, false],
];
const phaseSwitchItems: MenuProps["items"] = phaseBind.map(
([phase, str, response], i) => ({
const phaseSwitchItems: MenuProps["items"] = phaseBind
.filter(([, , , show]) => show)
.map(([phase, str, response], i) => ({
key: i,
label: str,
disabled: currentPhase >= phase,
......@@ -78,21 +80,18 @@ export const Menu = () => {
},
icon: currentPhase >= phase ? <CheckOutlined /> : <ArrowRightOutlined />,
danger: phase === PhaseType.END,
})
);
}));
const surrenderMenuItems: MenuProps["items"] = [
{
key: 0,
label: "取消",
},
{
key: 1,
label: "确定",
danger: true,
onClick: sendSurrender,
},
];
].map((item, i) => ({ key: i, ...item }));
const globalDisable = !matStore.isMe(currentPlayer);
return (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment