Commit 3e698b65 authored by timel's avatar timel

refactor: place store gen

parent 74e504ea
Pipeline #22582 passed with stages
in 9 minutes and 45 seconds
...@@ -20,39 +20,21 @@ export interface BlockState { ...@@ -20,39 +20,21 @@ export interface BlockState {
disabled: boolean; // 是否被禁用 disabled: boolean; // 是否被禁用
} }
const genPLaces = (n: number): BlockState[] =>
Array.from({ length: n }).map(() => ({
interactivity: undefined,
disabled: false,
}));
export const placeStore = proxy({ export const placeStore = proxy({
inner: { inner: {
[MZONE]: { [MZONE]: {
me: Array.from({ length: 7 }).map( me: genPLaces(7),
() => op: genPLaces(7),
({
interactivity: undefined,
disabled: false,
} as BlockState)
),
op: Array.from({ length: 7 }).map(
() =>
({
interactivity: undefined,
disabled: false,
} as BlockState)
),
}, },
[SZONE]: { [SZONE]: {
me: Array.from({ length: 6 }).map( me: genPLaces(6),
() => op: genPLaces(6),
({
interactivity: undefined,
disabled: false,
} as BlockState)
),
op: Array.from({ length: 6 }).map(
() =>
({
interactivity: undefined,
disabled: false,
} as BlockState)
),
}, },
}, },
set( set(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment