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
8eb301bd
Commit
8eb301bd
authored
Jan 22, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update field slice
parent
1a5e0584
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
2 deletions
+59
-2
src/reducers/duel/fieldSlice.ts
src/reducers/duel/fieldSlice.ts
+54
-2
src/reducers/duel/mod.ts
src/reducers/duel/mod.ts
+5
-0
No files found.
src/reducers/duel/fieldSlice.ts
View file @
8eb301bd
...
...
@@ -2,8 +2,18 @@ import { judgeSelf } from "./util";
import
{
DuelState
}
from
"
./mod
"
;
import
{
RootState
}
from
"
../../store
"
;
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
PayloadAction
,
CaseReducer
}
from
"
@reduxjs/toolkit
"
;
import
{
CardState
,
Interactivity
,
InteractType
}
from
"
./generic
"
;
import
{
PayloadAction
,
CaseReducer
,
ActionReducerMapBuilder
,
}
from
"
@reduxjs/toolkit
"
;
import
{
CardState
,
createAsyncMetaThunk
,
DuelReducer
,
Interactivity
,
InteractType
,
}
from
"
./generic
"
;
export
interface
FieldState
{
inner
?:
CardState
;
...
...
@@ -99,5 +109,47 @@ export const clearFieldIdleInteractivitiesImpl: CaseReducer<
}
};
// 增加场地区
export
const
fetchFieldMeta
=
createAsyncMetaThunk
(
"
duel/fetchFieldMeta
"
);
export
const
fieldCase
=
(
builder
:
ActionReducerMapBuilder
<
DuelState
>
)
=>
{
builder
.
addCase
(
fetchFieldMeta
.
pending
,
(
state
,
action
)
=>
{
const
controler
=
action
.
meta
.
arg
.
controler
;
const
sequence
=
action
.
meta
.
arg
.
sequence
;
const
code
=
action
.
meta
.
arg
.
code
;
if
(
sequence
==
0
)
{
const
meta
=
{
id
:
code
,
data
:
{},
text
:
{}
};
const
field
=
judgeSelf
(
controler
,
state
)
?
state
.
meField
:
state
.
opField
;
if
(
field
&&
field
.
inner
)
{
field
.
inner
.
occupant
=
meta
;
}
}
});
builder
.
addCase
(
fetchFieldMeta
.
fulfilled
,
(
state
,
action
)
=>
{
const
controler
=
action
.
payload
.
controler
;
const
meta
=
action
.
payload
.
meta
;
const
field
=
judgeSelf
(
controler
,
state
)
?
state
.
meField
:
state
.
opField
;
if
(
field
&&
field
.
inner
)
{
field
.
inner
.
occupant
=
meta
;
}
});
};
// 删除场地区
export
const
removeFieldImpl
:
DuelReducer
<
{
controler
:
number
}
>
=
(
state
,
action
)
=>
{
const
controler
=
action
.
payload
.
controler
;
const
field
=
judgeSelf
(
controler
,
state
)
?
state
.
meField
:
state
.
opField
;
if
(
field
&&
field
.
inner
)
{
field
.
inner
.
occupant
=
undefined
;
}
};
export
const
selectMeField
=
(
state
:
RootState
)
=>
state
.
duel
.
meField
;
export
const
selectOpField
=
(
state
:
RootState
)
=>
state
.
duel
.
opField
;
src/reducers/duel/mod.ts
View file @
8eb301bd
...
...
@@ -96,6 +96,8 @@ import {
addFieldPlaceInteractivitiesImpl
,
addFieldIdleInteractivitiesImpl
,
clearFieldIdleInteractivitiesImpl
,
removeFieldImpl
,
fieldCase
,
}
from
"
./fieldSlice
"
;
export
interface
DuelState
{
...
...
@@ -208,6 +210,7 @@ const duelSlice = createSlice({
addFieldPlaceInteractivities
:
addFieldPlaceInteractivitiesImpl
,
addFieldIdleInteractivities
:
addFieldIdleInteractivitiesImpl
,
clearFieldIdleInteractivities
:
clearFieldIdleInteractivitiesImpl
,
removeField
:
removeFieldImpl
,
// 阶段相关
updatePhase
:
newPhaseImpl
,
...
...
@@ -252,6 +255,7 @@ const duelSlice = createSlice({
YesNoModalCase
(
builder
);
optionModalCase
(
builder
);
checkCardModalV2Case
(
builder
);
fieldCase
(
builder
);
},
});
...
...
@@ -305,6 +309,7 @@ export const {
initExclusion
,
removeExclusion
,
initField
,
removeField
,
clearFieldPlaceInteractivities
,
addFieldPlaceInteractivities
,
addFieldIdleInteractivities
,
...
...
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