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
baichixing
Neos
Commits
37abfc37
Commit
37abfc37
authored
Jul 16, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimize
parent
41d4757f
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
31 deletions
+24
-31
src/stores/matStore/store.ts
src/stores/matStore/store.ts
+11
-15
src/stores/placeStore.ts
src/stores/placeStore.ts
+6
-11
src/stores/playerStore.ts
src/stores/playerStore.ts
+2
-2
src/stores/replayStore.ts
src/stores/replayStore.ts
+3
-3
src/ui/Duel/Message/EndModal/index.tsx
src/ui/Duel/Message/EndModal/index.tsx
+2
-0
No files found.
src/stores/matStore/store.ts
View file @
37abfc37
/* eslint valtio/avoid-this-in-proxy: 0 */
/* eslint valtio/avoid-this-in-proxy: 0 */
import
{
Omit
}
from
"
@react-spring/web
"
;
import
_
from
"
lodash
"
;
import
{
proxy
}
from
"
valtio
"
;
import
{
proxy
}
from
"
valtio
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
ygopro
}
from
"
@/api
"
;
...
@@ -41,8 +39,7 @@ const defaultInitInfo = {
...
@@ -41,8 +39,7 @@ const defaultInitInfo = {
extraSize
:
0
,
extraSize
:
0
,
};
};
const
initInfo
:
MatState
[
"
initInfo
"
]
=
(()
=>
{
const
initInfo
:
MatState
[
"
initInfo
"
]
=
proxy
({
return
proxy
({
me
:
{
...
defaultInitInfo
},
me
:
{
...
defaultInitInfo
},
op
:
{
...
defaultInitInfo
},
op
:
{
...
defaultInitInfo
},
of
:
(
controller
:
number
)
=>
initInfo
[
getWhom
(
controller
)],
of
:
(
controller
:
number
)
=>
initInfo
[
getWhom
(
controller
)],
...
@@ -52,8 +49,7 @@ const initInfo: MatState["initInfo"] = (() => {
...
@@ -52,8 +49,7 @@ const initInfo: MatState["initInfo"] = (() => {
...
obj
,
...
obj
,
};
};
},
},
});
});
})();
const
initialState
:
Omit
<
MatState
,
"
reset
"
>
=
{
const
initialState
:
Omit
<
MatState
,
"
reset
"
>
=
{
chains
:
[],
chains
:
[],
...
...
src/stores/placeStore.ts
View file @
37abfc37
import
{
cloneDeep
}
from
"
lodash-es
"
;
import
{
proxy
}
from
"
valtio
"
;
import
{
proxy
}
from
"
valtio
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
ygopro
}
from
"
@/api
"
;
...
@@ -68,17 +69,11 @@ class PlaceStore implements NeosStore {
...
@@ -68,17 +69,11 @@ class PlaceStore implements NeosStore {
});
});
}
}
reset
():
void
{
reset
():
void
{
// this.inner = initialState;
const
resetObj
=
cloneDeep
(
initialState
);
this
.
inner
=
{
Object
.
keys
(
resetObj
).
forEach
((
key
)
=>
{
[
MZONE
]:
{
// @ts-ignore
me
:
genPLaces
(
7
),
placeStore
.
inner
[
key
]
=
resetObj
[
key
];
op
:
genPLaces
(
7
),
});
},
[
SZONE
]:
{
me
:
genPLaces
(
6
),
op
:
genPLaces
(
6
),
},
};
}
}
}
}
...
...
src/stores/playerStore.ts
View file @
37abfc37
/* eslint valtio/avoid-this-in-proxy: 0 */
/* eslint valtio/avoid-this-in-proxy: 0 */
import
_
from
"
lodash
"
;
import
{
cloneDeep
}
from
"
lodash-es
"
;
import
{
proxy
}
from
"
valtio
"
;
import
{
proxy
}
from
"
valtio
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
ygopro
}
from
"
@/api
"
;
...
@@ -48,7 +48,7 @@ export const playerStore = proxy<PlayerState>({
...
@@ -48,7 +48,7 @@ export const playerStore = proxy<PlayerState>({
return
this
.
player0
;
return
this
.
player0
;
},
},
reset
()
{
reset
()
{
const
resetObj
=
_
.
cloneDeep
(
initialState
);
const
resetObj
=
cloneDeep
(
initialState
);
Object
.
keys
(
resetObj
).
forEach
((
key
)
=>
{
Object
.
keys
(
resetObj
).
forEach
((
key
)
=>
{
// @ts-ignore
// @ts-ignore
playerStore
[
key
]
=
resetObj
[
key
];
playerStore
[
key
]
=
resetObj
[
key
];
...
...
src/stores/replayStore.ts
View file @
37abfc37
import
{
proxy
}
from
"
valtio
"
;
import
{
proxy
,
ref
}
from
"
valtio
"
;
import
{
YgoProPacket
}
from
"
@/api/ocgcore/ocgAdapter/packet
"
;
import
{
YgoProPacket
}
from
"
@/api/ocgcore/ocgAdapter/packet
"
;
...
@@ -17,7 +17,7 @@ interface ReplayPacket {
...
@@ -17,7 +17,7 @@ interface ReplayPacket {
// 保存对局回放数据的`Store`
// 保存对局回放数据的`Store`
class
ReplayStore
implements
NeosStore
{
class
ReplayStore
implements
NeosStore
{
inner
:
ReplaySpot
[]
=
[]
;
inner
:
ReplaySpot
[]
=
ref
([])
;
record
(
ygoPacket
:
YgoProPacket
)
{
record
(
ygoPacket
:
YgoProPacket
)
{
this
.
inner
.
push
({
this
.
inner
.
push
({
packet
:
ygoPacket2replayPacket
(
ygoPacket
),
packet
:
ygoPacket2replayPacket
(
ygoPacket
),
...
@@ -27,7 +27,7 @@ class ReplayStore implements NeosStore {
...
@@ -27,7 +27,7 @@ class ReplayStore implements NeosStore {
return
this
.
inner
.
map
((
spot
)
=>
spot
.
packet
).
map
(
replayPacket2arrayBuffer
);
return
this
.
inner
.
map
((
spot
)
=>
spot
.
packet
).
map
(
replayPacket2arrayBuffer
);
}
}
reset
()
{
reset
()
{
this
.
inner
=
[]
;
this
.
inner
.
splice
(
0
)
;
}
}
}
}
...
...
src/ui/Duel/Message/EndModal/index.tsx
View file @
37abfc37
...
@@ -56,6 +56,8 @@ export const EndModal: React.FC = () => {
...
@@ -56,6 +56,8 @@ export const EndModal: React.FC = () => {
// download the replay file
// download the replay file
window
.
URL
.
revokeObjectURL
(
url
);
window
.
URL
.
revokeObjectURL
(
url
);
document
.
body
.
removeChild
(
anchorElement
);
}
}
onReturn
();
onReturn
();
}
}
}
}
...
...
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