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
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
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
love_飞影
Neos
Commits
e3b696b8
Commit
e3b696b8
authored
Apr 22, 2023
by
timel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: valtio store logic 75%
parent
c77fde8c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
1 deletion
+57
-1
src/service/duel/reloadField.ts
src/service/duel/reloadField.ts
+57
-1
No files found.
src/service/duel/reloadField.ts
View file @
e3b696b8
import
{
ygopro
}
from
"
@/api
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
reloadField
}
from
"
@/reducers/duel/mod
"
;
import
{
reloadField
}
from
"
@/reducers/duel/mod
"
;
import
{
AppDispatch
}
from
"
@/store
"
;
import
{
AppDispatch
}
from
"
@/store
"
;
import
MsgReloadField
=
ygopro
.
StocGameMessage
.
MsgReloadField
;
import
{
matStore
,
type
DuelFieldState
}
from
"
@/valtioStores
"
;
type
MsgReloadField
=
ygopro
.
StocGameMessage
.
MsgReloadField
;
type
ZoneActions
=
ygopro
.
StocGameMessage
.
MsgReloadField
.
ZoneAction
[];
export
default
(
field
:
MsgReloadField
,
dispatch
:
AppDispatch
)
=>
{
export
default
(
field
:
MsgReloadField
,
dispatch
:
AppDispatch
)
=>
{
dispatch
(
reloadField
(
field
));
dispatch
(
reloadField
(
field
));
const
_duel_rule
=
field
.
duel_rule
;
const
gamers
=
[
"
me
"
,
"
op
"
]
as
const
;
gamers
.
forEach
((
gamer
)
=>
{
matStore
.
banishedZones
[
gamer
]
=
[];
matStore
.
extraDecks
[
gamer
]
=
[];
matStore
.
graveyards
[
gamer
]
=
[];
matStore
.
hands
[
gamer
]
=
[];
matStore
.
monsters
[
gamer
]
=
[];
matStore
.
magics
[
gamer
]
=
[];
});
const
{
MZONE
,
SZONE
,
HAND
,
DECK
,
GRAVE
,
REMOVED
,
EXTRA
}
=
ygopro
.
CardZone
;
const
zones
=
[
MZONE
,
SZONE
,
HAND
,
DECK
,
GRAVE
,
REMOVED
,
EXTRA
]
as
const
;
field
.
actions
.
forEach
(({
player
,
zone_actions
})
=>
{
zones
.
forEach
((
zone
)
=>
{
reloadDuelField
(
zone
,
zone_actions
.
filter
((
item
)
=>
item
.
zone
===
zone
),
player
);
});
});
};
};
/** 可以理解成reload DuelFieldState */
function
reloadDuelField
(
cardZone
:
ygopro
.
CardZone
,
zoneActions
:
ZoneActions
,
controller
:
number
)
{
zoneActions
.
sort
((
a
,
b
)
=>
a
.
sequence
-
b
.
sequence
);
const
cards
=
zoneActions
.
map
((
action
)
=>
{
// FIXME: OVERLAY
return
{
location
:
{
controler
:
controller
,
location
:
action
.
zone
,
position
:
action
.
position
,
},
idleInteractivities
:
[],
counters
:
{},
reload
:
true
,
};
});
matStore
.
getZone
(
cardZone
).
at
(
controller
).
length
=
0
;
matStore
.
getZone
(
cardZone
)
.
at
(
controller
)
.
push
(...
cards
);
}
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