Commit 9d5ff8ec authored by Chunchi Che's avatar Chunchi Che

update

parent d51ac1c0
Pipeline #17780 passed with stages
in 3 minutes and 10 seconds
......@@ -12,6 +12,7 @@ import {
STOC_HAND_RESULT,
STOC_DECK_COUNT,
STOC_DUEL_START,
STOC_GAME_MSG,
} from "./protoDecl";
import StocChat from "./stoc/stocChat";
import StocJoinGame from "./stoc/stocJoinGame";
......@@ -22,6 +23,7 @@ import StocTypeChange from "./stoc/stocTypeChange";
import StocSelectHand from "./stoc/stocSelectHand";
import StocSelectTp from "./stoc/stocSelectTp";
import StocDeckCount from "./stoc/stocDeckCount";
import StocGameMsg from "./stoc/stocGameMsg/mod";
/*
* 将[`ygoProPacket`]对象转换成[`ygopro.YgoStocMsg`]对象
......@@ -87,6 +89,11 @@ export function adaptStoc(packet: YgoProPacket): ygopro.YgoStocMsg {
break;
}
case STOC_GAME_MSG: {
pb = new StocGameMsg(packet).upcast();
break;
}
default: {
break;
}
......
......@@ -21,5 +21,6 @@ export const STOC_SELECT_TP = 4;
export const STOC_HAND_RESULT = 5;
export const STOC_DECK_COUNT = 9;
export const STOC_DUEL_START = 21;
export const STOC_GAME_MSG = 1;
export const MSG_START = 4;
import { ygopro } from "../../api/ocgcore/idl/ocgcore";
export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
const msg = pb.stoc_game_msg;
switch (msg.gameMsg) {
case "start": {
// TODO
console.log(msg.start);
break;
}
default: {
console.log("Unhandled GameMsg=" + msg.gameMsg);
break;
}
}
}
......@@ -13,6 +13,7 @@ import { adaptStoc } from "../api/ocgcore/ocgAdapter/adapter";
import handleSelectHand from "./mora/selectHand";
import handleSelectTp from "./mora/selectTp";
import handleDeckCount from "./mora/deckCount";
import handleGameMsg from "./duel/gameMsg";
/*
* 先将从长连接中读取到的二进制数据通过Adapter转成protobuf结构体,
......@@ -81,6 +82,11 @@ export default function handleSocketMessage(e: MessageEvent) {
break;
}
case "stoc_game_msg": {
handleGameMsg(pb);
break;
}
default: {
console.log(packet);
......
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