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
fc04e90b
Commit
fc04e90b
authored
Jan 13, 2023
by
chechunchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add field slice
parent
2d88c2dc
Changes
2
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 {
...
@@ -62,6 +62,7 @@ import {
exclusionCase
,
exclusionCase
,
}
from
"
./exclusionSlice
"
;
}
from
"
./exclusionSlice
"
;
import
{
DeckState
,
initDeckImpl
}
from
"
./deckSlice
"
;
import
{
DeckState
,
initDeckImpl
}
from
"
./deckSlice
"
;
import
{
FieldState
,
initFieldImpl
}
from
"
./fieldSlice
"
;
export
interface
DuelState
{
export
interface
DuelState
{
selfType
?:
number
;
selfType
?:
number
;
...
@@ -86,6 +87,9 @@ export interface DuelState {
...
@@ -86,6 +87,9 @@ export interface DuelState {
meDeck
?:
DeckState
;
// 自己的卡组状态
meDeck
?:
DeckState
;
// 自己的卡组状态
opDeck
?:
DeckState
;
// 对手的卡组状态
opDeck
?:
DeckState
;
// 对手的卡组状态
meField
?:
FieldState
;
// 自己的场地区状态
opField
?:
FieldState
;
// 对手的场地区状态
meTimeLimit
?:
TimeLimit
;
// 自己的计时
meTimeLimit
?:
TimeLimit
;
// 自己的计时
opTimeLimit
?:
TimeLimit
;
// 对手的计时
opTimeLimit
?:
TimeLimit
;
// 对手的计时
...
@@ -146,6 +150,9 @@ const duelSlice = createSlice({
...
@@ -146,6 +150,9 @@ const duelSlice = createSlice({
// 卡组相关`Reducer`
// 卡组相关`Reducer`
initDeck
:
initDeckImpl
,
initDeck
:
initDeckImpl
,
// 场地区相关`Reducer`
initField
:
initFieldImpl
,
// UI相关`Reducer`
// UI相关`Reducer`
setCardModalIsOpen
:
setCardModalIsOpenImpl
,
setCardModalIsOpen
:
setCardModalIsOpenImpl
,
setCardModalText
:
setCardModalTextImpl
,
setCardModalText
:
setCardModalTextImpl
,
...
@@ -214,6 +221,8 @@ export const {
...
@@ -214,6 +221,8 @@ export const {
setOptionModalIsOpen
,
setOptionModalIsOpen
,
resetOptionModal
,
resetOptionModal
,
initDeck
,
initDeck
,
initExclusion
,
initField
,
}
=
duelSlice
.
actions
;
}
=
duelSlice
.
actions
;
export
const
selectDuelHsStart
=
(
state
:
RootState
)
=>
{
export
const
selectDuelHsStart
=
(
state
:
RootState
)
=>
{
return
state
.
duel
.
meInitInfo
!=
null
;
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