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
3a9b2d64
Commit
3a9b2d64
authored
Aug 15, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat/match' into 'main'
错误处理 See merge request
!263
parents
f6414f4d
4168249f
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
308 additions
and
31 deletions
+308
-31
neos-protobuf
neos-protobuf
+1
-1
src/api/ocgcore/idl/ocgcore.ts
src/api/ocgcore/idl/ocgcore.ts
+157
-4
src/api/ocgcore/ocgAdapter/adapter.ts
src/api/ocgcore/ocgAdapter/adapter.ts
+6
-12
src/api/ocgcore/ocgAdapter/protoDecl.ts
src/api/ocgcore/ocgAdapter/protoDecl.ts
+1
-0
src/api/ocgcore/ocgAdapter/stoc/stocErrorMsg.ts
src/api/ocgcore/ocgAdapter/stoc/stocErrorMsg.ts
+35
-0
src/service/onSocketMessage.ts
src/service/onSocketMessage.ts
+5
-12
src/service/room/errorMsg.ts
src/service/room/errorMsg.ts
+91
-0
src/stores/roomStore.ts
src/stores/roomStore.ts
+2
-1
src/ui/Match/MatchModal.tsx
src/ui/Match/MatchModal.tsx
+10
-1
No files found.
neos-protobuf
@
12f48aa7
Subproject commit
d6c01dd88fd72f22c432a52ba74eee9ece267499
Subproject commit
12f48aa7901f81f4b356b968bc7a8281a1a2d848
src/api/ocgcore/idl/ocgcore.ts
View file @
3a9b2d64
...
@@ -978,7 +978,7 @@ export namespace ygopro {
...
@@ -978,7 +978,7 @@ export namespace ygopro {
}
}
}
}
export
class
YgoStocMsg
extends
pb_1
.
Message
{
export
class
YgoStocMsg
extends
pb_1
.
Message
{
#one_of_decls: number[][] = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]];
#
one_of_decls
:
number
[][]
=
[[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
]];
constructor
(
data
?:
any
[]
|
({}
&
(({
constructor
(
data
?:
any
[]
|
({}
&
(({
stoc_join_game
?:
StocJoinGame
;
stoc_join_game
?:
StocJoinGame
;
stoc_chat
?:
never
;
stoc_chat
?:
never
;
...
@@ -993,6 +993,7 @@ export namespace ygopro {
...
@@ -993,6 +993,7 @@ export namespace ygopro {
stoc_duel_start
?:
never
;
stoc_duel_start
?:
never
;
stoc_game_msg
?:
never
;
stoc_game_msg
?:
never
;
stoc_time_limit
?:
never
;
stoc_time_limit
?:
never
;
stoc_error_msg
?:
never
;
}
|
{
}
|
{
stoc_join_game
?:
never
;
stoc_join_game
?:
never
;
stoc_chat
?:
StocChat
;
stoc_chat
?:
StocChat
;
...
@@ -1007,6 +1008,7 @@ export namespace ygopro {
...
@@ -1007,6 +1008,7 @@ export namespace ygopro {
stoc_duel_start
?:
never
;
stoc_duel_start
?:
never
;
stoc_game_msg
?:
never
;
stoc_game_msg
?:
never
;
stoc_time_limit
?:
never
;
stoc_time_limit
?:
never
;
stoc_error_msg
?:
never
;
}
|
{
}
|
{
stoc_join_game
?:
never
;
stoc_join_game
?:
never
;
stoc_chat
?:
never
;
stoc_chat
?:
never
;
...
@@ -1021,6 +1023,7 @@ export namespace ygopro {
...
@@ -1021,6 +1023,7 @@ export namespace ygopro {
stoc_duel_start
?:
never
;
stoc_duel_start
?:
never
;
stoc_game_msg
?:
never
;
stoc_game_msg
?:
never
;
stoc_time_limit
?:
never
;
stoc_time_limit
?:
never
;
stoc_error_msg
?:
never
;
}
|
{
}
|
{
stoc_join_game
?:
never
;
stoc_join_game
?:
never
;
stoc_chat
?:
never
;
stoc_chat
?:
never
;
...
@@ -1035,6 +1038,7 @@ export namespace ygopro {
...
@@ -1035,6 +1038,7 @@ export namespace ygopro {
stoc_duel_start
?:
never
;
stoc_duel_start
?:
never
;
stoc_game_msg
?:
never
;
stoc_game_msg
?:
never
;
stoc_time_limit
?:
never
;
stoc_time_limit
?:
never
;
stoc_error_msg
?:
never
;
}
|
{
}
|
{
stoc_join_game
?:
never
;
stoc_join_game
?:
never
;
stoc_chat
?:
never
;
stoc_chat
?:
never
;
...
@@ -1049,6 +1053,7 @@ export namespace ygopro {
...
@@ -1049,6 +1053,7 @@ export namespace ygopro {
stoc_duel_start
?:
never
;
stoc_duel_start
?:
never
;
stoc_game_msg
?:
never
;
stoc_game_msg
?:
never
;
stoc_time_limit
?:
never
;
stoc_time_limit
?:
never
;
stoc_error_msg
?:
never
;
}
|
{
}
|
{
stoc_join_game
?:
never
;
stoc_join_game
?:
never
;
stoc_chat
?:
never
;
stoc_chat
?:
never
;
...
@@ -1063,6 +1068,7 @@ export namespace ygopro {
...
@@ -1063,6 +1068,7 @@ export namespace ygopro {
stoc_duel_start
?:
never
;
stoc_duel_start
?:
never
;
stoc_game_msg
?:
never
;
stoc_game_msg
?:
never
;
stoc_time_limit
?:
never
;
stoc_time_limit
?:
never
;
stoc_error_msg
?:
never
;
}
|
{
}
|
{
stoc_join_game
?:
never
;
stoc_join_game
?:
never
;
stoc_chat
?:
never
;
stoc_chat
?:
never
;
...
@@ -1077,6 +1083,7 @@ export namespace ygopro {
...
@@ -1077,6 +1083,7 @@ export namespace ygopro {
stoc_duel_start
?:
never
;
stoc_duel_start
?:
never
;
stoc_game_msg
?:
never
;
stoc_game_msg
?:
never
;
stoc_time_limit
?:
never
;
stoc_time_limit
?:
never
;
stoc_error_msg
?:
never
;
}
|
{
}
|
{
stoc_join_game
?:
never
;
stoc_join_game
?:
never
;
stoc_chat
?:
never
;
stoc_chat
?:
never
;
...
@@ -1091,6 +1098,7 @@ export namespace ygopro {
...
@@ -1091,6 +1098,7 @@ export namespace ygopro {
stoc_duel_start
?:
never
;
stoc_duel_start
?:
never
;
stoc_game_msg
?:
never
;
stoc_game_msg
?:
never
;
stoc_time_limit
?:
never
;
stoc_time_limit
?:
never
;
stoc_error_msg
?:
never
;
}
|
{
}
|
{
stoc_join_game
?:
never
;
stoc_join_game
?:
never
;
stoc_chat
?:
never
;
stoc_chat
?:
never
;
...
@@ -1105,6 +1113,7 @@ export namespace ygopro {
...
@@ -1105,6 +1113,7 @@ export namespace ygopro {
stoc_duel_start
?:
never
;
stoc_duel_start
?:
never
;
stoc_game_msg
?:
never
;
stoc_game_msg
?:
never
;
stoc_time_limit
?:
never
;
stoc_time_limit
?:
never
;
stoc_error_msg
?:
never
;
}
|
{
}
|
{
stoc_join_game
?:
never
;
stoc_join_game
?:
never
;
stoc_chat
?:
never
;
stoc_chat
?:
never
;
...
@@ -1119,6 +1128,7 @@ export namespace ygopro {
...
@@ -1119,6 +1128,7 @@ export namespace ygopro {
stoc_duel_start
?:
never
;
stoc_duel_start
?:
never
;
stoc_game_msg
?:
never
;
stoc_game_msg
?:
never
;
stoc_time_limit
?:
never
;
stoc_time_limit
?:
never
;
stoc_error_msg
?:
never
;
}
|
{
}
|
{
stoc_join_game
?:
never
;
stoc_join_game
?:
never
;
stoc_chat
?:
never
;
stoc_chat
?:
never
;
...
@@ -1133,6 +1143,7 @@ export namespace ygopro {
...
@@ -1133,6 +1143,7 @@ export namespace ygopro {
stoc_duel_start
?:
StocDuelStart
;
stoc_duel_start
?:
StocDuelStart
;
stoc_game_msg
?:
never
;
stoc_game_msg
?:
never
;
stoc_time_limit
?:
never
;
stoc_time_limit
?:
never
;
stoc_error_msg
?:
never
;
}
|
{
}
|
{
stoc_join_game
?:
never
;
stoc_join_game
?:
never
;
stoc_chat
?:
never
;
stoc_chat
?:
never
;
...
@@ -1147,6 +1158,7 @@ export namespace ygopro {
...
@@ -1147,6 +1158,7 @@ export namespace ygopro {
stoc_duel_start
?:
never
;
stoc_duel_start
?:
never
;
stoc_game_msg
?:
StocGameMessage
;
stoc_game_msg
?:
StocGameMessage
;
stoc_time_limit
?:
never
;
stoc_time_limit
?:
never
;
stoc_error_msg
?:
never
;
}
|
{
}
|
{
stoc_join_game
?:
never
;
stoc_join_game
?:
never
;
stoc_chat
?:
never
;
stoc_chat
?:
never
;
...
@@ -1161,6 +1173,22 @@ export namespace ygopro {
...
@@ -1161,6 +1173,22 @@ export namespace ygopro {
stoc_duel_start
?:
never
;
stoc_duel_start
?:
never
;
stoc_game_msg
?:
never
;
stoc_game_msg
?:
never
;
stoc_time_limit
?:
StocTimeLimit
;
stoc_time_limit
?:
StocTimeLimit
;
stoc_error_msg
?:
never
;
}
|
{
stoc_join_game
?:
never
;
stoc_chat
?:
never
;
stoc_hs_player_enter
?:
never
;
stoc_type_change
?:
never
;
stoc_hs_player_change
?:
never
;
stoc_hs_watch_change
?:
never
;
stoc_select_hand
?:
never
;
stoc_hand_result
?:
never
;
stoc_select_tp
?:
never
;
stoc_deck_count
?:
never
;
stoc_duel_start
?:
never
;
stoc_game_msg
?:
never
;
stoc_time_limit
?:
never
;
stoc_error_msg
?:
StocErrorMsg
;
}))))
{
}))))
{
super
();
super
();
pb_1
.
Message
.
initialize
(
this
,
Array
.
isArray
(
data
)
?
data
:
[],
0
,
-
1
,
[],
this
.
#
one_of_decls
);
pb_1
.
Message
.
initialize
(
this
,
Array
.
isArray
(
data
)
?
data
:
[],
0
,
-
1
,
[],
this
.
#
one_of_decls
);
...
@@ -1204,6 +1232,9 @@ export namespace ygopro {
...
@@ -1204,6 +1232,9 @@ export namespace ygopro {
if
(
"
stoc_time_limit
"
in
data
&&
data
.
stoc_time_limit
!=
undefined
)
{
if
(
"
stoc_time_limit
"
in
data
&&
data
.
stoc_time_limit
!=
undefined
)
{
this
.
stoc_time_limit
=
data
.
stoc_time_limit
;
this
.
stoc_time_limit
=
data
.
stoc_time_limit
;
}
}
if
(
"
stoc_error_msg
"
in
data
&&
data
.
stoc_error_msg
!=
undefined
)
{
this
.
stoc_error_msg
=
data
.
stoc_error_msg
;
}
}
}
}
}
get
stoc_join_game
()
{
get
stoc_join_game
()
{
...
@@ -1323,9 +1354,18 @@ export namespace ygopro {
...
@@ -1323,9 +1354,18 @@ export namespace ygopro {
get
has_stoc_time_limit
()
{
get
has_stoc_time_limit
()
{
return
pb_1
.
Message
.
getField
(
this
,
13
)
!=
null
;
return
pb_1
.
Message
.
getField
(
this
,
13
)
!=
null
;
}
}
get
stoc_error_msg
()
{
return
pb_1
.
Message
.
getWrapperField
(
this
,
StocErrorMsg
,
14
)
as
StocErrorMsg
;
}
set
stoc_error_msg
(
value
:
StocErrorMsg
)
{
pb_1
.
Message
.
setOneofWrapperField
(
this
,
14
,
this
.
#
one_of_decls
[
0
],
value
);
}
get
has_stoc_error_msg
()
{
return
pb_1
.
Message
.
getField
(
this
,
14
)
!=
null
;
}
get
msg
()
{
get
msg
()
{
const
cases
:
{
const
cases
:
{
[index: number]: "none" | "stoc_join_game" | "stoc_chat" | "stoc_hs_player_enter" | "stoc_type_change" | "stoc_hs_player_change" | "stoc_hs_watch_change" | "stoc_select_hand" | "stoc_hand_result" | "stoc_select_tp" | "stoc_deck_count" | "stoc_duel_start" | "stoc_game_msg" | "stoc_time_limit";
[
index
:
number
]:
"
none
"
|
"
stoc_join_game
"
|
"
stoc_chat
"
|
"
stoc_hs_player_enter
"
|
"
stoc_type_change
"
|
"
stoc_hs_player_change
"
|
"
stoc_hs_watch_change
"
|
"
stoc_select_hand
"
|
"
stoc_hand_result
"
|
"
stoc_select_tp
"
|
"
stoc_deck_count
"
|
"
stoc_duel_start
"
|
"
stoc_game_msg
"
|
"
stoc_time_limit
"
|
"
stoc_error_msg
"
;
}
=
{
}
=
{
0
:
"
none
"
,
0
:
"
none
"
,
1
:
"
stoc_join_game
"
,
1
:
"
stoc_join_game
"
,
...
@@ -1340,9 +1380,10 @@ export namespace ygopro {
...
@@ -1340,9 +1380,10 @@ export namespace ygopro {
10
:
"
stoc_deck_count
"
,
10
:
"
stoc_deck_count
"
,
11
:
"
stoc_duel_start
"
,
11
:
"
stoc_duel_start
"
,
12
:
"
stoc_game_msg
"
,
12
:
"
stoc_game_msg
"
,
13: "stoc_time_limit"
13
:
"
stoc_time_limit
"
,
14
:
"
stoc_error_msg
"
};
};
return cases[pb_1.Message.computeOneofCase(this, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13])];
return
cases
[
pb_1
.
Message
.
computeOneofCase
(
this
,
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
])];
}
}
static
fromObject
(
data
:
{
static
fromObject
(
data
:
{
stoc_join_game
?:
ReturnType
<
typeof
StocJoinGame
.
prototype
.
toObject
>
;
stoc_join_game
?:
ReturnType
<
typeof
StocJoinGame
.
prototype
.
toObject
>
;
...
@@ -1358,6 +1399,7 @@ export namespace ygopro {
...
@@ -1358,6 +1399,7 @@ export namespace ygopro {
stoc_duel_start
?:
ReturnType
<
typeof
StocDuelStart
.
prototype
.
toObject
>
;
stoc_duel_start
?:
ReturnType
<
typeof
StocDuelStart
.
prototype
.
toObject
>
;
stoc_game_msg
?:
ReturnType
<
typeof
StocGameMessage
.
prototype
.
toObject
>
;
stoc_game_msg
?:
ReturnType
<
typeof
StocGameMessage
.
prototype
.
toObject
>
;
stoc_time_limit
?:
ReturnType
<
typeof
StocTimeLimit
.
prototype
.
toObject
>
;
stoc_time_limit
?:
ReturnType
<
typeof
StocTimeLimit
.
prototype
.
toObject
>
;
stoc_error_msg
?:
ReturnType
<
typeof
StocErrorMsg
.
prototype
.
toObject
>
;
}):
YgoStocMsg
{
}):
YgoStocMsg
{
const
message
=
new
YgoStocMsg
({});
const
message
=
new
YgoStocMsg
({});
if
(
data
.
stoc_join_game
!=
null
)
{
if
(
data
.
stoc_join_game
!=
null
)
{
...
@@ -1399,6 +1441,9 @@ export namespace ygopro {
...
@@ -1399,6 +1441,9 @@ export namespace ygopro {
if
(
data
.
stoc_time_limit
!=
null
)
{
if
(
data
.
stoc_time_limit
!=
null
)
{
message
.
stoc_time_limit
=
StocTimeLimit
.
fromObject
(
data
.
stoc_time_limit
);
message
.
stoc_time_limit
=
StocTimeLimit
.
fromObject
(
data
.
stoc_time_limit
);
}
}
if
(
data
.
stoc_error_msg
!=
null
)
{
message
.
stoc_error_msg
=
StocErrorMsg
.
fromObject
(
data
.
stoc_error_msg
);
}
return
message
;
return
message
;
}
}
toObject
()
{
toObject
()
{
...
@@ -1416,6 +1461,7 @@ export namespace ygopro {
...
@@ -1416,6 +1461,7 @@ export namespace ygopro {
stoc_duel_start
?:
ReturnType
<
typeof
StocDuelStart
.
prototype
.
toObject
>
;
stoc_duel_start
?:
ReturnType
<
typeof
StocDuelStart
.
prototype
.
toObject
>
;
stoc_game_msg
?:
ReturnType
<
typeof
StocGameMessage
.
prototype
.
toObject
>
;
stoc_game_msg
?:
ReturnType
<
typeof
StocGameMessage
.
prototype
.
toObject
>
;
stoc_time_limit
?:
ReturnType
<
typeof
StocTimeLimit
.
prototype
.
toObject
>
;
stoc_time_limit
?:
ReturnType
<
typeof
StocTimeLimit
.
prototype
.
toObject
>
;
stoc_error_msg
?:
ReturnType
<
typeof
StocErrorMsg
.
prototype
.
toObject
>
;
}
=
{};
}
=
{};
if
(
this
.
stoc_join_game
!=
null
)
{
if
(
this
.
stoc_join_game
!=
null
)
{
data
.
stoc_join_game
=
this
.
stoc_join_game
.
toObject
();
data
.
stoc_join_game
=
this
.
stoc_join_game
.
toObject
();
...
@@ -1456,6 +1502,9 @@ export namespace ygopro {
...
@@ -1456,6 +1502,9 @@ export namespace ygopro {
if
(
this
.
stoc_time_limit
!=
null
)
{
if
(
this
.
stoc_time_limit
!=
null
)
{
data
.
stoc_time_limit
=
this
.
stoc_time_limit
.
toObject
();
data
.
stoc_time_limit
=
this
.
stoc_time_limit
.
toObject
();
}
}
if
(
this
.
stoc_error_msg
!=
null
)
{
data
.
stoc_error_msg
=
this
.
stoc_error_msg
.
toObject
();
}
return
data
;
return
data
;
}
}
serialize
():
Uint8Array
;
serialize
():
Uint8Array
;
...
@@ -1488,6 +1537,8 @@ export namespace ygopro {
...
@@ -1488,6 +1537,8 @@ export namespace ygopro {
writer
.
writeMessage
(
12
,
this
.
stoc_game_msg
,
()
=>
this
.
stoc_game_msg
.
serialize
(
writer
));
writer
.
writeMessage
(
12
,
this
.
stoc_game_msg
,
()
=>
this
.
stoc_game_msg
.
serialize
(
writer
));
if
(
this
.
has_stoc_time_limit
)
if
(
this
.
has_stoc_time_limit
)
writer
.
writeMessage
(
13
,
this
.
stoc_time_limit
,
()
=>
this
.
stoc_time_limit
.
serialize
(
writer
));
writer
.
writeMessage
(
13
,
this
.
stoc_time_limit
,
()
=>
this
.
stoc_time_limit
.
serialize
(
writer
));
if
(
this
.
has_stoc_error_msg
)
writer
.
writeMessage
(
14
,
this
.
stoc_error_msg
,
()
=>
this
.
stoc_error_msg
.
serialize
(
writer
));
if
(
!
w
)
if
(
!
w
)
return
writer
.
getResultBuffer
();
return
writer
.
getResultBuffer
();
}
}
...
@@ -1536,6 +1587,9 @@ export namespace ygopro {
...
@@ -1536,6 +1587,9 @@ export namespace ygopro {
case
13
:
case
13
:
reader
.
readMessage
(
message
.
stoc_time_limit
,
()
=>
message
.
stoc_time_limit
=
StocTimeLimit
.
deserialize
(
reader
));
reader
.
readMessage
(
message
.
stoc_time_limit
,
()
=>
message
.
stoc_time_limit
=
StocTimeLimit
.
deserialize
(
reader
));
break
;
break
;
case
14
:
reader
.
readMessage
(
message
.
stoc_error_msg
,
()
=>
message
.
stoc_error_msg
=
StocErrorMsg
.
deserialize
(
reader
));
break
;
default
:
reader
.
skipField
();
default
:
reader
.
skipField
();
}
}
}
}
...
@@ -3832,6 +3886,105 @@ export namespace ygopro {
...
@@ -3832,6 +3886,105 @@ export namespace ygopro {
return
StocChat
.
deserialize
(
bytes
);
return
StocChat
.
deserialize
(
bytes
);
}
}
}
}
export
class
StocErrorMsg
extends
pb_1
.
Message
{
#
one_of_decls
:
number
[][]
=
[];
constructor
(
data
?:
any
[]
|
{
error_type
?:
StocErrorMsg
.
ErrorType
;
error_code
?:
number
;
})
{
super
();
pb_1
.
Message
.
initialize
(
this
,
Array
.
isArray
(
data
)
?
data
:
[],
0
,
-
1
,
[],
this
.
#
one_of_decls
);
if
(
!
Array
.
isArray
(
data
)
&&
typeof
data
==
"
object
"
)
{
if
(
"
error_type
"
in
data
&&
data
.
error_type
!=
undefined
)
{
this
.
error_type
=
data
.
error_type
;
}
if
(
"
error_code
"
in
data
&&
data
.
error_code
!=
undefined
)
{
this
.
error_code
=
data
.
error_code
;
}
}
}
get
error_type
()
{
return
pb_1
.
Message
.
getFieldWithDefault
(
this
,
1
,
StocErrorMsg
.
ErrorType
.
UNKNOWN
)
as
StocErrorMsg
.
ErrorType
;
}
set
error_type
(
value
:
StocErrorMsg
.
ErrorType
)
{
pb_1
.
Message
.
setField
(
this
,
1
,
value
);
}
get
error_code
()
{
return
pb_1
.
Message
.
getFieldWithDefault
(
this
,
2
,
0
)
as
number
;
}
set
error_code
(
value
:
number
)
{
pb_1
.
Message
.
setField
(
this
,
2
,
value
);
}
static
fromObject
(
data
:
{
error_type
?:
StocErrorMsg
.
ErrorType
;
error_code
?:
number
;
}):
StocErrorMsg
{
const
message
=
new
StocErrorMsg
({});
if
(
data
.
error_type
!=
null
)
{
message
.
error_type
=
data
.
error_type
;
}
if
(
data
.
error_code
!=
null
)
{
message
.
error_code
=
data
.
error_code
;
}
return
message
;
}
toObject
()
{
const
data
:
{
error_type
?:
StocErrorMsg
.
ErrorType
;
error_code
?:
number
;
}
=
{};
if
(
this
.
error_type
!=
null
)
{
data
.
error_type
=
this
.
error_type
;
}
if
(
this
.
error_code
!=
null
)
{
data
.
error_code
=
this
.
error_code
;
}
return
data
;
}
serialize
():
Uint8Array
;
serialize
(
w
:
pb_1
.
BinaryWriter
):
void
;
serialize
(
w
?:
pb_1
.
BinaryWriter
):
Uint8Array
|
void
{
const
writer
=
w
||
new
pb_1
.
BinaryWriter
();
if
(
this
.
error_type
!=
StocErrorMsg
.
ErrorType
.
UNKNOWN
)
writer
.
writeEnum
(
1
,
this
.
error_type
);
if
(
this
.
error_code
!=
0
)
writer
.
writeInt32
(
2
,
this
.
error_code
);
if
(
!
w
)
return
writer
.
getResultBuffer
();
}
static
deserialize
(
bytes
:
Uint8Array
|
pb_1
.
BinaryReader
):
StocErrorMsg
{
const
reader
=
bytes
instanceof
pb_1
.
BinaryReader
?
bytes
:
new
pb_1
.
BinaryReader
(
bytes
),
message
=
new
StocErrorMsg
();
while
(
reader
.
nextField
())
{
if
(
reader
.
isEndGroup
())
break
;
switch
(
reader
.
getFieldNumber
())
{
case
1
:
message
.
error_type
=
reader
.
readEnum
();
break
;
case
2
:
message
.
error_code
=
reader
.
readInt32
();
break
;
default
:
reader
.
skipField
();
}
}
return
message
;
}
serializeBinary
():
Uint8Array
{
return
this
.
serialize
();
}
static
deserializeBinary
(
bytes
:
Uint8Array
):
StocErrorMsg
{
return
StocErrorMsg
.
deserialize
(
bytes
);
}
}
export
namespace
StocErrorMsg
{
export
enum
ErrorType
{
UNKNOWN
=
0
,
JOINERROR
=
1
,
DECKERROR
=
2
,
SIDEERROR
=
3
,
VERSIONERROR
=
4
}
}
export
class
StocHsPlayerEnter
extends
pb_1
.
Message
{
export
class
StocHsPlayerEnter
extends
pb_1
.
Message
{
#
one_of_decls
:
number
[][]
=
[];
#
one_of_decls
:
number
[][]
=
[];
constructor
(
data
?:
any
[]
|
{
constructor
(
data
?:
any
[]
|
{
...
...
src/api/ocgcore/ocgAdapter/adapter.ts
View file @
3a9b2d64
...
@@ -4,6 +4,7 @@ import {
...
@@ -4,6 +4,7 @@ import {
STOC_CHAT
,
STOC_CHAT
,
STOC_DECK_COUNT
,
STOC_DECK_COUNT
,
STOC_DUEL_START
,
STOC_DUEL_START
,
STOC_ERROR_MSG
,
STOC_GAME_MSG
,
STOC_GAME_MSG
,
STOC_HAND_RESULT
,
STOC_HAND_RESULT
,
STOC_HS_PLAYER_CHANGE
,
STOC_HS_PLAYER_CHANGE
,
...
@@ -18,6 +19,7 @@ import {
...
@@ -18,6 +19,7 @@ import {
import
StocChat
from
"
./stoc/stocChat
"
;
import
StocChat
from
"
./stoc/stocChat
"
;
import
StocDeckCount
from
"
./stoc/stocDeckCount
"
;
import
StocDeckCount
from
"
./stoc/stocDeckCount
"
;
import
StocDuelStart
from
"
./stoc/stocDuelStart
"
;
import
StocDuelStart
from
"
./stoc/stocDuelStart
"
;
import
StocErrorMsg
from
"
./stoc/stocErrorMsg
"
;
import
StocGameMsg
from
"
./stoc/stocGameMsg/mod
"
;
import
StocGameMsg
from
"
./stoc/stocGameMsg/mod
"
;
import
StocHandResult
from
"
./stoc/stocHandResult
"
;
import
StocHandResult
from
"
./stoc/stocHandResult
"
;
import
StocHsPlayerChange
from
"
./stoc/stocHsPlayerChange
"
;
import
StocHsPlayerChange
from
"
./stoc/stocHsPlayerChange
"
;
...
@@ -41,37 +43,30 @@ export function adaptStoc(packet: YgoProPacket): ygopro.YgoStocMsg {
...
@@ -41,37 +43,30 @@ export function adaptStoc(packet: YgoProPacket): ygopro.YgoStocMsg {
switch
(
packet
.
proto
)
{
switch
(
packet
.
proto
)
{
case
STOC_JOIN_GAME
:
{
case
STOC_JOIN_GAME
:
{
pb
=
new
StocJoinGame
(
packet
).
upcast
();
pb
=
new
StocJoinGame
(
packet
).
upcast
();
break
;
break
;
}
}
case
STOC_CHAT
:
{
case
STOC_CHAT
:
{
pb
=
new
StocChat
(
packet
).
upcast
();
pb
=
new
StocChat
(
packet
).
upcast
();
break
;
break
;
}
}
case
STOC_HS_PLAYER_ENTER
:
{
case
STOC_HS_PLAYER_ENTER
:
{
pb
=
new
StocHsPlayerEnter
(
packet
).
upcast
();
pb
=
new
StocHsPlayerEnter
(
packet
).
upcast
();
break
;
break
;
}
}
case
STOC_HS_PLAYER_CHANGE
:
{
case
STOC_HS_PLAYER_CHANGE
:
{
pb
=
new
StocHsPlayerChange
(
packet
).
upcast
();
pb
=
new
StocHsPlayerChange
(
packet
).
upcast
();
break
;
break
;
}
}
case
STOC_HS_WATCH_CHANGE
:
{
case
STOC_HS_WATCH_CHANGE
:
{
pb
=
new
StocHsWatchChange
(
packet
).
upcast
();
pb
=
new
StocHsWatchChange
(
packet
).
upcast
();
break
;
break
;
}
}
case
STOC_TYPE_CHANGE
:
{
case
STOC_TYPE_CHANGE
:
{
pb
=
new
StocTypeChange
(
packet
).
upcast
();
pb
=
new
StocTypeChange
(
packet
).
upcast
();
break
;
break
;
}
}
case
STOC_SELECT_HAND
:
{
case
STOC_SELECT_HAND
:
{
pb
=
new
StocSelectHand
(
packet
).
upcast
();
pb
=
new
StocSelectHand
(
packet
).
upcast
();
break
;
break
;
}
}
case
STOC_SELECT_TP
:
{
case
STOC_SELECT_TP
:
{
...
@@ -80,27 +75,26 @@ export function adaptStoc(packet: YgoProPacket): ygopro.YgoStocMsg {
...
@@ -80,27 +75,26 @@ export function adaptStoc(packet: YgoProPacket): ygopro.YgoStocMsg {
}
}
case
STOC_HAND_RESULT
:
{
case
STOC_HAND_RESULT
:
{
pb
=
new
StocHandResult
(
packet
).
upcast
();
pb
=
new
StocHandResult
(
packet
).
upcast
();
break
;
break
;
}
}
case
STOC_DECK_COUNT
:
{
case
STOC_DECK_COUNT
:
{
pb
=
new
StocDeckCount
(
packet
).
upcast
();
pb
=
new
StocDeckCount
(
packet
).
upcast
();
break
;
break
;
}
}
case
STOC_DUEL_START
:
{
case
STOC_DUEL_START
:
{
pb
=
new
StocDuelStart
(
packet
).
upcast
();
pb
=
new
StocDuelStart
(
packet
).
upcast
();
break
;
break
;
}
}
case
STOC_GAME_MSG
:
{
case
STOC_GAME_MSG
:
{
pb
=
new
StocGameMsg
(
packet
).
upcast
();
pb
=
new
StocGameMsg
(
packet
).
upcast
();
break
;
break
;
}
}
case
STOC_TIME_LIMIT
:
{
case
STOC_TIME_LIMIT
:
{
pb
=
new
StocTimeLimit
(
packet
).
upcast
();
pb
=
new
StocTimeLimit
(
packet
).
upcast
();
break
;
}
case
STOC_ERROR_MSG
:
{
pb
=
new
StocErrorMsg
(
packet
).
upcast
();
break
;
break
;
}
}
default
:
{
default
:
{
...
...
src/api/ocgcore/ocgAdapter/protoDecl.ts
View file @
3a9b2d64
...
@@ -30,6 +30,7 @@ export const STOC_DECK_COUNT = 9;
...
@@ -30,6 +30,7 @@ export const STOC_DECK_COUNT = 9;
export
const
STOC_DUEL_START
=
21
;
export
const
STOC_DUEL_START
=
21
;
export
const
STOC_GAME_MSG
=
1
;
export
const
STOC_GAME_MSG
=
1
;
export
const
STOC_TIME_LIMIT
=
24
;
export
const
STOC_TIME_LIMIT
=
24
;
export
const
STOC_ERROR_MSG
=
2
;
export
const
MSG_START
=
4
;
export
const
MSG_START
=
4
;
export
const
MSG_DRAW
=
90
;
export
const
MSG_DRAW
=
90
;
...
...
src/api/ocgcore/ocgAdapter/stoc/stocErrorMsg.ts
0 → 100644
View file @
3a9b2d64
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
();
reader
.
readUint8
();
reader
.
readUint8
();
reader
.
readUint8
();
const
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 @
3a9b2d64
...
@@ -13,6 +13,7 @@ import handleSelectHand from "./mora/selectHand";
...
@@ -13,6 +13,7 @@ import handleSelectHand from "./mora/selectHand";
import
handleSelectTp
from
"
./mora/selectTp
"
;
import
handleSelectTp
from
"
./mora/selectTp
"
;
import
handleChat
from
"
./room/chat
"
;
import
handleChat
from
"
./room/chat
"
;
import
handleDuelStart
from
"
./room/duelStart
"
;
import
handleDuelStart
from
"
./room/duelStart
"
;
import
handleErrorMsg
from
"
./room/errorMsg
"
;
import
handleHandResult
from
"
./room/handResult
"
;
import
handleHandResult
from
"
./room/handResult
"
;
import
handleHsPlayerChange
from
"
./room/hsPlayerChange
"
;
import
handleHsPlayerChange
from
"
./room/hsPlayerChange
"
;
import
handleHsPlayerEnter
from
"
./room/hsPlayerEnter
"
;
import
handleHsPlayerEnter
from
"
./room/hsPlayerEnter
"
;
...
@@ -32,57 +33,46 @@ export default async function handleSocketMessage(e: MessageEvent) {
...
@@ -32,57 +33,46 @@ export default async function handleSocketMessage(e: MessageEvent) {
switch
(
pb
.
msg
)
{
switch
(
pb
.
msg
)
{
case
"
stoc_join_game
"
:
{
case
"
stoc_join_game
"
:
{
handleJoinGame
(
pb
);
handleJoinGame
(
pb
);
break
;
break
;
}
}
case
"
stoc_chat
"
:
{
case
"
stoc_chat
"
:
{
handleChat
(
pb
);
handleChat
(
pb
);
break
;
break
;
}
}
case
"
stoc_hs_player_change
"
:
{
case
"
stoc_hs_player_change
"
:
{
handleHsPlayerChange
(
pb
);
handleHsPlayerChange
(
pb
);
break
;
break
;
}
}
case
"
stoc_hs_watch_change
"
:
{
case
"
stoc_hs_watch_change
"
:
{
handleHsWatchChange
(
pb
);
handleHsWatchChange
(
pb
);
break
;
break
;
}
}
case
"
stoc_hs_player_enter
"
:
{
case
"
stoc_hs_player_enter
"
:
{
handleHsPlayerEnter
(
pb
);
handleHsPlayerEnter
(
pb
);
break
;
break
;
}
}
case
"
stoc_type_change
"
:
{
case
"
stoc_type_change
"
:
{
handleTypeChange
(
pb
);
handleTypeChange
(
pb
);
break
;
break
;
}
}
case
"
stoc_select_hand
"
:
{
case
"
stoc_select_hand
"
:
{
handleSelectHand
(
pb
);
handleSelectHand
(
pb
);
break
;
break
;
}
}
case
"
stoc_hand_result
"
:
{
case
"
stoc_hand_result
"
:
{
handleHandResult
(
pb
);
handleHandResult
(
pb
);
break
;
break
;
}
}
case
"
stoc_select_tp
"
:
{
case
"
stoc_select_tp
"
:
{
handleSelectTp
(
pb
);
handleSelectTp
(
pb
);
break
;
break
;
}
}
case
"
stoc_deck_count
"
:
{
case
"
stoc_deck_count
"
:
{
handleDeckCount
(
pb
);
handleDeckCount
(
pb
);
break
;
break
;
}
}
case
"
stoc_duel_start
"
:
{
case
"
stoc_duel_start
"
:
{
handleDuelStart
(
pb
);
handleDuelStart
(
pb
);
break
;
break
;
}
}
case
"
stoc_game_msg
"
:
{
case
"
stoc_game_msg
"
:
{
...
@@ -97,7 +87,10 @@ export default async function handleSocketMessage(e: MessageEvent) {
...
@@ -97,7 +87,10 @@ export default async function handleSocketMessage(e: MessageEvent) {
}
}
case
"
stoc_time_limit
"
:
{
case
"
stoc_time_limit
"
:
{
handleTimeLimit
(
pb
.
stoc_time_limit
);
handleTimeLimit
(
pb
.
stoc_time_limit
);
break
;
}
case
"
stoc_error_msg
"
:
{
await
handleErrorMsg
(
pb
.
stoc_error_msg
);
break
;
break
;
}
}
default
:
{
default
:
{
...
...
src/service/room/errorMsg.ts
0 → 100644
View file @
3a9b2d64
import
{
fetchCard
,
fetchStrings
,
Region
,
ygopro
}
from
"
@/api
"
;
import
{
roomStore
}
from
"
@/stores
"
;
import
ErrorType
=
ygopro
.
StocErrorMsg
.
ErrorType
;
// TODO: 是时候需要一个统一管理国际化文案的模块了
const
DECKERROR_LFLIST
=
0x1
;
const
DECKERROR_OCGONLY
=
0x2
;
const
DECKERROR_TCGONLY
=
0x3
;
const
DECKERROR_UNKNOWNCARD
=
0x4
;
const
DECKERROR_CARDCOUNT
=
0x5
;
const
DECKERROR_MAINCOUNT
=
0x6
;
const
DECKERROR_EXTRACOUNT
=
0x7
;
const
DECKERROR_SIDECOUNT
=
0x8
;
const
DECKERROR_NOTAVAIL
=
0x9
;
export
default
async
function
handleErrorMsg
(
errorMsg
:
ygopro
.
StocErrorMsg
)
{
const
{
error_type
,
error_code
}
=
errorMsg
;
switch
(
error_type
)
{
case
ErrorType
.
JOINERROR
:
{
roomStore
.
errorMsg
=
fetchStrings
(
Region
.
System
,
1403
+
error_code
);
break
;
}
case
ErrorType
.
DECKERROR
:
{
const
flag
=
error_code
>>
28
;
const
code
=
error_code
&&
0xfffffff
;
const
card
=
await
fetchCard
(
code
);
const
baseMsg
=
`卡组非法,请检查:
${
card
.
text
.
name
}
`
;
switch
(
flag
)
{
case
DECKERROR_LFLIST
:
{
roomStore
.
errorMsg
=
baseMsg
+
"
(数量不符合禁限卡表)
"
;
break
;
}
case
DECKERROR_OCGONLY
:
{
roomStore
.
errorMsg
=
baseMsg
+
"
(OCG独有卡,不能在当前设置使用)
"
;
break
;
}
case
DECKERROR_TCGONLY
:
{
roomStore
.
errorMsg
=
baseMsg
+
"
(TCG独有卡,不能在当前设置使用)
"
;
break
;
}
case
DECKERROR_UNKNOWNCARD
:
{
if
(
code
<
100000000
)
{
roomStore
.
errorMsg
=
baseMsg
+
"
(服务器无法识别此卡,可能是服务器未更新)
"
;
}
else
{
roomStore
.
errorMsg
=
baseMsg
+
"
(服务器无法识别此卡,可能是服务器不支持先行卡或此先行卡已正式更新)
"
;
}
break
;
}
case
DECKERROR_CARDCOUNT
:
{
roomStore
.
errorMsg
=
baseMsg
+
"
(数量过多)
"
;
break
;
}
case
DECKERROR_MAINCOUNT
:
{
roomStore
.
errorMsg
=
"
主卡组数量应为40-60张
"
;
break
;
}
case
DECKERROR_EXTRACOUNT
:
{
roomStore
.
errorMsg
=
"
额外卡组数量应为0-15张
"
;
break
;
}
case
DECKERROR_SIDECOUNT
:
{
roomStore
.
errorMsg
=
"
副卡组数量应为0-15张
"
;
break
;
}
case
DECKERROR_NOTAVAIL
:
{
roomStore
.
errorMsg
=
`
${
card
.
text
.
name
}
不允许在当前设置下使用。`
;
break
;
}
default
:
{
roomStore
.
errorMsg
=
fetchStrings
(
Region
.
System
,
1406
);
break
;
}
}
break
;
}
case
ErrorType
.
SIDEERROR
:
{
roomStore
.
errorMsg
=
"
更换副卡组失败,请检查卡片张数是否一致。
"
;
break
;
}
case
ErrorType
.
VERSIONERROR
:
{
roomStore
.
errorMsg
=
"
版本不匹配,请联系技术人员解决
"
;
break
;
}
default
:
break
;
}
}
src/stores/roomStore.ts
View file @
3a9b2d64
...
@@ -41,8 +41,8 @@ class RoomStore implements NeosStore {
...
@@ -41,8 +41,8 @@ class RoomStore implements NeosStore {
observerCount
:
number
=
0
;
// 观战者数量
observerCount
:
number
=
0
;
// 观战者数量
isHost
:
boolean
=
false
;
// 当前玩家是否是房主
isHost
:
boolean
=
false
;
// 当前玩家是否是房主
selfType
:
SelfType
=
0
;
// 当前玩家的类型
selfType
:
SelfType
=
0
;
// 当前玩家的类型
stage
:
RoomStage
=
RoomStage
.
WAITING
;
stage
:
RoomStage
=
RoomStage
.
WAITING
;
errorMsg
?:
string
=
undefined
;
// 错误信息
getMePlayer
()
{
getMePlayer
()
{
return
this
.
players
.
find
((
player
)
=>
player
?.
isMe
);
return
this
.
players
.
find
((
player
)
=>
player
?.
isMe
);
...
@@ -57,6 +57,7 @@ class RoomStore implements NeosStore {
...
@@ -57,6 +57,7 @@ class RoomStore implements NeosStore {
this
.
observerCount
=
0
;
this
.
observerCount
=
0
;
this
.
isHost
=
false
;
this
.
isHost
=
false
;
this
.
stage
=
RoomStage
.
WAITING
;
this
.
stage
=
RoomStage
.
WAITING
;
this
.
errorMsg
=
undefined
;
}
}
}
}
...
...
src/ui/Match/MatchModal.tsx
View file @
3a9b2d64
...
@@ -29,7 +29,7 @@ export const matchStore = proxy<Props>(defaultProps);
...
@@ -29,7 +29,7 @@ export const matchStore = proxy<Props>(defaultProps);
export
const
MatchModal
:
React
.
FC
=
({})
=>
{
export
const
MatchModal
:
React
.
FC
=
({})
=>
{
const
{
open
}
=
useSnapshot
(
matchStore
);
const
{
open
}
=
useSnapshot
(
matchStore
);
const
{
user
}
=
useSnapshot
(
accountStore
);
const
{
user
}
=
useSnapshot
(
accountStore
);
const
{
joined
}
=
useSnapshot
(
roomStore
);
const
{
joined
,
errorMsg
}
=
useSnapshot
(
roomStore
);
const
[
player
,
setPlayer
]
=
useState
(
user
?.
name
??
defaultPlayer
);
const
[
player
,
setPlayer
]
=
useState
(
user
?.
name
??
defaultPlayer
);
const
[
passwd
,
setPasswd
]
=
useState
(
defaultPassword
);
const
[
passwd
,
setPasswd
]
=
useState
(
defaultPassword
);
const
[
server
,
setServer
]
=
useState
(
const
[
server
,
setServer
]
=
useState
(
...
@@ -67,6 +67,15 @@ export const MatchModal: React.FC = ({}) => {
...
@@ -67,6 +67,15 @@ export const MatchModal: React.FC = ({}) => {
}
}
},
[
joined
]);
},
[
joined
]);
useEffect
(()
=>
{
// 出现错误
if
(
errorMsg
!==
undefined
&&
errorMsg
!==
""
)
{
alert
(
errorMsg
);
setConfirmLoading
(
false
);
roomStore
.
errorMsg
=
undefined
;
}
},
[
errorMsg
]);
return
(
return
(
<
Modal
<
Modal
open=
{
open
}
open=
{
open
}
...
...
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