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
fc04e90b
Commit
fc04e90b
authored
Jan 13, 2023
by
chechunchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add field slice
parent
2d88c2dc
Pipeline
#19469
passed with stages
in 3 minutes and 18 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
0 deletions
+53
-0
src/reducers/duel/fieldSlice.ts
src/reducers/duel/fieldSlice.ts
+44
-0
src/reducers/duel/mod.ts
src/reducers/duel/mod.ts
+9
-0
No files found.
src/reducers/duel/fieldSlice.ts
0 → 100644
View file @
fc04e90b
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
}
from
"
./generic
"
;
export
interface
FieldState
{
inner
?:
CardState
;
}
// 初始化场地区状态
export
const
initFieldImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
number
>>
=
(
state
,
action
)
=>
{
const
player
=
action
.
payload
;
if
(
judgeSelf
(
player
,
state
))
{
state
.
meField
=
{
inner
:
{
location
:
{
controler
:
player
,
sequence
:
0
,
location
:
ygopro
.
CardZone
.
ONFIELD
,
},
idleInteractivities
:
[],
},
};
}
else
{
state
.
opField
=
{
inner
:
{
location
:
{
controler
:
player
,
sequence
:
0
,
location
:
ygopro
.
CardZone
.
ONFIELD
,
},
idleInteractivities
:
[],
},
};
}
};
export
const
selectMeField
=
(
state
:
RootState
)
=>
state
.
duel
.
meField
;
export
const
selectOpField
=
(
state
:
RootState
)
=>
state
.
duel
.
opField
;
src/reducers/duel/mod.ts
View file @
fc04e90b
...
...
@@ -62,6 +62,7 @@ import {
exclusionCase
,
}
from
"
./exclusionSlice
"
;
import
{
DeckState
,
initDeckImpl
}
from
"
./deckSlice
"
;
import
{
FieldState
,
initFieldImpl
}
from
"
./fieldSlice
"
;
export
interface
DuelState
{
selfType
?:
number
;
...
...
@@ -86,6 +87,9 @@ export interface DuelState {
meDeck
?:
DeckState
;
// 自己的卡组状态
opDeck
?:
DeckState
;
// 对手的卡组状态
meField
?:
FieldState
;
// 自己的场地区状态
opField
?:
FieldState
;
// 对手的场地区状态
meTimeLimit
?:
TimeLimit
;
// 自己的计时
opTimeLimit
?:
TimeLimit
;
// 对手的计时
...
...
@@ -146,6 +150,9 @@ const duelSlice = createSlice({
// 卡组相关`Reducer`
initDeck
:
initDeckImpl
,
// 场地区相关`Reducer`
initField
:
initFieldImpl
,
// UI相关`Reducer`
setCardModalIsOpen
:
setCardModalIsOpenImpl
,
setCardModalText
:
setCardModalTextImpl
,
...
...
@@ -214,6 +221,8 @@ export const {
setOptionModalIsOpen
,
resetOptionModal
,
initDeck
,
initExclusion
,
initField
,
}
=
duelSlice
.
actions
;
export
const
selectDuelHsStart
=
(
state
:
RootState
)
=>
{
return
state
.
duel
.
meInitInfo
!=
null
;
...
...
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