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
c598f38d
Commit
c598f38d
authored
Jan 20, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'optimize/ui/monster' into 'main'
Optimize/ui/monster See merge request
!87
parents
9fd24f08
3ad00630
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
94 additions
and
25 deletions
+94
-25
src/reducers/duel/monstersSlice.ts
src/reducers/duel/monstersSlice.ts
+16
-0
src/ui/Duel/monsters.tsx
src/ui/Duel/monsters.tsx
+78
-25
No files found.
src/reducers/duel/monstersSlice.ts
View file @
c598f38d
...
...
@@ -70,6 +70,22 @@ export const initMonstersImpl: CaseReducer<DuelState, PayloadAction<number>> = (
},
idleInteractivities
:
[],
},
{
location
:
{
controler
:
player
,
location
:
ygopro
.
CardZone
.
MZONE
,
sequence
:
5
,
},
idleInteractivities
:
[],
},
{
location
:
{
controler
:
player
,
location
:
ygopro
.
CardZone
.
MZONE
,
sequence
:
6
,
},
idleInteractivities
:
[],
},
],
};
...
...
src/ui/Duel/monsters.tsx
View file @
c598f38d
...
...
@@ -25,7 +25,7 @@ const Monsters = () => {
<>
{
zip
(
meMonsters
,
meMonsterPositions
).
map
(
([
monster
,
position
],
sequence
)
=>
{
return
(
return
sequence
<
5
?
(
<
FixedSlot
state=
{
monster
}
key=
{
sequence
}
...
...
@@ -35,12 +35,14 @@ const Monsters = () => {
deffenseRotation=
{
CONFIG
.
CardSlotDefenceRotation
()
}
clearPlaceInteractivitiesAction=
{
clearMonsterPlaceInteractivities
}
/>
)
:
(
<></>
);
}
)
}
{
zip
(
opMonsters
,
opMonsterPositions
).
map
(
([
monster
,
position
],
sequence
)
=>
{
return
(
return
sequence
<
5
?
(
<
FixedSlot
state=
{
monster
}
key=
{
sequence
}
...
...
@@ -50,41 +52,92 @@ const Monsters = () => {
deffenseRotation=
{
CONFIG
.
CardSlotDefenceRotation
()
}
clearPlaceInteractivitiesAction=
{
clearMonsterPlaceInteractivities
}
/>
)
:
(
<></>
);
}
)
}
<
ExtraMonsters
/>
<
ExtraMonsters
/>
<
ExtraMonsters
meMonsters=
{
meMonsters
}
opMonsters=
{
opMonsters
}
/>
</>
);
};
// TODO: use props and redux
const
ExtraMonsters
=
()
=>
{
const
xs
=
[
-
1.1
,
1
];
const
ExtraMonsters
=
(
props
:
{
meMonsters
:
CardState
[];
opMonsters
:
CardState
[];
})
=>
{
const
shape
=
CONFIG
.
CardSlotShape
();
const
position
=
(
x
:
number
)
=>
new
BABYLON
.
Vector3
(
x
,
shape
.
depth
/
2
+
CONFIG
.
Floating
,
0
);
const
rotation
=
CONFIG
.
CardSlotRotation
(
false
);
const
meLeft
=
props
.
meMonsters
.
find
((
_
,
sequence
)
=>
sequence
==
5
);
const
meRight
=
props
.
meMonsters
.
find
((
_
,
sequence
)
=>
sequence
==
6
);
const
opLeft
=
props
.
opMonsters
.
find
((
_
,
sequence
)
=>
sequence
==
5
);
const
opRight
=
props
.
opMonsters
.
find
((
_
,
sequence
)
=>
sequence
==
6
);
const
leftPosition
=
new
BABYLON
.
Vector3
(
-
1.1
,
shape
.
depth
/
2
+
CONFIG
.
Floating
,
0
);
const
rightPosition
=
new
BABYLON
.
Vector3
(
1.1
,
shape
.
depth
/
2
+
CONFIG
.
Floating
,
0
);
const
meRotation
=
CONFIG
.
CardSlotRotation
(
false
);
const
opRotation
=
CONFIG
.
CardSlotRotation
(
true
);
return
(
<>
{
xs
.
map
((
x
,
idx
)
=>
(
<
plane
name=
{
`extra-monster-${idx}`
}
key=
{
idx
}
position=
{
position
(
x
)
}
rotation=
{
rotation
}
>
<
standardMaterial
name=
{
`extra-monster-mat-${idx}`
}
diffuseTexture=
{
new
BABYLON
.
Texture
(
`http://localhost:3030/images/card_slot.png`
)
}
alpha=
{
0.2
}
></
standardMaterial
>
</
plane
>
))
}
{
meLeft
?
(
<
FixedSlot
state=
{
meLeft
}
sequence=
{
5
}
position=
{
leftPosition
}
rotation=
{
meRotation
}
deffenseRotation=
{
CONFIG
.
CardSlotDefenceRotation
()
}
clearPlaceInteractivitiesAction=
{
clearMonsterPlaceInteractivities
}
/>
)
:
(
<></>
)
}
{
meRight
?
(
<
FixedSlot
state=
{
meRight
}
sequence=
{
6
}
position=
{
rightPosition
}
rotation=
{
meRotation
}
deffenseRotation=
{
CONFIG
.
CardSlotDefenceRotation
()
}
clearPlaceInteractivitiesAction=
{
clearMonsterPlaceInteractivities
}
/>
)
:
(
<></>
)
}
{
opLeft
?
(
<
FixedSlot
state=
{
opLeft
}
sequence=
{
5
}
position=
{
rightPosition
}
rotation=
{
opRotation
}
deffenseRotation=
{
CONFIG
.
CardSlotDefenceRotation
()
}
clearPlaceInteractivitiesAction=
{
clearMonsterPlaceInteractivities
}
/>
)
:
(
<></>
)
}
{
opRight
?
(
<
FixedSlot
state=
{
opRight
}
sequence=
{
6
}
position=
{
leftPosition
}
rotation=
{
opRotation
}
deffenseRotation=
{
CONFIG
.
CardSlotDefenceRotation
()
}
clearPlaceInteractivitiesAction=
{
clearMonsterPlaceInteractivities
}
/>
)
:
(
<></>
)
}
</>
);
};
...
...
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