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
Hide 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 */
import
{
Omit
}
from
"
@react-spring/web
"
;
import
_
from
"
lodash
"
;
import
{
proxy
}
from
"
valtio
"
;
import
{
ygopro
}
from
"
@/api
"
;
...
...
@@ -41,19 +39,17 @@ const defaultInitInfo = {
extraSize
:
0
,
};
const
initInfo
:
MatState
[
"
initInfo
"
]
=
(()
=>
{
return
proxy
({
me
:
{
...
defaultInitInfo
},
op
:
{
...
defaultInitInfo
},
of
:
(
controller
:
number
)
=>
initInfo
[
getWhom
(
controller
)],
set
:
(
controller
:
number
,
obj
:
Partial
<
InitInfo
>
)
=>
{
initInfo
[
getWhom
(
controller
)]
=
{
...
initInfo
[
getWhom
(
controller
)],
...
obj
,
};
},
});
})();
const
initInfo
:
MatState
[
"
initInfo
"
]
=
proxy
({
me
:
{
...
defaultInitInfo
},
op
:
{
...
defaultInitInfo
},
of
:
(
controller
:
number
)
=>
initInfo
[
getWhom
(
controller
)],
set
:
(
controller
:
number
,
obj
:
Partial
<
InitInfo
>
)
=>
{
initInfo
[
getWhom
(
controller
)]
=
{
...
initInfo
[
getWhom
(
controller
)],
...
obj
,
};
},
});
const
initialState
:
Omit
<
MatState
,
"
reset
"
>
=
{
chains
:
[],
...
...
src/stores/placeStore.ts
View file @
37abfc37
import
{
cloneDeep
}
from
"
lodash-es
"
;
import
{
proxy
}
from
"
valtio
"
;
import
{
ygopro
}
from
"
@/api
"
;
...
...
@@ -68,17 +69,11 @@ class PlaceStore implements NeosStore {
});
}
reset
():
void
{
// this.inner = initialState;
this
.
inner
=
{
[
MZONE
]:
{
me
:
genPLaces
(
7
),
op
:
genPLaces
(
7
),
},
[
SZONE
]:
{
me
:
genPLaces
(
6
),
op
:
genPLaces
(
6
),
},
};
const
resetObj
=
cloneDeep
(
initialState
);
Object
.
keys
(
resetObj
).
forEach
((
key
)
=>
{
// @ts-ignore
placeStore
.
inner
[
key
]
=
resetObj
[
key
];
});
}
}
...
...
src/stores/playerStore.ts
View file @
37abfc37
/* eslint valtio/avoid-this-in-proxy: 0 */
import
_
from
"
lodash
"
;
import
{
cloneDeep
}
from
"
lodash-es
"
;
import
{
proxy
}
from
"
valtio
"
;
import
{
ygopro
}
from
"
@/api
"
;
...
...
@@ -48,7 +48,7 @@ export const playerStore = proxy<PlayerState>({
return
this
.
player0
;
},
reset
()
{
const
resetObj
=
_
.
cloneDeep
(
initialState
);
const
resetObj
=
cloneDeep
(
initialState
);
Object
.
keys
(
resetObj
).
forEach
((
key
)
=>
{
// @ts-ignore
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
"
;
...
...
@@ -17,7 +17,7 @@ interface ReplayPacket {
// 保存对局回放数据的`Store`
class
ReplayStore
implements
NeosStore
{
inner
:
ReplaySpot
[]
=
[]
;
inner
:
ReplaySpot
[]
=
ref
([])
;
record
(
ygoPacket
:
YgoProPacket
)
{
this
.
inner
.
push
({
packet
:
ygoPacket2replayPacket
(
ygoPacket
),
...
...
@@ -27,7 +27,7 @@ class ReplayStore implements NeosStore {
return
this
.
inner
.
map
((
spot
)
=>
spot
.
packet
).
map
(
replayPacket2arrayBuffer
);
}
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 = () => {
// download the replay file
window
.
URL
.
revokeObjectURL
(
url
);
document
.
body
.
removeChild
(
anchorElement
);
}
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