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
49aa13b5
Commit
49aa13b5
authored
Jun 17, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add toss adapter and service
parent
343776ec
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
0 deletions
+57
-0
src/api/ocgcore/ocgAdapter/protoDecl.ts
src/api/ocgcore/ocgAdapter/protoDecl.ts
+2
-0
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/mod.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/mod.ts
+17
-0
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/toss.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/toss.ts
+26
-0
src/service/duel/gameMsg.ts
src/service/duel/gameMsg.ts
+6
-0
src/service/duel/toss.ts
src/service/duel/toss.ts
+6
-0
No files found.
src/api/ocgcore/ocgAdapter/protoDecl.ts
View file @
49aa13b5
...
...
@@ -61,3 +61,5 @@ export const MSG_ANNOUNCE_RACE = 140;
export
const
MSG_ANNOUNCE_ATTRIB
=
141
;
export
const
MSG_ANNOUNCE_CARD
=
142
;
export
const
MSG_ANNOUNCE_NUMBER
=
143
;
export
const
MSG_TOSS_COIN
=
130
;
export
const
MSG_TOSS_DICE
=
131
;
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/mod.ts
View file @
49aa13b5
...
...
@@ -35,6 +35,7 @@ import MsgSelectTributeAdapter from "./selectTribute";
import
MsgSelectUnselectCardAdapter
from
"
./selectUnselectCard
"
;
import
MsgSortCard
from
"
./sortCard
"
;
import
MsgStartAdapter
from
"
./start
"
;
import
MsgTossAdapter
from
"
./toss
"
;
import
MsgUpdateDataAdapter
from
"
./updateData
"
;
import
MsgWaitAdapter
from
"
./wait
"
;
import
MsgWin
from
"
./win
"
;
...
...
@@ -220,6 +221,22 @@ export default class GameMsgAdapter implements StocAdapter {
break
;
}
case
GAME_MSG
.
MSG_TOSS_COIN
:
{
gameMsg
.
toss
=
MsgTossAdapter
(
gameData
,
ygopro
.
StocGameMessage
.
MsgToss
.
TossType
.
COIN
);
break
;
}
case
GAME_MSG
.
MSG_TOSS_DICE
:
{
gameMsg
.
toss
=
MsgTossAdapter
(
gameData
,
ygopro
.
StocGameMessage
.
MsgToss
.
TossType
.
DICE
);
break
;
}
default
:
{
gameMsg
.
unimplemented
=
new
ygopro
.
StocGameMessage
.
MsgUnimplemented
({
command
:
func
,
...
...
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/toss.ts
0 → 100644
View file @
49aa13b5
import
{
BufferReader
}
from
"
../../../../../../rust-src/pkg/rust_src
"
;
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
MsgToss
=
ygopro
.
StocGameMessage
.
MsgToss
;
/*
* Msg Toss
* @param - TODO
*
* @usage 骰子/硬币结果
* */
export
default
(
data
:
Uint8Array
,
toss_type
:
MsgToss
.
TossType
)
=>
{
const
reader
=
new
BufferReader
(
data
);
const
player
=
reader
.
readUint8
();
const
count
=
reader
.
readUint8
();
const
res
=
[];
for
(
let
i
=
0
;
i
<
count
;
i
++
)
{
res
.
push
(
reader
.
readUint8
());
}
return
new
MsgToss
({
player
,
toss_type
,
res
,
});
};
src/service/duel/gameMsg.ts
View file @
49aa13b5
...
...
@@ -42,6 +42,7 @@ import onMsgStart from "./start";
import
onMsgSummoned
from
"
./summoned
"
;
import
onMsgSummoning
from
"
./summoning
"
;
import
onMsgSwap
from
"
./swap
"
;
import
onMsgToss
from
"
./toss
"
;
import
onUnimplemented
from
"
./unimplemented
"
;
import
onMsgUpdateCounter
from
"
./updateCounter
"
;
import
onMsgUpdateData
from
"
./updateData
"
;
...
...
@@ -303,6 +304,11 @@ async function _handleGameMsg(pb: ygopro.YgoStocMsg) {
break
;
}
case
"
toss
"
:
{
onMsgToss
(
msg
.
toss
);
break
;
}
case
"
unimplemented
"
:
{
onUnimplemented
(
msg
.
unimplemented
);
...
...
src/service/duel/toss.ts
0 → 100644
View file @
49aa13b5
import
{
ygopro
}
from
"
@/api
"
;
import
MsgToss
=
ygopro
.
StocGameMessage
.
MsgToss
;
export
default
(
toss
:
MsgToss
)
=>
{
console
.
log
(
toss
);
};
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