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
2549ef0e
Commit
2549ef0e
authored
Jun 17, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update toss.ts
parent
619b2226
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
7 deletions
+18
-7
src/service/duel/toss.ts
src/service/duel/toss.ts
+5
-7
src/stores/matStore/types.ts
src/stores/matStore/types.ts
+2
-0
src/ui/Duel/Message/HintNotification.tsx
src/ui/Duel/Message/HintNotification.tsx
+11
-0
No files found.
src/service/duel/toss.ts
View file @
2549ef0e
import
{
ygopro
}
from
"
@/api
"
;
import
{
fetchStrings
,
ygopro
}
from
"
@/api
"
;
import
{
matStore
}
from
"
@/stores
"
;
import
MsgToss
=
ygopro
.
StocGameMessage
.
MsgToss
;
export
default
(
toss
:
MsgToss
)
=>
{
...
...
@@ -6,13 +7,10 @@ export default (toss: MsgToss) => {
for
(
const
x
of
toss
.
res
)
{
if
(
tossType
==
MsgToss
.
TossType
.
DICE
)
{
console
.
log
(
`骰子结果:
${
x
}
`
)
;
matStore
.
tossResult
=
fetchStrings
(
"
!system
"
,
1624
)
+
x
;
}
else
if
(
tossType
==
MsgToss
.
TossType
.
COIN
)
{
if
(
x
)
{
console
.
log
(
`硬币正面`
);
}
else
{
console
.
log
(
`硬币反面`
);
}
matStore
.
tossResult
=
fetchStrings
(
"
!system
"
,
1623
)
+
fetchStrings
(
"
!system
"
,
60
+
x
);
}
else
{
console
.
log
(
`Unknown tossType =
${
tossType
}
`
);
}
...
...
src/stores/matStore/types.ts
View file @
2549ef0e
...
...
@@ -37,6 +37,8 @@ export interface MatState {
unimplemented
:
number
;
// 未处理的`Message`
tossResult
?:
string
;
// 骰子/硬币结果
/** 根据自己的先后手判断是否是自己 */
isMe
:
(
player
:
number
)
=>
boolean
;
}
...
...
src/ui/Duel/Message/HintNotification.tsx
View file @
2549ef0e
...
...
@@ -17,6 +17,7 @@ const NeosConfig = useConfig();
export
const
HintNotification
=
()
=>
{
const
snap
=
useSnapshot
(
matStore
);
const
hintState
=
snap
.
hint
;
const
toss
=
snap
.
tossResult
;
const
currentPhase
=
snap
.
phase
.
currentPhase
;
const
waiting
=
snap
.
waiting
;
...
...
@@ -35,6 +36,16 @@ export const HintNotification = () => {
}
},
[
hintState
.
msg
]);
useEffect
(()
=>
{
if
(
toss
)
{
api
.
open
({
message
:
`
${
toss
}
`
,
placement
:
"
topLeft
"
,
style
:
style
,
});
}
},
[
toss
]);
useEffect
(()
=>
{
if
(
currentPhase
)
{
const
message
=
fetchStrings
(
...
...
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