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
385774df
Commit
385774df
authored
Jul 15, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reset stores when duel end
parent
96426b81
Pipeline
#22695
passed with stages
in 10 minutes and 43 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
8 deletions
+37
-8
src/stores/index.ts
src/stores/index.ts
+12
-0
src/stores/moraStore.ts
src/stores/moraStore.ts
+14
-2
src/ui/Duel/Message/EndModal/index.tsx
src/ui/Duel/Message/EndModal/index.tsx
+11
-6
No files found.
src/stores/index.ts
View file @
385774df
...
...
@@ -26,3 +26,15 @@ devtools(matStore, { name: "mat", enabled: true });
devtools
(
cardStore
,
{
name
:
"
card
"
,
enabled
:
true
});
devtools
(
placeStore
,
{
name
:
"
place
"
,
enabled
:
true
});
devtools
(
replayStore
,
{
name
:
"
replay
"
,
enabled
:
true
});
// 重置所有`Store`
export
const
resetUniverse
=
()
=>
{
cardStore
.
reset
();
chatStore
.
reset
();
joinStore
.
reset
();
matStore
.
reset
();
moraStore
.
reset
();
playerStore
.
reset
();
playerStore
.
reset
();
replayStore
.
reset
();
};
src/stores/moraStore.ts
View file @
385774df
import
{
proxy
}
from
"
valtio
"
;
export
interface
MoraState
{
import
{
NeosStore
}
from
"
./shared
"
;
export
interface
MoraState
extends
NeosStore
{
duelStart
:
boolean
;
selectHandAble
:
boolean
;
selectTpAble
:
boolean
;
}
export
const
moraStore
=
proxy
<
MoraState
>
(
{
const
initialState
=
{
duelStart
:
false
,
selectHandAble
:
false
,
selectTpAble
:
false
,
};
export
const
moraStore
=
proxy
<
MoraState
>
({
...
initialState
,
reset
()
{
Object
.
entries
(
initialState
).
forEach
((
key
)
=>
{
// @ts-ignore
moraStore
[
key
]
=
initialState
[
key
];
});
},
});
src/ui/Duel/Message/EndModal/index.tsx
View file @
385774df
import
"
./index.scss
"
;
import
React
,
{
CSSProperties
}
from
"
react
"
;
import
{
useNavigate
}
from
"
react-router-dom
"
;
import
{
proxy
,
useSnapshot
}
from
"
valtio
"
;
import
{
fetchStrings
}
from
"
@/api
"
;
import
{
matStore
,
replayStore
}
from
"
@/stores
"
;
import
{
matStore
,
replayStore
,
resetUniverse
}
from
"
@/stores
"
;
import
{
NeosModal
}
from
"
../NeosModal
"
;
...
...
@@ -25,6 +26,13 @@ export const EndModal: React.FC = () => {
const
{
isOpen
,
isWin
,
reason
}
=
useSnapshot
(
localStore
);
const
{
isReplay
}
=
useSnapshot
(
matStore
);
const
navigate
=
useNavigate
();
const
onReturn
=
()
=>
{
rs
();
resetUniverse
();
navigate
(
"
/
"
);
};
return
(
<
NeosModal
title=
{
fetchStrings
(
"
!system
"
,
1500
)
}
...
...
@@ -38,12 +46,9 @@ export const EndModal: React.FC = () => {
// download the replay file
window
.
open
(
URL
.
createObjectURL
(
blob
));
}
rs
();
}
}
onCancel=
{
()
=>
{
// TODO: reset all stores, and navigate to home
rs
();
onReturn
();
}
}
onCancel=
{
onReturn
}
>
<
div
className=
"end-container"
>
<
p
...
...
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