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
4
Merge Requests
4
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
9d3aa237
Commit
9d3aa237
authored
Oct 24, 2022
by
Chunchi Che
Committed by
WANG HE
Dec 23, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add StocTypeChange adapt
parent
1b7e9441
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
0 deletions
+64
-0
src/api/ocgcore/ocgAdapter/protoDecl.ts
src/api/ocgcore/ocgAdapter/protoDecl.ts
+1
-0
src/api/ocgcore/ocgAdapter/stoc/stocTypeChange.ts
src/api/ocgcore/ocgAdapter/stoc/stocTypeChange.ts
+56
-0
src/service/onSocketMessage.ts
src/service/onSocketMessage.ts
+7
-0
No files found.
src/api/ocgcore/ocgAdapter/protoDecl.ts
View file @
9d3aa237
...
...
@@ -8,3 +8,4 @@ export const STOC_CHAT = 25;
export
const
STOC_HS_PLAYER_ENTER
=
32
;
export
const
STOC_HS_PLAYER_CHANGE
=
33
;
export
const
STOC_HS_WATCH_CHANGE
=
34
;
export
const
STOC_TYPE_CHANGE
=
19
;
src/api/ocgcore/ocgAdapter/stoc/stocTypeChange.ts
0 → 100644
View file @
9d3aa237
import
{
ygopro
}
from
"
../../idl/ocgcore
"
;
import
{
ygoProPacket
,
ygoProtobuf
}
from
"
../packet
"
;
export
default
class
StocTypeChange
implements
ygoProtobuf
{
packet
:
ygoProPacket
;
constructor
(
packet
:
ygoProPacket
)
{
this
.
packet
=
packet
;
}
adapt
():
ygopro
.
YgoStocMsg
{
const
type_
=
new
DataView
(
this
.
packet
.
exData
.
buffer
).
getUint8
(
0
);
const
isHost
=
((
type_
>>
4
)
&
0xf
)
!=
0
;
let
selfType
=
ygopro
.
StocTypeChange
.
SelfType
.
UNKNOWN
;
switch
(
type_
&
0xf
)
{
case
0
:
{
selfType
=
ygopro
.
StocTypeChange
.
SelfType
.
PLAYER1
;
break
;
}
case
1
:
{
selfType
=
ygopro
.
StocTypeChange
.
SelfType
.
PLAYER2
;
break
;
}
case
2
:
{
selfType
=
ygopro
.
StocTypeChange
.
SelfType
.
PLAYER3
;
break
;
}
case
3
:
{
selfType
=
ygopro
.
StocTypeChange
.
SelfType
.
PLAYER4
;
break
;
}
case
4
:
{
selfType
=
ygopro
.
StocTypeChange
.
SelfType
.
PLAYER5
;
break
;
}
case
5
:
{
selfType
=
ygopro
.
StocTypeChange
.
SelfType
.
PLAYER6
;
break
;
}
}
return
new
ygopro
.
YgoStocMsg
({
stoc_type_change
:
new
ygopro
.
StocTypeChange
({
self_type
:
selfType
,
is_host
:
isHost
,
}),
});
}
}
src/service/onSocketMessage.ts
View file @
9d3aa237
...
...
@@ -13,11 +13,13 @@ import {
STOC_HS_PLAYER_ENTER
,
STOC_HS_WATCH_CHANGE
,
STOC_JOIN_GAME
,
STOC_TYPE_CHANGE
,
}
from
"
../api/ocgcore/ocgAdapter/protoDecl
"
;
import
StocChat
from
"
../api/ocgcore/ocgAdapter/stoc/stocChat
"
;
import
StocHsPlayerEnter
from
"
../api/ocgcore/ocgAdapter/stoc/stocHsPlayerEnter
"
;
import
StocHsPlayerChange
from
"
../api/ocgcore/ocgAdapter/stoc/stocHsPlayerChange
"
;
import
StocHsWatchChange
from
"
../api/ocgcore/ocgAdapter/stoc/stocHsWatchChange
"
;
import
StocTypeChange
from
"
../api/ocgcore/ocgAdapter/stoc/stocTypeChange
"
;
export
default
function
handleSocketMessage
(
e
:
MessageEvent
)
{
const
packet
=
new
ygoArrayBuilder
(
e
.
data
);
...
...
@@ -50,6 +52,11 @@ export default function handleSocketMessage(e: MessageEvent) {
break
;
}
case
STOC_TYPE_CHANGE
:
{
pb
=
new
StocTypeChange
(
packet
).
adapt
();
break
;
}
default
:
{
break
;
}
...
...
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