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
b2f71ef0
Commit
b2f71ef0
authored
Dec 01, 2022
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
impl onMsgNewTurn
parent
c5d4e353
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
+16
-2
src/reducers/duel/mod.ts
src/reducers/duel/mod.ts
+4
-1
src/reducers/duel/turnSlice.ts
src/reducers/duel/turnSlice.ts
+9
-0
src/service/duel/newTurn.ts
src/service/duel/newTurn.ts
+3
-1
No files found.
src/reducers/duel/mod.ts
View file @
b2f71ef0
...
@@ -11,6 +11,7 @@ import {
...
@@ -11,6 +11,7 @@ import {
opAddHandsImpl
,
opAddHandsImpl
,
meHandsCase
,
meHandsCase
,
}
from
"
./handsSlice
"
;
}
from
"
./handsSlice
"
;
import
{
newTurnImpl
}
from
"
./turnSlice
"
;
import
{
RootState
}
from
"
../../store
"
;
import
{
RootState
}
from
"
../../store
"
;
export
interface
DuelState
{
export
interface
DuelState
{
...
@@ -18,6 +19,7 @@ export interface DuelState {
...
@@ -18,6 +19,7 @@ export interface DuelState {
opInitInfo
?:
InitInfo
;
// 对手的初始状态
opInitInfo
?:
InitInfo
;
// 对手的初始状态
meHands
?:
Hands
;
// 自己的手牌
meHands
?:
Hands
;
// 自己的手牌
opHands
?:
Hands
;
// 对手的手牌
opHands
?:
Hands
;
// 对手的手牌
currentPlayer
?:
number
;
// 当前的操作方
}
}
const
initialState
:
DuelState
=
{};
const
initialState
:
DuelState
=
{};
...
@@ -30,13 +32,14 @@ const duelSlice = createSlice({
...
@@ -30,13 +32,14 @@ const duelSlice = createSlice({
opInfoInit
:
opInfoInitImpl
,
opInfoInit
:
opInfoInitImpl
,
meAddHands
:
meAddHandsImpl
,
meAddHands
:
meAddHandsImpl
,
opAddHands
:
opAddHandsImpl
,
opAddHands
:
opAddHandsImpl
,
updateTurn
:
newTurnImpl
,
},
},
extraReducers
(
builder
)
{
extraReducers
(
builder
)
{
meHandsCase
(
builder
);
meHandsCase
(
builder
);
},
},
});
});
export
const
{
meInfoInit
,
opInfoInit
,
meAddHands
,
opAddHands
}
=
export
const
{
meInfoInit
,
opInfoInit
,
meAddHands
,
opAddHands
,
updateTurn
}
=
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/turnSlice.ts
0 → 100644
View file @
b2f71ef0
import
{
PayloadAction
,
CaseReducer
}
from
"
@reduxjs/toolkit
"
;
import
{
DuelState
}
from
"
./mod
"
;
export
const
newTurnImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
number
>>
=
(
state
,
action
)
=>
{
state
.
currentPlayer
=
action
.
payload
;
};
src/service/duel/newTurn.ts
View file @
b2f71ef0
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
AppDispatch
}
from
"
../../store
"
;
import
{
AppDispatch
}
from
"
../../store
"
;
import
{
updateTurn
}
from
"
../../reducers/duel/mod
"
;
export
default
(
export
default
(
newTurn
:
ygopro
.
StocGameMessage
.
MsgNewTurn
,
newTurn
:
ygopro
.
StocGameMessage
.
MsgNewTurn
,
dispatch
:
AppDispatch
dispatch
:
AppDispatch
)
=>
{
)
=>
{
// TODO
const
player
=
newTurn
.
player
;
dispatch
(
updateTurn
(
player
));
};
};
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