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
733c252f
Commit
733c252f
authored
Aug 03, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update placeStore
parent
051fc7f6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
23 deletions
+35
-23
src/service/duel/fieldDisabled.ts
src/service/duel/fieldDisabled.ts
+6
-4
src/service/duel/selectPlace.ts
src/service/duel/selectPlace.ts
+5
-5
src/stores/placeStore.ts
src/stores/placeStore.ts
+24
-14
No files found.
src/service/duel/fieldDisabled.ts
View file @
733c252f
...
...
@@ -7,10 +7,12 @@ export default (fieldDisabled: MsgFieldDisabled) => {
switch
(
action
.
zone
)
{
case
ygopro
.
CardZone
.
MZONE
:
case
ygopro
.
CardZone
.
SZONE
:
placeStore
.
set
(
action
.
zone
,
action
.
controller
,
action
.
sequence
,
{
interactivity
:
undefined
,
disabled
:
action
.
disabled
,
});
const
block
=
placeStore
.
of
(
action
);
if
(
block
)
{
block
.
disabled
=
action
.
disabled
;
}
else
{
console
.
warn
(
"
<FieldDisabled>block is undefined
"
);
}
break
;
default
:
console
.
warn
(
"
<FieldDisabled>zone is not MZONE nor SZONE!
"
);
...
...
src/service/duel/selectPlace.ts
View file @
733c252f
...
...
@@ -13,17 +13,17 @@ export default (selectPlace: MsgSelectPlace) => {
switch
(
place
.
zone
)
{
case
ygopro
.
CardZone
.
MZONE
:
case
ygopro
.
CardZone
.
SZONE
:
placeStore
.
set
(
place
.
zone
,
place
.
controller
,
place
.
sequence
,
{
interactivity
:
{
const
block
=
placeStore
.
of
(
place
);
if
(
block
)
{
block
.
interactivity
=
{
interactType
:
InteractType
.
PLACE_SELECTABLE
,
response
:
{
controller
:
place
.
controller
,
zone
:
place
.
zone
,
sequence
:
place
.
sequence
,
},
},
disabled
:
false
,
});
};
}
break
;
}
}
...
...
src/stores/placeStore.ts
View file @
733c252f
...
...
@@ -15,17 +15,19 @@ export type PlaceInteractivity =
}
>
|
undefined
;
const
{
MZONE
,
SZONE
}
=
ygopro
.
CardZone
;
const
{
MZONE
,
SZONE
,
HAND
,
GRAVE
,
EXTRA
}
=
ygopro
.
CardZone
;
export
interface
BlockState
{
interactivity
?:
PlaceInteractivity
;
// 互动性
disabled
:
boolean
;
// 是否被禁用
chainIndex
:
number
[];
// 当前位置上的连锁序号。YGOPRO和MASTER DUEL的连锁都是和位置绑定的,因此在`PlaceStore`中记录连锁状态。
}
const
genPLaces
=
(
n
:
number
):
BlockState
[]
=>
Array
.
from
({
length
:
n
}).
map
(()
=>
({
interactivity
:
undefined
,
disabled
:
false
,
chainIndex
:
[],
}));
const
initialState
=
{
...
...
@@ -37,27 +39,35 @@ const initialState = {
me
:
genPLaces
(
6
),
op
:
genPLaces
(
6
),
},
[
HAND
]:
{
me
:
[],
op
:
[],
},
[
GRAVE
]:
{
me
:
[],
op
:
[],
},
[
EXTRA
]:
{
me
:
[],
op
:
[],
},
};
class
PlaceStore
implements
NeosStore
{
inner
:
{
[
MZONE
]:
{
me
:
BlockState
[];
op
:
BlockState
[];
};
[
SZONE
]:
{
[
zone
:
number
]:
{
me
:
BlockState
[];
op
:
BlockState
[];
};
}
=
initialState
;
set
(
zone
:
ygopro
.
CardZone
.
MZONE
|
ygopro
.
CardZone
.
SZONE
,
controller
:
number
,
sequence
:
number
,
state
:
BlockState
,
)
{
placeStore
.
inner
[
zone
][
matStore
.
isMe
(
controller
)
?
"
me
"
:
"
op
"
][
sequence
]
=
state
;
of
(
location
:
{
zone
:
ygopro
.
CardZone
;
controller
:
number
;
sequence
:
number
;
}):
BlockState
|
undefined
{
return
placeStore
.
inner
[
location
.
zone
][
matStore
.
isMe
(
location
.
controller
)
?
"
me
"
:
"
op
"
][
location
.
sequence
]
;
}
clearAllInteractivity
()
{
([
"
me
"
,
"
op
"
]
as
const
).
forEach
((
who
)
=>
{
...
...
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