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
8a848677
Commit
8a848677
authored
Jun 30, 2023
by
chechunchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add handresult hint
parent
7de528a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
3 deletions
+31
-3
src/ui/Duel/Message/HintNotification/index.tsx
src/ui/Duel/Message/HintNotification/index.tsx
+31
-3
No files found.
src/ui/Duel/Message/HintNotification/index.tsx
View file @
8a848677
...
...
@@ -7,7 +7,7 @@ import { useSnapshot } from "valtio";
import
{
fetchStrings
}
from
"
@/api
"
;
import
{
Phase2StringCodeMap
}
from
"
@/common
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
{
matStore
}
from
"
@/stores
"
;
import
{
HandResult
,
matStore
}
from
"
@/stores
"
;
const
style
=
{
borderStyle
:
"
groove
"
,
...
...
@@ -22,9 +22,8 @@ export const HintNotification = () => {
const
snap
=
useSnapshot
(
matStore
);
const
hintState
=
snap
.
hint
;
const
toss
=
snap
.
tossResult
;
const
handResults
=
snap
.
handResults
;
const
currentPhase
=
snap
.
phase
.
currentPhase
;
// const waiting = snap.waiting;
const
result
=
snap
.
result
;
const
[
notify
,
notifyContextHolder
]
=
notification
.
useNotification
({
...
...
@@ -54,6 +53,21 @@ export const HintNotification = () => {
}
},
[
toss
]);
// TODO: I18n
useEffect
(()
=>
{
const
meHand
=
handResults
.
me
;
const
opHand
=
handResults
.
op
;
if
(
meHand
!==
HandResult
.
UNKNOWN
&&
opHand
!==
HandResult
.
UNKNOWN
)
{
notify
.
open
({
message
:
`{我方出示
${
getHandResultText
(
meHand
)}
,对方出示
${
getHandResultText
(
opHand
)}
}`
,
placement
:
"
topLeft
"
,
style
:
style
,
});
}
},
[
handResults
]);
useEffect
(()
=>
{
if
(
currentPhase
)
{
const
message
=
fetchStrings
(
...
...
@@ -117,3 +131,17 @@ export const showWaiting = (open: boolean) => {
}
}
};
// TODO: I18n
function
getHandResultText
(
res
:
HandResult
):
string
{
switch
(
res
)
{
case
HandResult
.
UNKNOWN
:
return
"
[?]
"
;
case
HandResult
.
ROCK
:
return
"
拳头
"
;
case
HandResult
.
PAPER
:
return
"
布
"
;
case
HandResult
.
SCISSOR
:
return
"
剪刀
"
;
}
}
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