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
f473b3e1
Commit
f473b3e1
authored
Mar 08, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat/ui/hp' into 'main'
use local state in status.tsx See merge request
mycard/Neos!122
parents
1ec3eb3a
841608db
Changes
3
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 @
f473b3e1
import
{
PayloadAction
,
CaseReducer
}
from
"
@reduxjs/toolkit
"
;
import
{
PayloadAction
,
CaseReducer
}
from
"
@reduxjs/toolkit
"
;
import
{
RootState
}
from
"
../../store
"
;
import
{
DuelState
}
from
"
./mod
"
;
import
{
DuelState
}
from
"
./mod
"
;
import
{
judgeSelf
}
from
"
./util
"
;
import
{
judgeSelf
}
from
"
./util
"
;
...
@@ -23,3 +24,6 @@ export const infoInitImpl: CaseReducer<
...
@@ -23,3 +24,6 @@ export const infoInitImpl: CaseReducer<
state
.
opInitInfo
=
initInfo
;
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 @
f473b3e1
...
@@ -26,6 +26,11 @@ import DuelTimeLine from "./timeLine";
...
@@ -26,6 +26,11 @@ import DuelTimeLine from "./timeLine";
import
{
Row
}
from
"
antd
"
;
import
{
Row
}
from
"
antd
"
;
import
SendBox
from
"
./sendBox
"
;
import
SendBox
from
"
./sendBox
"
;
import
PlayerStatus
from
"
./status
"
;
import
PlayerStatus
from
"
./status
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
selectMeInitInfo
,
selectOpInitInfo
,
}
from
"
../../reducers/duel/initInfoSlice
"
;
// Ref: https://github.com/brianzinn/react-babylonjs/issues/126
// Ref: https://github.com/brianzinn/react-babylonjs/issues/126
const
NeosDuel
=
()
=>
{
const
NeosDuel
=
()
=>
{
...
@@ -44,13 +49,16 @@ const NeosDuel = () => {
...
@@ -44,13 +49,16 @@ const NeosDuel = () => {
init
();
init
();
},
[]);
},
[]);
const
meInfo
=
useAppSelector
(
selectMeInitInfo
);
const
opInfo
=
useAppSelector
(
selectOpInitInfo
);
return
(
return
(
<>
<>
<
NeosLayout
<
NeosLayout
sider=
{
<
NeosSider
/>
}
sider=
{
<
NeosSider
/>
}
header=
{
<
PlayerStatus
/>
}
header=
{
<
PlayerStatus
userName=
"UserName"
hp=
{
opInfo
?.
life
||
0
}
/>
}
content=
{
<
NeosCanvas
/>
}
content=
{
<
NeosCanvas
/>
}
footer=
{
<
PlayerStatus
/>
}
footer=
{
<
PlayerStatus
userName=
"UserName"
hp=
{
meInfo
?.
life
||
0
}
/>
}
/>
/>
<
CardModal
/>
<
CardModal
/>
<
CardListModal
/>
<
CardListModal
/>
...
...
src/ui/Duel/status.tsx
View file @
f473b3e1
...
@@ -5,16 +5,16 @@ import { Avatar, Space, Statistic } from "antd";
...
@@ -5,16 +5,16 @@ import { Avatar, Space, Statistic } from "antd";
const
spaceSize
=
20
;
const
spaceSize
=
20
;
const
avatarSize
=
40
;
const
avatarSize
=
40
;
const
PlayerStatus
=
()
=>
(
const
PlayerStatus
=
(
props
:
{
userName
:
string
;
hp
:
number
}
)
=>
(
<
Space
size=
{
spaceSize
}
direction=
"horizontal"
>
<
Space
size=
{
spaceSize
}
direction=
"horizontal"
>
<
Space
wrap
size=
{
spaceSize
}
>
<
Space
wrap
size=
{
spaceSize
}
>
<
Avatar
size=
{
avatarSize
}
icon=
{
<
UserOutlined
/>
}
/>
<
Avatar
size=
{
avatarSize
}
icon=
{
<
UserOutlined
/>
}
/>
</
Space
>
</
Space
>
<
Space
wrap
size=
{
spaceSize
}
>
<
Space
wrap
size=
{
spaceSize
}
>
UserName
{
props
.
userName
}
</
Space
>
</
Space
>
<
Space
wrap
size=
{
spaceSize
}
>
<
Space
wrap
size=
{
spaceSize
}
>
<
Statistic
title=
"Hp"
value=
{
4000
}
/>
<
Statistic
title=
"Hp"
value=
{
props
.
hp
}
/>
</
Space
>
</
Space
>
<
Space
wrap
size=
{
spaceSize
}
>
<
Space
wrap
size=
{
spaceSize
}
>
<
Avatar
<
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