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
bee6e416
Commit
bee6e416
authored
Mar 18, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimize
parent
a38b43bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
8 deletions
+14
-8
src/reducers/duel/turnSlice.ts
src/reducers/duel/turnSlice.ts
+3
-2
src/ui/Duel/status.tsx
src/ui/Duel/status.tsx
+11
-6
No files found.
src/reducers/duel/turnSlice.ts
View file @
bee6e416
import
{
PayloadAction
,
CaseReducer
}
from
"
@reduxjs/toolkit
"
;
import
{
RootState
}
from
"
../../store
"
;
import
{
DuelState
}
from
"
./mod
"
;
import
{
judgeSelf
}
from
"
./util
"
;
export
const
newTurnImpl
:
CaseReducer
<
DuelState
,
PayloadAction
<
number
>>
=
(
state
,
...
...
@@ -9,5 +10,5 @@ export const newTurnImpl: CaseReducer<DuelState, PayloadAction<number>> = (
state
.
currentPlayer
=
action
.
payload
;
};
export
const
selectCurrentPlayer
=
(
state
:
RootState
)
=>
state
.
duel
.
currentPlayer
;
export
const
selectCurrentPlayer
IsMe
=
(
state
:
RootState
)
=>
judgeSelf
(
state
.
duel
.
currentPlayer
!
,
state
.
duel
)
;
src/ui/Duel/status.tsx
View file @
bee6e416
...
...
@@ -8,18 +8,23 @@ import {
selectMeInitInfo
,
selectOpInitInfo
,
}
from
"
../../reducers/duel/initInfoSlice
"
;
import
{
selectCurrentPlayerIsMe
}
from
"
../../reducers/duel/turnSlice
"
;
const
Config
=
NeosConfig
.
ui
.
status
;
const
avatarSize
=
40
;
const
ME_VALUE
=
"
myself
"
;
const
OP_VALUE
=
"
opponent
"
;
const
PlayerStatus
=
()
=>
{
const
meInfo
=
useAppSelector
(
selectMeInitInfo
);
const
opInfo
=
useAppSelector
(
selectOpInitInfo
);
const
myTurn
=
useAppSelector
(
selectCurrentPlayerIsMe
);
return
(
<
CheckCard
.
Group
bordered
style=
{
{
height
:
`${NeosConfig.ui.layout.header.height}`
}
}
value=
{
myTurn
?
ME_VALUE
:
OP_VALUE
}
>
<
CheckCard
avatar=
{
...
...
@@ -29,9 +34,9 @@ const PlayerStatus = () => {
icon=
{
<
UserOutlined
/>
}
/>
}
title=
{
`opponent`
}
description=
{
`
H
p: ${opInfo?.life || 0}`
}
value=
"opponent"
title=
{
OP_VALUE
}
description=
{
`
L
p: ${opInfo?.life || 0}`
}
value=
{
OP_VALUE
}
style=
{
{
position
:
"
absolute
"
,
left
:
`${NeosConfig.ui.layout.sider.width}px`
,
...
...
@@ -45,9 +50,9 @@ const PlayerStatus = () => {
icon=
{
<
UserOutlined
/>
}
/>
}
title=
{
`myself`
}
description=
{
`
H
p: ${meInfo?.life || 0}`
}
value=
"myself"
title=
{
ME_VALUE
}
description=
{
`
L
p: ${meInfo?.life || 0}`
}
value=
{
ME_VALUE
}
style=
{
{
position
:
"
absolute
"
,
right
:
"
0px
"
,
...
...
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