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 @@
},
"54": {
"protoType": "set",
"fields": []
"fields": [
{
"fieldName": "code",
"fieldType": "uint32"
},
{
"fieldName": "location",
"fieldType": "CardLocation"
}
]
},
"55": {
"protoType": "swap",
......
......@@ -175,7 +175,10 @@ export default async (container: Container, move: MsgMove) => {
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);
// 维护完了之后,开始播放音效和动画
......
......@@ -3,6 +3,8 @@ import { Container } from "@/container";
import { fetchEsHintMeta } from "./util";
export default (container: Container, _set: ygopro.StocGameMessage.MsgSet) => {
fetchEsHintMeta({ context: container.context, originMsg: 1601 });
export default (container: Container, set: ygopro.StocGameMessage.MsgSet) => {
const context = container.context;
context.historyStore.putSet(context, set.code, set.location);
fetchEsHintMeta({ context: context, originMsg: 1601 });
};
......@@ -14,6 +14,7 @@ export enum HistoryOp {
SUMMON = 6,
SP_SUMMON = 7,
FLIP_SUMMON = 8,
SET = 9,
}
export interface History {
......@@ -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 {
this.historys = [];
}
......
......@@ -73,6 +73,8 @@ const HistoryItem: React.FC<History> = ({
/>
) : operation === HistoryOp.ATTACK ? (
<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"]} />
)}
......@@ -104,6 +106,8 @@ function Op2Text(op: HistoryOp): string {
return fetchStrings(Region.System, 1152);
case HistoryOp.FLIP_SUMMON:
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