Commit 7de528a2 authored by chechunchi's avatar chechunchi

handle MsgHandResult

parent f0dd5248
Pipeline #22494 passed with stages
in 13 minutes and 58 seconds
import { ygopro } from "@/api";
import { matStore } from "@/stores";
import MsgHandResult = ygopro.StocGameMessage.MsgHandResult;
export default (res: MsgHandResult) => {
console.log(res);
// TODO
const { result1, result2 } = res;
matStore.handResults.set(0, result1);
matStore.handResults.set(1, result2);
};
......@@ -81,6 +81,14 @@ export const matStore: MatState = proxy<MatState>({
enableEp: false, // 允许回合结束
},
unimplemented: 0,
handResults: {
me: 0,
op: 0,
of: (controller: number) => matStore.handResults[getWhom(controller)],
set(controller, result) {
matStore.handResults[getWhom(controller)] = result;
},
},
// methods
isMe,
});
......
......@@ -37,6 +37,10 @@ export interface MatState {
tossResult?: string; // 骰子/硬币结果
handResults: BothSide<HandResult> & {
set: (controller: number, result: HandResult) => void;
}; // 猜拳结果
/** 根据自己的先后手判断是否是自己 */
isMe: (player: number) => boolean;
}
......@@ -94,4 +98,11 @@ export interface PhaseState {
enableM2: boolean; // 允许进入M2阶段
enableEp: boolean; // 允许回合结束
}
export enum HandResult {
UNKNOWN = 0,
SCISSOR = 1,
ROCK = 2,
PAPER = 3,
}
// <<< play mat state <<<
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