Commit 71871e17 authored by Chunchi Che's avatar Chunchi Che

sync neos-protobuf

parent 5a6f4933
Pipeline #21526 passed with stages
in 14 minutes
neos-protobuf @ be66d514
Subproject commit 1648b05d2e0bf0fc84c9e98104b8d9ca6a014c1a
Subproject commit be66d514be6d1224163f55bca85dc361d0c9fe6a
This diff is collapsed.
......@@ -2,15 +2,14 @@ import { ygopro } from "../../../idl/ocgcore";
import { YgoProPacket } from "../../packet";
import { CTOS_RESPONSE } from "../../protoDecl";
import adaptSelectBattleCmdResponse from "./selectBattleCmd";
import adaptSelectCardResponse from "./selectCard";
import adaptSelectChainResponse from "./selectChain";
import adaptSelectCounterResponse from "./selectCounter";
import adaptSelectEffectYnResponse from "./selectEffectYn";
import adaptSelectIdleCmdResponse from "./selectIdleCmd";
import adaptSelectMultiResponse from "./selectMulti";
import adaptSelectOptionResponse from "./selectOption";
import adaptSelectPlaceResponse from "./selectPlace";
import adaptSelectPositionResponse from "./selectPosition";
import adaptSelectUnselectCardResponse from "./selectUnselectCard";
import adaptSelectSingleResponse from "./selectSingle";
import adaptSortCardResponse from "./sortCard";
/*
......@@ -37,13 +36,13 @@ export default class CtosResponsePacket extends YgoProPacket {
break;
}
case "select_card": {
extraData = adaptSelectCardResponse(response.select_card);
case "select_multi": {
extraData = adaptSelectMultiResponse(response.select_multi);
break;
}
case "select_chain": {
extraData = adaptSelectChainResponse(response.select_chain);
case "select_single": {
extraData = adaptSelectSingleResponse(response.select_single);
break;
}
......@@ -67,13 +66,6 @@ export default class CtosResponsePacket extends YgoProPacket {
break;
}
case "select_unselect_card": {
extraData = adaptSelectUnselectCardResponse(
response.select_unselect_card
);
break;
}
case "select_counter_response": {
extraData = adaptSelectCounterResponse(
response.select_counter_response
......
......@@ -2,7 +2,7 @@ import { BufferWriter } from "rust-src";
import { ygopro } from "../../../idl/ocgcore";
export default (response: ygopro.CtosGameMsgResponse.SelectCardResponse) => {
export default (response: ygopro.CtosGameMsgResponse.SelectMultiResponse) => {
const writer = new BufferWriter();
writer.writeUint8(response.selected_ptrs.length);
......
......@@ -2,7 +2,7 @@ import { BufferWriter } from "rust-src";
import { ygopro } from "../../../idl/ocgcore";
export default (response: ygopro.CtosGameMsgResponse.SelectChainResponse) => {
export default (response: ygopro.CtosGameMsgResponse.SelectSingleResponse) => {
const writer = new BufferWriter();
writer.writeInt32(response.selected_ptr);
......
import { BufferWriter } from "rust-src";
import { ygopro } from "../../../idl/ocgcore";
export default (
response: ygopro.CtosGameMsgResponse.SelectUnselectCardResponse
) => {
const writer = new BufferWriter();
if (response.cancel_or_finish) {
writer.writeInt32(-1);
} else {
writer.writeUint8(1);
writer.writeUint8(response.selected_ptr);
}
return writer.toArray();
};
......@@ -172,10 +172,10 @@ export function sendSelectPlaceResponse(value: {
socketMiddleWare({ cmd: socketCmd.SEND, payload });
}
export function sendSelectCardResponse(value: number[]) {
export function sendSelectMultiResponse(value: number[]) {
const response = new ygopro.YgoCtosMsg({
ctos_response: new ygopro.CtosGameMsgResponse({
select_card: new ygopro.CtosGameMsgResponse.SelectCardResponse({
select_multi: new ygopro.CtosGameMsgResponse.SelectMultiResponse({
selected_ptrs: value,
}),
}),
......@@ -185,10 +185,10 @@ export function sendSelectCardResponse(value: number[]) {
socketMiddleWare({ cmd: socketCmd.SEND, payload });
}
export function sendSelectChainResponse(value: number) {
export function sendSelectSingleResponse(value: number) {
const response = new ygopro.YgoCtosMsg({
ctos_response: new ygopro.CtosGameMsgResponse({
select_chain: new ygopro.CtosGameMsgResponse.SelectChainResponse({
select_single: new ygopro.CtosGameMsgResponse.SelectSingleResponse({
selected_ptr: value,
}),
}),
......@@ -252,24 +252,6 @@ export function sendSelectBattleCmdResponse(value: number) {
socketMiddleWare({ cmd: socketCmd.SEND, payload });
}
export function sendSelectUnselectCardResponse(value: {
cancel_or_finish?: boolean;
selected_ptr?: number;
}) {
const response = new ygopro.YgoCtosMsg({
ctos_response: new ygopro.CtosGameMsgResponse({
select_unselect_card:
new ygopro.CtosGameMsgResponse.SelectUnselectCardResponse({
selected_ptr: value.selected_ptr,
cancel_or_finish: value.cancel_or_finish,
}),
}),
});
const payload = new GameMsgResponse(response).serialize();
socketMiddleWare({ cmd: socketCmd.SEND, payload });
}
export function sendSelectCounterResponse(counts: number[]) {
const response = new ygopro.YgoCtosMsg({
ctos_response: new ygopro.CtosGameMsgResponse({
......
import { sendSelectChainResponse, ygopro } from "@/api";
import { sendSelectSingleResponse, ygopro } from "@/api";
import {
fetchCheckCardMeta,
fetchSelectHintMeta,
......@@ -49,7 +49,7 @@ export default (selectChain: MsgSelectChain) => {
switch (handle_flag) {
case 0: {
// 直接回答
sendSelectChainResponse(-1);
sendSelectSingleResponse(-1);
break;
}
......@@ -79,7 +79,7 @@ export default (selectChain: MsgSelectChain) => {
}
case 4: {
// 有一张强制发动的卡,直接回应
sendSelectChainResponse(chains[0].response);
sendSelectSingleResponse(chains[0].response);
break;
}
......
......@@ -6,8 +6,8 @@ import { useSnapshot } from "valtio";
import {
fetchStrings,
sendSelectCardResponse,
sendSelectChainResponse,
sendSelectMultiResponse,
sendSelectSingleResponse,
} from "@/api";
import { useConfig } from "@/config";
import { matStore, messageStore } from "@/stores";
......@@ -85,9 +85,9 @@ export const CheckCardModal = () => {
.map((option) => option.response);
if (isChain) {
sendSelectChainResponse(values[0]);
sendSelectSingleResponse(values[0]);
} else {
sendSelectCardResponse(values);
sendSelectMultiResponse(values);
}
resetCheckCardModal();
}}
......@@ -99,7 +99,7 @@ export const CheckCardModal = () => {
<Button
disabled={!finishable}
onClick={() => {
sendSelectCardResponse([FINISH_RESPONSE]);
sendSelectSingleResponse(FINISH_RESPONSE);
resetCheckCardModal();
}}
onFocus={() => {}}
......@@ -111,7 +111,7 @@ export const CheckCardModal = () => {
<Button
disabled={!cancelable}
onClick={() => {
sendSelectChainResponse(CANCEL_RESPONSE);
sendSelectSingleResponse(CANCEL_RESPONSE);
resetCheckCardModal();
}}
onFocus={() => {}}
......
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