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
20b60179
Commit
20b60179
authored
Mar 18, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add surrender feature
parent
eefa5f20
Pipeline
#20766
passed with stages
in 13 minutes and 7 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
3 deletions
+59
-3
src/api/ocgcore/ocgAdapter/ctos/ctosSurrender.ts
src/api/ocgcore/ocgAdapter/ctos/ctosSurrender.ts
+17
-0
src/api/ocgcore/ocgAdapter/protoDecl.ts
src/api/ocgcore/ocgAdapter/protoDecl.ts
+1
-0
src/api/ocgcore/ocgHelper.ts
src/api/ocgcore/ocgHelper.ts
+10
-0
src/ui/Duel/phase.tsx
src/ui/Duel/phase.tsx
+31
-3
No files found.
src/api/ocgcore/ocgAdapter/ctos/ctosSurrender.ts
0 → 100644
View file @
20b60179
import
{
ygopro
}
from
"
../../idl/ocgcore
"
;
import
{
YgoProPacket
}
from
"
../packet
"
;
import
{
CTOS_SURRENDER
}
from
"
../protoDecl
"
;
/*
* CTOS SURRENDER
*
* @param - null
*
* @usage - 告知服务端当前玩家投降
*
* */
export
default
class
CtosSurrender
extends
YgoProPacket
{
constructor
(
_
:
ygopro
.
YgoCtosMsg
)
{
super
(
1
,
CTOS_SURRENDER
,
new
Uint8Array
(
0
));
}
}
src/api/ocgcore/ocgAdapter/protoDecl.ts
View file @
20b60179
...
...
@@ -12,6 +12,7 @@ export const CTOS_TP_RESULT = 4;
export
const
CTOS_TIME_CONFIRM
=
21
;
export
const
CTOS_RESPONSE
=
1
;
export
const
CTOS_CHAT
=
22
;
export
const
CTOS_SURRENDER
=
0x14
;
export
const
STOC_JOIN_GAME
=
18
;
export
const
STOC_CHAT
=
25
;
...
...
src/api/ocgcore/ocgHelper.ts
View file @
20b60179
...
...
@@ -13,6 +13,7 @@ import HsStartAdapter from "./ocgAdapter/ctos/ctosHsStart";
import
HandResult
from
"
./ocgAdapter/ctos/ctosHandResult
"
;
import
TpResult
from
"
./ocgAdapter/ctos/ctosTpResult
"
;
import
TimeConfirm
from
"
./ocgAdapter/ctos/ctosTimeConfirm
"
;
import
Surrender
from
"
./ocgAdapter/ctos/ctosSurrender
"
;
import
GameMsgResponse
from
"
./ocgAdapter/ctos/ctosGameMsgResponse/mod
"
;
import
Chat
from
"
./ocgAdapter/ctos/ctosChat
"
;
...
...
@@ -120,6 +121,15 @@ export function sendTimeConfirm() {
socketMiddleWare
({
cmd
:
socketCmd
.
SEND
,
payload
});
}
export
function
sendSurrender
()
{
const
surrender
=
new
ygopro
.
YgoCtosMsg
({
ctos_surrender
:
new
ygopro
.
CtosSurrender
({}),
});
const
payload
=
new
Surrender
(
surrender
).
serialize
();
socketMiddleWare
({
cmd
:
socketCmd
.
SEND
,
payload
});
}
export
function
sendChat
(
message
:
string
)
{
const
chat
=
new
ygopro
.
YgoCtosMsg
({
ctos_chat
:
new
ygopro
.
CtosChat
({
message
}),
...
...
src/ui/Duel/phase.tsx
View file @
20b60179
import
React
from
"
react
"
;
import
React
,
{
useState
}
from
"
react
"
;
import
{
store
}
from
"
../../store
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
...
...
@@ -10,6 +10,7 @@ import {
import
{
sendSelectBattleCmdResponse
,
sendSelectIdleCmdResponse
,
sendSurrender
,
}
from
"
../../api/ocgcore/ocgHelper
"
;
import
{
clearAllIdleInteractivities
,
...
...
@@ -17,7 +18,7 @@ import {
setEnableEp
,
setEnableM2
,
}
from
"
../../reducers/duel/mod
"
;
import
{
Button
,
Space
}
from
"
antd
"
;
import
{
Button
,
Modal
,
Space
}
from
"
antd
"
;
import
Icon
from
"
@ant-design/icons
"
;
import
{
ReactComponent
as
BattleSvg
}
from
"
../../../neos-assets/crossed-swords.svg
"
;
import
{
ReactComponent
as
Main2Svg
}
from
"
../../../neos-assets/sword-in-stone.svg
"
;
...
...
@@ -51,6 +52,7 @@ const Phase = () => {
const
enableM2
=
useAppSelector
(
selectEnableM2
);
const
enableEp
=
useAppSelector
(
selectEnableEp
);
const
currentPhase
=
useAppSelector
(
selectCurrentPhase
);
const
[
modalOpen
,
setModalOpen
]
=
useState
(
false
);
const
response
=
currentPhase
===
"
BATTLE_START
"
||
...
...
@@ -82,7 +84,9 @@ const Phase = () => {
sendSelectIdleCmdResponse
(
response
);
dispatch
(
setEnableEp
(
false
));
};
const
onSurrender
=
()
=>
{};
const
onSurrender
=
()
=>
{
setModalOpen
(
true
);
};
return
(
<
Space
wrap
size=
{
SpaceSize
}
>
...
...
@@ -110,6 +114,30 @@ const Phase = () => {
text=
"投降"
onClick=
{
onSurrender
}
/>
<
Modal
title=
"是否确认要投降?"
open=
{
modalOpen
}
closable=
{
false
}
footer=
{
<>
<
Button
onClick=
{
()
=>
{
sendSurrender
();
setModalOpen
(
false
);
}
}
>
Yes
</
Button
>
<
Button
onClick=
{
()
=>
{
setModalOpen
(
false
);
}
}
>
No
</
Button
>
</>
}
/>
</
Space
>
);
};
...
...
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