Commit b826b116 authored by timel's avatar timel

feat: comment out all dispatch codes

parent 35991603
......@@ -7,9 +7,9 @@ export default (
attack: ygopro.StocGameMessage.MsgAttack,
dispatch: AppDispatch
) => {
dispatch(
fetchEsHintMeta({ originMsg: "「[?]」攻击时", location: attack.location })
);
// dispatch(
// fetchEsHintMeta({ originMsg: "「[?]」攻击时", location: attack.location })
// );
FIXME_fetchEsHintMeta({
originMsg: "「[?]」攻击时",
location: attack.location,
......
......@@ -10,6 +10,6 @@ export default (
_: ygopro.StocGameMessage.MsgAttackDisabled,
dispatch: AppDispatch
) => {
dispatch(fetchEsHintMeta({ originMsg: "攻击被无效时" }));
// dispatch(fetchEsHintMeta({ originMsg: "攻击被无效时" }));
FIXME_fetchEsHintMeta({ originMsg: "攻击被无效时" });
};
......@@ -9,9 +9,9 @@ export default (
chaining: ygopro.StocGameMessage.MsgChaining,
dispatch: AppDispatch
) => {
dispatch(
fetchEsHintMeta({ originMsg: "「[?]」被发动时", cardID: chaining.code })
);
// dispatch(
// fetchEsHintMeta({ originMsg: "「[?]」被发动时", cardID: chaining.code })
// );
FIXME_fetchEsHintMeta({
originMsg: "「[?]」被发动时",
cardID: chaining.code,
......
......@@ -11,8 +11,8 @@ export default (
draw: ygopro.StocGameMessage.MsgDraw,
dispatch: AppDispatch
) => {
dispatch(fetchEsHintMeta({ originMsg: "玩家抽卡时" }));
dispatch(fetchHandsMeta({ controler: draw.player, codes: draw.cards }));
// dispatch(fetchEsHintMeta({ originMsg: "玩家抽卡时" }));
// dispatch(fetchHandsMeta({ controler: draw.player, codes: draw.cards }));
FIXME_fetchEsHintMeta({ originMsg: "玩家抽卡时" });
matStore.hands.of(draw.player).add(draw.cards);
......
......@@ -7,6 +7,6 @@ export default (
_: ygopro.StocGameMessage.MsgFlipSummoned,
dispatch: AppDispatch
) => {
dispatch(fetchEsHintMeta({ originMsg: 1608 }));
// dispatch(fetchEsHintMeta({ originMsg: 1608 }));
FIXME_fetchEsHintMeta({ originMsg: 1608 });
};
......@@ -7,12 +7,12 @@ export default (
flipSummoning: ygopro.StocGameMessage.MsgFlipSummoning,
dispatch: AppDispatch
) => {
dispatch(
fetchEsHintMeta({
originMsg: "「[?]」反转召唤宣言时",
cardID: flipSummoning.code,
})
);
// dispatch(
// fetchEsHintMeta({
// originMsg: "「[?]」反转召唤宣言时",
// cardID: flipSummoning.code,
// })
// );
FIXME_fetchEsHintMeta({
originMsg: "「[?]」反转召唤宣言时",
cardID: flipSummoning.code,
......
......@@ -16,19 +16,19 @@ import MsgHint = ygopro.StocGameMessage.MsgHint;
export default (hint: MsgHint, dispatch: AppDispatch) => {
switch (hint.hint_type) {
case MsgHint.HintType.HINT_EVENT: {
dispatch(fetchEsHintMeta({ originMsg: hint.hint_data }));
// dispatch(fetchEsHintMeta({ originMsg: hint.hint_data }));
FIXME_fetchEsHintMeta({ originMsg: hint.hint_data });
break;
}
case MsgHint.HintType.HINT_MESSAGE: {
dispatch(fetchCommonHintMeta(hint.hint_data));
// dispatch(fetchCommonHintMeta(hint.hint_data));
FIXME_fetchCommonHintMeta(hint.hint_data);
break;
}
case MsgHint.HintType.HINT_SELECTMSG: {
dispatch(
fetchSelectHintMeta({ selectHintData: hint.hint_data, esHint: "" })
);
// dispatch(
// fetchSelectHintMeta({ selectHintData: hint.hint_data, esHint: "" })
// );
FIXME_fetchSelectHintMeta({
selectHintData: hint.hint_data,
esHint: "",
......
......@@ -114,162 +114,162 @@ export default (move: MsgMove, dispatch: AppDispatch) => {
}
}
switch (from.location) {
case ygopro.CardZone.HAND: {
dispatch(removeHand([from.controler, from.sequence]));
break;
}
case ygopro.CardZone.MZONE: {
dispatch(
removeMonster({ controler: from.controler, sequence: from.sequence })
);
break;
}
case ygopro.CardZone.SZONE: {
dispatch(
removeMagic({ controler: from.controler, sequence: from.sequence })
);
break;
}
case ygopro.CardZone.GRAVE: {
dispatch(
removeGraveyard({ controler: from.controler, sequence: from.sequence })
);
break;
}
case ygopro.CardZone.REMOVED: {
dispatch(
removeBanishedZone({
controler: from.controler,
sequence: from.sequence,
})
);
break;
}
case ygopro.CardZone.EXTRA: {
dispatch(
removeExtraDeck({ controler: from.controler, sequence: from.sequence })
);
break;
}
case ygopro.CardZone.OVERLAY: {
dispatch(
removeOverlay({
controler: from.controler,
sequence: from.sequence,
overlaySequence: from.overlay_sequence,
})
);
// switch (from.location) {
// case ygopro.CardZone.HAND: {
// dispatch(removeHand([from.controler, from.sequence]));
// break;
// }
// case ygopro.CardZone.MZONE: {
// dispatch(
// removeMonster({ controler: from.controler, sequence: from.sequence })
// );
// break;
// }
// case ygopro.CardZone.SZONE: {
// dispatch(
// removeMagic({ controler: from.controler, sequence: from.sequence })
// );
// break;
// }
// case ygopro.CardZone.GRAVE: {
// dispatch(
// removeGraveyard({ controler: from.controler, sequence: from.sequence })
// );
// break;
// }
// case ygopro.CardZone.REMOVED: {
// dispatch(
// removeBanishedZone({
// controler: from.controler,
// sequence: from.sequence,
// })
// );
// break;
// }
// case ygopro.CardZone.EXTRA: {
// dispatch(
// removeExtraDeck({ controler: from.controler, sequence: from.sequence })
// );
// break;
// }
// case ygopro.CardZone.OVERLAY: {
// dispatch(
// removeOverlay({
// controler: from.controler,
// sequence: from.sequence,
// overlaySequence: from.overlay_sequence,
// })
// );
break;
}
default: {
console.log(`Unhandled zone type ${from.location}`);
break;
}
}
// break;
// }
// default: {
// console.log(`Unhandled zone type ${from.location}`);
// break;
// }
// }
switch (to.location) {
case ygopro.CardZone.MZONE: {
dispatch(
fetchMonsterMeta({
controler: to.controler,
sequence: to.sequence,
position: to.position,
code,
})
);
// switch (to.location) {
// case ygopro.CardZone.MZONE: {
// dispatch(
// fetchMonsterMeta({
// controler: to.controler,
// sequence: to.sequence,
// position: to.position,
// code,
// })
// );
// 处理超量素材
const overlayMetarials = OVERLAY_STACK.splice(0, OVERLAY_STACK.length);
let sorted = overlayMetarials
.sort((a, b) => a.sequence - b.sequence)
.map((overlay) => overlay.code);
dispatch(
fetchOverlayMeta({
controler: to.controler,
sequence: to.sequence,
overlayCodes: sorted,
})
);
// // 处理超量素材
// const overlayMetarials = OVERLAY_STACK.splice(0, OVERLAY_STACK.length);
// let sorted = overlayMetarials
// .sort((a, b) => a.sequence - b.sequence)
// .map((overlay) => overlay.code);
// dispatch(
// fetchOverlayMeta({
// controler: to.controler,
// sequence: to.sequence,
// overlayCodes: sorted,
// })
// );
break;
}
case ygopro.CardZone.SZONE: {
dispatch(
fetchMagicMeta({
controler: to.controler,
sequence: to.sequence,
position: to.position,
code,
})
);
// break;
// }
// case ygopro.CardZone.SZONE: {
// dispatch(
// fetchMagicMeta({
// controler: to.controler,
// sequence: to.sequence,
// position: to.position,
// code,
// })
// );
break;
}
case ygopro.CardZone.GRAVE: {
dispatch(
fetchGraveyardMeta({
controler: to.controler,
sequence: to.sequence,
code,
})
);
// break;
// }
// case ygopro.CardZone.GRAVE: {
// dispatch(
// fetchGraveyardMeta({
// controler: to.controler,
// sequence: to.sequence,
// code,
// })
// );
break;
}
case ygopro.CardZone.HAND: {
dispatch(
insertHandMeta({ controler: to.controler, sequence: to.sequence, code })
);
// break;
// }
// case ygopro.CardZone.HAND: {
// dispatch(
// insertHandMeta({ controler: to.controler, sequence: to.sequence, code })
// );
break;
}
case ygopro.CardZone.REMOVED: {
dispatch(
fetchBanishedZoneMeta({
controler: to.controler,
sequence: to.sequence,
code,
})
);
// break;
// }
// case ygopro.CardZone.REMOVED: {
// dispatch(
// fetchBanishedZoneMeta({
// controler: to.controler,
// sequence: to.sequence,
// code,
// })
// );
break;
}
case ygopro.CardZone.EXTRA: {
dispatch(
fetchExtraDeckMeta({
controler: to.controler,
sequence: to.sequence,
code,
})
);
// break;
// }
// case ygopro.CardZone.EXTRA: {
// dispatch(
// fetchExtraDeckMeta({
// controler: to.controler,
// sequence: to.sequence,
// code,
// })
// );
break;
}
case ygopro.CardZone.OVERLAY: {
if (reason == REASON_MATERIAL) {
// 超量素材在进行超量召唤时,若玩家未选择超量怪兽的位置,会“沉到决斗盘下面”,`reason`字段值是`REASON_MATERIAL`
// 这时候将它们放到一个栈中,待超量怪兽的Move消息到来时从栈中获取超量素材补充到状态中
OVERLAY_STACK.push({ code, sequence: to.overlay_sequence });
} else {
// 其他情况下,比如“宵星的机神 丁吉尔苏”的“补充超量素材”效果,直接更新状态中
dispatch(
fetchOverlayMeta({
controler: to.controler,
sequence: to.sequence,
overlayCodes: [code],
append: true,
})
);
}
// break;
// }
// case ygopro.CardZone.OVERLAY: {
// if (reason == REASON_MATERIAL) {
// // 超量素材在进行超量召唤时,若玩家未选择超量怪兽的位置,会“沉到决斗盘下面”,`reason`字段值是`REASON_MATERIAL`
// // 这时候将它们放到一个栈中,待超量怪兽的Move消息到来时从栈中获取超量素材补充到状态中
// OVERLAY_STACK.push({ code, sequence: to.overlay_sequence });
// } else {
// // 其他情况下,比如“宵星的机神 丁吉尔苏”的“补充超量素材”效果,直接更新状态中
// dispatch(
// fetchOverlayMeta({
// controler: to.controler,
// sequence: to.sequence,
// overlayCodes: [code],
// append: true,
// })
// );
// }
break;
}
default: {
console.log(`Unhandled zone type ${to.location}`);
// break;
// }
// default: {
// console.log(`Unhandled zone type ${to.location}`);
break;
}
}
// break;
// }
// }
};
......@@ -7,11 +7,11 @@ export default (
newPhase: ygopro.StocGameMessage.MsgNewPhase,
dispatch: AppDispatch
) => {
dispatch(
updatePhase(
ygopro.StocGameMessage.MsgNewPhase.PhaseType[newPhase.phase_type]
)
);
// dispatch(
// updatePhase(
// ygopro.StocGameMessage.MsgNewPhase.PhaseType[newPhase.phase_type]
// )
// );
// ts本身还没有这么智能,所以需要手动指定类型
const currentPhase = ygopro.StocGameMessage.MsgNewPhase.PhaseType[
......
......@@ -8,6 +8,6 @@ export default (
dispatch: AppDispatch
) => {
const player = newTurn.player;
dispatch(updateTurn(player));
// dispatch(updateTurn(player));
matStore.currentPlayer = player;
};
......@@ -12,26 +12,26 @@ export default (posChange: MsgPosChange, dispatch: AppDispatch) => {
switch (location) {
case ygopro.CardZone.MZONE: {
dispatch(
setMonsterPosition({
controler: controler,
sequence,
position: posChange.cur_position,
})
);
// dispatch(
// setMonsterPosition({
// controler: controler,
// sequence,
// position: posChange.cur_position,
// })
// );
matStore.monsters.of(controler)[sequence].location.position =
posChange.cur_position;
break;
}
case ygopro.CardZone.SZONE: {
dispatch(
setMagicPosition({
controler: controler,
sequence,
position: posChange.cur_position,
})
);
// dispatch(
// setMagicPosition({
// controler: controler,
// sequence,
// position: posChange.cur_position,
// })
// );
matStore.magics.of(controler)[sequence].location.position =
posChange.cur_position;
......@@ -42,7 +42,7 @@ export default (posChange: MsgPosChange, dispatch: AppDispatch) => {
}
}
dispatch(fetchEsHintMeta({ originMsg: 1600 }));
// dispatch(fetchEsHintMeta({ originMsg: 1600 }));
FIXME_fetchEsHintMeta({
originMsg: 1600,
});
......
......@@ -8,7 +8,7 @@ type MsgReloadField = ygopro.StocGameMessage.MsgReloadField;
type ZoneActions = ygopro.StocGameMessage.MsgReloadField.ZoneAction[];
export default (field: MsgReloadField, dispatch: AppDispatch) => {
dispatch(reloadField(field));
// dispatch(reloadField(field));
const _duel_rule = field.duel_rule;
......
......@@ -23,51 +23,51 @@ export default (selectBattleCmd: MsgSelectBattleCmd, dispatch: AppDispatch) => {
const cmds = selectBattleCmd.battle_cmds;
// 先清掉之前的互动性
dispatch(clearAllIdleInteractivities(player));
// dispatch(clearAllIdleInteractivities(player));
FIXME_clearAllIdleInteractivities(player);
const dispatcher = (
battleData: MsgSelectBattleCmd.BattleCmd.BattleData,
interactType: InteractType | undefined,
actionCreator: ActionCreatorWithPayload<
{
player: number;
sequence: number;
interactivity: Interactivity<number>;
},
string
>
) => {
const cardInfo = battleData.card_info;
if (interactType === InteractType.ACTIVATE) {
dispatch(
actionCreator({
player,
sequence: cardInfo.sequence,
interactivity: {
interactType,
activateIndex: battleData.effect_description,
response: battleData.response,
},
})
);
} else if (interactType === InteractType.ATTACK) {
dispatch(
actionCreator({
player,
sequence: cardInfo.sequence,
interactivity: {
interactType,
directAttackAble: battleData.direct_attackable,
response: battleData.response,
},
})
);
} else {
console.log(`Unhandled InteractType`);
}
};
// const dispatcher = (
// battleData: MsgSelectBattleCmd.BattleCmd.BattleData,
// interactType: InteractType | undefined,
// actionCreator: ActionCreatorWithPayload<
// {
// player: number;
// sequence: number;
// interactivity: Interactivity<number>;
// },
// string
// >
// ) => {
// const cardInfo = battleData.card_info;
// if (interactType === InteractType.ACTIVATE) {
// dispatch(
// actionCreator({
// player,
// sequence: cardInfo.sequence,
// interactivity: {
// interactType,
// activateIndex: battleData.effect_description,
// response: battleData.response,
// },
// })
// );
// } else if (interactType === InteractType.ATTACK) {
// dispatch(
// actionCreator({
// player,
// sequence: cardInfo.sequence,
// interactivity: {
// interactType,
// directAttackAble: battleData.direct_attackable,
// response: battleData.response,
// },
// })
// );
// } else {
// console.log(`Unhandled InteractType`);
// }
// };
cmds.forEach((cmd) => {
const interactType = battleTypeToInteracType(cmd.battle_type);
......@@ -97,31 +97,31 @@ export default (selectBattleCmd: MsgSelectBattleCmd, dispatch: AppDispatch) => {
}
// >>> 从这开始删除 >>>
switch (location) {
case ygopro.CardZone.HAND: {
dispatcher(data, interactType, addHandsIdleInteractivity);
break;
}
case ygopro.CardZone.MZONE: {
dispatcher(data, interactType, addMonsterIdleInteractivities);
break;
}
case ygopro.CardZone.SZONE: {
dispatcher(data, interactType, addMagicIdleInteractivities);
break;
}
default: {
}
}
// switch (location) {
// case ygopro.CardZone.HAND: {
// dispatcher(data, interactType, addHandsIdleInteractivity);
// break;
// }
// case ygopro.CardZone.MZONE: {
// dispatcher(data, interactType, addMonsterIdleInteractivities);
// break;
// }
// case ygopro.CardZone.SZONE: {
// dispatcher(data, interactType, addMagicIdleInteractivities);
// break;
// }
// default: {
// }
// }
// <<< 到这结束删除,上面的const dispatcher也删掉 <<<
});
});
dispatch(setEnableM2(selectBattleCmd.enable_m2));
dispatch(setEnableEp(selectBattleCmd.enable_ep));
// dispatch(setEnableM2(selectBattleCmd.enable_m2));
// dispatch(setEnableEp(selectBattleCmd.enable_ep));
matStore.phase.enableM2 = selectBattleCmd.enable_m2;
matStore.phase.enableEp = selectBattleCmd.enable_ep;
......
......@@ -23,8 +23,8 @@ export default (selectCard: MsgSelectCard, dispatch: AppDispatch) => {
// TODO: handle release_param
dispatch(setCheckCardModalMinMax({ min, max }));
dispatch(setCheckCardModalOnSubmit("sendSelectCardResponse"));
// dispatch(setCheckCardModalMinMax({ min, max }));
// dispatch(setCheckCardModalOnSubmit("sendSelectCardResponse"));
messageStore.checkCardModal.selectMin = min;
messageStore.checkCardModal.selectMax = max;
......@@ -32,16 +32,16 @@ export default (selectCard: MsgSelectCard, dispatch: AppDispatch) => {
for (const card of cards) {
const tagName = CardZoneToChinese(card.location.location);
dispatch(
fetchCheckCardMeta({
tagName,
option: {
code: card.code,
location: card.location,
response: card.response,
},
})
);
// dispatch(
// fetchCheckCardMeta({
// tagName,
// option: {
// code: card.code,
// location: card.location,
// response: card.response,
// },
// })
// );
// FIXME: rename
FIXME_fetchCheckCardMeta(card.location.location, {
code: card.code,
......@@ -50,7 +50,7 @@ export default (selectCard: MsgSelectCard, dispatch: AppDispatch) => {
});
}
dispatch(setCheckCardModalIsOpen(true));
// dispatch(setCheckCardModalIsOpen(true));
messageStore.checkCardModal.isOpen = true;
};
......@@ -71,10 +71,10 @@ export default (selectChain: MsgSelectChain, dispatch: AppDispatch) => {
case 3: {
// 处理强制发动的卡
dispatch(setCheckCardModalMinMax({ min: 1, max: 1 }));
dispatch(setCheckCardModalOnSubmit("sendSelectChainResponse"));
dispatch(setCheckCardMOdalCancelAble(!forced));
dispatch(setCheckCardModalCancelResponse(-1));
// dispatch(setCheckCardModalMinMax({ min: 1, max: 1 }));
// dispatch(setCheckCardModalOnSubmit("sendSelectChainResponse"));
// dispatch(setCheckCardMOdalCancelAble(!forced));
// dispatch(setCheckCardModalCancelResponse(-1));
messageStore.checkCardModal.selectMin = 1;
messageStore.checkCardModal.selectMax = 1;
......@@ -83,18 +83,18 @@ export default (selectChain: MsgSelectChain, dispatch: AppDispatch) => {
messageStore.checkCardModal.cancelResponse = -1;
for (const chain of chains) {
const tagName = CardZoneToChinese(chain.location.location);
dispatch(
fetchCheckCardMeta({
tagName,
option: {
code: chain.code,
location: chain.location,
response: chain.response,
effectDescCode: chain.effect_description,
},
})
);
// const tagName = CardZoneToChinese(chain.location.location);
// dispatch(
// fetchCheckCardMeta({
// tagName,
// option: {
// code: chain.code,
// location: chain.location,
// response: chain.response,
// effectDescCode: chain.effect_description,
// },
// })
// );
FIXME_fetchCheckCardMeta(chain.location.location, {
code: chain.code,
location: chain.location,
......@@ -102,16 +102,16 @@ export default (selectChain: MsgSelectChain, dispatch: AppDispatch) => {
effectDescCode: chain.effect_description,
});
}
dispatch(
fetchSelectHintMeta({
selectHintData: 203,
})
);
// dispatch(
// fetchSelectHintMeta({
// selectHintData: 203,
// })
// );
FIXME_fetchSelectHintMeta({
selectHintData: 203,
});
dispatch(setCheckCardModalIsOpen(true));
// dispatch(setCheckCardModalIsOpen(true));
messageStore.checkCardModal.isOpen = true;
break;
......
......@@ -5,7 +5,7 @@ import { getCardByLocation, messageStore } from "@/valtioStores";
type MsgSelectCounter = ygopro.StocGameMessage.MsgSelectCounter;
export default (selectCounter: MsgSelectCounter, dispatch: AppDispatch) => {
dispatch(setCheckCounter(selectCounter.toObject()));
// dispatch(setCheckCounter(selectCounter.toObject()));
messageStore.checkCounterModal.counterType = selectCounter.counter_type;
messageStore.checkCounterModal.min = selectCounter.min;
......
......@@ -38,18 +38,19 @@ export default async (
const desc1 = desc.replace(`[%ls]`, cardMeta.text.name || "[?]");
return desc1;
};
dispatch(
fetchYesNoMeta({
code,
location,
descCode: effect_description,
textGenerator,
})
);
// dispatch(
// fetchYesNoMeta({
// code,
// location,
// descCode: effect_description,
// textGenerator,
// })
// );
// TODO: 国际化文案
dispatch(setYesNoModalIsOpen(true));
const desc = fetchStrings("!system", effect_description);
const meta = await fetchCard(code);
messageStore.yesNoModal.msg = textGenerator(desc, meta, location);
messageStore.yesNoModal.isOpen = true;
};
......@@ -26,47 +26,47 @@ export default (selectIdleCmd: MsgSelectIdleCmd, dispatch: AppDispatch) => {
const cmds = selectIdleCmd.idle_cmds;
// 先清掉之前的互动性
dispatch(clearAllIdleInteractivities(player));
// dispatch(clearAllIdleInteractivities(player));
FIXME_clearAllIdleInteractivities(player);
const dispatcher = (
idleData: MsgSelectIdleCmd.IdleCmd.IdleData,
interactType: InteractType | undefined,
actionCreator: ActionCreatorWithPayload<
{
player: number;
sequence: number;
interactivity: Interactivity<number>;
},
string
>
) => {
const cardInfo = idleData.card_info;
if (interactType === InteractType.ACTIVATE) {
// 发动效果会多一个字段
dispatch(
actionCreator({
player,
sequence: cardInfo.sequence,
interactivity: {
interactType,
activateIndex: idleData.effect_description,
response: idleData.response,
},
})
);
} else if (interactType) {
dispatch(
actionCreator({
player,
sequence: cardInfo.sequence,
interactivity: { interactType, response: idleData.response },
})
);
} else {
console.log(`InteractType undefined`);
}
};
// const dispatcher = (
// idleData: MsgSelectIdleCmd.IdleCmd.IdleData,
// interactType: InteractType | undefined,
// actionCreator: ActionCreatorWithPayload<
// {
// player: number;
// sequence: number;
// interactivity: Interactivity<number>;
// },
// string
// >
// ) => {
// const cardInfo = idleData.card_info;
// if (interactType === InteractType.ACTIVATE) {
// // 发动效果会多一个字段
// dispatch(
// actionCreator({
// player,
// sequence: cardInfo.sequence,
// interactivity: {
// interactType,
// activateIndex: idleData.effect_description,
// response: idleData.response,
// },
// })
// );
// } else if (interactType) {
// dispatch(
// actionCreator({
// player,
// sequence: cardInfo.sequence,
// interactivity: { interactType, response: idleData.response },
// })
// );
// } else {
// console.log(`InteractType undefined`);
// }
// };
cmds.forEach((cmd) => {
const interactType = idleTypeToInteractType(cmd.idle_type);
......@@ -94,46 +94,46 @@ export default (selectIdleCmd: MsgSelectIdleCmd, dispatch: AppDispatch) => {
console.warn(`Undefined InteractType`);
}
switch (location) {
case ygopro.CardZone.HAND: {
dispatcher(data, interactType, addHandsIdleInteractivity);
break;
}
case ygopro.CardZone.MZONE: {
dispatcher(data, interactType, addMonsterIdleInteractivities);
break;
}
case ygopro.CardZone.SZONE: {
dispatcher(data, interactType, addMagicIdleInteractivities);
break;
}
case ygopro.CardZone.GRAVE: {
dispatcher(data, interactType, addGraveyardIdleInteractivities);
break;
}
case ygopro.CardZone.REMOVED: {
dispatcher(data, interactType, addBanishedZoneIdleInteractivities);
break;
}
case ygopro.CardZone.EXTRA: {
dispatcher(data, interactType, addExtraDeckIdleInteractivities);
break;
}
default: {
console.log(`Unhandled zone type: ${location}`);
}
}
// switch (location) {
// case ygopro.CardZone.HAND: {
// dispatcher(data, interactType, addHandsIdleInteractivity);
// break;
// }
// case ygopro.CardZone.MZONE: {
// dispatcher(data, interactType, addMonsterIdleInteractivities);
// break;
// }
// case ygopro.CardZone.SZONE: {
// dispatcher(data, interactType, addMagicIdleInteractivities);
// break;
// }
// case ygopro.CardZone.GRAVE: {
// dispatcher(data, interactType, addGraveyardIdleInteractivities);
// break;
// }
// case ygopro.CardZone.REMOVED: {
// dispatcher(data, interactType, addBanishedZoneIdleInteractivities);
// break;
// }
// case ygopro.CardZone.EXTRA: {
// dispatcher(data, interactType, addExtraDeckIdleInteractivities);
// break;
// }
// default: {
// console.log(`Unhandled zone type: ${location}`);
// }
// }
});
});
dispatch(setEnableBp(selectIdleCmd.enable_bp));
dispatch(setEnableEp(selectIdleCmd.enable_ep));
// dispatch(setEnableBp(selectIdleCmd.enable_bp));
// dispatch(setEnableEp(selectIdleCmd.enable_ep));
matStore.phase.enableBp = selectIdleCmd.enable_bp;
matStore.phase.enableEp = selectIdleCmd.enable_ep;
......
......@@ -9,11 +9,11 @@ export default async (selectOption: MsgSelectOption, dispatch: AppDispatch) => {
const player = selectOption.player;
const options = selectOption.options;
for (let option of options) {
dispatch(fetchOptionMeta(option));
}
// for (let option of options) {
// dispatch(fetchOptionMeta(option));
// }
dispatch(setOptionModalIsOpen(true));
// dispatch(setOptionModalIsOpen(true));
await Promise.all(
options.map(async ({ code, response }) => {
......
......@@ -19,9 +19,9 @@ export default (selectPlace: MsgSelectPlace, dispatch: AppDispatch) => {
for (const place of selectPlace.places) {
switch (place.zone) {
case ygopro.CardZone.MZONE: {
dispatch(
addMonsterPlaceInteractivities([place.controler, place.sequence])
);
// dispatch(
// addMonsterPlaceInteractivities([place.controler, place.sequence])
// );
matStore.monsters
.of(place.controler)
.setPlaceInteractivityType(
......@@ -31,9 +31,9 @@ export default (selectPlace: MsgSelectPlace, dispatch: AppDispatch) => {
break;
}
case ygopro.CardZone.SZONE: {
dispatch(
addMagicPlaceInteractivities([place.controler, place.sequence])
);
// dispatch(
// addMagicPlaceInteractivities([place.controler, place.sequence])
// );
matStore.magics
.of(place.controler)
.setPlaceInteractivityType(
......
......@@ -12,11 +12,11 @@ export default (selectPosition: MsgSelectPosition, dispatch: AppDispatch) => {
const player = selectPosition.player;
const positions = selectPosition.positions;
dispatch(
setPositionModalPositions(positions.map((position) => position.position))
);
// dispatch(
// setPositionModalPositions(positions.map((position) => position.position))
// );
dispatch(setPositionModalIsOpen(true));
// dispatch(setPositionModalIsOpen(true));
messageStore.positionModal.positions = positions.map(
(position) => position.position
......
......@@ -14,36 +14,36 @@ import {
type MsgSelectSum = ygopro.StocGameMessage.MsgSelectSum;
export default (selectSum: MsgSelectSum, dispatch: AppDispatch) => {
dispatch(setCheckCardModalV3OverFlow(selectSum.overflow != 0));
// dispatch(setCheckCardModalV3OverFlow(selectSum.overflow != 0));
messageStore.checkCardModalV3.overflow = selectSum.overflow != 0;
dispatch(setCheckCardModalV3AllLevel(selectSum.level_sum));
// dispatch(setCheckCardModalV3AllLevel(selectSum.level_sum));
messageStore.checkCardModalV3.allLevel = selectSum.level_sum;
dispatch(
setCheckCardModalV3MinMax({ min: selectSum.min, max: selectSum.max })
);
// dispatch(
// setCheckCardModalV3MinMax({ min: selectSum.min, max: selectSum.max })
// );
messageStore.checkCardModalV3.selectMin = selectSum.min;
messageStore.checkCardModalV3.selectMax = selectSum.max;
dispatch(
fetchCheckCardMetasV3({
mustSelect: true,
options: selectSum.must_select_cards,
})
);
// dispatch(
// fetchCheckCardMetasV3({
// mustSelect: true,
// options: selectSum.must_select_cards,
// })
// );
FIXME_fetchCheckCardMetasV3({
mustSelect: true,
options: selectSum.must_select_cards,
});
dispatch(
fetchCheckCardMetasV3({
mustSelect: false,
options: selectSum.selectable_cards,
})
);
// dispatch(
// fetchCheckCardMetasV3({
// mustSelect: false,
// options: selectSum.selectable_cards,
// })
// );
FIXME_fetchCheckCardMetasV3({
mustSelect: false,
options: selectSum.selectable_cards,
});
dispatch(setCheckCardModalV3IsOpen(true));
// dispatch(setCheckCardModalV3IsOpen(true));
messageStore.checkCardModalV3.isOpen = true;
};
......@@ -16,32 +16,32 @@ type MsgSelectTribute = ygopro.StocGameMessage.MsgSelectTribute;
export default (selectTribute: MsgSelectTribute, dispatch: AppDispatch) => {
// TODO: 当玩家选择卡数大于`max`时,是否也合法?
dispatch(setCheckCardModalV3OverFlow(true));
// dispatch(setCheckCardModalV3OverFlow(true));
messageStore.checkCardModalV3.overflow = true;
dispatch(setCheckCardModalV3AllLevel(0));
// dispatch(setCheckCardModalV3AllLevel(0));
messageStore.checkCardModalV3.allLevel = 0;
dispatch(
setCheckCardModalV3MinMax({
min: selectTribute.min,
max: selectTribute.max,
})
);
// dispatch(
// setCheckCardModalV3MinMax({
// min: selectTribute.min,
// max: selectTribute.max,
// })
// );
messageStore.checkCardModalV3.selectMin = selectTribute.min;
messageStore.checkCardModalV3.selectMax = selectTribute.max;
dispatch(
fetchCheckCardMetasV3({
mustSelect: false,
options: selectTribute.selectable_cards.map((card) => {
return {
code: card.code,
location: card.location,
level1: card.level,
level2: card.level,
response: card.response,
};
}),
})
);
// dispatch(
// fetchCheckCardMetasV3({
// mustSelect: false,
// options: selectTribute.selectable_cards.map((card) => {
// return {
// code: card.code,
// location: card.location,
// level1: card.level,
// level2: card.level,
// response: card.response,
// };
// }),
// })
// );
FIXME_fetchCheckCardMetasV3({
mustSelect: false,
options: selectTribute.selectable_cards.map((card) => {
......@@ -54,6 +54,6 @@ export default (selectTribute: MsgSelectTribute, dispatch: AppDispatch) => {
};
}),
});
dispatch(setCheckCardModalV3IsOpen(true));
// dispatch(setCheckCardModalV3IsOpen(true));
messageStore.checkCardModalV3.isOpen = true;
};
......@@ -26,10 +26,10 @@ export default (
}: MsgSelectUnselectCard,
dispatch: AppDispatch
) => {
dispatch(setCheckCardModalV2IsOpen(true));
dispatch(setCheckCardModalV2FinishAble(finishable));
dispatch(setCheckCardModalV2CancelAble(cancelable));
dispatch(setCheckCardModalV2MinMax({ min, max }));
// dispatch(setCheckCardModalV2IsOpen(true));
// dispatch(setCheckCardModalV2FinishAble(finishable));
// dispatch(setCheckCardModalV2CancelAble(cancelable));
// dispatch(setCheckCardModalV2MinMax({ min, max }));
messageStore.checkCardModalV2.isOpen = true;
messageStore.checkCardModalV2.finishAble = finishable;
......@@ -85,7 +85,7 @@ export default (
}),
});
dispatch(setCheckCardModalV2ResponseAble(true));
// dispatch(setCheckCardModalV2ResponseAble(true));
messageStore.checkCardModalV2.responseable = true;
};
import { ygopro } from "@/api";
import { getStrings, ygopro } from "@/api";
import { setYesNoModalIsOpen } from "@/reducers/duel/mod";
import { fetchYesNoMetaWithEffecDesc } from "@/reducers/duel/modal/yesNoModalSlice";
import { AppDispatch } from "@/store";
import MsgSelectYesNo = ygopro.StocGameMessage.MsgSelectYesNo;
export default (selectYesNo: MsgSelectYesNo, dispatch: AppDispatch) => {
import { messageStore } from "@/valtioStores";
type MsgSelectYesNo = ygopro.StocGameMessage.MsgSelectYesNo;
export default async (selectYesNo: MsgSelectYesNo, dispatch: AppDispatch) => {
const player = selectYesNo.player;
const effect_description = selectYesNo.effect_description;
dispatch(fetchYesNoMetaWithEffecDesc(effect_description));
dispatch(setYesNoModalIsOpen(true));
// dispatch(fetchYesNoMetaWithEffecDesc(effect_description));
// dispatch(setYesNoModalIsOpen(true));
messageStore.yesNoModal.msg = await getStrings(effect_description);
messageStore.yesNoModal.isOpen = true;
};
......@@ -4,6 +4,6 @@ import { AppDispatch } from "@/store";
import { fetchEsHintMeta as FIXME_fetchEsHintMeta } from "@/valtioStores";
export default (_set: ygopro.StocGameMessage.MsgSet, dispatch: AppDispatch) => {
dispatch(fetchEsHintMeta({ originMsg: 1601 }));
// dispatch(fetchEsHintMeta({ originMsg: 1601 }));
FIXME_fetchEsHintMeta({ originMsg: 1601 });
};
......@@ -6,9 +6,9 @@ import MsgShuffleHand = ygopro.StocGameMessage.MsgShuffleHand;
import { matStore } from "@/valtioStores";
export default (shuffleHand: MsgShuffleHand, dispatch: AppDispatch) => {
dispatch(
updateHandsMeta({ controler: shuffleHand.player, codes: shuffleHand.hands })
);
// dispatch(
// updateHandsMeta({ controler: shuffleHand.player, codes: shuffleHand.hands })
// );
const { hands: codes, player: controller } = shuffleHand;
......
......@@ -7,10 +7,11 @@ import MsgSortCard = ygopro.StocGameMessage.MsgSortCard;
import { messageStore } from "@/valtioStores";
export default async (sortCard: MsgSortCard, dispatch: AppDispatch) => {
for (const option of sortCard.options) {
dispatch(fetchSortCardMeta(option.toObject()));
}
dispatch(setSortCardModalIsOpen(true));
// for (const option of sortCard.options) {
// dispatch(fetchSortCardMeta(option.toObject()));
// }
// dispatch(setSortCardModalIsOpen(true));
await Promise.all(
sortCard.options.map(async ({ code, response }) => {
const meta = await fetchCard(code!, true);
......
......@@ -7,6 +7,6 @@ export default (
_: ygopro.StocGameMessage.MsgSpSummoned,
dispatch: AppDispatch
) => {
dispatch(fetchEsHintMeta({ originMsg: 1606 }));
// dispatch(fetchEsHintMeta({ originMsg: 1606 }));
FIXME_fetchEsHintMeta({ originMsg: 1606 });
};
......@@ -6,12 +6,12 @@ export default (
spSummoning: ygopro.StocGameMessage.MsgSpSummoning,
dispatch: AppDispatch
) => {
dispatch(
fetchEsHintMeta({
originMsg: "「[?]」特殊召唤宣言时",
cardID: spSummoning.code,
})
);
// dispatch(
// fetchEsHintMeta({
// originMsg: "「[?]」特殊召唤宣言时",
// cardID: spSummoning.code,
// })
// );
FIXME_fetchEsHintMeta({
originMsg: "「[?]」特殊召唤宣言时",
cardID: spSummoning.code,
......
......@@ -18,7 +18,7 @@ export default (
start: ygopro.StocGameMessage.MsgStart,
dispatch: AppDispatch
) => {
dispatch(setSelfType(start.playerType));
// dispatch(setSelfType(start.playerType));
matStore.selfType = start.playerType;
......@@ -33,40 +33,40 @@ export default (
extraSize: start.extraSize2,
});
dispatch(
infoInit([
0,
{
life: start.life1,
deckSize: start.deckSize1,
extraSize: start.extraSize1,
},
])
);
dispatch(
infoInit([
1,
{
life: start.life2,
deckSize: start.deckSize2,
extraSize: start.extraSize2,
},
])
);
// dispatch(
// infoInit([
// 0,
// {
// life: start.life1,
// deckSize: start.deckSize1,
// extraSize: start.extraSize1,
// },
// ])
// );
// dispatch(
// infoInit([
// 1,
// {
// life: start.life2,
// deckSize: start.deckSize2,
// extraSize: start.extraSize2,
// },
// ])
// );
// >>> 删除 >>>
dispatch(initMonsters(0));
dispatch(initMonsters(1));
dispatch(initMagics(0));
dispatch(initMagics(1));
dispatch(initGraveyard(0));
dispatch(initGraveyard(1));
// dispatch(initMonsters(0));
// dispatch(initMonsters(1));
// dispatch(initMagics(0));
// dispatch(initMagics(1));
// dispatch(initGraveyard(0));
// dispatch(initGraveyard(1));
dispatch(initDeck({ player: 0, deskSize: start.deckSize1 }));
dispatch(initDeck({ player: 1, deskSize: start.deckSize2 }));
// dispatch(initDeck({ player: 0, deskSize: start.deckSize1 }));
// dispatch(initDeck({ player: 1, deskSize: start.deckSize2 }));
dispatch(initBanishedZone(0));
dispatch(initBanishedZone(1));
// dispatch(initBanishedZone(0));
// dispatch(initBanishedZone(1));
// <<< 删除 <<<
// 上面的删除就可以了
......@@ -78,5 +78,5 @@ export default (
matStore.decks.of(0).add(Array(start.deckSize1).fill(0));
matStore.decks.of(1).add(Array(start.deckSize2).fill(0));
dispatch(initHint()); // 直接删除
// dispatch(initHint()); // 直接删除
};
......@@ -7,6 +7,6 @@ export default (
_: ygopro.StocGameMessage.MsgSummoned,
dispatch: AppDispatch
) => {
dispatch(fetchEsHintMeta({ originMsg: 1604 }));
// dispatch(fetchEsHintMeta({ originMsg: 1604 }));
FIXME_fetchEsHintMeta({ originMsg: 1604 });
};
......@@ -7,12 +7,12 @@ export default (
summoning: ygopro.StocGameMessage.MsgSummoning,
dispatch: AppDispatch
) => {
dispatch(
fetchEsHintMeta({
originMsg: "「[?]」通常召唤宣言时",
cardID: summoning.code,
})
);
// dispatch(
// fetchEsHintMeta({
// originMsg: "「[?]」通常召唤宣言时",
// cardID: summoning.code,
// })
// );
FIXME_fetchEsHintMeta({
originMsg: "「[?]」通常召唤宣言时",
cardID: summoning.code,
......
......@@ -7,6 +7,6 @@ export default (
_swap: ygopro.StocGameMessage.MsgSwap,
dispatch: AppDispatch
) => {
dispatch(fetchEsHintMeta({ originMsg: 1602 }));
// dispatch(fetchEsHintMeta({ originMsg: 1602 }));
FIXME_fetchEsHintMeta({ originMsg: 1602 });
};
......@@ -5,9 +5,9 @@ import { store } from "@/store";
import { matStore } from "@/valtioStores";
export default function handleTimeLimit(timeLimit: ygopro.StocTimeLimit) {
const dispatch = store.dispatch;
// const dispatch = store.dispatch;
dispatch(updateTimeLimit([timeLimit.player, timeLimit.left_time]));
// dispatch(updateTimeLimit([timeLimit.player, timeLimit.left_time]));
matStore.timeLimits.set(timeLimit.player, timeLimit.left_time);
......
......@@ -11,7 +11,7 @@ export default (
dispatch: AppDispatch
) => {
if (!NeosConfig.unimplementedWhiteList.includes(unimplemented.command)) {
dispatch(setUnimplemented(unimplemented.command));
// dispatch(setUnimplemented(unimplemented.command));
matStore.unimplemented = unimplemented.command;
}
};
......@@ -6,7 +6,7 @@ import { getCardByLocation } from "@/valtioStores";
type MsgUpdateCounter = ygopro.StocGameMessage.MsgUpdateCounter;
export default (updateCounter: MsgUpdateCounter, dispatch: AppDispatch) => {
dispatch(updateMonsterCounters(updateCounter.toObject()));
// dispatch(updateMonsterCounters(updateCounter.toObject()));
const { location, count, action_type: counterType } = updateCounter;
const target = getCardByLocation(location); // 不太确定这个后面能不能相应,我不好说
if (target) {
......
......@@ -6,7 +6,7 @@ import MsgUpdateData = ygopro.StocGameMessage.MsgUpdateData;
import { matStore } from "@/valtioStores";
export default (updateData: MsgUpdateData, dispatch: AppDispatch) => {
dispatch(updateFieldData(updateData.toObject()));
// dispatch(updateFieldData(updateData.toObject()));
const { player: controller, zone, actions } = updateData;
if (controller !== undefined && zone !== undefined && actions !== undefined) {
......
......@@ -10,11 +10,11 @@ import MsgUpdateHp = ygopro.StocGameMessage.MsgUpdateHp;
export default (msgUpdateHp: MsgUpdateHp, dispatch: AppDispatch) => {
if (msgUpdateHp.type_ == MsgUpdateHp.ActionType.DAMAGE) {
dispatch(fetchEsHintMeta({ originMsg: "玩家收到伤害时" })); // TODO: i18n
// dispatch(fetchEsHintMeta({ originMsg: "玩家收到伤害时" })); // TODO: i18n
FIXME_fetchEsHintMeta({ originMsg: "玩家收到伤害时" });
matStore.initInfo.of(msgUpdateHp.player).life -= msgUpdateHp.value;
} else if (msgUpdateHp.type_ == MsgUpdateHp.ActionType.RECOVER) {
dispatch(fetchEsHintMeta({ originMsg: "玩家生命值回复时" })); // TODO: i18n
// dispatch(fetchEsHintMeta({ originMsg: "玩家生命值回复时" })); // TODO: i18n
FIXME_fetchEsHintMeta({ originMsg: "玩家生命值回复时" });
matStore.initInfo.of(msgUpdateHp.player).life += msgUpdateHp.value;
}
......
......@@ -10,9 +10,9 @@ export default (
_wait: ygopro.StocGameMessage.MsgWait,
dispatch: AppDispatch
) => {
dispatch(clearAllIdleInteractivities(0));
dispatch(clearAllIdleInteractivities(1));
dispatch(setWaiting(true));
// dispatch(clearAllIdleInteractivities(0));
// dispatch(clearAllIdleInteractivities(1));
// dispatch(setWaiting(true));
FIXME_clearAllIdleInteractivities(0);
FIXME_clearAllIdleInteractivities(1);
......
......@@ -4,6 +4,6 @@ import { AppDispatch } from "@/store";
import { matStore } from "@/valtioStores";
export default (win: ygopro.StocGameMessage.MsgWin, dispatch: AppDispatch) => {
dispatch(setResult(win.type_));
// dispatch(setResult(win.type_));
matStore.result = win.type_;
};
......@@ -5,16 +5,16 @@ import { playerStore } from "@/valtioStores";
// FIXME: player0 不一定是当前玩家
export default function handleDeckCount(pb: ygopro.YgoStocMsg) {
const dispath = store.dispatch;
// const dispath = store.dispatch;
const deckCount = pb.stoc_deck_count;
dispath(
player0DeckInfo({
mainCnt: deckCount.meMain,
extraCnt: deckCount.meExtra,
sideCnt: deckCount.meSide,
})
);
// dispath(
// player0DeckInfo({
// mainCnt: deckCount.meMain,
// extraCnt: deckCount.meExtra,
// sideCnt: deckCount.meSide,
// })
// );
playerStore.player0.deckInfo = {
mainCnt: deckCount.meMain,
......@@ -22,13 +22,13 @@ export default function handleDeckCount(pb: ygopro.YgoStocMsg) {
sideCnt: deckCount.meSide,
};
dispath(
player1DeckInfo({
mainCnt: deckCount.opMain,
extraCnt: deckCount.opExtra,
sideCnt: deckCount.opSide,
})
);
// dispath(
// player1DeckInfo({
// mainCnt: deckCount.opMain,
// extraCnt: deckCount.opExtra,
// sideCnt: deckCount.opSide,
// })
// );
playerStore.player1.deckInfo = {
mainCnt: deckCount.opMain,
......
......@@ -4,8 +4,8 @@ import { store } from "@/store";
import { moraStore } from "@/valtioStores";
export default function handleSelectHand(_: ygopro.YgoStocMsg) {
const dispatch = store.dispatch;
// const dispatch = store.dispatch;
dispatch(selectHandAble());
// dispatch(selectHandAble());
moraStore.selectHandAble = true;
}
......@@ -4,8 +4,8 @@ import { store } from "@/store";
import { moraStore } from "@/valtioStores";
export default function handleSelectTp(_: ygopro.YgoStocMsg) {
const dispatch = store.dispatch;
// const dispatch = store.dispatch;
dispatch(selectTpAble());
// dispatch(selectTpAble());
moraStore.selectTpAble = true;
}
......@@ -4,10 +4,10 @@ import { store } from "@/store";
import { chatStore } from "@/valtioStores";
export default function handleChat(pb: ygopro.YgoStocMsg) {
const dispatch = store.dispatch;
// const dispatch = store.dispatch;
const chat = pb.stoc_chat;
dispatch(postChat(chat.msg));
// dispatch(postChat(chat.msg));
chatStore.message = chat.msg;
}
......@@ -4,8 +4,8 @@ import { store } from "@/store";
import { moraStore } from "@/valtioStores";
export default function handleDuelStart(_pb: ygopro.YgoStocMsg) {
const dispatch = store.dispatch;
// const dispatch = store.dispatch;
dispatch(duelStart());
// dispatch(duelStart());
moraStore.duelStart = true;
}
......@@ -13,7 +13,7 @@ const READY_STATE = "ready";
const NO_READY_STATE = "not ready";
export default function handleHsPlayerChange(pb: ygopro.YgoStocMsg) {
const dispatch = store.dispatch;
// const dispatch = store.dispatch;
const change = pb.stoc_hs_player_change;
if (change.pos > 1) {
......@@ -46,31 +46,31 @@ export default function handleHsPlayerChange(pb: ygopro.YgoStocMsg) {
break;
}
case ygopro.StocHsPlayerChange.State.READY: {
change.pos == 0
? dispatch(player0Update(READY_STATE))
: dispatch(player1Update(READY_STATE));
// change.pos == 0
// ? dispatch(player0Update(READY_STATE))
// : dispatch(player1Update(READY_STATE));
playerStore[change.pos == 0 ? "player0" : "player1"].state =
READY_STATE;
break;
}
case ygopro.StocHsPlayerChange.State.NO_READY: {
change.pos == 0
? dispatch(player0Update(NO_READY_STATE))
: dispatch(player1Update(NO_READY_STATE));
// change.pos == 0
// ? dispatch(player0Update(NO_READY_STATE))
// : dispatch(player1Update(NO_READY_STATE));
playerStore[change.pos == 0 ? "player0" : "player1"].state =
NO_READY_STATE;
break;
}
case ygopro.StocHsPlayerChange.State.LEAVE: {
change.pos == 0 ? dispatch(player0Leave) : dispatch(player1Leave);
// change.pos == 0 ? dispatch(player0Leave) : dispatch(player1Leave);
playerStore[change.pos == 0 ? "player0" : "player1"] = {};
break;
}
case ygopro.StocHsPlayerChange.State.TO_OBSERVER: {
change.pos == 0 ? dispatch(player0Leave) : dispatch(player1Leave);
dispatch(observerIncrement());
// change.pos == 0 ? dispatch(player0Leave) : dispatch(player1Leave);
// dispatch(observerIncrement());
playerStore[change.pos == 0 ? "player0" : "player1"] = {}; // todo: 有没有必要?
playerStore.observerCount += 1;
break;
......
......@@ -4,7 +4,7 @@ import { store } from "@/store";
import { playerStore } from "@/valtioStores";
export default function handleHsPlayerEnter(pb: ygopro.YgoStocMsg) {
const dispatch = store.dispatch;
// const dispatch = store.dispatch;
const name = pb.stoc_hs_player_enter.name;
const pos = pb.stoc_hs_player_enter.pos;
......@@ -12,7 +12,7 @@ export default function handleHsPlayerEnter(pb: ygopro.YgoStocMsg) {
if (pos > 1) {
console.log("Currently only supported 2v2 mode.");
} else {
pos == 0 ? dispatch(player0Enter(name)) : dispatch(player1Enter(name));
// pos == 0 ? dispatch(player0Enter(name)) : dispatch(player1Enter(name));
playerStore[pos == 0 ? "player0" : "player1"].name = name;
}
}
......@@ -4,9 +4,9 @@ import { store } from "@/store";
import { playerStore } from "@/valtioStores";
export default function handleHsWatchChange(pb: ygopro.YgoStocMsg) {
const dispatch = store.dispatch;
// const dispatch = store.dispatch;
const count = pb.stoc_hs_watch_change.count;
dispatch(observerChange(count));
// dispatch(observerChange(count));
playerStore.observerCount = count;
}
......@@ -4,11 +4,11 @@ import { store } from "@/store";
import { joinStore } from "@/valtioStores";
export default function handleJoinGame(pb: ygopro.YgoStocMsg) {
const dispatch = store.dispatch;
// const dispatch = store.dispatch;
const msg = pb.stoc_join_game;
// todo
dispatch(setJoined());
// dispatch(setJoined());
joinStore.value = true;
}
......@@ -11,17 +11,18 @@ import { playerStore } from "@/valtioStores";
const NO_READY_STATE = "not ready";
export default function handleTypeChange(pb: ygopro.YgoStocMsg) {
const dispatch = store.dispatch;
// const dispatch = store.dispatch;
const selfType = pb.stoc_type_change.self_type;
const assertHost = pb.stoc_type_change.is_host;
dispatch(updateIsHost(assertHost));
// dispatch(updateIsHost(assertHost));
playerStore.isHost = assertHost;
if (assertHost) {
switch (selfType) {
case ygopro.StocTypeChange.SelfType.PLAYER1: {
dispatch(hostChange(0));
dispatch(player0Update(NO_READY_STATE));
// dispatch(hostChange(0));
// dispatch(player0Update(NO_READY_STATE));
playerStore.player0.isHost = true;
playerStore.player1.isHost = false;
......@@ -30,8 +31,8 @@ export default function handleTypeChange(pb: ygopro.YgoStocMsg) {
break;
}
case ygopro.StocTypeChange.SelfType.PLAYER2: {
dispatch(hostChange(0));
dispatch(player1Update(NO_READY_STATE));
// dispatch(hostChange(0));
// dispatch(player1Update(NO_READY_STATE));
playerStore.player0.isHost = false;
playerStore.player1.isHost = true;
......
......@@ -28,7 +28,7 @@ const CARD_WIDTH = 100;
const { cardListModal } = messageStore;
export const CardListModal = () => {
const dispatch = store.dispatch;
// const dispatch = store.dispatch;
// const isOpen = useAppSelector(selectCardListModalIsOpen);
// const list = useAppSelector(selectCardListModalInfo);
......@@ -37,7 +37,7 @@ export const CardListModal = () => {
const list = snapCardListModal.list as typeof cardListModal.list;
const handleOkOrCancel = () => {
dispatch(setCardListModalIsOpen(false));
// dispatch(setCardListModalIsOpen(false));
cardListModal.isOpen = false;
};
......@@ -53,9 +53,9 @@ export const CardListModal = () => {
key={idx}
onClick={() => {
sendSelectIdleCmdResponse(interactivy.response);
dispatch(setCardListModalIsOpen(false));
dispatch(clearAllIdleInteractivities(0));
dispatch(clearAllIdleInteractivities(1));
// dispatch(setCardListModalIsOpen(false));
// dispatch(clearAllIdleInteractivities(0));
// dispatch(clearAllIdleInteractivities(1));
cardListModal.isOpen = false;
FIXME_clearAllIdleInteractivities(0);
......
......@@ -42,7 +42,7 @@ const { cardModal } = messageStore;
export const CardModal = () => {
const snapCardModal = useSnapshot(cardModal);
const dispatch = store.dispatch;
// const dispatch = store.dispatch;
// const isOpen = useAppSelector(selectCardModalIsOpen);
// const meta = useAppSelector(selectCardModalMeta);
......@@ -68,7 +68,7 @@ export const CardModal = () => {
const interactivies = snapCardModal.interactivies;
const handleOkOrCancel = () => {
dispatch(setCardModalIsOpen(false));
// dispatch(setCardModalIsOpen(false));
cardModal.isOpen = false;
};
......@@ -95,9 +95,9 @@ export const CardModal = () => {
key={idx}
onClick={() => {
sendSelectIdleCmdResponse(interactive.response);
dispatch(setCardModalIsOpen(false));
dispatch(clearAllIdleInteractivities(0));
dispatch(clearAllIdleInteractivities(1));
// dispatch(setCardModalIsOpen(false));
// dispatch(clearAllIdleInteractivities(0));
// dispatch(clearAllIdleInteractivities(1));
cardModal.isOpen = false;
FIXME_clearAllIdleInteractivities(0);
FIXME_clearAllIdleInteractivities(1);
......
......@@ -36,7 +36,7 @@ const { checkCardModal } = messageStore;
export const CheckCardModal = () => {
const snapCheckCardModal = useSnapshot(checkCardModal);
const dispatch = store.dispatch;
// const dispatch = store.dispatch;
// const isOpen = useAppSelector(selectCheckCardModalIsOpen);
// const { min, max } = useAppSelector(selectCheckCardModalMinMax);
// const tabs = useAppSelector(selectCheckCardModalTags);
......@@ -104,8 +104,8 @@ export const CheckCardModal = () => {
disabled={response.length < min || response.length > max}
onClick={() => {
sendResponseHandler(onSubmit, response);
dispatch(setCheckCardModalIsOpen(false));
dispatch(resetCheckCardModal());
// dispatch(setCheckCardModalIsOpen(false));
// dispatch(resetCheckCardModal());
checkCardModal.isOpen = false;
FIXME_resetCheckCardModal();
}}
......@@ -120,8 +120,8 @@ export const CheckCardModal = () => {
if (cancelResponse) {
sendResponseHandler(onSubmit, [cancelResponse]);
}
dispatch(setCheckCardModalIsOpen(false));
dispatch(resetCheckCardModal());
// dispatch(setCheckCardModalIsOpen(false));
// dispatch(resetCheckCardModal());
checkCardModal.isOpen = false;
FIXME_resetCheckCardModal();
}}
......
......@@ -32,7 +32,7 @@ const { checkCardModalV2 } = messageStore;
const NeosConfig = useConfig();
export const CheckCardModalV2 = () => {
const snapCheckCardModalV2 = useSnapshot(checkCardModalV2);
const dispatch = store.dispatch;
// const dispatch = store.dispatch;
// const isOpen = useAppSelector(selectCheckCardModalV2IsOpen);
// const { min, max } = useAppSelector(selectCheckCardModalV2MinMax);
// const cancelable = useAppSelector(selectCheckCardModalV2CancelAble);
......@@ -73,9 +73,9 @@ export const CheckCardModalV2 = () => {
};
const onFinishOrCancel = () => {
sendSelectUnselectCardResponse({ cancel_or_finish: true });
dispatch(setCheckCardModalV2IsOpen(false));
dispatch(resetCheckCardModalV2());
dispatch(setCheckCardModalV2ResponseAble(false));
// dispatch(setCheckCardModalV2IsOpen(false));
// dispatch(resetCheckCardModalV2());
// dispatch(setCheckCardModalV2ResponseAble(false));
checkCardModalV2.isOpen = false;
checkCardModalV2.responseable = false;
......@@ -110,10 +110,10 @@ export const CheckCardModalV2 = () => {
size="small"
onChange={(value) => {
if (responseable) {
dispatch(setCheckCardModalV2IsOpen(false));
// dispatch(setCheckCardModalV2IsOpen(false));
// @ts-ignore
sendSelectUnselectCardResponse({ selected_ptr: value });
dispatch(setCheckCardModalV2ResponseAble(false));
// dispatch(setCheckCardModalV2ResponseAble(false));
checkCardModalV2.isOpen = false;
checkCardModalV2.responseable = false;
}
......
......@@ -26,7 +26,7 @@ const { checkCardModalV3 } = messageStore;
export const CheckCardModalV3 = () => {
const snapCheckCardModalV3 = useSnapshot(checkCardModalV3);
const dispatch = store.dispatch;
// const dispatch = store.dispatch;
// const state = useAppSelector(selectCheckCardModalV3);
// const isOpen = state.isOpen;
......@@ -69,9 +69,9 @@ export const CheckCardModalV3 = () => {
sendSelectCardResponse(
mustSelectOptions.concat(selectedOptions).map((option) => option.response)
);
dispatch(setCheckCardModalV3IsOpen(false));
dispatch(resetCheckCardModalV3());
dispatch(setCheckCardModalV3ResponseAble(false));
// dispatch(setCheckCardModalV3IsOpen(false));
// dispatch(resetCheckCardModalV3());
// dispatch(setCheckCardModalV3ResponseAble(false));
checkCardModalV3.isOpen = false;
checkCardModalV3.responseable = false;
......
......@@ -21,7 +21,7 @@ export const CheckCounterModal = () => {
const snapCheckCounterModal = useSnapshot(checkCounterModal);
const snapMat = useSnapshot(matStore);
const dispatch = store.dispatch;
// const dispatch = store.dispatch;
// const state = useAppSelector(selectCheckCounterModal);
// const isOpen = state.isOpen;
// const counterName = fetchStrings("!counter", `0x${state.counterType!}`);
......@@ -42,7 +42,11 @@ export const CheckCounterModal = () => {
const onFinish = () => {
sendSelectCounterResponse(selected);
dispatch(clearCheckCounter());
// dispatch(clearCheckCounter());
messageStore.checkCounterModal.isOpen = false;
messageStore.checkCounterModal.min = undefined;
messageStore.checkCounterModal.counterType = undefined;
messageStore.checkCounterModal.options = [];
};
return (
......
......@@ -18,7 +18,7 @@ import { useSnapshot } from "valtio";
const { optionModal } = messageStore;
export const OptionModal = () => {
const dispatch = store.dispatch;
// const dispatch = store.dispatch;
// const isOpen = useAppSelector(selectOptionModalIsOpen);
// const options = useAppSelector(selectOptionModalOptions);
......@@ -40,8 +40,8 @@ export const OptionModal = () => {
onClick={() => {
if (selected !== undefined) {
sendSelectOptionResponse(selected);
dispatch(setOptionModalIsOpen(false));
dispatch(resetOptionModal());
// dispatch(setOptionModalIsOpen(false));
// dispatch(resetOptionModal());
optionModal.isOpen = false;
optionModal.options = [];
}
......
......@@ -57,7 +57,7 @@ const PhaseButton = (props: {
const { phase } = matStore;
export const Phase = () => {
const dispatch = store.dispatch;
// const dispatch = store.dispatch;
// const enableBp = useAppSelector(selectEnableBp);
// const enableM2 = useAppSelector(selectEnableM2);
// const enableEp = useAppSelector(selectEnableEp);
......@@ -81,8 +81,8 @@ export const Phase = () => {
: 7;
const onBp = () => {
dispatch(clearAllIdleInteractivities(0));
dispatch(clearAllIdleInteractivities(0));
// dispatch(clearAllIdleInteractivities(0));
// dispatch(clearAllIdleInteractivities(0));
sendSelectIdleCmdResponse(6);
// dispatch(setEnableBp(false));
......@@ -91,21 +91,21 @@ export const Phase = () => {
phase.enableBp = false;
};
const onM2 = () => {
dispatch(clearAllIdleInteractivities(0));
dispatch(clearAllIdleInteractivities(0));
// dispatch(clearAllIdleInteractivities(0));
// dispatch(clearAllIdleInteractivities(0));
sendSelectBattleCmdResponse(2);
dispatch(setEnableM2(false));
// dispatch(setEnableM2(false));
FIXME_clearAllIdleInteractivities(0);
FIXME_clearAllIdleInteractivities(0);
phase.enableM2 = false;
};
const onEp = () => {
dispatch(clearAllIdleInteractivities(0));
dispatch(clearAllIdleInteractivities(0));
// dispatch(clearAllIdleInteractivities(0));
// dispatch(clearAllIdleInteractivities(0));
sendSelectIdleCmdResponse(response);
dispatch(setEnableEp(false));
// dispatch(setEnableEp(false));
FIXME_clearAllIdleInteractivities(0);
FIXME_clearAllIdleInteractivities(0);
phase.enableEp = false;
......
......@@ -23,7 +23,7 @@ import { useSnapshot } from "valtio";
const { positionModal } = messageStore;
export const PositionModal = () => {
const dispatch = store.dispatch;
// const dispatch = store.dispatch;
const snapPositionModal = useSnapshot(positionModal);
// const isOpen = useAppSelector(selectPositionModalIsOpen);
// const positions = useAppSelector(selectPositionModalPositions);
......@@ -45,8 +45,8 @@ export const PositionModal = () => {
onClick={() => {
if (selected !== undefined) {
sendSelectPositionResponse(selected);
dispatch(setPositionModalIsOpen(false));
dispatch(resetPositionModal());
// dispatch(setPositionModalIsOpen(false));
// dispatch(resetPositionModal());
positionModal.isOpen = false;
positionModal.positions = [];
}
......
......@@ -34,7 +34,7 @@ const NeosConfig = useConfig();
const { sortCardModal } = messageStore;
export const SortCardModal = () => {
const dispatch = store.dispatch;
// const dispatch = store.dispatch;
const snapSortCardModal = useSnapshot(sortCardModal);
// const state = useAppSelector(selectSortCardModal);
......@@ -52,7 +52,7 @@ export const SortCardModal = () => {
const onFinish = () => {
sendSortCardResponse(items.map((item) => item.response));
dispatch(resetSortCardModal());
// dispatch(resetSortCardModal());
sortCardModal.isOpen = false;
sortCardModal.options = [];
};
......
......@@ -19,7 +19,7 @@ import { useSnapshot } from "valtio";
const { yesNoModal } = messageStore;
export const YesNoModal = () => {
const dispatch = store.dispatch;
// const dispatch = store.dispatch;
// const isOpen = useAppSelector(selectYesNoModalIsOpen);
// const msg = useAppSelector(selectYesNOModalMsg);
// const hint = useAppSelector(selectHint);
......@@ -41,7 +41,7 @@ export const YesNoModal = () => {
<Button
onClick={() => {
sendSelectEffectYnResponse(true);
dispatch(setYesNoModalIsOpen(false));
// dispatch(setYesNoModalIsOpen(false));
yesNoModal.isOpen = false;
}}
>
......@@ -50,7 +50,7 @@ export const YesNoModal = () => {
<Button
onClick={() => {
sendSelectEffectYnResponse(false);
dispatch(setYesNoModalIsOpen(false));
// dispatch(setYesNoModalIsOpen(false));
yesNoModal.isOpen = false;
}}
>
......
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