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
5d2523fa
Commit
5d2523fa
authored
Dec 18, 2022
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add CtosGameMsgResponse adapter
parent
4668b5dc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
0 deletions
+71
-0
src/api/ocgcore/ocgAdapter/bufferIO.ts
src/api/ocgcore/ocgAdapter/bufferIO.ts
+27
-0
src/api/ocgcore/ocgAdapter/ctos/ctosGameMsgResponse/mod.ts
src/api/ocgcore/ocgAdapter/ctos/ctosGameMsgResponse/mod.ts
+32
-0
src/api/ocgcore/ocgAdapter/ctos/ctosGameMsgResponse/selectIdleCmd.ts
...core/ocgAdapter/ctos/ctosGameMsgResponse/selectIdleCmd.ts
+11
-0
src/api/ocgcore/ocgAdapter/protoDecl.ts
src/api/ocgcore/ocgAdapter/protoDecl.ts
+1
-0
No files found.
src/api/ocgcore/ocgAdapter/bufferIO.ts
View file @
5d2523fa
...
...
@@ -63,3 +63,30 @@ export class BufferReader {
return
cardInfo
;
}
}
export
class
BufferWriter
{
dataView
:
DataView
;
littleEndian
:
boolean
;
offset
:
number
;
constructor
(
data
:
Uint8Array
,
littleEndian
:
boolean
)
{
this
.
dataView
=
new
DataView
(
data
.
buffer
);
this
.
littleEndian
=
littleEndian
;
this
.
offset
=
0
;
}
writeUint8
(
value
:
number
)
{
this
.
dataView
.
setUint8
(
this
.
offset
,
value
);
this
.
offset
+=
OFFSET_UINT8
;
}
writeInt8
(
value
:
number
)
{
this
.
dataView
.
setInt8
(
this
.
offset
,
value
);
this
.
offset
+=
OFFSET_INT8
;
}
writeUint32
(
value
:
number
)
{
this
.
dataView
.
setUint32
(
this
.
offset
,
value
);
this
.
offset
+=
OFFSET_UINT32
;
}
}
src/api/ocgcore/ocgAdapter/ctos/ctosGameMsgResponse/mod.ts
0 → 100644
View file @
5d2523fa
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
YgoProPacket
}
from
"
../../packet
"
;
import
{
CTOS_RESPONSE
}
from
"
../../protoDecl
"
;
import
adaptSelectIdleCmdResponse
from
"
./selectIdleCmd
"
;
/*
* CTOS CTOS_RESPONSE
*
* @param response: any - 对于服务端传给端上的`GameMsg`,回传一个`Response`
*
* @usage - 告知服务端玩家对局内的操作选择
*
* */
export
default
class
CtosResponsePacket
extends
YgoProPacket
{
constructor
(
pb
:
ygopro
.
YgoCtosMsg
)
{
const
response
=
pb
.
ctos_response
;
let
extraData
=
new
Uint8Array
(
0
);
switch
(
response
.
gameMsgResponse
)
{
case
"
select_idle_cmd
"
:
{
extraData
=
adaptSelectIdleCmdResponse
(
response
.
select_idle_cmd
);
break
;
}
default
:
{
break
;
}
}
super
(
extraData
.
length
+
1
,
CTOS_RESPONSE
,
extraData
);
}
}
src/api/ocgcore/ocgAdapter/ctos/ctosGameMsgResponse/selectIdleCmd.ts
0 → 100644
View file @
5d2523fa
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
BufferWriter
}
from
"
../../bufferIO
"
;
export
default
(
response
:
ygopro
.
CtosGameMsgResponse
.
SelectIdleCmdResponse
)
=>
{
const
array
=
new
Uint8Array
(
4
);
const
writer
=
new
BufferWriter
(
array
,
true
);
writer
.
writeUint32
(
response
.
code
);
return
array
;
};
src/api/ocgcore/ocgAdapter/protoDecl.ts
View file @
5d2523fa
...
...
@@ -10,6 +10,7 @@ export const CTOS_HS_START = 37;
export
const
CTOS_HAND_RESULT
=
3
;
export
const
CTOS_TP_RESULT
=
4
;
export
const
CTOS_TIME_CONFIRM
=
21
;
export
const
CTOS_RESPONSE
=
1
;
export
const
STOC_JOIN_GAME
=
18
;
export
const
STOC_CHAT
=
25
;
...
...
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