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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
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
MyCard
Neos
Commits
e9b2b562
Commit
e9b2b562
authored
Mar 18, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add waiting
parent
1405e8d2
Pipeline
#20778
passed with stages
in 15 minutes and 11 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
77 additions
and
7 deletions
+77
-7
src/api/ocgcore/ocgAdapter/protoDecl.ts
src/api/ocgcore/ocgAdapter/protoDecl.ts
+1
-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/wait.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/wait.ts
+13
-0
src/reducers/duel/mod.ts
src/reducers/duel/mod.ts
+11
-0
src/service/duel/gameMsg.ts
src/service/duel/gameMsg.ts
+26
-0
src/service/duel/selectBattleCmd.ts
src/service/duel/selectBattleCmd.ts
+2
-6
src/service/duel/wait.ts
src/service/duel/wait.ts
+15
-0
src/ui/Duel/status.tsx
src/ui/Duel/status.tsx
+3
-1
No files found.
src/api/ocgcore/ocgAdapter/protoDecl.ts
View file @
e9b2b562
...
...
@@ -48,3 +48,4 @@ export const MSG_DAMAGE = 91;
export
const
MSG_RECOVER
=
92
;
export
const
MSG_PAY_LP_COST
=
100
;
export
const
MSG_WIN
=
5
;
export
const
MSG_WAITING
=
3
;
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/mod.ts
View file @
e9b2b562
...
...
@@ -21,6 +21,7 @@ import MsgSelectPositionAdapter from "./selectPosition";
import
MsgSelectOptionAdapter
from
"
./selectOption
"
;
import
MsgSelectBattleCmdAdapter
from
"
./selectBattleCmd
"
;
import
MsgSelectUnselectCardAdapter
from
"
./selectUnselectCard
"
;
import
MsgWaitAdapter
from
"
./wait
"
;
import
MsgDamage
from
"
./damage
"
;
import
MsgRecover
from
"
./recover
"
;
import
MsgWin
from
"
./win
"
;
...
...
@@ -142,6 +143,11 @@ export default class GameMsgAdapter implements StocAdapter {
break
;
}
case
GAME_MSG
.
MSG_WAITING
:
{
gameMsg
.
wait
=
MsgWaitAdapter
(
gameData
);
break
;
}
default
:
{
console
.
log
(
"
Unhandled GameMessage function=
"
,
func
);
...
...
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/wait.ts
0 → 100644
View file @
e9b2b562
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
MsgWait
=
ygopro
.
StocGameMessage
.
MsgWait
;
/*
* Msg Wait
*
* @param - null
*
* @usage - 后端通知前端等待对手操作
* */
export
default
(
_data
:
Uint8Array
)
=>
{
return
new
MsgWait
({});
};
src/reducers/duel/mod.ts
View file @
e9b2b562
...
...
@@ -142,6 +142,8 @@ export interface DuelState {
result
?:
MsgWin
.
ActionType
;
waiting
?:
boolean
;
// UI相关
modalState
:
ModalState
;
}
...
...
@@ -257,6 +259,11 @@ const duelSlice = createSlice({
setResult
:
(
state
,
action
:
PayloadAction
<
MsgWin
.
ActionType
>
)
=>
{
state
.
result
=
action
.
payload
;
},
// 等待状态`Reducer`
setWaiting
:
(
state
,
action
:
PayloadAction
<
boolean
>
)
=>
{
state
.
waiting
=
action
.
payload
;
},
},
extraReducers
(
builder
)
{
handsCase
(
builder
);
...
...
@@ -336,6 +343,7 @@ export const {
clearAllIdleInteractivities
,
clearAllPlaceInteractivities
,
setResult
,
setWaiting
,
}
=
duelSlice
.
actions
;
export
const
selectDuelHsStart
=
(
state
:
RootState
)
=>
{
return
state
.
duel
.
meInitInfo
!=
null
;
...
...
@@ -343,4 +351,7 @@ export const selectDuelHsStart = (state: RootState) => {
export
const
selectDuelResult
=
(
state
:
RootState
)
=>
{
return
state
.
duel
.
result
;
};
export
const
selectWaiting
=
(
state
:
RootState
)
=>
{
return
state
.
duel
.
waiting
;
};
export
default
duelSlice
.
reducer
;
src/service/duel/gameMsg.ts
View file @
e9b2b562
...
...
@@ -20,11 +20,32 @@ import onMsgSelectUnselectCard from "./selectUnselectCard";
import
onMsgSelectYesNo
from
"
./selectYesNo
"
;
import
onMsgUpdateHp
from
"
./updateHp
"
;
import
onMsgWin
from
"
./win
"
;
import
onMsgWait
from
"
./wait
"
;
import
{
setWaiting
}
from
"
../../reducers/duel/mod
"
;
const
ActiveList
=
[
"
draw
"
,
"
new_turn
"
,
"
select_idle_cmd
"
,
"
select_place
"
,
"
select_card
"
,
"
select_chain
"
,
"
select_effect_yn
"
,
"
select_position
"
,
"
select_option
"
,
"
select_battle_cmd
"
,
"
select_unselect_card
"
,
"
select_yes_no
"
,
];
export
default
function
handleGameMsg
(
pb
:
ygopro
.
YgoStocMsg
)
{
const
dispatch
=
store
.
dispatch
;
const
msg
=
pb
.
stoc_game_msg
;
if
(
ActiveList
.
includes
(
msg
.
gameMsg
))
{
dispatch
(
setWaiting
(
false
));
}
switch
(
msg
.
gameMsg
)
{
case
"
start
"
:
{
onMsgStart
(
msg
.
start
,
dispatch
);
...
...
@@ -126,6 +147,11 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
break
;
}
case
"
wait
"
:
{
onMsgWait
(
msg
.
wait
,
dispatch
);
break
;
}
default
:
{
break
;
}
...
...
src/service/duel/selectBattleCmd.ts
View file @
e9b2b562
...
...
@@ -5,9 +5,7 @@ import {
addHandsIdleInteractivity
,
addMagicIdleInteractivities
,
addMonsterIdleInteractivities
,
clearHandsIdleInteractivity
,
clearMagicIdleInteractivities
,
clearMonsterIdleInteractivities
,
clearAllIdleInteractivities
,
setEnableEp
,
setEnableM2
,
}
from
"
../../reducers/duel/mod
"
;
...
...
@@ -19,9 +17,7 @@ export default (selectBattleCmd: MsgSelectBattleCmd, dispatch: AppDispatch) => {
const
cmds
=
selectBattleCmd
.
battle_cmds
;
// 先清掉之前的互动性
dispatch
(
clearHandsIdleInteractivity
(
player
));
dispatch
(
clearMonsterIdleInteractivities
(
player
));
dispatch
(
clearMagicIdleInteractivities
(
player
));
dispatch
(
clearAllIdleInteractivities
(
player
));
const
dispatcher
=
(
battleData
:
MsgSelectBattleCmd
.
BattleCmd
.
BattleData
,
...
...
src/service/duel/wait.ts
0 → 100644
View file @
e9b2b562
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
clearAllIdleInteractivities
,
setWaiting
,
}
from
"
../../reducers/duel/mod
"
;
import
{
AppDispatch
}
from
"
../../store
"
;
export
default
(
_wait
:
ygopro
.
StocGameMessage
.
MsgWait
,
dispatch
:
AppDispatch
)
=>
{
dispatch
(
clearAllIdleInteractivities
(
0
));
dispatch
(
clearAllIdleInteractivities
(
1
));
dispatch
(
setWaiting
(
true
));
};
src/ui/Duel/status.tsx
View file @
e9b2b562
...
...
@@ -9,6 +9,7 @@ import {
selectOpInitInfo
,
}
from
"
../../reducers/duel/initInfoSlice
"
;
import
{
selectCurrentPlayerIsMe
}
from
"
../../reducers/duel/turnSlice
"
;
import
{
selectWaiting
}
from
"
../../reducers/duel/mod
"
;
const
Config
=
NeosConfig
.
ui
.
status
;
const
avatarSize
=
40
;
...
...
@@ -19,12 +20,13 @@ const PlayerStatus = () => {
const
meInfo
=
useAppSelector
(
selectMeInitInfo
);
const
opInfo
=
useAppSelector
(
selectOpInitInfo
);
const
myTurn
=
useAppSelector
(
selectCurrentPlayerIsMe
);
const
waiting
=
useAppSelector
(
selectWaiting
)
||
false
;
return
(
<
CheckCard
.
Group
bordered
style=
{
{
height
:
`${NeosConfig.ui.layout.header.height}`
}
}
value=
{
myTurn
?
ME_VALUE
:
OP_VALUE
}
value=
{
myTurn
&&
!
waiting
?
ME_VALUE
:
OP_VALUE
}
>
<
CheckCard
avatar=
{
...
...
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