Commit 35991603 authored by timel's avatar timel

fix: the same extra field; few options

parent d6508a0c
Pipeline #21379 passed with stages
in 14 minutes and 33 seconds
...@@ -73,7 +73,7 @@ export default (selectBattleCmd: MsgSelectBattleCmd, dispatch: AppDispatch) => { ...@@ -73,7 +73,7 @@ export default (selectBattleCmd: MsgSelectBattleCmd, dispatch: AppDispatch) => {
const interactType = battleTypeToInteracType(cmd.battle_type); const interactType = battleTypeToInteracType(cmd.battle_type);
cmd.battle_datas.forEach((data) => { cmd.battle_datas.forEach((data) => {
const cardInfo = data.card_info; const { location, sequence } = data.card_info;
// valtio // valtio
if (interactType) { if (interactType) {
...@@ -84,22 +84,20 @@ export default (selectBattleCmd: MsgSelectBattleCmd, dispatch: AppDispatch) => { ...@@ -84,22 +84,20 @@ export default (selectBattleCmd: MsgSelectBattleCmd, dispatch: AppDispatch) => {
[InteractType.ATTACK]: { directAttackAble: data.direct_attackable }, [InteractType.ATTACK]: { directAttackAble: data.direct_attackable },
}; };
const tmp = map[interactType]; const tmp = map[interactType];
if (tmp) { matStore
matStore .in(location)
.in(cardInfo.location) .of(player)
.of(player) .addIdleInteractivity(sequence, {
.addIdleInteractivity(cardInfo.sequence, { ...tmp,
...tmp, interactType,
interactType, response: data.response,
response: data.response, });
}); } else {
} else { console.warn(`Undefined InteractType`);
console.warn(`Unhandled InteractType:`, interactType);
}
} }
// >>> 从这开始删除 >>> // >>> 从这开始删除 >>>
switch (cardInfo.location) { switch (location) {
case ygopro.CardZone.HAND: { case ygopro.CardZone.HAND: {
dispatcher(data, interactType, addHandsIdleInteractivity); dispatcher(data, interactType, addHandsIdleInteractivity);
......
...@@ -72,7 +72,7 @@ export default (selectIdleCmd: MsgSelectIdleCmd, dispatch: AppDispatch) => { ...@@ -72,7 +72,7 @@ export default (selectIdleCmd: MsgSelectIdleCmd, dispatch: AppDispatch) => {
const interactType = idleTypeToInteractType(cmd.idle_type); const interactType = idleTypeToInteractType(cmd.idle_type);
cmd.idle_datas.forEach((data) => { cmd.idle_datas.forEach((data) => {
const cardInfo = data.card_info; const { location, sequence } = data.card_info;
// valtio。代码从 ./selectBattleCmd.ts 复制过来的 // valtio。代码从 ./selectBattleCmd.ts 复制过来的
if (interactType) { if (interactType) {
...@@ -82,21 +82,19 @@ export default (selectIdleCmd: MsgSelectIdleCmd, dispatch: AppDispatch) => { ...@@ -82,21 +82,19 @@ export default (selectIdleCmd: MsgSelectIdleCmd, dispatch: AppDispatch) => {
[InteractType.ACTIVATE]: { activateIndex: data.effect_description }, [InteractType.ACTIVATE]: { activateIndex: data.effect_description },
}; };
const tmp = map[interactType]; const tmp = map[interactType];
if (tmp) { matStore
matStore .in(location)
.in(cardInfo.location) .of(player)
.of(player) .addIdleInteractivity(sequence, {
.addIdleInteractivity(cardInfo.sequence, { ...tmp,
...tmp, interactType,
interactType, response: data.response,
response: data.response, });
}); } else {
} else { console.warn(`Undefined InteractType`);
console.warn(`Unhandled InteractType:`, interactType);
}
} }
switch (cardInfo.location) { switch (location) {
case ygopro.CardZone.HAND: { case ygopro.CardZone.HAND: {
dispatcher(data, interactType, addHandsIdleInteractivity); dispatcher(data, interactType, addHandsIdleInteractivity);
...@@ -128,7 +126,7 @@ export default (selectIdleCmd: MsgSelectIdleCmd, dispatch: AppDispatch) => { ...@@ -128,7 +126,7 @@ export default (selectIdleCmd: MsgSelectIdleCmd, dispatch: AppDispatch) => {
break; break;
} }
default: { default: {
console.log(`Unhandled zone type: ${cardInfo.location}`); console.log(`Unhandled zone type: ${location}`);
} }
} }
}); });
......
...@@ -37,18 +37,18 @@ export default ( ...@@ -37,18 +37,18 @@ export default (
messageStore.checkCardModalV2.selectMin = min; messageStore.checkCardModalV2.selectMin = min;
messageStore.checkCardModalV2.selectMax = max; messageStore.checkCardModalV2.selectMax = max;
dispatch( // dispatch(
fetchCheckCardMetasV2({ // fetchCheckCardMetasV2({
selected: false, // selected: false,
options: selectableCards.map((card) => { // options: selectableCards.map((card) => {
return { // return {
code: card.code, // code: card.code,
location: card.location, // location: card.location,
response: card.response, // response: card.response,
}; // };
}), // }),
}) // })
); // );
FIXME_fetchCheckCardMetasV2({ FIXME_fetchCheckCardMetasV2({
selected: false, selected: false,
...@@ -61,18 +61,18 @@ export default ( ...@@ -61,18 +61,18 @@ export default (
}), }),
}); });
dispatch( // dispatch(
fetchCheckCardMetasV2({ // fetchCheckCardMetasV2({
selected: true, // selected: true,
options: selectedCards.map((card) => { // options: selectedCards.map((card) => {
return { // return {
code: card.code, // code: card.code,
location: card.location, // location: card.location,
response: card.response, // response: card.response,
}; // };
}), // }),
}) // })
); // );
FIXME_fetchCheckCardMetasV2({ FIXME_fetchCheckCardMetasV2({
selected: true, selected: true,
......
...@@ -71,7 +71,7 @@ export const Monsters = () => { ...@@ -71,7 +71,7 @@ export const Monsters = () => {
))} ))}
<ExtraMonsters <ExtraMonsters
meMonsters={meMonstersStore} meMonsters={meMonstersStore}
opMonsters={meMonstersStore} opMonsters={opMonstersStore}
/> />
</> </>
); );
...@@ -82,10 +82,10 @@ const ExtraMonsters = (props: { ...@@ -82,10 +82,10 @@ const ExtraMonsters = (props: {
meMonsters: CardState[]; meMonsters: CardState[];
opMonsters: CardState[]; opMonsters: CardState[];
}) => { }) => {
const meLeft = props.meMonsters.find((_, sequence) => sequence == 5); const meLeft = props.meMonsters[5];
const meRight = props.meMonsters.find((_, sequence) => sequence == 6); const meRight = props.meMonsters[6];
const opLeft = props.opMonsters.find((_, sequence) => sequence == 5); const opLeft = props.opMonsters[5];
const opRight = props.opMonsters.find((_, sequence) => sequence == 6); const opRight = props.opMonsters[6];
const leftPosition = new BABYLON.Vector3(-1.1, transform.z / 2 + floating, 0); const leftPosition = new BABYLON.Vector3(-1.1, transform.z / 2 + floating, 0);
const rightPosition = new BABYLON.Vector3(1.1, transform.z / 2 + floating, 0); const rightPosition = new BABYLON.Vector3(1.1, transform.z / 2 + floating, 0);
...@@ -95,56 +95,40 @@ const ExtraMonsters = (props: { ...@@ -95,56 +95,40 @@ const ExtraMonsters = (props: {
return ( return (
<> <>
{meLeft ? ( <FixedSlot
<FixedSlot state={meLeft}
state={meLeft} sequence={5}
sequence={5} position={leftPosition}
position={leftPosition} rotation={meRotation}
rotation={meRotation} deffenseRotation={cardSlotDefenceRotation()}
deffenseRotation={cardSlotDefenceRotation()} // clearPlaceInteractivitiesAction={clearMonsterPlaceInteractivities}
// clearPlaceInteractivitiesAction={clearMonsterPlaceInteractivities} clearPlaceInteractivitiesAction={clearPlaceInteractivitiesAction}
clearPlaceInteractivitiesAction={clearPlaceInteractivitiesAction} />
/> <FixedSlot
) : ( state={meRight}
<></> sequence={6}
)} position={rightPosition}
{meRight ? ( rotation={meRotation}
<FixedSlot deffenseRotation={cardSlotDefenceRotation()}
state={meRight} // clearPlaceInteractivitiesAction={clearMonsterPlaceInteractivities}
sequence={6} clearPlaceInteractivitiesAction={clearPlaceInteractivitiesAction}
position={rightPosition} />
rotation={meRotation} <FixedSlot
deffenseRotation={cardSlotDefenceRotation()} state={opLeft}
// clearPlaceInteractivitiesAction={clearMonsterPlaceInteractivities} sequence={5}
clearPlaceInteractivitiesAction={clearPlaceInteractivitiesAction} position={rightPosition}
/> rotation={opRotation}
) : ( deffenseRotation={cardSlotDefenceRotation()}
<></> clearPlaceInteractivitiesAction={clearMonsterPlaceInteractivities}
)} />
{opLeft ? ( <FixedSlot
<FixedSlot state={opRight}
state={opLeft} sequence={6}
sequence={5} position={leftPosition}
position={rightPosition} rotation={opRotation}
rotation={opRotation} deffenseRotation={cardSlotDefenceRotation()}
deffenseRotation={cardSlotDefenceRotation()} clearPlaceInteractivitiesAction={clearMonsterPlaceInteractivities}
clearPlaceInteractivitiesAction={clearMonsterPlaceInteractivities} />
/>
) : (
<></>
)}
{opRight ? (
<FixedSlot
state={opRight}
sequence={6}
position={leftPosition}
rotation={opRotation}
deffenseRotation={cardSlotDefenceRotation()}
clearPlaceInteractivitiesAction={clearMonsterPlaceInteractivities}
/>
) : (
<></>
)}
</> </>
); );
}; };
......
...@@ -87,12 +87,24 @@ class CardArray extends Array<CardState> implements ArrayCardState { ...@@ -87,12 +87,24 @@ class CardArray extends Array<CardState> implements ArrayCardState {
sequence: number, sequence: number,
interactivity: CardState["idleInteractivities"][number] interactivity: CardState["idleInteractivities"][number]
) { ) {
console.warn("addIdleInteractivity", {
sequence,
interactivity,
zone: ygopro.CardZone[this.zone],
controller: getWhom(this.getController()),
});
this[sequence].idleInteractivities.push(interactivity); this[sequence].idleInteractivities.push(interactivity);
} }
clearIdleInteractivities() { clearIdleInteractivities() {
this.forEach((card) => (card.idleInteractivities = [])); this.forEach((card) => (card.idleInteractivities = []));
} }
setPlaceInteractivityType(sequence: number, interactType: InteractType) { setPlaceInteractivityType(sequence: number, interactType: InteractType) {
console.warn("setPlaceInteractivityType", {
sequence,
interactType,
zone: ygopro.CardZone[this.zone],
controller: getWhom(this.getController()),
});
this[sequence].placeInteractivity = { this[sequence].placeInteractivity = {
interactType: interactType, interactType: interactType,
response: { response: {
......
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