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
a65896ee
Commit
a65896ee
authored
May 25, 2023
by
chechunchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update announce service
parent
1de2b5d6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
5 deletions
+68
-5
src/service/duel/announce.ts
src/service/duel/announce.ts
+65
-4
src/service/duel/gameMsg.ts
src/service/duel/gameMsg.ts
+1
-1
src/stores/messageStore/store.ts
src/stores/messageStore/store.ts
+1
-0
src/stores/messageStore/types.ts
src/stores/messageStore/types.ts
+1
-0
No files found.
src/service/duel/announce.ts
View file @
a65896ee
import
{
ygopro
}
from
"
@/api
"
;
type
MsgAnnounce
=
ygopro
.
StocGameMessage
.
MsgAnnounce
;
import
{
fetchCard
,
fetchStrings
,
getStrings
,
ygopro
}
from
"
@/api
"
;
import
{
messageStore
}
from
"
@/stores
"
;
import
MsgAnnounce
=
ygopro
.
StocGameMessage
.
MsgAnnounce
;
export
default
(
announce
:
MsgAnnounce
)
=>
{
console
.
log
(
announce
);
const
{
announceModal
}
=
messageStore
;
export
default
async
(
announce
:
MsgAnnounce
)
=>
{
const
type_
=
announce
.
announce_type
;
let
min
=
announce
.
min
;
if
(
type_
==
MsgAnnounce
.
AnnounceType
.
Card
||
type_
==
MsgAnnounce
.
AnnounceType
.
Number
)
{
min
=
1
;
}
announceModal
.
min
=
min
;
switch
(
type_
)
{
case
MsgAnnounce
.
AnnounceType
.
RACE
:
{
announceModal
.
title
=
fetchStrings
(
"
!system
"
,
563
);
announceModal
.
options
=
announce
.
options
.
map
((
option
)
=>
({
info
:
fetchStrings
(
"
!system
"
,
1200
+
option
.
code
),
response
:
option
.
response
,
}));
announceModal
.
isOpen
=
true
;
break
;
}
case
MsgAnnounce
.
AnnounceType
.
Attribute
:
{
announceModal
.
title
=
fetchStrings
(
"
!system
"
,
562
);
announceModal
.
options
=
announce
.
options
.
map
((
option
)
=>
({
info
:
fetchStrings
(
"
!system
"
,
1010
+
option
.
code
),
response
:
option
.
response
,
}));
announceModal
.
isOpen
=
true
;
break
;
}
case
MsgAnnounce
.
AnnounceType
.
Card
:
{
announceModal
.
title
=
fetchStrings
(
"
!system
"
,
564
);
announceModal
.
options
=
await
Promise
.
all
(
announce
.
options
.
map
(
async
(
option
)
=>
({
info
:
await
fetchCard
(
option
.
code
).
then
(
(
meta
)
=>
meta
.
text
.
name
??
"
[?]
"
),
response
:
option
.
response
,
}))
);
announceModal
.
isOpen
=
true
;
break
;
}
case
MsgAnnounce
.
AnnounceType
.
Number
:
{
announceModal
.
title
=
fetchStrings
(
"
!system
"
,
565
);
announceModal
.
options
=
announce
.
options
.
map
((
option
)
=>
({
info
:
option
.
code
.
toString
(),
response
:
option
.
response
,
}));
announceModal
.
isOpen
=
true
;
break
;
}
default
:
{
console
.
warn
(
`Unknown announce_type =
${
type_
}
`
);
}
}
};
src/service/duel/gameMsg.ts
View file @
a65896ee
...
...
@@ -272,7 +272,7 @@ export default async function handleGameMsg(pb: ygopro.YgoStocMsg) {
break
;
}
case
"
announce
"
:
{
onAnnounce
(
msg
.
announce
);
await
onAnnounce
(
msg
.
announce
);
break
;
}
...
...
src/stores/messageStore/store.ts
View file @
a65896ee
...
...
@@ -27,6 +27,7 @@ export const messageStore = proxy<ModalState>({
},
announceModal
:
{
isOpen
:
false
,
min
:
1
,
options
:
[],
},
});
...
...
src/stores/messageStore/types.ts
View file @
a65896ee
...
...
@@ -91,6 +91,7 @@ export interface ModalState {
announceModal
:
{
isOpen
:
boolean
;
title
?:
string
;
min
:
number
;
options
:
{
info
:
string
;
response
:
number
;
...
...
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