Commit bb9cecc2 authored by timel's avatar timel

fix: remove players' names in matStore

parent 1a692983
......@@ -16,18 +16,13 @@ export default (start: ygopro.StocGameMessage.MsgStart) => {
? 1
: 0;
const meName = playerStore.getMePlayer().name;
const opName = playerStore.getOpPlayer().name;
matStore.initInfo.set(0, {
life: start.life1,
name: opponent == 0 ? opName : meName,
deckSize: start.deckSize1,
extraSize: start.extraSize1,
});
matStore.initInfo.set(1, {
life: start.life2,
name: opponent == 1 ? opName : meName,
deckSize: start.deckSize2,
extraSize: start.extraSize2,
});
......
......@@ -52,10 +52,6 @@ const initInfo: MatState["initInfo"] = (() => {
});
})();
const hint: MatState["hint"] = proxy({
code: -1,
});
/**
* 💡 决斗盘状态仓库,本文件核心,
* 具体介绍可以点进`MatState`去看
......@@ -76,7 +72,7 @@ export const matStore: MatState = proxy<MatState>({
initInfo,
selfType: ygopro.StocTypeChange.SelfType.UNKNOWN,
hint,
hint: { code: -1 },
currentPlayer: -1,
phase: {
currentPhase: ygopro.StocGameMessage.MsgNewPhase.PhaseType.UNKNOWN, // TODO 当前的阶段 应该改成enum
......
......@@ -40,7 +40,6 @@ export interface MatState {
export interface InitInfo {
masterRule?: string;
name: string;
life: number;
deckSize: number;
extraSize: number;
......
......@@ -3,15 +3,20 @@ import "./index.scss";
import React from "react";
import { useSnapshot } from "valtio";
import { matStore } from "@/stores";
import { matStore, playerStore } from "@/stores";
export const LifeBar: React.FC = () => {
const snap = useSnapshot(matStore.initInfo);
const snapPlayer = useSnapshot(playerStore);
return (
<div id="life-bar-container">
<div id="life-bar">{`${snap.me.name}: ${snap.me.life}`}</div>
<div id="life-bar">{`${snap.op.name}: ${snap.op.life}`}</div>
<div id="life-bar">{`${snapPlayer.getMePlayer().name}: ${
snap.me.life
}`}</div>
<div id="life-bar">{`${snapPlayer.getOpPlayer().name}: ${
snap.op.life
}`}</div>
</div>
);
};
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