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
c64ba78a
Commit
c64ba78a
authored
Nov 19, 2022
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add draw.ts and bufferIO.ts
parent
39e8bf88
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
2 deletions
+69
-2
src/api/ocgcore/ocgAdapter/bufferIO.ts
src/api/ocgcore/ocgAdapter/bufferIO.ts
+36
-0
src/api/ocgcore/ocgAdapter/protoDecl.ts
src/api/ocgcore/ocgAdapter/protoDecl.ts
+1
-0
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/draw.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/draw.ts
+25
-0
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/mod.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/mod.ts
+7
-2
No files found.
src/api/ocgcore/ocgAdapter/bufferIO.ts
0 → 100644
View file @
c64ba78a
const
OFFSET_UINT8
=
1
;
const
OFFSET_INT8
=
1
;
const
OFFSET_UINT32
=
4
;
export
class
BufferReader
{
dataView
:
DataView
;
littleEndian
:
boolean
;
offset
:
number
;
constructor
(
data
:
Uint8Array
,
littleEndian
:
boolean
)
{
this
.
dataView
=
new
DataView
(
data
.
buffer
);
this
.
littleEndian
=
littleEndian
;
this
.
offset
=
0
;
}
readUint8
():
number
{
const
ret
=
this
.
dataView
.
getUint8
(
this
.
offset
);
this
.
offset
+=
OFFSET_UINT8
;
return
ret
;
}
readInt8
():
number
{
const
ret
=
this
.
dataView
.
getInt8
(
this
.
offset
);
this
.
offset
+=
OFFSET_INT8
;
return
ret
;
}
readUint32
():
number
{
const
ret
=
this
.
dataView
.
getUint32
(
this
.
offset
,
this
.
littleEndian
);
this
.
offset
+=
OFFSET_UINT32
;
return
ret
;
}
}
src/api/ocgcore/ocgAdapter/protoDecl.ts
View file @
c64ba78a
...
@@ -24,3 +24,4 @@ export const STOC_DUEL_START = 21;
...
@@ -24,3 +24,4 @@ export const STOC_DUEL_START = 21;
export
const
STOC_GAME_MSG
=
1
;
export
const
STOC_GAME_MSG
=
1
;
export
const
MSG_START
=
4
;
export
const
MSG_START
=
4
;
export
const
MSG_DRAW
=
90
;
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/draw.ts
0 → 100644
View file @
c64ba78a
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
BufferReader
}
from
"
../../bufferIO
"
;
const
LITTLE_ENDIAN
=
true
;
/*
* MSG Draw
*
* @param player: char - 玩家编号
*
* @usage - 玩家抽卡内容
* */
export
default
(
data
:
Uint8Array
)
=>
{
const
reader
=
new
BufferReader
(
data
,
LITTLE_ENDIAN
);
const
player
=
reader
.
readUint8
();
const
count
=
reader
.
readUint8
();
let
hands
:
number
[]
=
[];
for
(
let
i
=
0
;
i
<
count
;
i
++
)
{
hands
.
push
(
reader
.
readUint32
());
}
// TODO
};
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/mod.ts
View file @
c64ba78a
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
YgoProPacket
,
StocAdapter
}
from
"
../../packet
"
;
import
{
YgoProPacket
,
StocAdapter
}
from
"
../../packet
"
;
import
{
MSG_START
}
from
"
../../protoDecl
"
;
import
*
as
GAME_MSG
from
"
../../protoDecl
"
;
import
MsgStartAdapter
from
"
./start
"
;
import
MsgStartAdapter
from
"
./start
"
;
/*
/*
...
@@ -32,11 +32,16 @@ export default class GameMsgAdapter implements StocAdapter {
...
@@ -32,11 +32,16 @@ export default class GameMsgAdapter implements StocAdapter {
const
gameMsg
=
new
ygopro
.
StocGameMessage
({});
const
gameMsg
=
new
ygopro
.
StocGameMessage
({});
switch
(
func
)
{
switch
(
func
)
{
case
MSG_START
:
{
case
GAME_MSG
.
MSG_START
:
{
gameMsg
.
start
=
MsgStartAdapter
(
gameData
);
gameMsg
.
start
=
MsgStartAdapter
(
gameData
);
break
;
break
;
}
}
case
GAME_MSG
.
MSG_DRAW
:
{
// TODO
break
;
}
default
:
{
default
:
{
console
.
log
(
"
Unhandled GameMessage function=
"
,
func
);
console
.
log
(
"
Unhandled GameMessage function=
"
,
func
);
...
...
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