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
3c556ab0
Commit
3c556ab0
authored
Mar 10, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat/win' into 'main'
Feat/win See merge request
!124
parents
b8cdf42f
cb5d129e
Pipeline
#20563
passed with stages
in 6 minutes and 56 seconds
Changes
9
Pipelines
1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
281 additions
and
4 deletions
+281
-4
neos-protobuf
neos-protobuf
+1
-1
src/api/ocgcore/idl/ocgcore.ts
src/api/ocgcore/idl/ocgcore.ts
+195
-3
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/win.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/win.ts
+28
-0
src/reducers/duel/mod.ts
src/reducers/duel/mod.ts
+13
-0
src/service/duel/gameMsg.ts
src/service/duel/gameMsg.ts
+6
-0
src/service/duel/win.ts
src/service/duel/win.ts
+7
-0
src/ui/Duel/hintNotification.tsx
src/ui/Duel/hintNotification.tsx
+24
-0
No files found.
neos-protobuf
@
6434c30b
Subproject commit
43cd7f197670493f58f648e52fb49f918e12803
a
Subproject commit
6434c30b91cc28627fff3a7266c69b5b4e83d3a
a
src/api/ocgcore/idl/ocgcore.ts
View file @
3c556ab0
This diff is collapsed.
Click to expand it.
src/api/ocgcore/ocgAdapter/protoDecl.ts
View file @
3c556ab0
...
...
@@ -45,3 +45,4 @@ export const MSG_SELECT_UNSELECT_CARD = 26;
export
const
MSG_DAMAGE
=
91
;
export
const
MSG_RECOVER
=
92
;
export
const
MSG_PAY_LP_COST
=
100
;
export
const
MSG_WIN
=
5
;
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/mod.ts
View file @
3c556ab0
...
...
@@ -22,6 +22,7 @@ import MsgSelectBattleCmdAdapter from "./selectBattleCmd";
import
MsgSelectUnselectCardAdapter
from
"
./selectUnselectCard
"
;
import
MsgDamage
from
"
./damage
"
;
import
MsgRecover
from
"
./recover
"
;
import
MsgWin
from
"
./win
"
;
import
PENETRATE
from
"
./penetrate
"
;
/*
...
...
@@ -130,6 +131,11 @@ export default class GameMsgAdapter implements StocAdapter {
break
;
}
case
GAME_MSG
.
MSG_WIN
:
{
gameMsg
.
win
=
MsgWin
(
gameData
);
break
;
}
default
:
{
console
.
log
(
"
Unhandled GameMessage function=
"
,
func
);
...
...
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/win.ts
0 → 100644
View file @
3c556ab0
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
BufferReader
}
from
"
../../bufferIO
"
;
import
MsgWin
=
ygopro
.
StocGameMessage
.
MsgWin
;
/*
* Msg Win
*
* @param player - 玩家编号
* @param winType - 结果类型
* */
export
default
(
data
:
Uint8Array
)
=>
{
const
reader
=
new
BufferReader
(
data
,
true
);
const
player
=
reader
.
readUint8
();
const
winType
=
reader
.
readUint8
();
const
type_
=
player
==
0
||
winType
==
4
?
MsgWin
.
ActionType
.
Win
:
player
==
1
?
MsgWin
.
ActionType
.
Defeated
:
MsgWin
.
ActionType
.
UNKNOWN
;
return
new
MsgWin
({
player
,
type_
,
});
};
src/reducers/duel/mod.ts
View file @
3c556ab0
...
...
@@ -3,6 +3,7 @@
*
* */
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
createSlice
,
PayloadAction
}
from
"
@reduxjs/toolkit
"
;
import
{
InitInfo
,
infoInitImpl
,
updateHpImpl
}
from
"
./initInfoSlice
"
;
import
{
TimeLimit
,
updateTimeLimitImpl
}
from
"
./timeLimit
"
;
...
...
@@ -102,6 +103,7 @@ import {
removeExtraDeckImpl
,
addExtraDeckIdleInteractivitiesImpl
,
}
from
"
./extraDeckSlice
"
;
import
MsgWin
=
ygopro
.
StocGameMessage
.
MsgWin
;
export
interface
DuelState
{
selfType
?:
number
;
...
...
@@ -139,6 +141,8 @@ export interface DuelState {
phase
?:
PhaseState
;
result
?:
MsgWin
.
ActionType
;
// UI相关
modalState
:
ModalState
;
}
...
...
@@ -250,6 +254,11 @@ const duelSlice = createSlice({
// 通用的`Reducer`
clearAllIdleInteractivities
:
clearAllIdleInteractivitiesImpl
,
clearAllPlaceInteractivities
:
clearAllPlaceInteractivitiesImpl
,
// 对局结果`Reducer`
setResult
:
(
state
,
action
:
PayloadAction
<
MsgWin
.
ActionType
>
)
=>
{
state
.
result
=
action
.
payload
;
},
},
extraReducers
(
builder
)
{
handsCase
(
builder
);
...
...
@@ -329,8 +338,12 @@ export const {
setCheckCardModalV2ResponseAble
,
clearAllIdleInteractivities
,
clearAllPlaceInteractivities
,
setResult
,
}
=
duelSlice
.
actions
;
export
const
selectDuelHsStart
=
(
state
:
RootState
)
=>
{
return
state
.
duel
.
meInitInfo
!=
null
;
};
export
const
selectDuelResult
=
(
state
:
RootState
)
=>
{
return
state
.
duel
.
result
;
};
export
default
duelSlice
.
reducer
;
src/service/duel/gameMsg.ts
View file @
3c556ab0
...
...
@@ -19,6 +19,7 @@ import onMsgPosChange from "./posChange";
import
onMsgSelectUnselectCard
from
"
./selectUnselectCard
"
;
import
onMsgSelectYesNo
from
"
./selectYesNo
"
;
import
onMsgUpdateHp
from
"
./updateHp
"
;
import
onMsgWin
from
"
./win
"
;
export
default
function
handleGameMsg
(
pb
:
ygopro
.
YgoStocMsg
)
{
const
dispatch
=
store
.
dispatch
;
...
...
@@ -120,6 +121,11 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
break
;
}
case
"
win
"
:
{
onMsgWin
(
msg
.
win
,
dispatch
);
break
;
}
default
:
{
break
;
}
...
...
src/service/duel/win.ts
0 → 100644
View file @
3c556ab0
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
setResult
}
from
"
../../reducers/duel/mod
"
;
import
{
AppDispatch
}
from
"
../../store
"
;
export
default
(
win
:
ygopro
.
StocGameMessage
.
MsgWin
,
dispatch
:
AppDispatch
)
=>
{
dispatch
(
setResult
(
win
.
type_
));
};
src/ui/Duel/hintNotification.tsx
View file @
3c556ab0
...
...
@@ -3,11 +3,17 @@ import { useAppSelector } from "../../hook";
import
{
selectMeHint
,
selectOpHint
}
from
"
../../reducers/duel/hintSlice
"
;
import
{
selectCurrentPhase
}
from
"
../../reducers/duel/phaseSlice
"
;
import
{
notification
}
from
"
antd
"
;
import
{
selectDuelResult
}
from
"
../../reducers/duel/mod
"
;
import
{
useNavigate
}
from
"
react-router-dom
"
;
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
MsgWin
=
ygopro
.
StocGameMessage
.
MsgWin
;
const
HintNotification
=
()
=>
{
const
meHint
=
useAppSelector
(
selectMeHint
);
const
opHint
=
useAppSelector
(
selectOpHint
);
const
currentPhase
=
useAppSelector
(
selectCurrentPhase
);
const
result
=
useAppSelector
(
selectDuelResult
);
const
navigate
=
useNavigate
();
const
[
api
,
contextHolder
]
=
notification
.
useNotification
();
useEffect
(()
=>
{
...
...
@@ -37,6 +43,24 @@ const HintNotification = () => {
}
},
[
currentPhase
]);
useEffect
(()
=>
{
if
(
result
)
{
const
message
=
result
==
MsgWin
.
ActionType
.
Win
?
"
胜利
"
:
MsgWin
.
ActionType
.
Defeated
?
"
失败
"
:
"
未知结果
"
;
api
.
info
({
message
,
placement
:
"
bottom
"
,
onClose
()
{
navigate
(
"
/
"
);
},
});
}
},
[
result
]);
return
<>
{
contextHolder
}
</>;
};
...
...
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