Commit 3184d713 authored by Chunchi Che's avatar Chunchi Che

Merge branch 'feat/animation/chain' into 'main'

Feat/animation/chain

See merge request !190
parents 65312b5b 65ec7fe5
neos-protobuf @ c83175eb
Subproject commit 30d0ceb9d06259c09f3dfd36c3872bd1e9c02b88 Subproject commit c83175eb31577752e3ea02100e5f782f4417b654
...@@ -71,7 +71,10 @@ ...@@ -71,7 +71,10 @@
"hint":{ "hint":{
"waitingDuration":1.5, "waitingDuration":1.5,
"maxCount": 1 "maxCount": 1
} },
"commonDelay": 200,
"moveDelay": 500,
"chainingDelay": 800
}, },
"unimplementedWhiteList":[ "unimplementedWhiteList":[
1, 1,
......
...@@ -71,7 +71,10 @@ ...@@ -71,7 +71,10 @@
"hint":{ "hint":{
"waitingDuration":1.5, "waitingDuration":1.5,
"maxCount": 1 "maxCount": 1
} },
"commonDelay": 200,
"moveDelay": 500,
"chainingDelay": 800
}, },
"unimplementedWhiteList":[ "unimplementedWhiteList":[
1, 1,
......
...@@ -5567,7 +5567,7 @@ export namespace ygopro { ...@@ -5567,7 +5567,7 @@ export namespace ygopro {
[ [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
39, 40, 39, 40, 41,
], ],
]; ];
constructor( constructor(
...@@ -5615,6 +5615,7 @@ export namespace ygopro { ...@@ -5615,6 +5615,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -5657,6 +5658,7 @@ export namespace ygopro { ...@@ -5657,6 +5658,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -5699,6 +5701,7 @@ export namespace ygopro { ...@@ -5699,6 +5701,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -5741,6 +5744,7 @@ export namespace ygopro { ...@@ -5741,6 +5744,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -5783,6 +5787,7 @@ export namespace ygopro { ...@@ -5783,6 +5787,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -5825,6 +5830,7 @@ export namespace ygopro { ...@@ -5825,6 +5830,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -5867,6 +5873,7 @@ export namespace ygopro { ...@@ -5867,6 +5873,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -5909,6 +5916,7 @@ export namespace ygopro { ...@@ -5909,6 +5916,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -5951,6 +5959,7 @@ export namespace ygopro { ...@@ -5951,6 +5959,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -5993,6 +6002,7 @@ export namespace ygopro { ...@@ -5993,6 +6002,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6035,6 +6045,7 @@ export namespace ygopro { ...@@ -6035,6 +6045,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6077,6 +6088,7 @@ export namespace ygopro { ...@@ -6077,6 +6088,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6119,6 +6131,7 @@ export namespace ygopro { ...@@ -6119,6 +6131,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6161,6 +6174,7 @@ export namespace ygopro { ...@@ -6161,6 +6174,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6203,6 +6217,7 @@ export namespace ygopro { ...@@ -6203,6 +6217,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6245,6 +6260,7 @@ export namespace ygopro { ...@@ -6245,6 +6260,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6287,6 +6303,7 @@ export namespace ygopro { ...@@ -6287,6 +6303,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6329,6 +6346,7 @@ export namespace ygopro { ...@@ -6329,6 +6346,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6371,6 +6389,7 @@ export namespace ygopro { ...@@ -6371,6 +6389,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6413,6 +6432,7 @@ export namespace ygopro { ...@@ -6413,6 +6432,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6455,6 +6475,7 @@ export namespace ygopro { ...@@ -6455,6 +6475,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6497,6 +6518,7 @@ export namespace ygopro { ...@@ -6497,6 +6518,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6539,6 +6561,7 @@ export namespace ygopro { ...@@ -6539,6 +6561,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6581,6 +6604,7 @@ export namespace ygopro { ...@@ -6581,6 +6604,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6623,6 +6647,7 @@ export namespace ygopro { ...@@ -6623,6 +6647,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6665,6 +6690,7 @@ export namespace ygopro { ...@@ -6665,6 +6690,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6707,6 +6733,7 @@ export namespace ygopro { ...@@ -6707,6 +6733,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6749,6 +6776,7 @@ export namespace ygopro { ...@@ -6749,6 +6776,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6791,6 +6819,7 @@ export namespace ygopro { ...@@ -6791,6 +6819,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6833,6 +6862,7 @@ export namespace ygopro { ...@@ -6833,6 +6862,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6875,6 +6905,7 @@ export namespace ygopro { ...@@ -6875,6 +6905,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6917,6 +6948,7 @@ export namespace ygopro { ...@@ -6917,6 +6948,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6959,6 +6991,7 @@ export namespace ygopro { ...@@ -6959,6 +6991,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -7001,6 +7034,7 @@ export namespace ygopro { ...@@ -7001,6 +7034,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -7043,6 +7077,7 @@ export namespace ygopro { ...@@ -7043,6 +7077,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -7085,6 +7120,7 @@ export namespace ygopro { ...@@ -7085,6 +7120,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -7127,6 +7163,7 @@ export namespace ygopro { ...@@ -7127,6 +7163,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -7169,6 +7206,7 @@ export namespace ygopro { ...@@ -7169,6 +7206,7 @@ export namespace ygopro {
chaining?: StocGameMessage.MsgChaining; chaining?: StocGameMessage.MsgChaining;
attack?: never; attack?: never;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -7211,6 +7249,7 @@ export namespace ygopro { ...@@ -7211,6 +7249,7 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: StocGameMessage.MsgAttack; attack?: StocGameMessage.MsgAttack;
attack_disable?: never; attack_disable?: never;
chain_solved?: never;
} }
| { | {
start?: never; start?: never;
...@@ -7253,6 +7292,50 @@ export namespace ygopro { ...@@ -7253,6 +7292,50 @@ export namespace ygopro {
chaining?: never; chaining?: never;
attack?: never; attack?: never;
attack_disable?: StocGameMessage.MsgAttackDisabled; attack_disable?: StocGameMessage.MsgAttackDisabled;
chain_solved?: never;
}
| {
start?: never;
draw?: never;
new_turn?: never;
new_phase?: never;
hint?: never;
select_idle_cmd?: never;
select_place?: never;
move?: never;
select_card?: never;
select_chain?: never;
select_effect_yn?: never;
select_position?: never;
select_option?: never;
shuffle_hand?: never;
select_battle_cmd?: never;
pos_change?: never;
select_unselect_card?: never;
select_yes_no?: never;
update_hp?: never;
win?: never;
wait?: never;
unimplemented?: never;
update_data?: never;
reload_field?: never;
select_sum?: never;
select_tribute?: never;
update_counter?: never;
select_counter?: never;
sort_card?: never;
set?: never;
swap?: never;
summoning?: never;
summoned?: never;
flip_summoning?: never;
flip_summoned?: never;
sp_summoning?: never;
sp_summoned?: never;
chaining?: never;
attack?: never;
attack_disable?: never;
chain_solved?: StocGameMessage.MsgChainSolved;
} }
)) ))
) { ) {
...@@ -7392,6 +7475,9 @@ export namespace ygopro { ...@@ -7392,6 +7475,9 @@ export namespace ygopro {
if ("attack_disable" in data && data.attack_disable != undefined) { if ("attack_disable" in data && data.attack_disable != undefined) {
this.attack_disable = data.attack_disable; this.attack_disable = data.attack_disable;
} }
if ("chain_solved" in data && data.chain_solved != undefined) {
this.chain_solved = data.chain_solved;
}
} }
} }
get start() { get start() {
...@@ -7914,6 +8000,19 @@ export namespace ygopro { ...@@ -7914,6 +8000,19 @@ export namespace ygopro {
get has_attack_disable() { get has_attack_disable() {
return pb_1.Message.getField(this, 40) != null; return pb_1.Message.getField(this, 40) != null;
} }
get chain_solved() {
return pb_1.Message.getWrapperField(
this,
StocGameMessage.MsgChainSolved,
41
) as StocGameMessage.MsgChainSolved;
}
set chain_solved(value: StocGameMessage.MsgChainSolved) {
pb_1.Message.setOneofWrapperField(this, 41, this.#one_of_decls[0], value);
}
get has_chain_solved() {
return pb_1.Message.getField(this, 41) != null;
}
get gameMsg() { get gameMsg() {
const cases: { const cases: {
[index: number]: [index: number]:
...@@ -7957,7 +8056,8 @@ export namespace ygopro { ...@@ -7957,7 +8056,8 @@ export namespace ygopro {
| "sp_summoned" | "sp_summoned"
| "chaining" | "chaining"
| "attack" | "attack"
| "attack_disable"; | "attack_disable"
| "chain_solved";
} = { } = {
0: "none", 0: "none",
1: "start", 1: "start",
...@@ -8000,6 +8100,7 @@ export namespace ygopro { ...@@ -8000,6 +8100,7 @@ export namespace ygopro {
38: "chaining", 38: "chaining",
39: "attack", 39: "attack",
40: "attack_disable", 40: "attack_disable",
41: "chain_solved",
}; };
return cases[ return cases[
pb_1.Message.computeOneofCase( pb_1.Message.computeOneofCase(
...@@ -8007,7 +8108,7 @@ export namespace ygopro { ...@@ -8007,7 +8108,7 @@ export namespace ygopro {
[ [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
37, 38, 39, 40, 37, 38, 39, 40, 41,
] ]
) )
]; ];
...@@ -8115,6 +8216,9 @@ export namespace ygopro { ...@@ -8115,6 +8216,9 @@ export namespace ygopro {
attack_disable?: ReturnType< attack_disable?: ReturnType<
typeof StocGameMessage.MsgAttackDisabled.prototype.toObject typeof StocGameMessage.MsgAttackDisabled.prototype.toObject
>; >;
chain_solved?: ReturnType<
typeof StocGameMessage.MsgChainSolved.prototype.toObject
>;
}): StocGameMessage { }): StocGameMessage {
const message = new StocGameMessage({}); const message = new StocGameMessage({});
if (data.start != null) { if (data.start != null) {
...@@ -8297,6 +8401,11 @@ export namespace ygopro { ...@@ -8297,6 +8401,11 @@ export namespace ygopro {
data.attack_disable data.attack_disable
); );
} }
if (data.chain_solved != null) {
message.chain_solved = StocGameMessage.MsgChainSolved.fromObject(
data.chain_solved
);
}
return message; return message;
} }
toObject() { toObject() {
...@@ -8405,6 +8514,9 @@ export namespace ygopro { ...@@ -8405,6 +8514,9 @@ export namespace ygopro {
attack_disable?: ReturnType< attack_disable?: ReturnType<
typeof StocGameMessage.MsgAttackDisabled.prototype.toObject typeof StocGameMessage.MsgAttackDisabled.prototype.toObject
>; >;
chain_solved?: ReturnType<
typeof StocGameMessage.MsgChainSolved.prototype.toObject
>;
} = {}; } = {};
if (this.start != null) { if (this.start != null) {
data.start = this.start.toObject(); data.start = this.start.toObject();
...@@ -8526,6 +8638,9 @@ export namespace ygopro { ...@@ -8526,6 +8638,9 @@ export namespace ygopro {
if (this.attack_disable != null) { if (this.attack_disable != null) {
data.attack_disable = this.attack_disable.toObject(); data.attack_disable = this.attack_disable.toObject();
} }
if (this.chain_solved != null) {
data.chain_solved = this.chain_solved.toObject();
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
...@@ -8676,6 +8791,10 @@ export namespace ygopro { ...@@ -8676,6 +8791,10 @@ export namespace ygopro {
writer.writeMessage(40, this.attack_disable, () => writer.writeMessage(40, this.attack_disable, () =>
this.attack_disable.serialize(writer) this.attack_disable.serialize(writer)
); );
if (this.has_chain_solved)
writer.writeMessage(41, this.chain_solved, () =>
this.chain_solved.serialize(writer)
);
if (!w) return writer.getResultBuffer(); if (!w) return writer.getResultBuffer();
} }
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): StocGameMessage { static deserialize(bytes: Uint8Array | pb_1.BinaryReader): StocGameMessage {
...@@ -8991,6 +9110,14 @@ export namespace ygopro { ...@@ -8991,6 +9110,14 @@ export namespace ygopro {
StocGameMessage.MsgAttackDisabled.deserialize(reader)) StocGameMessage.MsgAttackDisabled.deserialize(reader))
); );
break; break;
case 41:
reader.readMessage(
message.chain_solved,
() =>
(message.chain_solved =
StocGameMessage.MsgChainSolved.deserialize(reader))
);
break;
default: default:
reader.skipField(); reader.skipField();
} }
...@@ -16751,6 +16878,86 @@ export namespace ygopro { ...@@ -16751,6 +16878,86 @@ export namespace ygopro {
return MsgChaining.deserialize(bytes); return MsgChaining.deserialize(bytes);
} }
} }
export class MsgChainSolved extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(
data?:
| any[]
| {
solved_index?: number;
}
) {
super();
pb_1.Message.initialize(
this,
Array.isArray(data) ? data : [],
0,
-1,
[],
this.#one_of_decls
);
if (!Array.isArray(data) && typeof data == "object") {
if ("solved_index" in data && data.solved_index != undefined) {
this.solved_index = data.solved_index;
}
}
}
get solved_index() {
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
}
set solved_index(value: number) {
pb_1.Message.setField(this, 1, value);
}
static fromObject(data: { solved_index?: number }): MsgChainSolved {
const message = new MsgChainSolved({});
if (data.solved_index != null) {
message.solved_index = data.solved_index;
}
return message;
}
toObject() {
const data: {
solved_index?: number;
} = {};
if (this.solved_index != null) {
data.solved_index = this.solved_index;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.solved_index != 0) writer.writeInt32(1, this.solved_index);
if (!w) return writer.getResultBuffer();
}
static deserialize(
bytes: Uint8Array | pb_1.BinaryReader
): MsgChainSolved {
const reader =
bytes instanceof pb_1.BinaryReader
? bytes
: new pb_1.BinaryReader(bytes),
message = new MsgChainSolved();
while (reader.nextField()) {
if (reader.isEndGroup()) break;
switch (reader.getFieldNumber()) {
case 1:
message.solved_index = reader.readInt32();
break;
default:
reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): MsgChainSolved {
return MsgChainSolved.deserialize(bytes);
}
}
export class MsgAttack extends pb_1.Message { export class MsgAttack extends pb_1.Message {
#one_of_decls: number[][] = []; #one_of_decls: number[][] = [];
constructor( constructor(
......
...@@ -115,5 +115,9 @@ ...@@ -115,5 +115,9 @@
"112": { "112": {
"protoType": "attack_disable", "protoType": "attack_disable",
"fields": [] "fields": []
},
"73": {
"protoType": "chain_solved",
"fields": [{ "fieldName": "solved_index", "fieldType": "uint8"}]
} }
} }
...@@ -31,6 +31,7 @@ const MsgConstructorMap: Map<string, Constructor> = new Map([ ...@@ -31,6 +31,7 @@ const MsgConstructorMap: Map<string, Constructor> = new Map([
["chaining", ygopro.StocGameMessage.MsgChaining], ["chaining", ygopro.StocGameMessage.MsgChaining],
["attack", ygopro.StocGameMessage.MsgAttack], ["attack", ygopro.StocGameMessage.MsgAttack],
["attack_disable", ygopro.StocGameMessage.MsgAttackDisabled], ["attack_disable", ygopro.StocGameMessage.MsgAttackDisabled],
["chain_solved", ygopro.StocGameMessage.MsgChainSolved],
]); ]);
export interface penetrateType { export interface penetrateType {
......
import { ygopro } from "@/api";
export default (chainSolved: ygopro.StocGameMessage.MsgChainSolved) => {
console.log(chainSolved);
};
import { ygopro } from "@/api"; import { ygopro } from "@/api";
import { fetchEsHintMeta } from "@/stores"; import { useConfig } from "@/config";
import { fetchEsHintMeta, matStore } from "@/stores";
export default (chaining: ygopro.StocGameMessage.MsgChaining) => { export default (chaining: ygopro.StocGameMessage.MsgChaining) => {
fetchEsHintMeta({ fetchEsHintMeta({
originMsg: "「[?]」被发动时", originMsg: "「[?]」被发动时",
cardID: chaining.code, cardID: chaining.code,
}); });
matStore.setChaining(chaining.location, chaining.code, true);
setTimeout(() => {
matStore.setChaining(chaining.location, chaining.code, false);
// TODO: set chained
}, useConfig().ui.chainingDelay);
}; };
import { ygopro } from "@/api"; import { ygopro } from "@/api";
import { useConfig } from "@/config";
import { matStore } from "@/stores"; import { matStore } from "@/stores";
import onMsgAttack from "./attack"; import onMsgAttack from "./attack";
import onMsgAttackDisable from "./attackDisable"; import onMsgAttackDisable from "./attackDisable";
import onMsgChaining from "./chaining"; import onMsgChaining from "./chaining";
import onMsgChainSolved from "./chainSolved";
import onMsgDraw from "./draw"; import onMsgDraw from "./draw";
import onMsgFilpSummoned from "./flipSummoned"; import onMsgFilpSummoned from "./flipSummoned";
import onMsgFlipSummoning from "./flipSummoning"; import onMsgFlipSummoning from "./flipSummoning";
...@@ -55,7 +57,7 @@ const ActiveList = [ ...@@ -55,7 +57,7 @@ const ActiveList = [
"select_yes_no", "select_yes_no",
]; ];
const TIME_GAP = 200; const NeosConfig = useConfig();
export default function handleGameMsg(pb: ygopro.YgoStocMsg) { export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
// 防止MSG更新太频繁,做下控频 // 防止MSG更新太频繁,做下控频
...@@ -68,6 +70,9 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) { ...@@ -68,6 +70,9 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
matStore.waiting = false; matStore.waiting = false;
} }
// 先重置`delay`
matStore.delay = NeosConfig.ui.commonDelay;
switch (msg.gameMsg) { switch (msg.gameMsg) {
case "start": { case "start": {
onMsgStart(msg.start); onMsgStart(msg.start);
...@@ -107,6 +112,8 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) { ...@@ -107,6 +112,8 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
case "move": { case "move": {
onMsgMove(msg.move); onMsgMove(msg.move);
matStore.delay = NeosConfig.ui.moveDelay + 500;
break; break;
} }
case "select_card": { case "select_card": {
...@@ -232,6 +239,13 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) { ...@@ -232,6 +239,13 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
case "chaining": { case "chaining": {
onMsgChaining(msg.chaining); onMsgChaining(msg.chaining);
matStore.delay += NeosConfig.ui.chainingDelay;
break;
}
case "chain_solved": {
onMsgChainSolved(msg.chain_solved);
break; break;
} }
case "summoning": { case "summoning": {
...@@ -273,5 +287,5 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) { ...@@ -273,5 +287,5 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
break; break;
} }
} }
}, TIME_GAP); }, matStore.delay);
} }
...@@ -3,10 +3,12 @@ import { v4 as v4uuid } from "uuid"; ...@@ -3,10 +3,12 @@ import { v4 as v4uuid } from "uuid";
import { ygopro } from "@/api"; import { ygopro } from "@/api";
import { fetchOverlayMeta, store } from "@/stores"; import { fetchOverlayMeta, store } from "@/stores";
type MsgMove = ygopro.StocGameMessage.MsgMove; type MsgMove = ygopro.StocGameMessage.MsgMove;
import { useConfig } from "@/config";
import { REASON_MATERIAL } from "../../common"; import { REASON_MATERIAL } from "../../common";
const { matStore } = store; const { matStore } = store;
const NeosConfig = useConfig();
const OVERLAY_STACK: { uuid: string; code: number; sequence: number }[] = []; const OVERLAY_STACK: { uuid: string; code: number; sequence: number }[] = [];
...@@ -81,7 +83,7 @@ export default (move: MsgMove) => { ...@@ -81,7 +83,7 @@ export default (move: MsgMove) => {
() => () =>
(matStore.in(to.location).of(to.controler)[to.sequence].focus = (matStore.in(to.location).of(to.controler)[to.sequence].focus =
false), false),
500 // TODO: use config NeosConfig.ui.moveDelay
); );
break; break;
} }
...@@ -114,7 +116,7 @@ export default (move: MsgMove) => { ...@@ -114,7 +116,7 @@ export default (move: MsgMove) => {
for (const hand of matStore.in(to.location).of(to.controler)) { for (const hand of matStore.in(to.location).of(to.controler)) {
hand.focus = false; hand.focus = false;
} }
}, 500); }, NeosConfig.ui.moveDelay);
} }
break; break;
} }
......
...@@ -51,6 +51,7 @@ function reloadDuelField( ...@@ -51,6 +51,7 @@ function reloadDuelField(
idleInteractivities: [], idleInteractivities: [],
counters: {}, counters: {},
focus: false, focus: false,
chaining: false,
reload: true, reload: true,
}; };
}); });
......
...@@ -40,6 +40,7 @@ export default (start: ygopro.StocGameMessage.MsgStart) => { ...@@ -40,6 +40,7 @@ export default (start: ygopro.StocGameMessage.MsgStart) => {
zone: ygopro.CardZone.DECK, zone: ygopro.CardZone.DECK,
}, },
focus: false, focus: false,
chaining: false,
counters: {}, counters: {},
idleInteractivities: [], idleInteractivities: [],
}); });
...@@ -57,6 +58,7 @@ export default (start: ygopro.StocGameMessage.MsgStart) => { ...@@ -57,6 +58,7 @@ export default (start: ygopro.StocGameMessage.MsgStart) => {
zone: ygopro.CardZone.DECK, zone: ygopro.CardZone.DECK,
}, },
focus: false, focus: false,
chaining: false,
counters: {}, counters: {},
idleInteractivities: [], idleInteractivities: [],
}); });
...@@ -75,6 +77,7 @@ export default (start: ygopro.StocGameMessage.MsgStart) => { ...@@ -75,6 +77,7 @@ export default (start: ygopro.StocGameMessage.MsgStart) => {
zone: ygopro.CardZone.EXTRA, zone: ygopro.CardZone.EXTRA,
}, },
focus: false, focus: false,
chaining: false,
counters: {}, counters: {},
idleInteractivities: [], idleInteractivities: [],
}); });
......
import { sendTimeConfirm, ygopro } from "@/api"; import { sendTimeConfirm, ygopro } from "@/api";
import { useConfig } from "@/config";
import { matStore } from "@/stores"; import { matStore } from "@/stores";
const TIME_GAP = 200; // TODO: use config
export default function handleTimeLimit(timeLimit: ygopro.StocTimeLimit) { export default function handleTimeLimit(timeLimit: ygopro.StocTimeLimit) {
setTimeout(() => { setTimeout(() => {
matStore.timeLimits.set(timeLimit.player, timeLimit.left_time); matStore.timeLimits.set(timeLimit.player, timeLimit.left_time);
sendTimeConfirm(); sendTimeConfirm();
}, TIME_GAP); }, useConfig().ui.commonDelay);
} }
...@@ -41,6 +41,7 @@ class CardArray extends Array<CardState> implements ArrayCardState { ...@@ -41,6 +41,7 @@ class CardArray extends Array<CardState> implements ArrayCardState {
position == undefined ? ygopro.CardPosition.FACEUP_ATTACK : position, position == undefined ? ygopro.CardPosition.FACEUP_ATTACK : position,
}, },
focus: focus ?? false, focus: focus ?? false,
chaining: false,
counters: {}, counters: {},
idleInteractivities: [], idleInteractivities: [],
}); });
...@@ -161,6 +162,7 @@ const genBlock = (zone: ygopro.CardZone, n: number) => ...@@ -161,6 +162,7 @@ const genBlock = (zone: ygopro.CardZone, n: number) =>
zone, zone,
}, },
focus: false, focus: false,
chaining: false,
idleInteractivities: [], idleInteractivities: [],
counters: {}, counters: {},
})); }));
...@@ -253,9 +255,24 @@ export const matStore: MatState = proxy<MatState>({ ...@@ -253,9 +255,24 @@ export const matStore: MatState = proxy<MatState>({
result: ygopro.StocGameMessage.MsgWin.ActionType.UNKNOWN, result: ygopro.StocGameMessage.MsgWin.ActionType.UNKNOWN,
waiting: false, waiting: false,
unimplemented: 0, unimplemented: 0,
delay: 0,
// methods // methods
in: getZone, in: getZone,
isMe, isMe,
setChaining(location, code, isChaining) {
const target = this.in(location.location).of(location.controler)[
location.sequence
];
target.chaining = isChaining;
if (target.occupant) {
target.occupant.id = code;
}
if (target.location.zone == ygopro.CardZone.HAND) {
target.location.position = isChaining
? ygopro.CardPosition.FACEUP_ATTACK
: ygopro.CardPosition.FACEDOWN_ATTACK;
}
},
}); });
// @ts-ignore 挂到全局,便于调试 // @ts-ignore 挂到全局,便于调试
......
...@@ -94,11 +94,21 @@ export interface MatState { ...@@ -94,11 +94,21 @@ export interface MatState {
unimplemented: number; // 未处理的`Message` unimplemented: number; // 未处理的`Message`
delay: number; // MSG处理的延迟时间,目的时为了让一些动画处理完后再开始处理下一个MSG
// >>> methods >>> // >>> methods >>>
/** 根据zone获取hands/masters/magics... */ /** 根据zone获取hands/masters/magics... */
in: (zone: ygopro.CardZone) => BothSide<DuelFieldState>; in: (zone: ygopro.CardZone) => BothSide<DuelFieldState>;
/** 根据自己的先后手判断是否是自己 */ /** 根据自己的先后手判断是否是自己 */
isMe: (player: number) => boolean; isMe: (player: number) => boolean;
// 添加连锁中状态
// - 当是手牌以外的卡时,修改code并设置chaining字段;
// - 当是手牌中的卡时,修改code,设置chaining字段,并修改position,参数`isChaining`为true时修改成`FaceUpAttack`,为false时修改成`FaceDownAttack`
setChaining: (
location: ygopro.CardLocation,
code: number,
isChaining: boolean
) => void;
} }
export interface InitInfo { export interface InitInfo {
...@@ -121,6 +131,7 @@ export interface CardState { ...@@ -121,6 +131,7 @@ export interface CardState {
position?: ygopro.CardPosition; // 卡片的姿势:攻击还是守备 position?: ygopro.CardPosition; // 卡片的姿势:攻击还是守备
}; // 位置信息,叫location的原因是为了和ygo对齐 }; // 位置信息,叫location的原因是为了和ygo对齐
focus: boolean; // 用于实现动画效果,当这个字段为true时,该张卡片会被放大并在屏幕中央展示 focus: boolean; // 用于实现动画效果,当这个字段为true时,该张卡片会被放大并在屏幕中央展示
chaining: boolean; // 是否在连锁中
idleInteractivities: Interactivity<number>[]; // IDLE状态下的互动信息 idleInteractivities: Interactivity<number>[]; // IDLE状态下的互动信息
placeInteractivity?: Interactivity<{ placeInteractivity?: Interactivity<{
controler: number; controler: number;
......
...@@ -25,8 +25,8 @@ export const Card: React.FC<{ ...@@ -25,8 +25,8 @@ export const Card: React.FC<{
facedown?: boolean; facedown?: boolean;
vertical?: boolean; vertical?: boolean;
highlight?: boolean; highlight?: boolean;
fly?: boolean;
focus?: boolean; focus?: boolean;
fly?: boolean;
transTime?: number; transTime?: number;
onClick?: MouseEventHandler<{}>; onClick?: MouseEventHandler<{}>;
style?: CSSProperties; style?: CSSProperties;
...@@ -40,8 +40,8 @@ export const Card: React.FC<{ ...@@ -40,8 +40,8 @@ export const Card: React.FC<{
opponent = false, opponent = false,
vertical = false, vertical = false,
highlight = false, highlight = false,
fly = false,
focus = false, focus = false,
fly = false,
transTime = 0.3, transTime = 0.3,
onClick, onClick,
style = {}, style = {},
...@@ -49,7 +49,7 @@ export const Card: React.FC<{ ...@@ -49,7 +49,7 @@ export const Card: React.FC<{
<div <div
className={classnames("card", { className={classnames("card", {
"card-defense": defense, "card-defense": defense,
fly, fly: fly && !focus,
})} })}
style={ style={
{ {
...@@ -59,7 +59,9 @@ export const Card: React.FC<{ ...@@ -59,7 +59,9 @@ export const Card: React.FC<{
"--shadow": hight > 0 ? 1 : 0, "--shadow": hight > 0 ? 1 : 0,
"--opponent-deg": opponent ? "180deg" : "0deg", "--opponent-deg": opponent ? "180deg" : "0deg",
"--vertical": vertical ? 1 : 0, "--vertical": vertical ? 1 : 0,
"--trans-time": `${transTime}s`, "--trans-time": `${
fly ? NeosConfig.ui.chainingDelay / 1000 : transTime
}s`,
"--highlight-on": highlight ? 1 : 0, "--highlight-on": highlight ? 1 : 0,
"--scale-focus": focus ? FOCUS_SCALE : 1, "--scale-focus": focus ? FOCUS_SCALE : 1,
"--card-img": facedown "--card-img": facedown
......
...@@ -103,7 +103,11 @@ export const Mat = () => { ...@@ -103,7 +103,11 @@ export const Mat = () => {
facedown={CardStateToFaceDown(card)} facedown={CardStateToFaceDown(card)}
vertical={card.location.zone == YgoZone.HAND || card.focus} vertical={card.location.zone == YgoZone.HAND || card.focus}
highlight={card.idleInteractivities.length > 0} highlight={card.idleInteractivities.length > 0}
focus={card.focus} focus={
card.focus ||
(card.chaining && card.location.zone == YgoZone.HAND)
}
fly={card.chaining && card.location.zone != YgoZone.HAND}
opponent={card.opponent} opponent={card.opponent}
onClick={ onClick={
card.location.zone == YgoZone.SZONE || card.location.zone == YgoZone.SZONE ||
...@@ -130,7 +134,7 @@ function cardStateToRow(state: RenderCard): number { ...@@ -130,7 +134,7 @@ function cardStateToRow(state: RenderCard): number {
case YgoZone.DECK: case YgoZone.DECK:
return 0; return 0;
case YgoZone.HAND: case YgoZone.HAND:
return -1; return state.chaining ? 2 : -1;
case YgoZone.SZONE: case YgoZone.SZONE:
return state.sequence >= 5 ? 1 : 0; return state.sequence >= 5 ? 1 : 0;
case YgoZone.GRAVE: case YgoZone.GRAVE:
...@@ -148,7 +152,7 @@ function cardStateToRow(state: RenderCard): number { ...@@ -148,7 +152,7 @@ function cardStateToRow(state: RenderCard): number {
case YgoZone.DECK: case YgoZone.DECK:
return 4; return 4;
case YgoZone.HAND: case YgoZone.HAND:
return 5; return state.chaining ? 2 : 5;
case YgoZone.SZONE: case YgoZone.SZONE:
return state.sequence >= 5 ? 3 : 4; return state.sequence >= 5 ? 3 : 4;
case YgoZone.GRAVE: case YgoZone.GRAVE:
...@@ -170,7 +174,7 @@ function cardStateToCol(state: RenderCard): number { ...@@ -170,7 +174,7 @@ function cardStateToCol(state: RenderCard): number {
case YgoZone.EXTRA: case YgoZone.EXTRA:
return 5; return 5;
case YgoZone.HAND: case YgoZone.HAND:
return 4 - state.sequence; return state.chaining ? 2 : 4 - state.sequence;
case YgoZone.SZONE: case YgoZone.SZONE:
return state.sequence >= 5 ? 5 : 4 - state.sequence; return state.sequence >= 5 ? 5 : 4 - state.sequence;
case YgoZone.DECK: case YgoZone.DECK:
...@@ -191,7 +195,7 @@ function cardStateToCol(state: RenderCard): number { ...@@ -191,7 +195,7 @@ function cardStateToCol(state: RenderCard): number {
case YgoZone.EXTRA: case YgoZone.EXTRA:
return -1; return -1;
case YgoZone.HAND: case YgoZone.HAND:
return state.sequence; return state.chaining ? 2 : state.sequence;
case YgoZone.SZONE: case YgoZone.SZONE:
return state.sequence >= 5 ? -1 : state.sequence; return state.sequence >= 5 ? -1 : state.sequence;
case YgoZone.DECK: case YgoZone.DECK:
......
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