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
baichixing
Neos
Commits
00588b78
Commit
00588b78
authored
Jun 25, 2023
by
timel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: menu
parent
938dea2a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
100 additions
and
83 deletions
+100
-83
src/ui/Duel/PlayMat/LifeBar/index.scss
src/ui/Duel/PlayMat/LifeBar/index.scss
+1
-1
src/ui/Duel/PlayMat/Menu/index.scss
src/ui/Duel/PlayMat/Menu/index.scss
+7
-21
src/ui/Duel/PlayMat/Menu/index.tsx
src/ui/Duel/PlayMat/Menu/index.tsx
+92
-61
No files found.
src/ui/Duel/PlayMat/LifeBar/index.scss
View file @
00588b78
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
.life-bar
{
.life-bar
{
width
:
160px
;
width
:
160px
;
color
:
white
;
color
:
white
;
background-color
:
rgb
(
50
,
50
,
50
)
;
background-color
:
#323232
;
font-family
:
var
(
--
theme-font
);
font-family
:
var
(
--
theme-font
);
border
:
1px
solid
#222
;
border
:
1px
solid
#222
;
padding
:
1rem
;
padding
:
1rem
;
...
...
src/ui/Duel/PlayMat/Menu/index.scss
View file @
00588b78
#controll
er
{
.menu-contain
er
{
position
:
fixed
;
position
:
fixed
;
display
:
flex
;
display
:
flex
;
gap
:
20px
;
// flex-direction: column;
gap
:
6px
;
bottom
:
20px
;
bottom
:
20px
;
right
:
20
px
;
right
:
35
px
;
z-index
:
999
;
z-index
:
999
;
}
background-color
:
#323232
;
padding
:
8px
;
button
{
border-radius
:
6px
;
border-radius
:
8px
;
border
:
1px
solid
transparent
;
padding
:
0
.6em
1
.2em
;
font-size
:
1em
;
font-weight
:
500
;
font-family
:
inherit
;
cursor
:
pointer
;
transition
:
border-color
0
.25s
;
}
button
:hover
{
border-color
:
#646cff
;
}
button
:focus
,
button
:focus-visible
{
outline
:
4px
auto
-
webkit-focus-ring-color
;
}
}
src/ui/Duel/PlayMat/Menu/index.tsx
View file @
00588b78
import
"
./index.scss
"
;
import
"
./index.scss
"
;
import
{
Button
,
Modal
}
from
"
antd
"
;
import
{
Button
,
Tooltip
,
Dropdown
,
type
MenuProps
,
theme
,
Divider
,
Space
,
Popconfirm
,
}
from
"
antd
"
;
import
React
,
{
useState
}
from
"
react
"
;
import
React
,
{
useState
}
from
"
react
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
import
{
fetchStrings
,
StepForwardFilled
,
MessageFilled
,
CloseCircleFilled
,
}
from
"
@ant-design/icons
"
;
import
{
sendSelectBattleCmdResponse
,
sendSelectBattleCmdResponse
,
sendSelectIdleCmdResponse
,
sendSelectIdleCmdResponse
,
sendSurrender
,
ygopro
,
ygopro
,
sendSurrender
,
}
from
"
@/api
"
;
}
from
"
@/api
"
;
import
{
cardStore
,
matStore
}
from
"
@/stores
"
;
import
{
cardStore
,
matStore
}
from
"
@/stores
"
;
import
PhaseType
=
ygopro
.
StocGameMessage
.
MsgNewPhase
.
PhaseType
;
import
PhaseType
=
ygopro
.
StocGameMessage
.
MsgNewPhase
.
PhaseType
;
const
{
phase
}
=
matStore
;
const
{
phase
}
=
matStore
;
const
{
useToken
}
=
theme
;
export
const
Menu
=
()
=>
{
export
const
Menu
=
()
=>
{
const
snapPhase
=
useSnapshot
(
phase
);
const
snapPhase
=
useSnapshot
(
phase
);
const
enableBp
=
snapPhase
.
enableBp
;
const
enableM2
=
snapPhase
.
enableM2
;
const
enableEp
=
snapPhase
.
enableEp
;
const
currentPhase
=
snapPhase
.
currentPhase
;
const
currentPhase
=
snapPhase
.
currentPhase
;
const
[
modalOpen
,
setModalOpen
]
=
useState
(
false
);
const
[
modalOpen
,
setModalOpen
]
=
useState
(
false
);
...
@@ -40,61 +49,83 @@ export const Menu = () => {
...
@@ -40,61 +49,83 @@ export const Menu = () => {
}
}
};
};
const
onBp
=
()
=>
{
const
phaseBind
:
[
PhaseType
,
string
,
number
][]
=
[
sendSelectIdleCmdResponse
(
6
);
[
PhaseType
.
DRAW
,
"
抽卡阶段
"
,
-
1
],
clearAllIdleInteractivities
();
[
PhaseType
.
STANDBY
,
"
准备阶段
"
,
-
1
],
phase
.
enableBp
=
false
;
[
PhaseType
.
MAIN1
,
"
主要阶段 1
"
,
-
1
],
};
[
PhaseType
.
BATTLE
,
"
战斗阶段
"
,
6
],
const
onM2
=
()
=>
{
[
PhaseType
.
BATTLE_START
,
"
战斗开始
"
,
3
],
sendSelectBattleCmdResponse
(
2
);
[
PhaseType
.
BATTLE_STEP
,
"
战斗步骤
"
,
3
],
clearAllIdleInteractivities
();
[
PhaseType
.
DAMAGE
,
"
伤害步骤
"
,
3
],
phase
.
enableM2
=
false
;
[
PhaseType
.
DAMAGE_GAL
,
"
伤害步骤(伤害计算)
"
,
3
],
};
[
PhaseType
.
MAIN2
,
"
主要阶段 2
"
,
2
],
const
onEp
=
()
=>
{
[
PhaseType
.
END
,
"
结束阶段
"
,
response
],
sendSelectIdleCmdResponse
(
response
);
[
PhaseType
.
UNKNOWN
,
"
未知阶段
"
,
response
],
clearAllIdleInteractivities
();
];
phase
.
enableEp
=
false
;
};
const
items
:
MenuProps
[
"
items
"
]
=
phaseBind
.
map
(
const
onSurrender
=
()
=>
{
([
key
,
value
,
response
],
i
)
=>
({
setModalOpen
(
true
);
key
:
i
,
label
:
value
,
disabled
:
currentPhase
>=
Number
(
key
),
onClick
:
()
=>
{
sendSelectIdleCmdResponse
(
response
);
clearAllIdleInteractivities
();
},
})
);
const
{
token
}
=
useToken
();
const
contentStyle
=
{
backgroundColor
:
token
.
colorBgElevated
,
borderRadius
:
token
.
borderRadiusLG
,
boxShadow
:
token
.
boxShadowSecondary
,
};
};
const
menuStyle
=
{
boxShadow
:
"
none
"
,
};
return
(
return
(
<
div
id=
"controller"
>
<>
<
button
disabled=
{
!
enableBp
}
onClick=
{
onBp
}
>
<
div
className=
"menu-container"
>
{
fetchStrings
(
"
!system
"
,
80
)
}
<
Dropdown
</
button
>
menu=
{
{
items
}
}
<
button
disabled=
{
!
enableM2
}
onClick=
{
onM2
}
>
dropdownRender=
{
(
menu
)
=>
(
进入主要阶段2
<
div
style=
{
contentStyle
}
>
</
button
>
{
React
.
cloneElement
(
menu
as
React
.
ReactElement
,
{
<
button
disabled=
{
!
enableEp
}
onClick=
{
onEp
}
>
style
:
menuStyle
,
{
fetchStrings
(
"
!system
"
,
81
)
}
})
}
</
button
>
<
Divider
style=
{
{
margin
:
0
}
}
/>
<
button
onClick=
{
onSurrender
}
>
{
fetchStrings
(
"
!system
"
,
1351
)
}
</
button
>
<
Space
style=
{
{
padding
:
16
}
}
>
请选择要进入的阶段
</
Space
>
<
Modal
</
div
>
title=
"是否确认要投降?"
)
}
open=
{
modalOpen
}
arrow
closable=
{
false
}
>
footer=
{
<
Button
<>
icon=
{
<
StepForwardFilled
style=
{
{
transform
:
"
scale(1.5)
"
}
}
/>
}
<
Button
type=
"text"
onClick=
{
()
=>
{
>
sendSurrender
();
{
phaseBind
.
find
(([
key
])
=>
key
===
currentPhase
)?.[
1
]
}
setModalOpen
(
false
);
</
Button
>
}
}
</
Dropdown
>
>
<
Tooltip
title=
"聊天室"
>
Yes
<
Button
icon=
{
<
MessageFilled
/>
}
type=
"text"
></
Button
>
</
Button
>
</
Tooltip
>
<
Button
<
Tooltip
title=
"投降"
color=
"red"
>
onClick=
{
()
=>
{
<
Popconfirm
setModalOpen
(
false
);
title=
"投降"
}
}
description=
"您确认要投降?"
>
onConfirm=
{
sendSurrender
}
No
okText=
"确认"
</
Button
>
cancelText=
"取消"
</>
placement=
"topRight"
}
arrow
/>
>
</
div
>
<
Button
icon=
{
<
CloseCircleFilled
/>
}
type=
"text"
></
Button
>
</
Popconfirm
>
</
Tooltip
>
</
div
>
</>
);
);
};
};
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