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
602ea114
Commit
602ea114
authored
Apr 24, 2023
by
timel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: valtio store logic 81%, mora/waitroom use valtio data source
parent
c2161582
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
22 deletions
+22
-22
src/ui/Mora.tsx
src/ui/Mora.tsx
+9
-10
src/ui/WaitRoom.tsx
src/ui/WaitRoom.tsx
+13
-12
No files found.
src/ui/Mora.tsx
View file @
602ea114
...
@@ -27,17 +27,16 @@ const {
...
@@ -27,17 +27,16 @@ const {
}
=
useConfig
();
}
=
useConfig
();
const
Mora
=
()
=>
{
const
Mora
=
()
=>
{
const
stateMora
=
moraStore
;
const
snapMora
=
useSnapshot
(
moraStore
);
const
snapMora
=
useSnapshot
(
stateMora
);
const
dispatch
=
store
.
dispatch
;
const
dispatch
=
store
.
dispatch
;
const
selectHandAble
=
useAppSelector
(
selectHandSelectAble
);
//
const selectHandAble = useAppSelector(selectHandSelectAble);
const
selectTpAble
=
useAppSelector
(
selectTpSelectAble
);
//
const selectTpAble = useAppSelector(selectTpSelectAble);
const
duelHsStart
=
useAppSelector
(
selectDuelHsStart
);
//
const duelHsStart = useAppSelector(selectDuelHsStart);
//
const selectHandAble = snapMora.selectHandAble;
const
selectHandAble
=
snapMora
.
selectHandAble
;
//
const selectTpAble = snapMora.selectTpAble;
const
selectTpAble
=
snapMora
.
selectTpAble
;
//
const duelHsStart = snapMora.duelStart;
const
duelHsStart
=
snapMora
.
duelStart
;
const
navigate
=
useNavigate
();
const
navigate
=
useNavigate
();
const
{
player
,
passWd
,
ip
}
=
useParams
<
{
const
{
player
,
passWd
,
ip
}
=
useParams
<
{
...
@@ -49,12 +48,12 @@ const Mora = () => {
...
@@ -49,12 +48,12 @@ const Mora = () => {
const
handleSelectMora
=
(
selected
:
string
)
=>
{
const
handleSelectMora
=
(
selected
:
string
)
=>
{
sendHandResult
(
selected
);
sendHandResult
(
selected
);
dispatch
(
unSelectHandAble
());
dispatch
(
unSelectHandAble
());
stateMora
.
selectHandAble
=
false
;
moraStore
.
selectHandAble
=
false
;
};
};
const
handleSelectTp
=
(
isFirst
:
boolean
)
=>
{
const
handleSelectTp
=
(
isFirst
:
boolean
)
=>
{
sendTpResult
(
isFirst
);
sendTpResult
(
isFirst
);
dispatch
(
unSelectTpAble
());
dispatch
(
unSelectTpAble
());
stateMora
.
selectTpAble
=
false
;
moraStore
.
selectTpAble
=
false
;
};
};
useEffect
(()
=>
{
useEffect
(()
=>
{
...
...
src/ui/WaitRoom.tsx
View file @
602ea114
...
@@ -104,20 +104,20 @@ const WaitRoom = () => {
...
@@ -104,20 +104,20 @@ const WaitRoom = () => {
},
[]);
},
[]);
const
dispatch
=
store
.
dispatch
;
const
dispatch
=
store
.
dispatch
;
const
joined
=
useAppSelector
(
selectJoined
);
//
const joined = useAppSelector(selectJoined);
const
chat
=
useAppSelector
(
selectChat
);
//
const chat = useAppSelector(selectChat);
const
isHost
=
useAppSelector
(
selectIsHost
);
//
const isHost = useAppSelector(selectIsHost);
const
player0
=
useAppSelector
(
selectPlayer0
);
//
const player0 = useAppSelector(selectPlayer0);
const
player1
=
useAppSelector
(
selectPlayer1
);
//
const player1 = useAppSelector(selectPlayer1);
const
duelStart
=
useAppSelector
(
selectDuelStart
);
//
const duelStart = useAppSelector(selectDuelStart);
const
[
api
,
contextHolder
]
=
notification
.
useNotification
();
const
[
api
,
contextHolder
]
=
notification
.
useNotification
();
//
const joined = snap.joinStore.value;
const
joined
=
snap
.
joinStore
.
value
;
//
const chat = snap.chatStore.message;
const
chat
=
snap
.
chatStore
.
message
;
//
const isHost = snap.playerStore.isHost;
const
isHost
=
snap
.
playerStore
.
isHost
;
//
const player0 = snap.playerStore.player0;
const
player0
=
snap
.
playerStore
.
player0
;
//
const player1 = snap.playerStore.player1;
const
player1
=
snap
.
playerStore
.
player1
;
//
const duelStart = snap.moraStore.duelStart;
const
duelStart
=
snap
.
moraStore
.
duelStart
;
// FIXME: 这些数据应该从`store`中获取
// FIXME: 这些数据应该从`store`中获取
// TODO: 云卡组
// TODO: 云卡组
...
@@ -163,6 +163,7 @@ const WaitRoom = () => {
...
@@ -163,6 +163,7 @@ const WaitRoom = () => {
await
dispatch
(
await
dispatch
(
initMeExtraDeckMeta
({
controler
:
0
,
codes
:
deck
.
extra
?.
reverse
()
||
[]
})
initMeExtraDeckMeta
({
controler
:
0
,
codes
:
deck
.
extra
?.
reverse
()
||
[]
})
);
);
valtioStore
.
matStore
.
extraDecks
.
of
(
0
).
add
(
deck
.
extra
?.
reverse
()
||
[]);
setChoseDeck
(
true
);
setChoseDeck
(
true
);
};
};
...
...
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