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
a35b15b6
Commit
a35b15b6
authored
Aug 15, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finish handleErrorMsg
parent
89cf7e40
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
92 additions
and
5 deletions
+92
-5
src/service/onSocketMessage.ts
src/service/onSocketMessage.ts
+1
-1
src/service/room/errorMsg.ts
src/service/room/errorMsg.ts
+89
-3
src/stores/roomStore.ts
src/stores/roomStore.ts
+2
-1
No files found.
src/service/onSocketMessage.ts
View file @
a35b15b6
...
@@ -90,7 +90,7 @@ export default async function handleSocketMessage(e: MessageEvent) {
...
@@ -90,7 +90,7 @@ export default async function handleSocketMessage(e: MessageEvent) {
break
;
break
;
}
}
case
"
stoc_error_msg
"
:
{
case
"
stoc_error_msg
"
:
{
handleErrorMsg
(
pb
.
stoc_error_msg
);
await
handleErrorMsg
(
pb
.
stoc_error_msg
);
break
;
break
;
}
}
default
:
{
default
:
{
...
...
src/service/room/errorMsg.ts
View file @
a35b15b6
import
{
ygopro
}
from
"
@/api
"
;
import
{
fetchCard
,
fetchStrings
,
Region
,
ygopro
}
from
"
@/api
"
;
import
{
roomStore
}
from
"
@/stores
"
;
import
ErrorType
=
ygopro
.
StocErrorMsg
.
ErrorType
;
export
default
function
handleErrorMsg
(
errorMsg
:
ygopro
.
StocErrorMsg
)
{
// TODO: 是时候需要一个统一管理国际化文案的模块了
console
.
log
(
errorMsg
);
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 @
a35b15b6
...
@@ -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
;
}
}
}
}
...
...
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