Commit 4e52f9cf authored by Chunchi Che's avatar Chunchi Che Committed by WANG HE

add CtosHsStart adapt

parent 9d3aa237
import { ygopro } from "../../idl/ocgcore";
import { ygoProPacket } from "../packet";
import { CTOS_HS_START } from "../protoDecl";
export default class CtosHsStartPacket extends ygoProPacket {
constructor(_: ygopro.YgoCtosMsg) {
super(1, CTOS_HS_START, new Uint8Array(0));
}
}
......@@ -2,6 +2,7 @@ export const CTOS_PLAYER_INFO = 16;
export const CTOS_JOIN_GAME = 18;
export const CTOS_UPDATE_DECK = 2;
export const CTOS_HS_READY = 34;
export const CTOS_HS_START = 37;
export const STOC_JOIN_GAME = 18;
export const STOC_CHAT = 25;
......
import { ygopro } from "./idl/ocgcore";
import socketMiddleWare, { socketCmd } from "../../middleware/socket";
import { IDeck } from "../Card";
import playerInfoPacket from "./ocgAdapter/ctos/ctosPlayerInfo";
import joinGamePacket from "./ocgAdapter/ctos/ctosJoinGame";
import CtosPlayerInfo from "./ocgAdapter/ctos/ctosPlayerInfo";
import CtosJoinGame from "./ocgAdapter/ctos/ctosJoinGame";
import CtosUpdateDeck from "./ocgAdapter/ctos/ctosUpdateDeck";
import CtosHsReady from "./ocgAdapter/ctos/ctosHsReady";
import CtosHsStart from "./ocgAdapter/ctos/ctosHsStart";
export function sendUpdateDeck(deck: IDeck) {
const updateDeck = new ygopro.YgoCtosMsg({
......@@ -32,8 +33,9 @@ export function sendHsStart() {
const hasStart = new ygopro.YgoCtosMsg({
ctos_hs_start: new ygopro.CtosHsStart({}),
});
const payload = new CtosHsStart(hasStart).serialize();
socketMiddleWare({ cmd: socketCmd.SEND, payload: hasStart.serialize() });
socketMiddleWare({ cmd: socketCmd.SEND, payload });
}
export function sendPlayerInfo(ws: WebSocket, player: string) {
......@@ -42,7 +44,7 @@ export function sendPlayerInfo(ws: WebSocket, player: string) {
name: player,
}),
});
const packet = new playerInfoPacket(playerInfo); // todo: 需要收敛在一个层次里
const packet = new CtosPlayerInfo(playerInfo); // todo: 需要收敛在一个层次里
ws.send(packet.serialize());
}
......@@ -55,7 +57,7 @@ export function sendJoinGame(ws: WebSocket, version: number, passWd: string) {
passwd: passWd,
}),
});
const packet = new joinGamePacket(joinGame);
const packet = new CtosJoinGame(joinGame);
ws.send(packet.serialize());
}
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