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
2
Merge Requests
2
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
89cf7e40
Commit
89cf7e40
authored
Aug 15, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add error msg service
parent
10f24524
Pipeline
#23128
passed with stages
in 11 minutes and 52 seconds
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
24 deletions
+54
-24
src/api/ocgcore/ocgAdapter/adapter.ts
src/api/ocgcore/ocgAdapter/adapter.ts
+6
-12
src/api/ocgcore/ocgAdapter/stoc/stocErrorMsg.ts
src/api/ocgcore/ocgAdapter/stoc/stocErrorMsg.ts
+38
-0
src/service/onSocketMessage.ts
src/service/onSocketMessage.ts
+5
-12
src/service/room/errorMsg.ts
src/service/room/errorMsg.ts
+5
-0
No files found.
src/api/ocgcore/ocgAdapter/adapter.ts
View file @
89cf7e40
...
...
@@ -4,6 +4,7 @@ import {
STOC_CHAT
,
STOC_DECK_COUNT
,
STOC_DUEL_START
,
STOC_ERROR_MSG
,
STOC_GAME_MSG
,
STOC_HAND_RESULT
,
STOC_HS_PLAYER_CHANGE
,
...
...
@@ -18,6 +19,7 @@ import {
import
StocChat
from
"
./stoc/stocChat
"
;
import
StocDeckCount
from
"
./stoc/stocDeckCount
"
;
import
StocDuelStart
from
"
./stoc/stocDuelStart
"
;
import
StocErrorMsg
from
"
./stoc/stocErrorMsg
"
;
import
StocGameMsg
from
"
./stoc/stocGameMsg/mod
"
;
import
StocHandResult
from
"
./stoc/stocHandResult
"
;
import
StocHsPlayerChange
from
"
./stoc/stocHsPlayerChange
"
;
...
...
@@ -41,37 +43,30 @@ export function adaptStoc(packet: YgoProPacket): ygopro.YgoStocMsg {
switch
(
packet
.
proto
)
{
case
STOC_JOIN_GAME
:
{
pb
=
new
StocJoinGame
(
packet
).
upcast
();
break
;
}
case
STOC_CHAT
:
{
pb
=
new
StocChat
(
packet
).
upcast
();
break
;
}
case
STOC_HS_PLAYER_ENTER
:
{
pb
=
new
StocHsPlayerEnter
(
packet
).
upcast
();
break
;
}
case
STOC_HS_PLAYER_CHANGE
:
{
pb
=
new
StocHsPlayerChange
(
packet
).
upcast
();
break
;
}
case
STOC_HS_WATCH_CHANGE
:
{
pb
=
new
StocHsWatchChange
(
packet
).
upcast
();
break
;
}
case
STOC_TYPE_CHANGE
:
{
pb
=
new
StocTypeChange
(
packet
).
upcast
();
break
;
}
case
STOC_SELECT_HAND
:
{
pb
=
new
StocSelectHand
(
packet
).
upcast
();
break
;
}
case
STOC_SELECT_TP
:
{
...
...
@@ -80,27 +75,26 @@ export function adaptStoc(packet: YgoProPacket): ygopro.YgoStocMsg {
}
case
STOC_HAND_RESULT
:
{
pb
=
new
StocHandResult
(
packet
).
upcast
();
break
;
}
case
STOC_DECK_COUNT
:
{
pb
=
new
StocDeckCount
(
packet
).
upcast
();
break
;
}
case
STOC_DUEL_START
:
{
pb
=
new
StocDuelStart
(
packet
).
upcast
();
break
;
}
case
STOC_GAME_MSG
:
{
pb
=
new
StocGameMsg
(
packet
).
upcast
();
break
;
}
case
STOC_TIME_LIMIT
:
{
pb
=
new
StocTimeLimit
(
packet
).
upcast
();
break
;
}
case
STOC_ERROR_MSG
:
{
pb
=
new
StocErrorMsg
(
packet
).
upcast
();
break
;
}
default
:
{
...
...
src/api/ocgcore/ocgAdapter/stoc/stocErrorMsg.ts
0 → 100644
View file @
89cf7e40
import
{
BufferReader
}
from
"
rust-src
"
;
import
{
ygopro
}
from
"
../../idl/ocgcore
"
;
import
{
StocAdapter
,
YgoProPacket
}
from
"
../packet
"
;
/*
* STOC Error Msg
*
* @usage - 后端传来的错误信息
* */
export
default
class
ErrorMsg
implements
StocAdapter
{
packet
:
YgoProPacket
;
constructor
(
packet
:
YgoProPacket
)
{
this
.
packet
=
packet
;
}
upcast
():
ygopro
.
YgoStocMsg
{
const
reader
=
new
BufferReader
(
this
.
packet
.
exData
);
const
errorType
=
reader
.
readUint8
();
let
errorCode
=
0
;
if
(
errorType
!=
3
)
{
reader
.
readUint8
();
reader
.
readUint8
();
reader
.
readUint8
();
errorCode
=
reader
.
readInt32
();
}
return
new
ygopro
.
YgoStocMsg
({
stoc_error_msg
:
new
ygopro
.
StocErrorMsg
({
error_type
:
errorType
,
error_code
:
errorCode
,
}),
});
}
}
src/service/onSocketMessage.ts
View file @
89cf7e40
...
...
@@ -13,6 +13,7 @@ import handleSelectHand from "./mora/selectHand";
import
handleSelectTp
from
"
./mora/selectTp
"
;
import
handleChat
from
"
./room/chat
"
;
import
handleDuelStart
from
"
./room/duelStart
"
;
import
handleErrorMsg
from
"
./room/errorMsg
"
;
import
handleHandResult
from
"
./room/handResult
"
;
import
handleHsPlayerChange
from
"
./room/hsPlayerChange
"
;
import
handleHsPlayerEnter
from
"
./room/hsPlayerEnter
"
;
...
...
@@ -32,57 +33,46 @@ export default async function handleSocketMessage(e: MessageEvent) {
switch
(
pb
.
msg
)
{
case
"
stoc_join_game
"
:
{
handleJoinGame
(
pb
);
break
;
}
case
"
stoc_chat
"
:
{
handleChat
(
pb
);
break
;
}
case
"
stoc_hs_player_change
"
:
{
handleHsPlayerChange
(
pb
);
break
;
}
case
"
stoc_hs_watch_change
"
:
{
handleHsWatchChange
(
pb
);
break
;
}
case
"
stoc_hs_player_enter
"
:
{
handleHsPlayerEnter
(
pb
);
break
;
}
case
"
stoc_type_change
"
:
{
handleTypeChange
(
pb
);
break
;
}
case
"
stoc_select_hand
"
:
{
handleSelectHand
(
pb
);
break
;
}
case
"
stoc_hand_result
"
:
{
handleHandResult
(
pb
);
break
;
}
case
"
stoc_select_tp
"
:
{
handleSelectTp
(
pb
);
break
;
}
case
"
stoc_deck_count
"
:
{
handleDeckCount
(
pb
);
break
;
}
case
"
stoc_duel_start
"
:
{
handleDuelStart
(
pb
);
break
;
}
case
"
stoc_game_msg
"
:
{
...
...
@@ -97,7 +87,10 @@ export default async function handleSocketMessage(e: MessageEvent) {
}
case
"
stoc_time_limit
"
:
{
handleTimeLimit
(
pb
.
stoc_time_limit
);
break
;
}
case
"
stoc_error_msg
"
:
{
handleErrorMsg
(
pb
.
stoc_error_msg
);
break
;
}
default
:
{
...
...
src/service/room/errorMsg.ts
0 → 100644
View file @
89cf7e40
import
{
ygopro
}
from
"
@/api
"
;
export
default
function
handleErrorMsg
(
errorMsg
:
ygopro
.
StocErrorMsg
)
{
console
.
log
(
errorMsg
);
}
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