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
841608db
Commit
841608db
authored
Mar 09, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use local state in status.tsx
parent
1ec3eb3a
Pipeline
#20521
passed with stages
in 5 minutes and 59 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
5 deletions
+17
-5
src/reducers/duel/initInfoSlice.ts
src/reducers/duel/initInfoSlice.ts
+4
-0
src/ui/Duel/main.tsx
src/ui/Duel/main.tsx
+10
-2
src/ui/Duel/status.tsx
src/ui/Duel/status.tsx
+3
-3
No files found.
src/reducers/duel/initInfoSlice.ts
View file @
841608db
import
{
PayloadAction
,
CaseReducer
}
from
"
@reduxjs/toolkit
"
;
import
{
RootState
}
from
"
../../store
"
;
import
{
DuelState
}
from
"
./mod
"
;
import
{
judgeSelf
}
from
"
./util
"
;
...
...
@@ -23,3 +24,6 @@ export const infoInitImpl: CaseReducer<
state
.
opInitInfo
=
initInfo
;
}
};
export
const
selectMeInitInfo
=
(
state
:
RootState
)
=>
state
.
duel
.
meInitInfo
;
export
const
selectOpInitInfo
=
(
state
:
RootState
)
=>
state
.
duel
.
opInitInfo
;
src/ui/Duel/main.tsx
View file @
841608db
...
...
@@ -26,6 +26,11 @@ import DuelTimeLine from "./timeLine";
import
{
Row
}
from
"
antd
"
;
import
SendBox
from
"
./sendBox
"
;
import
PlayerStatus
from
"
./status
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
selectMeInitInfo
,
selectOpInitInfo
,
}
from
"
../../reducers/duel/initInfoSlice
"
;
// Ref: https://github.com/brianzinn/react-babylonjs/issues/126
const
NeosDuel
=
()
=>
{
...
...
@@ -44,13 +49,16 @@ const NeosDuel = () => {
init
();
},
[]);
const
meInfo
=
useAppSelector
(
selectMeInitInfo
);
const
opInfo
=
useAppSelector
(
selectOpInitInfo
);
return
(
<>
<
NeosLayout
sider=
{
<
NeosSider
/>
}
header=
{
<
PlayerStatus
/>
}
header=
{
<
PlayerStatus
userName=
"UserName"
hp=
{
opInfo
?.
life
||
0
}
/>
}
content=
{
<
NeosCanvas
/>
}
footer=
{
<
PlayerStatus
/>
}
footer=
{
<
PlayerStatus
userName=
"UserName"
hp=
{
meInfo
?.
life
||
0
}
/>
}
/>
<
CardModal
/>
<
CardListModal
/>
...
...
src/ui/Duel/status.tsx
View file @
841608db
...
...
@@ -5,16 +5,16 @@ import { Avatar, Space, Statistic } from "antd";
const
spaceSize
=
20
;
const
avatarSize
=
40
;
const
PlayerStatus
=
()
=>
(
const
PlayerStatus
=
(
props
:
{
userName
:
string
;
hp
:
number
}
)
=>
(
<
Space
size=
{
spaceSize
}
direction=
"horizontal"
>
<
Space
wrap
size=
{
spaceSize
}
>
<
Avatar
size=
{
avatarSize
}
icon=
{
<
UserOutlined
/>
}
/>
</
Space
>
<
Space
wrap
size=
{
spaceSize
}
>
UserName
{
props
.
userName
}
</
Space
>
<
Space
wrap
size=
{
spaceSize
}
>
<
Statistic
title=
"Hp"
value=
{
4000
}
/>
<
Statistic
title=
"Hp"
value=
{
props
.
hp
}
/>
</
Space
>
<
Space
wrap
size=
{
spaceSize
}
>
<
Avatar
...
...
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