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
5e1e0834
Commit
5e1e0834
authored
Jan 14, 2023
by
chechunchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove sequence in CardState
parent
d521a1cd
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
60 additions
and
62 deletions
+60
-62
src/reducers/duel/deckSlice.ts
src/reducers/duel/deckSlice.ts
+0
-1
src/reducers/duel/fieldSlice.ts
src/reducers/duel/fieldSlice.ts
+0
-2
src/reducers/duel/generic.ts
src/reducers/duel/generic.ts
+18
-22
src/reducers/duel/handsSlice.ts
src/reducers/duel/handsSlice.ts
+1
-3
src/ui/Duel/field.tsx
src/ui/Duel/field.tsx
+2
-0
src/ui/Duel/fixedSlot.tsx
src/ui/Duel/fixedSlot.tsx
+3
-2
src/ui/Duel/magics.tsx
src/ui/Duel/magics.tsx
+7
-7
src/ui/Duel/monsters.tsx
src/ui/Duel/monsters.tsx
+29
-25
No files found.
src/reducers/duel/deckSlice.ts
View file @
5e1e0834
...
...
@@ -22,7 +22,6 @@ export const initDeckImpl: CaseReducer<
location
:
{
controler
:
player
,
location
:
ygopro
.
CardZone
.
DECK
,
sequence
:
i
,
},
idleInteractivities
:
[],
});
...
...
src/reducers/duel/fieldSlice.ts
View file @
5e1e0834
...
...
@@ -20,7 +20,6 @@ export const initFieldImpl: CaseReducer<DuelState, PayloadAction<number>> = (
inner
:
{
location
:
{
controler
:
player
,
sequence
:
0
,
location
:
ygopro
.
CardZone
.
ONFIELD
,
},
idleInteractivities
:
[],
...
...
@@ -31,7 +30,6 @@ export const initFieldImpl: CaseReducer<DuelState, PayloadAction<number>> = (
inner
:
{
location
:
{
controler
:
player
,
sequence
:
0
,
location
:
ygopro
.
CardZone
.
ONFIELD
,
},
idleInteractivities
:
[],
...
...
src/reducers/duel/generic.ts
View file @
5e1e0834
...
...
@@ -12,7 +12,6 @@ export interface CardState {
location
:
{
controler
:
number
;
location
?:
number
;
sequence
:
number
;
position
?:
ygopro
.
CardPosition
;
overlay_sequence
?:
number
;
};
// 位置信息
...
...
@@ -97,12 +96,11 @@ export function extendOccupant<T extends DuelFieldState>(
position
?:
ygopro
.
CardPosition
)
{
if
(
state
)
{
for
(
const
item
of
state
.
inner
)
{
if
(
item
.
location
.
sequence
==
sequence
)
{
item
.
occupant
=
newMeta
;
if
(
position
)
{
item
.
location
.
position
=
position
;
}
const
target
=
state
.
inner
.
find
((
_
,
idx
)
=>
idx
==
sequence
);
if
(
target
)
{
target
.
occupant
=
newMeta
;
if
(
position
)
{
target
.
location
.
position
=
position
;
}
}
}
...
...
@@ -114,10 +112,9 @@ export function extendMeta<T extends DuelFieldState>(
sequence
:
number
)
{
if
(
state
)
{
for
(
const
item
of
state
.
inner
)
{
if
(
item
.
location
.
sequence
==
sequence
)
{
item
.
occupant
=
newMeta
;
}
const
target
=
state
.
inner
.
find
((
_
,
idx
)
=>
idx
==
sequence
);
if
(
target
)
{
target
.
occupant
=
newMeta
;
}
}
}
...
...
@@ -129,17 +126,16 @@ export function extendPlaceInteractivity<T extends DuelFieldState>(
zone
:
ygopro
.
CardZone
)
{
if
(
state
)
{
for
(
let
item
of
state
.
inner
)
{
if
(
item
.
location
.
sequence
==
sequence
)
{
item
.
placeInteractivities
=
{
interactType
:
InteractType
.
PLACE_SELECTABLE
,
response
:
{
controler
,
zone
,
sequence
,
},
};
}
const
target
=
state
.
inner
.
find
((
_
,
idx
)
=>
idx
==
sequence
);
if
(
target
)
{
target
.
placeInteractivities
=
{
interactType
:
InteractType
.
PLACE_SELECTABLE
,
response
:
{
controler
,
zone
,
sequence
,
},
};
}
}
}
...
...
src/reducers/duel/handsSlice.ts
View file @
5e1e0834
...
...
@@ -130,9 +130,7 @@ export const removeHandImpl: CaseReducer<
const
hands
=
judgeSelf
(
controler
,
state
)
?
state
.
meHands
:
state
.
opHands
;
if
(
hands
)
{
hands
.
inner
=
hands
.
inner
.
filter
(
(
card
)
=>
card
.
location
.
sequence
!=
sequence
);
hands
.
inner
=
hands
.
inner
.
filter
((
_
,
idx
)
=>
idx
!=
sequence
);
}
};
...
...
src/ui/Duel/field.tsx
View file @
5e1e0834
...
...
@@ -14,6 +14,7 @@ const Field = () => {
{
meField
?
(
<
FixedSlot
state=
{
meField
}
sequence=
{
0
}
position=
{
fieldPosition
(
0
)
}
rotation=
{
CONFIG
.
CardSlotRotation
(
false
)
}
/>
...
...
@@ -23,6 +24,7 @@ const Field = () => {
{
opField
?
(
<
FixedSlot
state=
{
opField
}
sequence=
{
0
}
position=
{
fieldPosition
(
1
)
}
rotation=
{
CONFIG
.
CardSlotRotation
(
true
)
}
/>
...
...
src/ui/Duel/fixedSlot.tsx
View file @
5e1e0834
...
...
@@ -18,6 +18,7 @@ const shape = CONFIG.CardSlotShape();
const
FixedSlot
=
(
props
:
{
state
:
CardState
;
sequence
:
number
;
position
:
BABYLON
.
Vector3
;
rotation
:
BABYLON
.
Vector3
;
deffenseRotation
?:
BABYLON
.
Vector3
;
...
...
@@ -67,7 +68,7 @@ const FixedSlot = (props: {
return
(
<
plane
name=
{
`fixedslot-${props.s
tate.location.s
equence}`
}
name=
{
`fixedslot-${props.sequence}`
}
ref=
{
planeRef
}
width=
{
shape
.
width
}
height=
{
shape
.
height
}
...
...
@@ -83,7 +84,7 @@ const FixedSlot = (props: {
edgesColor=
{
edgesColor
}
>
<
standardMaterial
name=
{
`fixedslot-mat-${props.s
tate.location.s
equence}`
}
name=
{
`fixedslot-mat-${props.sequence}`
}
diffuseTexture=
{
props
.
state
.
occupant
?
faceDown
...
...
src/ui/Duel/magics.tsx
View file @
5e1e0834
...
...
@@ -19,21 +19,23 @@ const Magics = () => {
return
(
<>
{
zip
(
meMagics
,
meMagicPositions
).
map
(([
magic
,
position
])
=>
{
{
zip
(
meMagics
,
meMagicPositions
).
map
(([
magic
,
position
]
,
sequence
)
=>
{
return
(
<
FixedSlot
state=
{
magic
}
key=
{
magic
.
location
.
sequence
}
key=
{
sequence
}
sequence=
{
sequence
}
position=
{
position
}
rotation=
{
CONFIG
.
CardSlotRotation
(
false
)
}
/>
);
})
}
{
zip
(
opMagics
,
opMagicPositions
).
map
(([
magic
,
position
])
=>
{
{
zip
(
opMagics
,
opMagicPositions
).
map
(([
magic
,
position
]
,
sequence
)
=>
{
return
(
<
FixedSlot
state=
{
magic
}
key=
{
magic
.
location
.
sequence
}
key=
{
sequence
}
sequence=
{
sequence
}
position=
{
position
}
rotation=
{
CONFIG
.
CardSlotRotation
(
true
)
}
/>
...
...
@@ -49,9 +51,7 @@ const magicPositions = (player: number, magics: CardState[]) => {
const
y
=
shape
.
depth
/
2
+
CONFIG
.
Floating
;
const
z
=
player
==
0
?
-
2.6
:
2.6
;
return
magics
.
map
(
(
magic
)
=>
new
BABYLON
.
Vector3
(
x
(
magic
.
location
.
sequence
),
y
,
z
)
);
return
magics
.
map
((
_
,
sequence
)
=>
new
BABYLON
.
Vector3
(
x
(
sequence
),
y
,
z
));
};
export
default
Magics
;
src/ui/Duel/monsters.tsx
View file @
5e1e0834
...
...
@@ -22,28 +22,34 @@ const Monsters = () => {
return
(
<>
{
zip
(
meMonsters
,
meMonsterPositions
).
map
(([
monster
,
position
],
idx
)
=>
{
return
(
<
FixedSlot
state=
{
monster
}
key=
{
idx
}
position=
{
position
}
rotation=
{
CONFIG
.
CardSlotRotation
(
false
)
}
deffenseRotation=
{
CONFIG
.
CardSlotDefenceRotation
()
}
/>
);
})
}
{
zip
(
opMonsters
,
opMonsterPositions
).
map
(([
monster
,
position
],
idx
)
=>
{
return
(
<
FixedSlot
state=
{
monster
}
key=
{
idx
}
position=
{
position
}
rotation=
{
CONFIG
.
CardSlotRotation
(
true
)
}
deffenseRotation=
{
CONFIG
.
CardSlotDefenceRotation
()
}
/>
);
})
}
{
zip
(
meMonsters
,
meMonsterPositions
).
map
(
([
monster
,
position
],
sequence
)
=>
{
return
(
<
FixedSlot
state=
{
monster
}
key=
{
sequence
}
sequence=
{
sequence
}
position=
{
position
}
rotation=
{
CONFIG
.
CardSlotRotation
(
false
)
}
deffenseRotation=
{
CONFIG
.
CardSlotDefenceRotation
()
}
/>
);
}
)
}
{
zip
(
opMonsters
,
opMonsterPositions
).
map
(
([
monster
,
position
],
sequence
)
=>
{
return
(
<
FixedSlot
state=
{
monster
}
key=
{
sequence
}
sequence=
{
sequence
}
position=
{
position
}
rotation=
{
CONFIG
.
CardSlotRotation
(
true
)
}
deffenseRotation=
{
CONFIG
.
CardSlotDefenceRotation
()
}
/>
);
}
)
}
<
ExtraMonsters
/>
<
ExtraMonsters
/>
</>
...
...
@@ -86,9 +92,7 @@ const monsterPositions = (player: number, monsters: CardState[]) => {
const
y
=
shape
.
depth
/
2
+
CONFIG
.
Floating
;
const
z
=
player
==
0
?
-
1.35
:
1.35
;
return
monsters
.
map
(
(
monster
)
=>
new
BABYLON
.
Vector3
(
x
(
monster
.
location
.
sequence
),
y
,
z
)
);
return
monsters
.
map
((
_
,
sequence
)
=>
new
BABYLON
.
Vector3
(
x
(
sequence
),
y
,
z
));
};
export
default
Monsters
;
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