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
55f0b27c
Commit
55f0b27c
authored
May 05, 2023
by
chechunchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimize Menu.tsx
parent
e2bf6c92
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
42 deletions
+15
-42
src/ui/Duel/PlayMat/Menu.tsx
src/ui/Duel/PlayMat/Menu.tsx
+15
-42
No files found.
src/ui/Duel/PlayMat/Menu.tsx
View file @
55f0b27c
import
"
@/styles/mat.css
"
;
import
Icon
from
"
@ant-design/icons
"
;
import
{
Button
,
Modal
}
from
"
antd
"
;
import
{
ReactComponent
as
BattleSvg
}
from
"
neos-assets/crossed-swords.svg
"
;
import
{
ReactComponent
as
EpSvg
}
from
"
neos-assets/power-button.svg
"
;
import
{
ReactComponent
as
Main2Svg
}
from
"
neos-assets/sword-in-stone.svg
"
;
import
{
ReactComponent
as
SurrenderSvg
}
from
"
neos-assets/truce.svg
"
;
import
React
,
{
useState
}
from
"
react
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
...
...
@@ -19,23 +14,15 @@ import {
matStore
,
}
from
"
@/stores
"
;
const
IconSize
=
"
150%
"
;
const
PhaseButton
=
(
props
:
{
text
:
string
;
enable
:
boolean
;
onClick
:
()
=>
void
;
icon
?:
React
.
ReactNode
;
})
=>
{
return
(
<
Button
icon=
{
props
.
icon
}
disabled=
{
!
props
.
enable
}
onClick=
{
props
.
onClick
}
size=
"large"
>
<
button
disabled=
{
!
props
.
enable
}
onClick=
{
props
.
onClick
}
>
{
props
.
text
}
</
B
utton
>
</
b
utton
>
);
};
...
...
@@ -61,20 +48,20 @@ export const Menu = () => {
const
onBp
=
()
=>
{
sendSelectIdleCmdResponse
(
6
);
clearAllIdleInteractivities
(
0
);
// 为什么要clear两次?
clearAllIdleInteractivities
(
0
);
clearAllIdleInteractivities
(
1
);
phase
.
enableBp
=
false
;
};
const
onM2
=
()
=>
{
sendSelectBattleCmdResponse
(
2
);
clearAllIdleInteractivities
(
0
);
clearAllIdleInteractivities
(
0
);
clearAllIdleInteractivities
(
1
);
phase
.
enableM2
=
false
;
};
const
onEp
=
()
=>
{
sendSelectIdleCmdResponse
(
response
);
clearAllIdleInteractivities
(
0
);
clearAllIdleInteractivities
(
0
);
clearAllIdleInteractivities
(
1
);
phase
.
enableEp
=
false
;
};
const
onSurrender
=
()
=>
{
...
...
@@ -83,30 +70,16 @@ export const Menu = () => {
return
(
<
div
id=
"controller"
>
<
PhaseButton
icon=
{
<
Icon
component=
{
BattleSvg
}
style=
{
{
fontSize
:
IconSize
}
}
/>
}
enable=
{
enableBp
}
text=
"战斗阶段"
onClick=
{
onBp
}
/>
<
PhaseButton
icon=
{
<
Icon
component=
{
Main2Svg
}
style=
{
{
fontSize
:
IconSize
}
}
/>
}
enable=
{
enableM2
}
text=
"主要阶段2"
onClick=
{
onM2
}
/>
<
PhaseButton
icon=
{
<
Icon
component=
{
EpSvg
}
style=
{
{
fontSize
:
IconSize
}
}
/>
}
enable=
{
enableEp
}
text=
"结束回合"
onClick=
{
onEp
}
/>
<
PhaseButton
icon=
{
<
Icon
component=
{
SurrenderSvg
}
style=
{
{
fontSize
:
IconSize
}
}
/>
}
enable=
{
true
}
text=
"投降"
onClick=
{
onSurrender
}
/>
<
button
disabled=
{
!
enableBp
}
onClick=
{
onBp
}
>
战斗阶段
</
button
>
<
button
disabled=
{
!
enableM2
}
onClick=
{
onM2
}
>
主要阶段2
</
button
>
<
button
disabled=
{
!
enableEp
}
onClick=
{
onEp
}
>
结束回合
</
button
>
<
button
onClick=
{
onSurrender
}
>
投降
</
button
>
<
Modal
title=
"是否确认要投降?"
open=
{
modalOpen
}
...
...
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