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
f43d12d0
Commit
f43d12d0
authored
Oct 24, 2022
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add CtosHsStart adapt
parent
92dbd5da
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
5 deletions
+17
-5
src/api/ocgcore/ocgAdapter/ctos/ctosHsStart.ts
src/api/ocgcore/ocgAdapter/ctos/ctosHsStart.ts
+9
-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
+7
-5
No files found.
src/api/ocgcore/ocgAdapter/ctos/ctosHsStart.ts
0 → 100644
View file @
f43d12d0
import
{
ygopro
}
from
"
../../idl/ocgcore
"
;
import
{
ygoProPacket
}
from
"
../packet
"
;
import
{
CTOS_HS_START
}
from
"
../protoDecl
"
;
export
default
class
CtosHsStartPacket
extends
ygoProPacket
{
constructor
(
_
:
ygopro
.
YgoCtosMsg
)
{
super
(
1
,
CTOS_HS_START
,
new
Uint8Array
(
0
));
}
}
src/api/ocgcore/ocgAdapter/protoDecl.ts
View file @
f43d12d0
...
@@ -2,6 +2,7 @@ export const CTOS_PLAYER_INFO = 16;
...
@@ -2,6 +2,7 @@ export const CTOS_PLAYER_INFO = 16;
export
const
CTOS_JOIN_GAME
=
18
;
export
const
CTOS_JOIN_GAME
=
18
;
export
const
CTOS_UPDATE_DECK
=
2
;
export
const
CTOS_UPDATE_DECK
=
2
;
export
const
CTOS_HS_READY
=
34
;
export
const
CTOS_HS_READY
=
34
;
export
const
CTOS_HS_START
=
37
;
export
const
STOC_JOIN_GAME
=
18
;
export
const
STOC_JOIN_GAME
=
18
;
export
const
STOC_CHAT
=
25
;
export
const
STOC_CHAT
=
25
;
...
...
src/api/ocgcore/ocgHelper.ts
View file @
f43d12d0
import
{
ygopro
}
from
"
./idl/ocgcore
"
;
import
{
ygopro
}
from
"
./idl/ocgcore
"
;
import
socketMiddleWare
,
{
socketCmd
}
from
"
../../middleware/socket
"
;
import
socketMiddleWare
,
{
socketCmd
}
from
"
../../middleware/socket
"
;
import
{
IDeck
}
from
"
../Card
"
;
import
{
IDeck
}
from
"
../Card
"
;
import
playerInfoPacket
from
"
./ocgAdapter/ctos/ctosPlayerInfo
"
;
import
CtosPlayerInfo
from
"
./ocgAdapter/ctos/ctosPlayerInfo
"
;
import
joinGamePacket
from
"
./ocgAdapter/ctos/ctosJoinGame
"
;
import
CtosJoinGame
from
"
./ocgAdapter/ctos/ctosJoinGame
"
;
import
CtosUpdateDeck
from
"
./ocgAdapter/ctos/ctosUpdateDeck
"
;
import
CtosUpdateDeck
from
"
./ocgAdapter/ctos/ctosUpdateDeck
"
;
import
CtosHsReady
from
"
./ocgAdapter/ctos/ctosHsReady
"
;
import
CtosHsReady
from
"
./ocgAdapter/ctos/ctosHsReady
"
;
import
CtosHsStart
from
"
./ocgAdapter/ctos/ctosHsStart
"
;
export
function
sendUpdateDeck
(
deck
:
IDeck
)
{
export
function
sendUpdateDeck
(
deck
:
IDeck
)
{
const
updateDeck
=
new
ygopro
.
YgoCtosMsg
({
const
updateDeck
=
new
ygopro
.
YgoCtosMsg
({
...
@@ -32,8 +33,9 @@ export function sendHsStart() {
...
@@ -32,8 +33,9 @@ export function sendHsStart() {
const
hasStart
=
new
ygopro
.
YgoCtosMsg
({
const
hasStart
=
new
ygopro
.
YgoCtosMsg
({
ctos_hs_start
:
new
ygopro
.
CtosHsStart
({}),
ctos_hs_start
:
new
ygopro
.
CtosHsStart
({}),
});
});
const
payload
=
new
CtosHsStart
(
hasStart
).
serialize
();
socketMiddleWare
({
cmd
:
socketCmd
.
SEND
,
payload
:
hasStart
.
serialize
()
});
socketMiddleWare
({
cmd
:
socketCmd
.
SEND
,
payload
});
}
}
export
function
sendPlayerInfo
(
ws
:
WebSocket
,
player
:
string
)
{
export
function
sendPlayerInfo
(
ws
:
WebSocket
,
player
:
string
)
{
...
@@ -42,7 +44,7 @@ export function sendPlayerInfo(ws: WebSocket, player: string) {
...
@@ -42,7 +44,7 @@ export function sendPlayerInfo(ws: WebSocket, player: string) {
name
:
player
,
name
:
player
,
}),
}),
});
});
const
packet
=
new
playerInfoPacket
(
playerInfo
);
// todo: 需要收敛在一个层次里
const
packet
=
new
CtosPlayerInfo
(
playerInfo
);
// todo: 需要收敛在一个层次里
ws
.
send
(
packet
.
serialize
());
ws
.
send
(
packet
.
serialize
());
}
}
...
@@ -55,7 +57,7 @@ export function sendJoinGame(ws: WebSocket, version: number, passWd: string) {
...
@@ -55,7 +57,7 @@ export function sendJoinGame(ws: WebSocket, version: number, passWd: string) {
passwd
:
passWd
,
passwd
:
passWd
,
}),
}),
});
});
const
packet
=
new
joinGamePacket
(
joinGame
);
const
packet
=
new
CtosJoinGame
(
joinGame
);
ws
.
send
(
packet
.
serialize
());
ws
.
send
(
packet
.
serialize
());
}
}
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