Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Neos
Commits
b826b116
Commit
b826b116
authored
Apr 26, 2023
by
timel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: comment out all dispatch codes
parent
35991603
Changes
62
Hide whitespace changes
Inline
Side-by-side
Showing
62 changed files
with
609 additions
and
596 deletions
+609
-596
src/service/duel/attack.ts
src/service/duel/attack.ts
+3
-3
src/service/duel/attackDisable.ts
src/service/duel/attackDisable.ts
+1
-1
src/service/duel/chaining.ts
src/service/duel/chaining.ts
+3
-3
src/service/duel/draw.ts
src/service/duel/draw.ts
+2
-2
src/service/duel/flipSummoned.ts
src/service/duel/flipSummoned.ts
+1
-1
src/service/duel/flipSummoning.ts
src/service/duel/flipSummoning.ts
+6
-6
src/service/duel/hint.ts
src/service/duel/hint.ts
+5
-5
src/service/duel/move.ts
src/service/duel/move.ts
+147
-147
src/service/duel/newPhase.ts
src/service/duel/newPhase.ts
+5
-5
src/service/duel/newTurn.ts
src/service/duel/newTurn.ts
+1
-1
src/service/duel/posChange.ts
src/service/duel/posChange.ts
+15
-15
src/service/duel/reloadField.ts
src/service/duel/reloadField.ts
+1
-1
src/service/duel/selectBattleCmd.ts
src/service/duel/selectBattleCmd.ts
+63
-63
src/service/duel/selectCard.ts
src/service/duel/selectCard.ts
+13
-13
src/service/duel/selectChain.ts
src/service/duel/selectChain.ts
+22
-22
src/service/duel/selectCounter.ts
src/service/duel/selectCounter.ts
+1
-1
src/service/duel/selectEffectYn.ts
src/service/duel/selectEffectYn.ts
+9
-8
src/service/duel/selectIdleCmd.ts
src/service/duel/selectIdleCmd.ts
+76
-76
src/service/duel/selectOption.ts
src/service/duel/selectOption.ts
+4
-4
src/service/duel/selectPlace.ts
src/service/duel/selectPlace.ts
+6
-6
src/service/duel/selectPosition.ts
src/service/duel/selectPosition.ts
+4
-4
src/service/duel/selectSum.ts
src/service/duel/selectSum.ts
+18
-18
src/service/duel/selectTribute.ts
src/service/duel/selectTribute.ts
+23
-23
src/service/duel/selectUnselectCard.ts
src/service/duel/selectUnselectCard.ts
+5
-5
src/service/duel/selectYesNo.ts
src/service/duel/selectYesNo.ts
+11
-5
src/service/duel/set.ts
src/service/duel/set.ts
+1
-1
src/service/duel/shuffleHand.ts
src/service/duel/shuffleHand.ts
+3
-3
src/service/duel/sortCard.ts
src/service/duel/sortCard.ts
+5
-4
src/service/duel/spSummoned.ts
src/service/duel/spSummoned.ts
+1
-1
src/service/duel/spSummoning.ts
src/service/duel/spSummoning.ts
+6
-6
src/service/duel/start.ts
src/service/duel/start.ts
+32
-32
src/service/duel/summoned.ts
src/service/duel/summoned.ts
+1
-1
src/service/duel/summoning.ts
src/service/duel/summoning.ts
+6
-6
src/service/duel/swap.ts
src/service/duel/swap.ts
+1
-1
src/service/duel/timeLimit.ts
src/service/duel/timeLimit.ts
+2
-2
src/service/duel/unimplemented.ts
src/service/duel/unimplemented.ts
+1
-1
src/service/duel/updateCounter.ts
src/service/duel/updateCounter.ts
+1
-1
src/service/duel/updateData.ts
src/service/duel/updateData.ts
+1
-1
src/service/duel/updateHp.ts
src/service/duel/updateHp.ts
+2
-2
src/service/duel/wait.ts
src/service/duel/wait.ts
+3
-3
src/service/duel/win.ts
src/service/duel/win.ts
+1
-1
src/service/mora/deckCount.ts
src/service/mora/deckCount.ts
+15
-15
src/service/mora/selectHand.ts
src/service/mora/selectHand.ts
+2
-2
src/service/mora/selectTp.ts
src/service/mora/selectTp.ts
+2
-2
src/service/room/chat.ts
src/service/room/chat.ts
+2
-2
src/service/room/duelStart.ts
src/service/room/duelStart.ts
+2
-2
src/service/room/hsPlayerChange.ts
src/service/room/hsPlayerChange.ts
+10
-10
src/service/room/hsPlayerEnter.ts
src/service/room/hsPlayerEnter.ts
+2
-2
src/service/room/hsWatchChange.ts
src/service/room/hsWatchChange.ts
+2
-2
src/service/room/joinGame.ts
src/service/room/joinGame.ts
+2
-2
src/service/room/typeChange.ts
src/service/room/typeChange.ts
+7
-6
src/ui/Duel/Message/CardListModal.tsx
src/ui/Duel/Message/CardListModal.tsx
+5
-5
src/ui/Duel/Message/CardModal.tsx
src/ui/Duel/Message/CardModal.tsx
+5
-5
src/ui/Duel/Message/CheckCardModal.tsx
src/ui/Duel/Message/CheckCardModal.tsx
+5
-5
src/ui/Duel/Message/CheckCardModalV2.tsx
src/ui/Duel/Message/CheckCardModalV2.tsx
+6
-6
src/ui/Duel/Message/CheckCardModalV3.tsx
src/ui/Duel/Message/CheckCardModalV3.tsx
+4
-4
src/ui/Duel/Message/CheckCounterModal.tsx
src/ui/Duel/Message/CheckCounterModal.tsx
+6
-2
src/ui/Duel/Message/OptionModal.tsx
src/ui/Duel/Message/OptionModal.tsx
+3
-3
src/ui/Duel/Message/Phase.tsx
src/ui/Duel/Message/Phase.tsx
+9
-9
src/ui/Duel/Message/PositionModal.tsx
src/ui/Duel/Message/PositionModal.tsx
+3
-3
src/ui/Duel/Message/SortCardModal.tsx
src/ui/Duel/Message/SortCardModal.tsx
+2
-2
src/ui/Duel/Message/YesNoModal.tsx
src/ui/Duel/Message/YesNoModal.tsx
+3
-3
No files found.
src/service/duel/attack.ts
View file @
b826b116
...
...
@@ -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
,
...
...
src/service/duel/attackDisable.ts
View file @
b826b116
...
...
@@ -10,6 +10,6 @@ export default (
_
:
ygopro
.
StocGameMessage
.
MsgAttackDisabled
,
dispatch
:
AppDispatch
)
=>
{
dispatch
(
fetchEsHintMeta
({
originMsg
:
"
攻击被无效时
"
}));
//
dispatch(fetchEsHintMeta({ originMsg: "攻击被无效时" }));
FIXME_fetchEsHintMeta
({
originMsg
:
"
攻击被无效时
"
});
};
src/service/duel/chaining.ts
View file @
b826b116
...
...
@@ -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
,
...
...
src/service/duel/draw.ts
View file @
b826b116
...
...
@@ -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
);
...
...
src/service/duel/flipSummoned.ts
View file @
b826b116
...
...
@@ -7,6 +7,6 @@ export default (
_
:
ygopro
.
StocGameMessage
.
MsgFlipSummoned
,
dispatch
:
AppDispatch
)
=>
{
dispatch
(
fetchEsHintMeta
({
originMsg
:
1608
}));
//
dispatch(fetchEsHintMeta({ originMsg: 1608 }));
FIXME_fetchEsHintMeta
({
originMsg
:
1608
});
};
src/service/duel/flipSummoning.ts
View file @
b826b116
...
...
@@ -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
,
...
...
src/service/duel/hint.ts
View file @
b826b116
...
...
@@ -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
:
""
,
...
...
src/service/duel/move.ts
View file @
b826b116
...
...
@@ -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;
//
}
//
}
};
src/service/duel/newPhase.ts
View file @
b826b116
...
...
@@ -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
[
...
...
src/service/duel/newTurn.ts
View file @
b826b116
...
...
@@ -8,6 +8,6 @@ export default (
dispatch
:
AppDispatch
)
=>
{
const
player
=
newTurn
.
player
;
dispatch
(
updateTurn
(
player
));
//
dispatch(updateTurn(player));
matStore
.
currentPlayer
=
player
;
};
src/service/duel/posChange.ts
View file @
b826b116
...
...
@@ -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
,
});
...
...
src/service/duel/reloadField.ts
View file @
b826b116
...
...
@@ -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
;
...
...
src/service/duel/selectBattleCmd.ts
View file @
b826b116
...
...
@@ -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
;
...
...
src/service/duel/selectCard.ts
View file @
b826b116
...
...
@@ -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
;
};
src/service/duel/selectChain.ts
View file @
b826b116
...
...
@@ -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
;
...
...
src/service/duel/selectCounter.ts
View file @
b826b116
...
...
@@ -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
;
...
...
src/service/duel/selectEffectYn.ts
View file @
b826b116
...
...
@@ -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
;
};
src/service/duel/selectIdleCmd.ts
View file @
b826b116
...
...
@@ -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
;
...
...
src/service/duel/selectOption.ts
View file @
b826b116
...
...
@@ -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
})
=>
{
...
...
src/service/duel/selectPlace.ts
View file @
b826b116
...
...
@@ -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
(
...
...
src/service/duel/selectPosition.ts
View file @
b826b116
...
...
@@ -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
...
...
src/service/duel/selectSum.ts
View file @
b826b116
...
...
@@ -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
;
};
src/service/duel/selectTribute.ts
View file @
b826b116
...
...
@@ -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
;
};
src/service/duel/selectUnselectCard.ts
View file @
b826b116
...
...
@@ -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
;
};
src/service/duel/selectYesNo.ts
View file @
b826b116
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
;
};
src/service/duel/set.ts
View file @
b826b116
...
...
@@ -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
});
};
src/service/duel/shuffleHand.ts
View file @
b826b116
...
...
@@ -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
;
...
...
src/service/duel/sortCard.ts
View file @
b826b116
...
...
@@ -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
);
...
...
src/service/duel/spSummoned.ts
View file @
b826b116
...
...
@@ -7,6 +7,6 @@ export default (
_
:
ygopro
.
StocGameMessage
.
MsgSpSummoned
,
dispatch
:
AppDispatch
)
=>
{
dispatch
(
fetchEsHintMeta
({
originMsg
:
1606
}));
//
dispatch(fetchEsHintMeta({ originMsg: 1606 }));
FIXME_fetchEsHintMeta
({
originMsg
:
1606
});
};
src/service/duel/spSummoning.ts
View file @
b826b116
...
...
@@ -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
,
...
...
src/service/duel/start.ts
View file @
b826b116
...
...
@@ -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()); // 直接删除
};
src/service/duel/summoned.ts
View file @
b826b116
...
...
@@ -7,6 +7,6 @@ export default (
_
:
ygopro
.
StocGameMessage
.
MsgSummoned
,
dispatch
:
AppDispatch
)
=>
{
dispatch
(
fetchEsHintMeta
({
originMsg
:
1604
}));
//
dispatch(fetchEsHintMeta({ originMsg: 1604 }));
FIXME_fetchEsHintMeta
({
originMsg
:
1604
});
};
src/service/duel/summoning.ts
View file @
b826b116
...
...
@@ -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
,
...
...
src/service/duel/swap.ts
View file @
b826b116
...
...
@@ -7,6 +7,6 @@ export default (
_swap
:
ygopro
.
StocGameMessage
.
MsgSwap
,
dispatch
:
AppDispatch
)
=>
{
dispatch
(
fetchEsHintMeta
({
originMsg
:
1602
}));
//
dispatch(fetchEsHintMeta({ originMsg: 1602 }));
FIXME_fetchEsHintMeta
({
originMsg
:
1602
});
};
src/service/duel/timeLimit.ts
View file @
b826b116
...
...
@@ -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
);
...
...
src/service/duel/unimplemented.ts
View file @
b826b116
...
...
@@ -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
;
}
};
src/service/duel/updateCounter.ts
View file @
b826b116
...
...
@@ -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
)
{
...
...
src/service/duel/updateData.ts
View file @
b826b116
...
...
@@ -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
)
{
...
...
src/service/duel/updateHp.ts
View file @
b826b116
...
...
@@ -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
;
}
...
...
src/service/duel/wait.ts
View file @
b826b116
...
...
@@ -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
);
...
...
src/service/duel/win.ts
View file @
b826b116
...
...
@@ -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_
;
};
src/service/mora/deckCount.ts
View file @
b826b116
...
...
@@ -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
,
...
...
src/service/mora/selectHand.ts
View file @
b826b116
...
...
@@ -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
;
}
src/service/mora/selectTp.ts
View file @
b826b116
...
...
@@ -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
;
}
src/service/room/chat.ts
View file @
b826b116
...
...
@@ -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
;
}
src/service/room/duelStart.ts
View file @
b826b116
...
...
@@ -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
;
}
src/service/room/hsPlayerChange.ts
View file @
b826b116
...
...
@@ -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
;
...
...
src/service/room/hsPlayerEnter.ts
View file @
b826b116
...
...
@@ -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
;
}
}
src/service/room/hsWatchChange.ts
View file @
b826b116
...
...
@@ -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
;
}
src/service/room/joinGame.ts
View file @
b826b116
...
...
@@ -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
;
}
src/service/room/typeChange.ts
View file @
b826b116
...
...
@@ -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
;
...
...
src/ui/Duel/Message/CardListModal.tsx
View file @
b826b116
...
...
@@ -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
);
...
...
src/ui/Duel/Message/CardModal.tsx
View file @
b826b116
...
...
@@ -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
);
...
...
src/ui/Duel/Message/CheckCardModal.tsx
View file @
b826b116
...
...
@@ -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
();
}
}
...
...
src/ui/Duel/Message/CheckCardModalV2.tsx
View file @
b826b116
...
...
@@ -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
;
}
...
...
src/ui/Duel/Message/CheckCardModalV3.tsx
View file @
b826b116
...
...
@@ -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
;
...
...
src/ui/Duel/Message/CheckCounterModal.tsx
View file @
b826b116
...
...
@@ -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
(
...
...
src/ui/Duel/Message/OptionModal.tsx
View file @
b826b116
...
...
@@ -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
=
[];
}
...
...
src/ui/Duel/Message/Phase.tsx
View file @
b826b116
...
...
@@ -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
;
...
...
src/ui/Duel/Message/PositionModal.tsx
View file @
b826b116
...
...
@@ -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
=
[];
}
...
...
src/ui/Duel/Message/SortCardModal.tsx
View file @
b826b116
...
...
@@ -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
=
[];
};
...
...
src/ui/Duel/Message/YesNoModal.tsx
View file @
b826b116
...
...
@@ -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
;
}
}
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment