Commit 456e3b98 authored by Chunchi Che's avatar Chunchi Che

add set history

parent 041b09fc
Pipeline #28962 passed with stages
in 17 minutes and 13 seconds
...@@ -52,7 +52,16 @@ ...@@ -52,7 +52,16 @@
}, },
"54": { "54": {
"protoType": "set", "protoType": "set",
"fields": [] "fields": [
{
"fieldName": "code",
"fieldType": "uint32"
},
{
"fieldName": "location",
"fieldType": "CardLocation"
}
]
}, },
"55": { "55": {
"protoType": "swap", "protoType": "swap",
......
...@@ -175,7 +175,10 @@ export default async (container: Container, move: MsgMove) => { ...@@ -175,7 +175,10 @@ export default async (container: Container, move: MsgMove) => {
target.targeted = false; target.targeted = false;
} }
if (to.zone !== MZONE) if (
(to.zone !== MZONE && to.zone !== SZONE) ||
(to.zone === MZONE && reason !== 0)
)
context.historyStore.putMove(context, code, from, to.zone); context.historyStore.putMove(context, code, from, to.zone);
// 维护完了之后,开始播放音效和动画 // 维护完了之后,开始播放音效和动画
......
...@@ -3,6 +3,8 @@ import { Container } from "@/container"; ...@@ -3,6 +3,8 @@ import { Container } from "@/container";
import { fetchEsHintMeta } from "./util"; import { fetchEsHintMeta } from "./util";
export default (container: Container, _set: ygopro.StocGameMessage.MsgSet) => { export default (container: Container, set: ygopro.StocGameMessage.MsgSet) => {
fetchEsHintMeta({ context: container.context, originMsg: 1601 }); const context = container.context;
context.historyStore.putSet(context, set.code, set.location);
fetchEsHintMeta({ context: context, originMsg: 1601 });
}; };
...@@ -14,6 +14,7 @@ export enum HistoryOp { ...@@ -14,6 +14,7 @@ export enum HistoryOp {
SUMMON = 6, SUMMON = 6,
SP_SUMMON = 7, SP_SUMMON = 7,
FLIP_SUMMON = 8, FLIP_SUMMON = 8,
SET = 9,
} }
export interface History { export interface History {
...@@ -94,6 +95,15 @@ export class HistoryStore implements NeosStore { ...@@ -94,6 +95,15 @@ export class HistoryStore implements NeosStore {
}); });
} }
putSet(context: Context, card: number, location: ygopro.CardLocation) {
this.historys.push({
card,
opponent: !context.matStore.isMe(location.controller),
operation: HistoryOp.SET,
target: location.zone,
});
}
reset(): void { reset(): void {
this.historys = []; this.historys = [];
} }
......
...@@ -73,6 +73,8 @@ const HistoryItem: React.FC<History> = ({ ...@@ -73,6 +73,8 @@ const HistoryItem: React.FC<History> = ({
/> />
) : operation === HistoryOp.ATTACK ? ( ) : operation === HistoryOp.ATTACK ? (
<img src={`${assetsPath}/attack.png`} className={styles["op-icon"]} /> <img src={`${assetsPath}/attack.png`} className={styles["op-icon"]} />
) : operation === HistoryOp.SET ? (
<img src={`${assetsPath}/set.png`} className={styles["op-icon"]} />
) : ( ) : (
<img src={`${assetsPath}/summon.png`} className={styles["op-icon"]} /> <img src={`${assetsPath}/summon.png`} className={styles["op-icon"]} />
)} )}
...@@ -104,6 +106,8 @@ function Op2Text(op: HistoryOp): string { ...@@ -104,6 +106,8 @@ function Op2Text(op: HistoryOp): string {
return fetchStrings(Region.System, 1152); return fetchStrings(Region.System, 1152);
case HistoryOp.FLIP_SUMMON: case HistoryOp.FLIP_SUMMON:
return fetchStrings(Region.System, 1154); return fetchStrings(Region.System, 1154);
case HistoryOp.SET:
return fetchStrings(Region.System, 1153);
} }
} }
......
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