Commit e7926dd5 authored by Chunchi Che's avatar Chunchi Che

impl CTOS TimeConfirm

parent 558f5612
import { ygopro } from "../../idl/ocgcore";
import { YgoProPacket } from "../packet";
import { CTOS_TIME_CONFIRM } from "../protoDecl";
/*
* CTOS CTOS_TIME_CONFIRM
*
* @param - null
*
* @usage - 确认计时?
*
* */
export default class CtosTimeConfirm extends YgoProPacket {
constructor(_: ygopro.YgoCtosMsg) {
super(1, CTOS_TIME_CONFIRM, new Uint8Array(0));
}
}
......@@ -9,6 +9,7 @@ export const CTOS_HS_READY = 34;
export const CTOS_HS_START = 37;
export const CTOS_HAND_RESULT = 3;
export const CTOS_TP_RESULT = 4;
export const CTOS_TIME_CONFIRM = 21;
export const STOC_JOIN_GAME = 18;
export const STOC_CHAT = 25;
......
......@@ -12,6 +12,7 @@ import HsReadyAdapter from "./ocgAdapter/ctos/ctosHsReady";
import HsStartAdapter from "./ocgAdapter/ctos/ctosHsStart";
import HandResult from "./ocgAdapter/ctos/ctosHandResult";
import TpResult from "./ocgAdapter/ctos/ctosTpResult";
import TimeConfirm from "./ocgAdapter/ctos/ctosTimeConfirm";
export function sendUpdateDeck(deck: IDeck) {
const updateDeck = new ygopro.YgoCtosMsg({
......@@ -107,3 +108,12 @@ export function sendTpResult(isFirst: boolean) {
socketMiddleWare({ cmd: socketCmd.SEND, payload });
}
export function sendTimeConfirm() {
const timeConfirm = new ygopro.YgoCtosMsg({
ctos_time_confirm: new ygopro.CtosTimeConfirm({}),
});
const payload = new TimeConfirm(timeConfirm).serialize();
socketMiddleWare({ cmd: socketCmd.SEND, payload });
}
import { ygopro } from "../../api/ocgcore/idl/ocgcore";
import { store } from "../../store";
import { updateTimeLimit } from "../../reducers/duel/mod";
import { sendTimeConfirm } from "../../api/ocgcore/ocgHelper";
export default function handleTimeLimit(timeLimit: ygopro.StocTimeLimit) {
const dispatch = store.dispatch;
dispatch(updateTimeLimit([timeLimit.player, timeLimit.left_time]));
sendTimeConfirm();
}
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