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
2767c807
Commit
2767c807
authored
Jan 15, 2023
by
chechunchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle field
parent
33f51925
Pipeline
#19567
passed with stages
in 4 minutes and 9 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
1 deletion
+45
-1
src/reducers/duel/fieldSlice.ts
src/reducers/duel/fieldSlice.ts
+31
-1
src/reducers/duel/mod.ts
src/reducers/duel/mod.ts
+6
-0
src/service/duel/selectIdleCmd.ts
src/service/duel/selectIdleCmd.ts
+8
-0
No files found.
src/reducers/duel/fieldSlice.ts
View file @
2767c807
...
...
@@ -3,7 +3,7 @@ import { DuelState } from "./mod";
import
{
RootState
}
from
"
../../store
"
;
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
PayloadAction
,
CaseReducer
}
from
"
@reduxjs/toolkit
"
;
import
{
CardState
,
InteractType
}
from
"
./generic
"
;
import
{
CardState
,
Interact
ivity
,
Interact
Type
}
from
"
./generic
"
;
export
interface
FieldState
{
inner
?:
CardState
;
...
...
@@ -69,5 +69,35 @@ export const clearFieldPlaceInteractivitiesImpl: CaseReducer<
}
};
export
const
addFieldIdleInteractivitiesImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
{
player
:
number
;
sequence
:
number
;
interactivity
:
Interactivity
<
number
>
;
}
>
>
=
(
state
,
action
)
=>
{
const
field
=
judgeSelf
(
action
.
payload
.
player
,
state
)
?
state
.
meField
:
state
.
opField
;
if
(
field
&&
field
.
inner
)
{
field
.
inner
.
idleInteractivities
.
push
(
action
.
payload
.
interactivity
);
}
};
export
const
clearFieldIdleInteractivitiesImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
number
>
>
=
(
state
,
action
)
=>
{
const
field
=
judgeSelf
(
action
.
payload
,
state
)
?
state
.
meField
:
state
.
opField
;
if
(
field
&&
field
.
inner
)
{
field
.
inner
.
idleInteractivities
=
[];
}
};
export
const
selectMeField
=
(
state
:
RootState
)
=>
state
.
duel
.
meField
;
export
const
selectOpField
=
(
state
:
RootState
)
=>
state
.
duel
.
opField
;
src/reducers/duel/mod.ts
View file @
2767c807
...
...
@@ -73,6 +73,8 @@ import {
initFieldImpl
,
clearFieldPlaceInteractivitiesImpl
,
addFieldPlaceInteractivitiesImpl
,
addFieldIdleInteractivitiesImpl
,
clearFieldIdleInteractivitiesImpl
,
}
from
"
./fieldSlice
"
;
export
interface
DuelState
{
...
...
@@ -171,6 +173,8 @@ const duelSlice = createSlice({
initField
:
initFieldImpl
,
clearFieldPlaceInteractivities
:
clearFieldPlaceInteractivitiesImpl
,
addFieldPlaceInteractivities
:
addFieldPlaceInteractivitiesImpl
,
addFieldIdleInteractivities
:
addFieldIdleInteractivitiesImpl
,
clearFieldIdleInteractivities
:
clearFieldIdleInteractivitiesImpl
,
// UI相关`Reducer`
setCardModalIsOpen
:
setCardModalIsOpenImpl
,
...
...
@@ -250,6 +254,8 @@ export const {
initField
,
clearFieldPlaceInteractivities
,
addFieldPlaceInteractivities
,
addFieldIdleInteractivities
,
clearFieldIdleInteractivities
,
}
=
duelSlice
.
actions
;
export
const
selectDuelHsStart
=
(
state
:
RootState
)
=>
{
return
state
.
duel
.
meInitInfo
!=
null
;
...
...
src/service/duel/selectIdleCmd.ts
View file @
2767c807
...
...
@@ -8,6 +8,8 @@ import {
addMagicIdleInteractivities
,
clearMonsterIdleInteractivities
,
clearMagicIdleInteractivities
,
clearFieldIdleInteractivities
,
addFieldIdleInteractivities
,
}
from
"
../../reducers/duel/mod
"
;
import
MsgSelectIdleCmd
=
ygopro
.
StocGameMessage
.
MsgSelectIdleCmd
;
import
{
ActionCreatorWithPayload
}
from
"
@reduxjs/toolkit
"
;
...
...
@@ -20,6 +22,7 @@ export default (selectIdleCmd: MsgSelectIdleCmd, dispatch: AppDispatch) => {
dispatch
(
clearHandsIdleInteractivity
(
player
));
dispatch
(
clearMonsterIdleInteractivities
(
player
));
dispatch
(
clearMagicIdleInteractivities
(
player
));
dispatch
(
clearFieldIdleInteractivities
(
player
));
const
dispatcher
=
(
idleData
:
MsgSelectIdleCmd
.
IdleCmd
.
IdleData
,
...
...
@@ -81,6 +84,11 @@ export default (selectIdleCmd: MsgSelectIdleCmd, dispatch: AppDispatch) => {
break
;
}
case
ygopro
.
CardZone
.
ONFIELD
:
{
dispatcher
(
data
,
interactType
,
addFieldIdleInteractivities
);
break
;
}
default
:
{
}
}
...
...
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