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