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
b33802fc
Commit
b33802fc
authored
Jan 12, 2023
by
chechunchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update hands
parent
dc0d0017
Changes
2
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";
...
@@ -8,13 +8,10 @@ import { DuelState } from "./mod";
import
{
RootState
}
from
"
../../store
"
;
import
{
RootState
}
from
"
../../store
"
;
import
{
fetchCard
,
CardMeta
}
from
"
../../api/cards
"
;
import
{
fetchCard
,
CardMeta
}
from
"
../../api/cards
"
;
import
{
judgeSelf
}
from
"
./util
"
;
import
{
judgeSelf
}
from
"
./util
"
;
import
{
CardState
,
Interactivity
}
from
"
./generic
"
;
import
{
Interactivity
,
DuelFieldState
}
from
"
./generic
"
;
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
export
interface
HandState
{
export
interface
HandState
extends
DuelFieldState
{}
// 注意:手牌的位置顺序是有约束的
hands
:
CardState
[];
}
// 增加手牌
// 增加手牌
export
const
fetchHandsMeta
=
createAsyncThunk
(
export
const
fetchHandsMeta
=
createAsyncThunk
(
...
@@ -57,15 +54,15 @@ export const handsCase = (builder: ActionReducerMapBuilder<DuelState>) => {
...
@@ -57,15 +54,15 @@ export const handsCase = (builder: ActionReducerMapBuilder<DuelState>) => {
});
});
if
(
judgeSelf
(
player
,
state
))
{
if
(
judgeSelf
(
player
,
state
))
{
if
(
state
.
meHands
)
{
if
(
state
.
meHands
)
{
state
.
meHands
.
hands
=
state
.
meHands
.
hands
.
concat
(
cards
);
state
.
meHands
.
inner
=
state
.
meHands
.
inner
.
concat
(
cards
);
}
else
{
}
else
{
state
.
meHands
=
{
hands
:
cards
};
state
.
meHands
=
{
inner
:
cards
};
}
}
}
else
{
}
else
{
if
(
state
.
opHands
)
{
if
(
state
.
opHands
)
{
state
.
opHands
.
hands
=
state
.
opHands
.
hands
.
concat
(
cards
);
state
.
opHands
.
inner
=
state
.
opHands
.
inner
.
concat
(
cards
);
}
else
{
}
else
{
state
.
opHands
=
{
hands
:
cards
};
state
.
opHands
=
{
inner
:
cards
};
}
}
}
}
});
});
...
@@ -76,7 +73,7 @@ export const handsCase = (builder: ActionReducerMapBuilder<DuelState>) => {
...
@@ -76,7 +73,7 @@ export const handsCase = (builder: ActionReducerMapBuilder<DuelState>) => {
const
hands
=
judgeSelf
(
player
,
state
)
?
state
.
meHands
:
state
.
opHands
;
const
hands
=
judgeSelf
(
player
,
state
)
?
state
.
meHands
:
state
.
opHands
;
if
(
hands
)
{
if
(
hands
)
{
for
(
let
hand
of
hands
.
hands
)
{
for
(
let
hand
of
hands
.
inner
)
{
for
(
let
meta
of
metas
)
{
for
(
let
meta
of
metas
)
{
if
(
hand
.
occupant
?.
id
===
meta
.
id
)
{
if
(
hand
.
occupant
?.
id
===
meta
.
id
)
{
hand
.
occupant
=
meta
;
hand
.
occupant
=
meta
;
...
@@ -97,7 +94,7 @@ export const clearHandsIdleInteractivityImpl: CaseReducer<
...
@@ -97,7 +94,7 @@ export const clearHandsIdleInteractivityImpl: CaseReducer<
const
hands
=
judgeSelf
(
player
,
state
)
?
state
.
meHands
:
state
.
opHands
;
const
hands
=
judgeSelf
(
player
,
state
)
?
state
.
meHands
:
state
.
opHands
;
if
(
hands
)
{
if
(
hands
)
{
for
(
let
hand
of
hands
.
hands
)
{
for
(
let
hand
of
hands
.
inner
)
{
hand
.
idleInteractivities
=
[];
hand
.
idleInteractivities
=
[];
}
}
}
}
...
@@ -119,7 +116,7 @@ export const addHandsIdleInteractivityImpl: CaseReducer<
...
@@ -119,7 +116,7 @@ export const addHandsIdleInteractivityImpl: CaseReducer<
const
sequence
=
action
.
payload
.
sequence
;
const
sequence
=
action
.
payload
.
sequence
;
const
interactivity
=
action
.
payload
.
interactivity
;
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<
...
@@ -133,13 +130,13 @@ export const removeHandImpl: CaseReducer<
const
hands
=
judgeSelf
(
controler
,
state
)
?
state
.
meHands
:
state
.
opHands
;
const
hands
=
judgeSelf
(
controler
,
state
)
?
state
.
meHands
:
state
.
opHands
;
if
(
hands
)
{
if
(
hands
)
{
hands
.
hands
=
hands
.
hands
.
filter
(
hands
.
inner
=
hands
.
inner
.
filter
(
(
card
)
=>
card
.
location
.
sequence
!=
sequence
(
card
)
=>
card
.
location
.
sequence
!=
sequence
);
);
}
}
};
};
export
const
selectMeHands
=
(
state
:
RootState
)
=>
export
const
selectMeHands
=
(
state
:
RootState
)
=>
state
.
duel
.
meHands
||
{
hands
:
[]
};
state
.
duel
.
meHands
||
{
inner
:
[]
};
export
const
selectOpHands
=
(
state
:
RootState
)
=>
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();
...
@@ -22,9 +22,9 @@ const handShape = CONFIG.HandShape();
const
handRotation
=
CONFIG
.
HandRotation
();
const
handRotation
=
CONFIG
.
HandRotation
();
const
Hands
=
()
=>
{
const
Hands
=
()
=>
{
const
meHands
=
useAppSelector
(
selectMeHands
).
hands
;
const
meHands
=
useAppSelector
(
selectMeHands
).
inner
;
const
meHandPositions
=
handPositons
(
0
,
meHands
);
const
meHandPositions
=
handPositons
(
0
,
meHands
);
const
opHands
=
useAppSelector
(
selectOpHands
).
hands
;
const
opHands
=
useAppSelector
(
selectOpHands
).
inner
;
const
opHandPositions
=
handPositons
(
1
,
opHands
);
const
opHandPositions
=
handPositons
(
1
,
opHands
);
return
(
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