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
deft
Neos
Commits
43b00a01
Commit
43b00a01
authored
Dec 02, 2022
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add Phase slice
parent
1bdc9c2b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
0 deletions
+39
-0
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/mod.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/mod.ts
+6
-0
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/newPhase.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/newPhase.ts
+1
-0
src/reducers/duel/mod.ts
src/reducers/duel/mod.ts
+3
-0
src/reducers/duel/phaseSlice.ts
src/reducers/duel/phaseSlice.ts
+12
-0
src/service/duel/gameMsg.ts
src/service/duel/gameMsg.ts
+8
-0
src/service/duel/newPhase.ts
src/service/duel/newPhase.ts
+9
-0
No files found.
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/mod.ts
View file @
43b00a01
...
...
@@ -9,6 +9,7 @@ import * as GAME_MSG from "../../protoDecl";
import
MsgStartAdapter
from
"
./start
"
;
import
MsgDrawAdapter
from
"
./draw
"
;
import
MsgNewTurnAdapter
from
"
./newTurn
"
;
import
MsgNewPhaseAdapter
from
"
./newPhase
"
;
/*
* STOC GameMsg
...
...
@@ -49,6 +50,11 @@ export default class GameMsgAdapter implements StocAdapter {
break
;
}
case
GAME_MSG
.
MSG_NEW_PHASE
:
{
gameMsg
.
new_phase
=
MsgNewPhaseAdapter
(
gameData
);
break
;
}
default
:
{
console
.
log
(
"
Unhandled GameMessage function=
"
,
func
);
...
...
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/newPhase.ts
View file @
43b00a01
...
...
@@ -24,6 +24,7 @@ export default (data: Uint8Array) => {
break
;
}
case
0x02
:
{
phaseType
=
ygopro
.
StocGameMessage
.
MsgNewPhase
.
PhaseType
.
STANDBY
;
break
;
}
case
0x04
:
{
...
...
src/reducers/duel/mod.ts
View file @
43b00a01
...
...
@@ -12,6 +12,7 @@ import {
meHandsCase
,
}
from
"
./handsSlice
"
;
import
{
newTurnImpl
}
from
"
./turnSlice
"
;
import
{
newPhaseImpl
}
from
"
./phaseSlice
"
;
import
{
RootState
}
from
"
../../store
"
;
export
interface
DuelState
{
...
...
@@ -20,6 +21,7 @@ export interface DuelState {
meHands
?:
Hands
;
// 自己的手牌
opHands
?:
Hands
;
// 对手的手牌
currentPlayer
?:
number
;
// 当前的操作方
currentPhase
?:
string
;
// 当前的阶段
}
const
initialState
:
DuelState
=
{};
...
...
@@ -33,6 +35,7 @@ const duelSlice = createSlice({
meAddHands
:
meAddHandsImpl
,
opAddHands
:
opAddHandsImpl
,
updateTurn
:
newTurnImpl
,
updatePhase
:
newPhaseImpl
,
},
extraReducers
(
builder
)
{
meHandsCase
(
builder
);
...
...
src/reducers/duel/phaseSlice.ts
0 → 100644
View file @
43b00a01
import
{
PayloadAction
,
CaseReducer
}
from
"
@reduxjs/toolkit
"
;
import
{
RootState
}
from
"
../../store
"
;
import
{
DuelState
}
from
"
./mod
"
;
export
const
newPhaseImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
string
>>
=
(
state
,
action
)
=>
{
state
.
currentPhase
=
action
.
payload
;
};
export
const
selectCurrentPhase
=
(
state
:
RootState
)
=>
state
.
duel
.
currentPhase
;
src/service/duel/gameMsg.ts
View file @
43b00a01
...
...
@@ -3,6 +3,7 @@ import { store } from "../../store";
import
onMsgStart
from
"
./start
"
;
import
onMsgDraw
from
"
./draw
"
;
import
onMsgNewTurn
from
"
./newTurn
"
;
import
onMsgNewPhase
from
"
./newPhase
"
;
export
default
function
handleGameMsg
(
pb
:
ygopro
.
YgoStocMsg
)
{
const
dispatch
=
store
.
dispatch
;
...
...
@@ -30,6 +31,13 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
break
;
}
case
"
new_phase
"
:
{
const
newPhase
=
msg
.
new_phase
;
onMsgNewPhase
(
newPhase
,
dispatch
);
break
;
}
default
:
{
console
.
log
(
"
Unhandled GameMsg=
"
+
msg
.
gameMsg
);
...
...
src/service/duel/newPhase.ts
0 → 100644
View file @
43b00a01
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
AppDispatch
}
from
"
../../store
"
;
export
default
(
newPhase
:
ygopro
.
StocGameMessage
.
MsgNewPhase
,
dispatch
:
AppDispatch
)
=>
{
// TODO
};
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