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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
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
MyCard
Neos
Commits
2f59f2df
Commit
2f59f2df
authored
Aug 22, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'optimize/hint' into 'main'
Optimize/hint See merge request
!282
parents
a28e035e
ede54487
Pipeline
#23242
passed with stages
in 11 minutes and 14 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
38 deletions
+17
-38
src/ui/Duel/Message/HintNotification/index.tsx
src/ui/Duel/Message/HintNotification/index.tsx
+10
-38
src/ui/Duel/Message/SelectCardsModal/index.tsx
src/ui/Duel/Message/SelectCardsModal/index.tsx
+6
-0
src/ui/Duel/Message/YesNoModal/index.tsx
src/ui/Duel/Message/YesNoModal/index.tsx
+1
-0
No files found.
src/ui/Duel/Message/HintNotification/index.tsx
View file @
2f59f2df
import
{
message
,
notification
}
from
"
antd
"
;
import
{
message
}
from
"
antd
"
;
import
React
,
{
useEffect
}
from
"
react
"
;
import
React
,
{
useEffect
}
from
"
react
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
...
@@ -9,12 +9,6 @@ import { HandResult, matStore } from "@/stores";
...
@@ -9,12 +9,6 @@ import { HandResult, matStore } from "@/stores";
import
styles
from
"
./index.module.scss
"
;
import
styles
from
"
./index.module.scss
"
;
const
style
=
{
// borderStyle: "groove",
// borderRadius: "8px",
backgroundColor
:
"
#444
"
,
};
const
NeosConfig
=
useConfig
();
const
NeosConfig
=
useConfig
();
let
globalMsgApi
:
ReturnType
<
typeof
message
.
useMessage
>
[
0
]
|
undefined
;
let
globalMsgApi
:
ReturnType
<
typeof
message
.
useMessage
>
[
0
]
|
undefined
;
...
@@ -25,30 +19,19 @@ export const HintNotification = () => {
...
@@ -25,30 +19,19 @@ export const HintNotification = () => {
const
handResults
=
snap
.
handResults
;
const
handResults
=
snap
.
handResults
;
const
currentPhase
=
snap
.
phase
.
currentPhase
;
const
currentPhase
=
snap
.
phase
.
currentPhase
;
const
[
notify
,
notifyContextHolder
]
=
notification
.
useNotification
({
maxCount
:
NeosConfig
.
ui
.
hint
.
maxCount
,
});
const
[
msgApi
,
msgContextHolder
]
=
message
.
useMessage
({
const
[
msgApi
,
msgContextHolder
]
=
message
.
useMessage
({
maxCount
:
NeosConfig
.
ui
.
hint
.
maxCount
,
maxCount
:
NeosConfig
.
ui
.
hint
.
maxCount
,
});
});
globalMsgApi
=
msgApi
;
globalMsgApi
=
msgApi
;
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
hintState
&&
hintState
.
msg
)
{
if
(
hintState
&&
hintState
.
msg
)
{
notify
.
open
({
msgApi
.
info
(
`
${
hintState
.
msg
}
`
);
message
:
`
${
hintState
.
msg
}
`
,
placement
:
"
topLeft
"
,
style
:
style
,
});
}
}
},
[
hintState
.
msg
]);
},
[
hintState
.
msg
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
toss
)
{
if
(
toss
)
{
notify
.
open
({
msgApi
.
info
(
`
${
toss
}
`
);
message
:
`
${
toss
}
`
,
placement
:
"
topLeft
"
,
style
:
style
,
});
}
}
},
[
toss
]);
},
[
toss
]);
...
@@ -57,13 +40,11 @@ export const HintNotification = () => {
...
@@ -57,13 +40,11 @@ export const HintNotification = () => {
const
meHand
=
handResults
.
me
;
const
meHand
=
handResults
.
me
;
const
opHand
=
handResults
.
op
;
const
opHand
=
handResults
.
op
;
if
(
meHand
!==
HandResult
.
UNKNOWN
&&
opHand
!==
HandResult
.
UNKNOWN
)
{
if
(
meHand
!==
HandResult
.
UNKNOWN
&&
opHand
!==
HandResult
.
UNKNOWN
)
{
notify
.
open
({
msgApi
.
info
(
message
:
`{我方出示
${
getHandResultText
(
`{我方出示
${
getHandResultText
(
meHand
)}
,对方出示
${
getHandResultText
(
meHand
,
opHand
,
)}
,对方出示
${
getHandResultText
(
opHand
)}
}`
,
)}
}`
,
placement
:
"
topLeft
"
,
);
style
:
style
,
});
}
}
},
[
handResults
]);
},
[
handResults
]);
...
@@ -73,23 +54,14 @@ export const HintNotification = () => {
...
@@ -73,23 +54,14 @@ export const HintNotification = () => {
Region
.
System
,
Region
.
System
,
Phase2StringCodeMap
.
get
(
currentPhase
)
??
0
,
Phase2StringCodeMap
.
get
(
currentPhase
)
??
0
,
);
);
notify
.
open
({
msgApi
.
info
(
message
);
message
,
placement
:
"
topRight
"
,
style
:
style
,
});
console
.
color
(
"
DeepPink
"
)(
console
.
color
(
"
DeepPink
"
)(
`
${
message
}
(
${
matStore
.
isMe
(
matStore
.
currentPlayer
)
?
"
me
"
:
"
op
"
}
)`
,
`
${
message
}
(
${
matStore
.
isMe
(
matStore
.
currentPlayer
)
?
"
me
"
:
"
op
"
}
)`
,
);
);
}
}
},
[
currentPhase
]);
},
[
currentPhase
]);
return
(
return
<>
{
msgContextHolder
}
</>;
<>
{
notifyContextHolder
}
{
msgContextHolder
}
</>
);
};
};
// 防抖的waiting msg
// 防抖的waiting msg
...
...
src/ui/Duel/Message/SelectCardsModal/index.tsx
View file @
2f59f2df
...
@@ -109,6 +109,12 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
...
@@ -109,6 +109,12 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
disabled
:
!
submitable
,
disabled
:
!
submitable
,
}
}
}
}
open=
{
isOpen
}
open=
{
isOpen
}
afterClose=
{
()
=>
{
// Modal每次展示时都会消费`esHint`和`esSelectHint`,
// 否则这些提示会保留到下一次Modal展示,可能会疑惑玩家
matStore
.
hint
.
esHint
=
undefined
;
matStore
.
hint
.
esSelectHint
=
undefined
;
}
}
footer=
{
footer=
{
<>
<>
{
cancelable
&&
<
Button
onClick=
{
onCancel
}
>
{
cancelText
}
</
Button
>
}
{
cancelable
&&
<
Button
onClick=
{
onCancel
}
>
{
cancelText
}
</
Button
>
}
...
...
src/ui/Duel/Message/YesNoModal/index.tsx
View file @
2f59f2df
...
@@ -26,6 +26,7 @@ export const YesNoModal: React.FC = () => {
...
@@ -26,6 +26,7 @@ export const YesNoModal: React.FC = () => {
title=
{
`${preHintMsg} ${msg}`
}
title=
{
`${preHintMsg} ${msg}`
}
open=
{
isOpen
}
open=
{
isOpen
}
width=
{
400
}
width=
{
400
}
afterClose=
{
()
=>
(
matStore
.
hint
.
esHint
=
undefined
)
}
footer=
{
footer=
{
<>
<>
<
Button
<
Button
...
...
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