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
d6f16bf0
Commit
d6f16bf0
authored
Aug 06, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix matStore compile error
parent
42a9b174
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
21 deletions
+28
-21
src/stores/matStore/store.ts
src/stores/matStore/store.ts
+27
-18
src/stores/matStore/types.ts
src/stores/matStore/types.ts
+1
-3
No files found.
src/stores/matStore/store.ts
View file @
d6f16bf0
...
...
@@ -3,6 +3,7 @@ import { proxy } from "valtio";
import
{
ygopro
}
from
"
@/api
"
;
import
{
type
NeosStore
}
from
"
../shared
"
;
import
{
ChainSetting
,
InitInfo
,
MatState
}
from
"
./types
"
;
/**
...
...
@@ -53,8 +54,6 @@ const initInfo: MatState["initInfo"] = proxy({
const
initialState
:
Omit
<
MatState
,
"
reset
"
>
=
{
chains
:
[],
chainSetting
:
ChainSetting
.
CHAIN_SMART
,
timeLimits
:
{
// 时间限制
me
:
-
1
,
...
...
@@ -64,9 +63,7 @@ const initialState: Omit<MatState, "reset"> = {
matStore
.
timeLimits
[
getWhom
(
controller
)]
=
time
;
},
},
initInfo
,
selfType
:
ygopro
.
StocTypeChange
.
SelfType
.
UNKNOWN
,
hint
:
{
code
:
-
1
},
currentPlayer
:
-
1
,
...
...
@@ -86,22 +83,28 @@ const initialState: Omit<MatState, "reset"> = {
matStore
.
handResults
[
getWhom
(
controller
)]
=
result
;
},
},
tossResult
:
undefined
,
chainSetting
:
ChainSetting
.
CHAIN_SMART
,
// methods
isMe
,
};
/**
* 💡 决斗盘状态仓库,本文件核心,
* 具体介绍可以点进`MatState`去看
*/
export
const
matStore
:
MatState
=
proxy
<
MatState
>
({
...
initialState
,
reset
()
{
// const resetObj = _.cloneDeep(initialState);
// Object.keys(resetObj).forEach((key) => {
// // @ts-ignore
// matStore[key] = initialState[key];
// });
class
MatStore
implements
MatState
,
NeosStore
{
chains
=
initialState
.
chains
;
chainSetting
=
initialState
.
chainSetting
;
timeLimits
=
initialState
.
timeLimits
;
initInfo
=
initialState
.
initInfo
;
selfType
=
initialState
.
selfType
;
hint
=
initialState
.
hint
;
currentPlayer
=
initialState
.
currentPlayer
;
phase
=
initialState
.
phase
;
isReplay
=
initialState
.
isReplay
;
unimplemented
=
initialState
.
unimplemented
;
handResults
=
initialState
.
handResults
;
tossResult
=
initialState
.
tossResult
;
// methods
isMe
=
initialState
.
isMe
;
reset
():
void
{
this
.
chains
=
[];
this
.
timeLimits
.
me
=
-
1
;
this
.
timeLimits
.
op
=
-
1
;
...
...
@@ -120,8 +123,14 @@ export const matStore: MatState = proxy<MatState>({
this
.
unimplemented
=
0
;
this
.
handResults
.
me
=
0
;
this
.
handResults
.
op
=
0
;
},
});
}
}
/**
* 💡 决斗盘状态仓库,本文件核心,
* 具体介绍可以点进`MatState`去看
*/
export
const
matStore
=
proxy
<
MatStore
>
(
new
MatStore
());
// @ts-ignore 挂到全局,便于调试
window
.
matStore
=
matStore
;
src/stores/matStore/types.ts
View file @
d6f16bf0
import
type
{
ygopro
}
from
"
@/api
"
;
import
{
NeosStore
}
from
"
../shared
"
;
// >>> play mat state >>>
export
interface
BothSide
<
T
>
{
...
...
@@ -11,7 +9,7 @@ export interface BothSide<T> {
of
:
(
controller
:
number
)
=>
T
;
}
export
interface
MatState
extends
NeosStore
{
export
interface
MatState
{
selfType
:
number
;
initInfo
:
BothSide
<
InitInfo
>
&
{
...
...
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