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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
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
MyCard
Neos
Commits
b33802fc
Commit
b33802fc
authored
Jan 12, 2023
by
chechunchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update hands
parent
dc0d0017
Pipeline
#19448
passed with stages
in 5 minutes and 33 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
17 deletions
+14
-17
src/reducers/duel/handsSlice.ts
src/reducers/duel/handsSlice.ts
+12
-15
src/ui/Duel/hands.tsx
src/ui/Duel/hands.tsx
+2
-2
No files found.
src/reducers/duel/handsSlice.ts
View file @
b33802fc
...
...
@@ -8,13 +8,10 @@ import { DuelState } from "./mod";
import
{
RootState
}
from
"
../../store
"
;
import
{
fetchCard
,
CardMeta
}
from
"
../../api/cards
"
;
import
{
judgeSelf
}
from
"
./util
"
;
import
{
CardState
,
Interactivity
}
from
"
./generic
"
;
import
{
Interactivity
,
DuelFieldState
}
from
"
./generic
"
;
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
export
interface
HandState
{
// 注意:手牌的位置顺序是有约束的
hands
:
CardState
[];
}
export
interface
HandState
extends
DuelFieldState
{}
// 增加手牌
export
const
fetchHandsMeta
=
createAsyncThunk
(
...
...
@@ -57,15 +54,15 @@ export const handsCase = (builder: ActionReducerMapBuilder<DuelState>) => {
});
if
(
judgeSelf
(
player
,
state
))
{
if
(
state
.
meHands
)
{
state
.
meHands
.
hands
=
state
.
meHands
.
hands
.
concat
(
cards
);
state
.
meHands
.
inner
=
state
.
meHands
.
inner
.
concat
(
cards
);
}
else
{
state
.
meHands
=
{
hands
:
cards
};
state
.
meHands
=
{
inner
:
cards
};
}
}
else
{
if
(
state
.
opHands
)
{
state
.
opHands
.
hands
=
state
.
opHands
.
hands
.
concat
(
cards
);
state
.
opHands
.
inner
=
state
.
opHands
.
inner
.
concat
(
cards
);
}
else
{
state
.
opHands
=
{
hands
:
cards
};
state
.
opHands
=
{
inner
:
cards
};
}
}
});
...
...
@@ -76,7 +73,7 @@ export const handsCase = (builder: ActionReducerMapBuilder<DuelState>) => {
const
hands
=
judgeSelf
(
player
,
state
)
?
state
.
meHands
:
state
.
opHands
;
if
(
hands
)
{
for
(
let
hand
of
hands
.
hands
)
{
for
(
let
hand
of
hands
.
inner
)
{
for
(
let
meta
of
metas
)
{
if
(
hand
.
occupant
?.
id
===
meta
.
id
)
{
hand
.
occupant
=
meta
;
...
...
@@ -97,7 +94,7 @@ export const clearHandsIdleInteractivityImpl: CaseReducer<
const
hands
=
judgeSelf
(
player
,
state
)
?
state
.
meHands
:
state
.
opHands
;
if
(
hands
)
{
for
(
let
hand
of
hands
.
hands
)
{
for
(
let
hand
of
hands
.
inner
)
{
hand
.
idleInteractivities
=
[];
}
}
...
...
@@ -119,7 +116,7 @@ export const addHandsIdleInteractivityImpl: CaseReducer<
const
sequence
=
action
.
payload
.
sequence
;
const
interactivity
=
action
.
payload
.
interactivity
;
hands
.
hands
[
sequence
].
idleInteractivities
.
push
(
interactivity
);
hands
.
inner
[
sequence
].
idleInteractivities
.
push
(
interactivity
);
}
};
...
...
@@ -133,13 +130,13 @@ export const removeHandImpl: CaseReducer<
const
hands
=
judgeSelf
(
controler
,
state
)
?
state
.
meHands
:
state
.
opHands
;
if
(
hands
)
{
hands
.
hands
=
hands
.
hands
.
filter
(
hands
.
inner
=
hands
.
inner
.
filter
(
(
card
)
=>
card
.
location
.
sequence
!=
sequence
);
}
};
export
const
selectMeHands
=
(
state
:
RootState
)
=>
state
.
duel
.
meHands
||
{
hands
:
[]
};
state
.
duel
.
meHands
||
{
inner
:
[]
};
export
const
selectOpHands
=
(
state
:
RootState
)
=>
state
.
duel
.
opHands
||
{
hands
:
[]
};
state
.
duel
.
opHands
||
{
inner
:
[]
};
src/ui/Duel/hands.tsx
View file @
b33802fc
...
...
@@ -22,9 +22,9 @@ const handShape = CONFIG.HandShape();
const
handRotation
=
CONFIG
.
HandRotation
();
const
Hands
=
()
=>
{
const
meHands
=
useAppSelector
(
selectMeHands
).
hands
;
const
meHands
=
useAppSelector
(
selectMeHands
).
inner
;
const
meHandPositions
=
handPositons
(
0
,
meHands
);
const
opHands
=
useAppSelector
(
selectOpHands
).
hands
;
const
opHands
=
useAppSelector
(
selectOpHands
).
inner
;
const
opHandPositions
=
handPositons
(
1
,
opHands
);
return
(
...
...
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