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
adcdd177
Commit
adcdd177
authored
Jan 13, 2023
by
chechunchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add deckSlice.ts
parent
90419ce0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
0 deletions
+49
-0
src/reducers/duel/deckSlice.ts
src/reducers/duel/deckSlice.ts
+41
-0
src/reducers/duel/mod.ts
src/reducers/duel/mod.ts
+8
-0
No files found.
src/reducers/duel/deckSlice.ts
0 → 100644
View file @
adcdd177
import
{
judgeSelf
}
from
"
./util
"
;
import
{
PayloadAction
,
CaseReducer
}
from
"
@reduxjs/toolkit
"
;
import
{
DuelState
}
from
"
./mod
"
;
import
{
RootState
}
from
"
../../store
"
;
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
DuelFieldState
,
CardState
}
from
"
./generic
"
;
export
interface
DeckState
extends
DuelFieldState
{}
// 初始化卡组状态
export
const
initDeckImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
{
player
:
number
;
deskSize
:
number
}
>
>
=
(
state
,
action
)
=>
{
const
player
=
action
.
payload
.
player
;
const
deckSize
=
action
.
payload
.
deskSize
;
let
deck
:
CardState
[]
=
new
Array
(
deckSize
);
for
(
let
i
=
0
;
i
<
deckSize
;
i
++
)
{
deck
.
push
({
occupant
:
{
id
:
0
,
data
:
{},
text
:
{}
},
location
:
{
controler
:
player
,
location
:
ygopro
.
CardZone
.
DECK
,
sequence
:
i
,
},
idleInteractivities
:
[],
});
}
if
(
judgeSelf
(
player
,
state
))
{
state
.
meDeck
=
{
inner
:
deck
};
}
else
{
state
.
opDeck
=
{
inner
:
deck
};
}
};
export
const
selectMeDeck
=
(
state
:
RootState
)
=>
state
.
duel
.
meDeck
||
{
inner
:
[]
};
export
const
selectOpDeck
=
(
state
:
RootState
)
=>
state
.
duel
.
opDeck
||
{
inner
:
[]
};
src/reducers/duel/mod.ts
View file @
adcdd177
...
@@ -61,6 +61,7 @@ import {
...
@@ -61,6 +61,7 @@ import {
initExclusionImpl
,
initExclusionImpl
,
exclusionCase
,
exclusionCase
,
}
from
"
./exclusionSlice
"
;
}
from
"
./exclusionSlice
"
;
import
{
DeckState
,
initDeckImpl
}
from
"
./deckSlice
"
;
export
interface
DuelState
{
export
interface
DuelState
{
selfType
?:
number
;
selfType
?:
number
;
...
@@ -82,6 +83,9 @@ export interface DuelState {
...
@@ -82,6 +83,9 @@ export interface DuelState {
meExclusion
?:
ExclusionState
;
// 自己的除外区状态
meExclusion
?:
ExclusionState
;
// 自己的除外区状态
opExclusion
?:
ExclusionState
;
// 对手的除外区状态
opExclusion
?:
ExclusionState
;
// 对手的除外区状态
meDeck
?:
DeckState
;
// 自己的卡组状态
opDeck
?:
DeckState
;
// 对手的卡组状态
meTimeLimit
?:
TimeLimit
;
// 自己的计时
meTimeLimit
?:
TimeLimit
;
// 自己的计时
opTimeLimit
?:
TimeLimit
;
// 对手的计时
opTimeLimit
?:
TimeLimit
;
// 对手的计时
...
@@ -139,6 +143,9 @@ const duelSlice = createSlice({
...
@@ -139,6 +143,9 @@ const duelSlice = createSlice({
// 除外区相关`Reducer`
// 除外区相关`Reducer`
initExclusion
:
initExclusionImpl
,
initExclusion
:
initExclusionImpl
,
// 卡组相关`Reducer`
initDeck
:
initDeckImpl
,
// UI相关`Reducer`
// UI相关`Reducer`
setCardModalIsOpen
:
setCardModalIsOpenImpl
,
setCardModalIsOpen
:
setCardModalIsOpenImpl
,
setCardModalText
:
setCardModalTextImpl
,
setCardModalText
:
setCardModalTextImpl
,
...
@@ -206,6 +213,7 @@ export const {
...
@@ -206,6 +213,7 @@ export const {
resetPositionModal
,
resetPositionModal
,
setOptionModalIsOpen
,
setOptionModalIsOpen
,
resetOptionModal
,
resetOptionModal
,
initDeck
,
}
=
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