Commit 261c838e authored by Chunchi Che's avatar Chunchi Che

update roomStore

parent b93e1471
Pipeline #22925 failed with stages
in 13 minutes and 9 seconds
import { ygopro } from "@/api";
import { roomStore } from "@/stores";
import { RoomStage, roomStore } from "@/stores";
export default function handleSelectHand(_: ygopro.YgoStocMsg) {
roomStore.selectHand = true;
roomStore.stage = RoomStage.SELECT_HAND;
}
import { ygopro } from "@/api";
import { roomStore } from "@/stores";
import { RoomStage, roomStore } from "@/stores";
export default function handleSelectTp(_: ygopro.YgoStocMsg) {
roomStore.selectTp = true;
roomStore.stage = RoomStage.SELECT_TP;
}
import { ygopro } from "@/api";
import { roomStore } from "@/stores";
import { RoomStage, roomStore } from "@/stores";
export default function handleDuelStart(_pb: ygopro.YgoStocMsg) {
roomStore.moraStart = true;
roomStore.stage = RoomStage.MORA;
}
......@@ -19,15 +19,22 @@ interface DeckInfo {
sideSize: number;
}
// 房间内当前的阶段
export enum RoomStage {
WAITING = 0, // 正在准备
MORA = 1, // 正在猜拳
SELECT_HAND = 2, // 选择猜拳
SELECT_TP = 2, // 选边
}
class RoomStore implements NeosStore {
joined: boolean = false; // 是否已经加入房间
players: Player[] = []; // 进入房间的玩家列表
observerCount: number = 0; // 观战者数量
isHost: boolean = false; // 当前玩家是否是房主
selfType: SelfType = 0; // 当前玩家的类型
moraStart: boolean = false; // 猜拳阶段是否开始
selectHand: boolean = false; // 是否可以选择猜拳
selectTp: boolean = false; // 是否可以选边
stage: RoomStage = RoomStage.WAITING;
getMePlayer() {
if (this.selfType == SelfType.PLAYER1) return this.players[0];
......@@ -43,9 +50,7 @@ class RoomStore implements NeosStore {
this.players = [];
this.observerCount = 0;
this.isHost = false;
this.moraStart = false;
this.selectHand = false;
this.selectTp = false;
this.stage = RoomStage.WAITING;
}
}
......
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