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
44db29b2
Commit
44db29b2
authored
Dec 25, 2022
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add monster slice
parent
cab7edda
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
1 deletion
+50
-1
src/reducers/duel/mod.ts
src/reducers/duel/mod.ts
+12
-0
src/reducers/duel/monstersSlice.ts
src/reducers/duel/monstersSlice.ts
+38
-1
No files found.
src/reducers/duel/mod.ts
View file @
44db29b2
...
@@ -23,17 +23,25 @@ import {
...
@@ -23,17 +23,25 @@ import {
setCardModalImgUrlImpl
,
setCardModalImgUrlImpl
,
setCardModalInteractiviesImpl
,
setCardModalInteractiviesImpl
,
}
from
"
./modalSlice
"
;
}
from
"
./modalSlice
"
;
import
{
MonsterState
,
initMonstersImpl
}
from
"
./monstersSlice
"
;
export
interface
DuelState
{
export
interface
DuelState
{
selfType
?:
number
;
selfType
?:
number
;
meInitInfo
?:
InitInfo
;
// 自己的初始状态
meInitInfo
?:
InitInfo
;
// 自己的初始状态
opInitInfo
?:
InitInfo
;
// 对手的初始状态
opInitInfo
?:
InitInfo
;
// 对手的初始状态
meHands
?:
Hands
;
// 自己的手牌
meHands
?:
Hands
;
// 自己的手牌
opHands
?:
Hands
;
// 对手的手牌
opHands
?:
Hands
;
// 对手的手牌
meMonsters
?:
MonsterState
;
// 自己的怪兽区状态
opMonsters
?:
MonsterState
;
// 对手的怪兽区状态
meTimeLimit
?:
TimeLimit
;
// 自己的计时
meTimeLimit
?:
TimeLimit
;
// 自己的计时
opTimeLimit
?:
TimeLimit
;
// 对手的计时
opTimeLimit
?:
TimeLimit
;
// 对手的计时
meHint
?:
HintState
;
// 自己的提示
meHint
?:
HintState
;
// 自己的提示
opHint
?:
HintState
;
// 对手的提示
opHint
?:
HintState
;
// 对手的提示
currentPlayer
?:
number
;
// 当前的操作方
currentPlayer
?:
number
;
// 当前的操作方
currentPhase
?:
string
;
// 当前的阶段
currentPhase
?:
string
;
// 当前的阶段
...
@@ -63,6 +71,9 @@ const duelSlice = createSlice({
...
@@ -63,6 +71,9 @@ const duelSlice = createSlice({
clearHandsInteractivity
:
clearHandsInteractivityImpl
,
clearHandsInteractivity
:
clearHandsInteractivityImpl
,
addHandsInteractivity
:
addHandsInteractivityImpl
,
addHandsInteractivity
:
addHandsInteractivityImpl
,
// 怪兽区相关`Reducer`
initMonsters
:
initMonstersImpl
,
// UI相关`Reducer`
// UI相关`Reducer`
setCardModalIsOpen
:
setCardModalIsOpenImpl
,
setCardModalIsOpen
:
setCardModalIsOpenImpl
,
setCardModalText
:
setCardModalTextImpl
,
setCardModalText
:
setCardModalTextImpl
,
...
@@ -87,6 +98,7 @@ export const {
...
@@ -87,6 +98,7 @@ export const {
setCardModalText
,
setCardModalText
,
setCardModalImgUrl
,
setCardModalImgUrl
,
setCardModalInteractivies
,
setCardModalInteractivies
,
initMonsters
,
}
=
duelSlice
.
actions
;
}
=
duelSlice
.
actions
;
export
const
selectDuelHsStart
=
(
state
:
RootState
)
=>
{
export
const
selectDuelHsStart
=
(
state
:
RootState
)
=>
{
return
state
.
duel
.
meInitInfo
!=
null
;
return
state
.
duel
.
meInitInfo
!=
null
;
...
...
src/reducers/duel/monstersSlice.ts
View file @
44db29b2
export
interface
MonsterState
{}
import
{
judgeSelf
,
Monster
}
from
"
./util
"
;
import
{
PayloadAction
,
CaseReducer
}
from
"
@reduxjs/toolkit
"
;
import
{
DuelState
}
from
"
./mod
"
;
export
interface
MonsterState
{
monsters
:
Monster
[];
}
// 初始化自己的怪兽区状态
export
const
initMonstersImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
number
>>
=
(
state
,
action
)
=>
{
const
player
=
action
.
payload
;
let
monsters
=
judgeSelf
(
player
,
state
)
?
state
.
meMonsters
:
state
.
opMonsters
;
if
(
!
monsters
)
{
monsters
=
{
monsters
:
[
{
sequence
:
0
,
},
{
sequence
:
1
,
},
{
sequence
:
2
,
},
{
sequence
:
3
,
},
{
sequence
:
4
,
},
],
};
}
};
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