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
ec21b1a9
Commit
ec21b1a9
authored
Mar 04, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove src/config
parent
ef116c47
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
101 additions
and
105 deletions
+101
-105
src/config/ui.ts
src/config/ui.ts
+0
-36
src/ui/Duel/cemetery.tsx
src/ui/Duel/cemetery.tsx
+5
-4
src/ui/Duel/deck.tsx
src/ui/Duel/deck.tsx
+5
-4
src/ui/Duel/exclusion.tsx
src/ui/Duel/exclusion.tsx
+5
-4
src/ui/Duel/extraDeck.tsx
src/ui/Duel/extraDeck.tsx
+5
-4
src/ui/Duel/field.tsx
src/ui/Duel/field.tsx
+5
-4
src/ui/Duel/fixedSlot.tsx
src/ui/Duel/fixedSlot.tsx
+10
-5
src/ui/Duel/hands.tsx
src/ui/Duel/hands.tsx
+13
-8
src/ui/Duel/magics.tsx
src/ui/Duel/magics.tsx
+6
-5
src/ui/Duel/main.tsx
src/ui/Duel/main.tsx
+1
-2
src/ui/Duel/monsters.tsx
src/ui/Duel/monsters.tsx
+17
-25
src/ui/Duel/singleSlot.tsx
src/ui/Duel/singleSlot.tsx
+3
-4
src/ui/Duel/util.ts
src/ui/Duel/util.ts
+26
-0
No files found.
src/config/ui.ts
deleted
100644 → 0
View file @
ef116c47
/*
* SimpleDuelPlateImpl的一些配置
*
* */
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
export
const
GroundShape
=
()
=>
{
return
{
width
:
9.9
,
height
:
8
};
};
export
const
CardSlotShape
=
()
=>
{
return
{
width
:
0.8
,
height
:
1
,
depth
:
0.05
};
};
export
const
SingleSlotShape
=
{
width
:
0.8
,
height
:
1
,
depth
:
0.2
};
export
const
CardSlotRotation
=
(
reverse
:
boolean
)
=>
{
return
reverse
?
new
BABYLON
.
Vector3
(
1.55
,
3.1
,
0
)
:
new
BABYLON
.
Vector3
(
1.55
,
0
,
0
);
};
export
const
CardSlotDefenceRotation
=
()
=>
{
return
new
BABYLON
.
Vector3
(
1.55
,
1.55
,
0
);
};
// 浮空
export
const
Floating
=
0.02
;
// 手牌
export
const
HandShape
=
()
=>
{
return
{
width
:
0.8
,
height
:
1
};
};
export
const
HandRotation
=
()
=>
{
return
new
BABYLON
.
Vector3
(
1
,
0
,
0
);
};
export
const
HandHoverScaling
=
()
=>
{
return
new
BABYLON
.
Vector3
(
1.2
,
1.2
,
1
);
};
src/ui/Duel/cemetery.tsx
View file @
ec21b1a9
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
CONFIG
from
"
../../config/ui
"
;
import
{
import
{
selectMeCemetery
,
selectMeCemetery
,
selectOpCemetery
,
selectOpCemetery
,
}
from
"
../../reducers/duel/cemeretySlice
"
;
}
from
"
../../reducers/duel/cemeretySlice
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
SingleSlot
,
{
Depth
}
from
"
./singleSlot
"
;
import
SingleSlot
,
{
Depth
}
from
"
./singleSlot
"
;
import
{
cardSlotRotation
}
from
"
./util
"
;
import
NeosConfig
from
"
../../../neos.config.json
"
;
const
Cemeteries
=
()
=>
{
const
Cemeteries
=
()
=>
{
const
meCemetery
=
useAppSelector
(
selectMeCemetery
).
inner
;
const
meCemetery
=
useAppSelector
(
selectMeCemetery
).
inner
;
...
@@ -16,12 +17,12 @@ const Cemeteries = () => {
...
@@ -16,12 +17,12 @@ const Cemeteries = () => {
<
SingleSlot
<
SingleSlot
state=
{
meCemetery
}
state=
{
meCemetery
}
position=
{
cemeteryPosition
(
0
,
meCemetery
.
length
)
}
position=
{
cemeteryPosition
(
0
,
meCemetery
.
length
)
}
rotation=
{
CONFIG
.
C
ardSlotRotation
(
false
)
}
rotation=
{
c
ardSlotRotation
(
false
)
}
/>
/>
<
SingleSlot
<
SingleSlot
state=
{
opCemetery
}
state=
{
opCemetery
}
position=
{
cemeteryPosition
(
1
,
opCemetery
.
length
)
}
position=
{
cemeteryPosition
(
1
,
opCemetery
.
length
)
}
rotation=
{
CONFIG
.
C
ardSlotRotation
(
true
)
}
rotation=
{
c
ardSlotRotation
(
true
)
}
/>
/>
</>
</>
);
);
...
@@ -29,7 +30,7 @@ const Cemeteries = () => {
...
@@ -29,7 +30,7 @@ const Cemeteries = () => {
const
cemeteryPosition
=
(
player
:
number
,
cemeteryLength
:
number
)
=>
{
const
cemeteryPosition
=
(
player
:
number
,
cemeteryLength
:
number
)
=>
{
const
x
=
player
==
0
?
3.2
:
-
3.2
;
const
x
=
player
==
0
?
3.2
:
-
3.2
;
const
y
=
(
Depth
*
cemeteryLength
)
/
2
+
CONFIG
.
F
loating
;
const
y
=
(
Depth
*
cemeteryLength
)
/
2
+
NeosConfig
.
ui
.
card
.
f
loating
;
const
z
=
player
==
0
?
-
2.0
:
2.0
;
const
z
=
player
==
0
?
-
2.0
:
2.0
;
return
new
BABYLON
.
Vector3
(
x
,
y
,
z
);
return
new
BABYLON
.
Vector3
(
x
,
y
,
z
);
...
...
src/ui/Duel/deck.tsx
View file @
ec21b1a9
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
CONFIG
from
"
../../config/ui
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
selectMeDeck
,
selectOpDeck
}
from
"
../../reducers/duel/deckSlice
"
;
import
{
selectMeDeck
,
selectOpDeck
}
from
"
../../reducers/duel/deckSlice
"
;
import
SingleSlot
,
{
Depth
}
from
"
./singleSlot
"
;
import
SingleSlot
,
{
Depth
}
from
"
./singleSlot
"
;
import
{
cardSlotRotation
}
from
"
./util
"
;
import
NeosConfig
from
"
../../../neos.config.json
"
;
const
CommonDeck
=
()
=>
{
const
CommonDeck
=
()
=>
{
const
meDeck
=
useAppSelector
(
selectMeDeck
).
inner
;
const
meDeck
=
useAppSelector
(
selectMeDeck
).
inner
;
...
@@ -13,12 +14,12 @@ const CommonDeck = () => {
...
@@ -13,12 +14,12 @@ const CommonDeck = () => {
<
SingleSlot
<
SingleSlot
state=
{
meDeck
}
state=
{
meDeck
}
position=
{
deckPosition
(
0
,
meDeck
.
length
)
}
position=
{
deckPosition
(
0
,
meDeck
.
length
)
}
rotation=
{
CONFIG
.
C
ardSlotRotation
(
false
)
}
rotation=
{
c
ardSlotRotation
(
false
)
}
/>
/>
<
SingleSlot
<
SingleSlot
state=
{
opDeck
}
state=
{
opDeck
}
position=
{
deckPosition
(
1
,
opDeck
.
length
)
}
position=
{
deckPosition
(
1
,
opDeck
.
length
)
}
rotation=
{
CONFIG
.
C
ardSlotRotation
(
true
)
}
rotation=
{
c
ardSlotRotation
(
true
)
}
/>
/>
</>
</>
);
);
...
@@ -26,7 +27,7 @@ const CommonDeck = () => {
...
@@ -26,7 +27,7 @@ const CommonDeck = () => {
const
deckPosition
=
(
player
:
number
,
deckLength
:
number
)
=>
{
const
deckPosition
=
(
player
:
number
,
deckLength
:
number
)
=>
{
const
x
=
player
==
0
?
3.2
:
-
3.2
;
const
x
=
player
==
0
?
3.2
:
-
3.2
;
const
y
=
(
Depth
*
deckLength
)
/
2
+
CONFIG
.
F
loating
;
const
y
=
(
Depth
*
deckLength
)
/
2
+
NeosConfig
.
ui
.
card
.
f
loating
;
const
z
=
player
==
0
?
-
3.3
:
3.3
;
const
z
=
player
==
0
?
-
3.3
:
3.3
;
return
new
BABYLON
.
Vector3
(
x
,
y
,
z
);
return
new
BABYLON
.
Vector3
(
x
,
y
,
z
);
...
...
src/ui/Duel/exclusion.tsx
View file @
ec21b1a9
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
CONFIG
from
"
../../config/ui
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
import
{
selectMeExclusion
,
selectMeExclusion
,
selectopExclusion
,
selectopExclusion
,
}
from
"
../../reducers/duel/exclusionSlice
"
;
}
from
"
../../reducers/duel/exclusionSlice
"
;
import
SingleSlot
,
{
Depth
}
from
"
./singleSlot
"
;
import
SingleSlot
,
{
Depth
}
from
"
./singleSlot
"
;
import
NeosConfig
from
"
../../../neos.config.json
"
;
import
{
cardSlotRotation
}
from
"
./util
"
;
const
Exclusion
=
()
=>
{
const
Exclusion
=
()
=>
{
const
meExclusion
=
useAppSelector
(
selectMeExclusion
).
inner
;
const
meExclusion
=
useAppSelector
(
selectMeExclusion
).
inner
;
...
@@ -16,12 +17,12 @@ const Exclusion = () => {
...
@@ -16,12 +17,12 @@ const Exclusion = () => {
<
SingleSlot
<
SingleSlot
state=
{
meExclusion
}
state=
{
meExclusion
}
position=
{
exclusionPosition
(
0
,
meExclusion
.
length
)
}
position=
{
exclusionPosition
(
0
,
meExclusion
.
length
)
}
rotation=
{
CONFIG
.
C
ardSlotRotation
(
false
)
}
rotation=
{
c
ardSlotRotation
(
false
)
}
/>
/>
<
SingleSlot
<
SingleSlot
state=
{
opExclusion
}
state=
{
opExclusion
}
position=
{
exclusionPosition
(
1
,
opExclusion
.
length
)
}
position=
{
exclusionPosition
(
1
,
opExclusion
.
length
)
}
rotation=
{
CONFIG
.
C
ardSlotRotation
(
true
)
}
rotation=
{
c
ardSlotRotation
(
true
)
}
/>
/>
</>
</>
);
);
...
@@ -29,7 +30,7 @@ const Exclusion = () => {
...
@@ -29,7 +30,7 @@ const Exclusion = () => {
const
exclusionPosition
=
(
player
:
number
,
exclusionLength
:
number
)
=>
{
const
exclusionPosition
=
(
player
:
number
,
exclusionLength
:
number
)
=>
{
const
x
=
player
==
0
?
3.2
:
-
3.2
;
const
x
=
player
==
0
?
3.2
:
-
3.2
;
const
y
=
(
Depth
*
exclusionLength
)
/
2
+
CONFIG
.
F
loating
;
const
y
=
(
Depth
*
exclusionLength
)
/
2
+
NeosConfig
.
ui
.
card
.
f
loating
;
const
z
=
player
==
0
?
-
0.7
:
0.7
;
const
z
=
player
==
0
?
-
0.7
:
0.7
;
return
new
BABYLON
.
Vector3
(
x
,
y
,
z
);
return
new
BABYLON
.
Vector3
(
x
,
y
,
z
);
...
...
src/ui/Duel/extraDeck.tsx
View file @
ec21b1a9
import
SingleSlot
,
{
Depth
}
from
"
./singleSlot
"
;
import
SingleSlot
,
{
Depth
}
from
"
./singleSlot
"
;
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
CONFIG
from
"
../../config/ui
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
import
{
selectMeExtraDeck
,
selectMeExtraDeck
,
selectOpExtraDeck
,
selectOpExtraDeck
,
}
from
"
../../reducers/duel/extraDeckSlice
"
;
}
from
"
../../reducers/duel/extraDeckSlice
"
;
import
NeosConfig
from
"
../../../neos.config.json
"
;
import
{
cardSlotRotation
}
from
"
./util
"
;
const
ExtraDeck
=
()
=>
{
const
ExtraDeck
=
()
=>
{
const
meExtraDeck
=
useAppSelector
(
selectMeExtraDeck
).
inner
;
const
meExtraDeck
=
useAppSelector
(
selectMeExtraDeck
).
inner
;
...
@@ -16,12 +17,12 @@ const ExtraDeck = () => {
...
@@ -16,12 +17,12 @@ const ExtraDeck = () => {
<
SingleSlot
<
SingleSlot
state=
{
meExtraDeck
}
state=
{
meExtraDeck
}
position=
{
extraDeckPosition
(
0
,
meExtraDeck
.
length
)
}
position=
{
extraDeckPosition
(
0
,
meExtraDeck
.
length
)
}
rotation=
{
CONFIG
.
C
ardSlotRotation
(
false
)
}
rotation=
{
c
ardSlotRotation
(
false
)
}
/>
/>
<
SingleSlot
<
SingleSlot
state=
{
opExtraDeck
}
state=
{
opExtraDeck
}
position=
{
extraDeckPosition
(
1
,
opExtraDeck
.
length
)
}
position=
{
extraDeckPosition
(
1
,
opExtraDeck
.
length
)
}
rotation=
{
CONFIG
.
C
ardSlotRotation
(
true
)
}
rotation=
{
c
ardSlotRotation
(
true
)
}
/>
/>
</>
</>
);
);
...
@@ -29,7 +30,7 @@ const ExtraDeck = () => {
...
@@ -29,7 +30,7 @@ const ExtraDeck = () => {
const
extraDeckPosition
=
(
player
:
number
,
deckLength
:
number
)
=>
{
const
extraDeckPosition
=
(
player
:
number
,
deckLength
:
number
)
=>
{
const
x
=
player
==
0
?
-
3.3
:
3.3
;
const
x
=
player
==
0
?
-
3.3
:
3.3
;
const
y
=
(
Depth
&
deckLength
)
/
2
+
CONFIG
.
F
loating
;
const
y
=
(
Depth
&
deckLength
)
/
2
+
NeosConfig
.
ui
.
card
.
f
loating
;
const
z
=
player
==
0
?
-
3.3
:
3.3
;
const
z
=
player
==
0
?
-
3.3
:
3.3
;
return
new
BABYLON
.
Vector3
(
x
,
y
,
z
);
return
new
BABYLON
.
Vector3
(
x
,
y
,
z
);
...
...
src/ui/Duel/field.tsx
View file @
ec21b1a9
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
CONFIG
from
"
../../config/ui
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
selectMeMagics
,
selectOpMagics
}
from
"
../../reducers/duel/magicSlice
"
;
import
{
selectMeMagics
,
selectOpMagics
}
from
"
../../reducers/duel/magicSlice
"
;
import
{
clearMagicPlaceInteractivities
}
from
"
../../reducers/duel/mod
"
;
import
{
clearMagicPlaceInteractivities
}
from
"
../../reducers/duel/mod
"
;
import
FixedSlot
from
"
./fixedSlot
"
;
import
FixedSlot
from
"
./fixedSlot
"
;
import
{
Depth
}
from
"
./singleSlot
"
;
import
{
Depth
}
from
"
./singleSlot
"
;
import
NeosConfig
from
"
../../../neos.config.json
"
;
import
{
cardSlotRotation
}
from
"
./util
"
;
const
Field
=
()
=>
{
const
Field
=
()
=>
{
const
meField
=
useAppSelector
(
selectMeMagics
).
inner
.
find
(
const
meField
=
useAppSelector
(
selectMeMagics
).
inner
.
find
(
...
@@ -21,7 +22,7 @@ const Field = () => {
...
@@ -21,7 +22,7 @@ const Field = () => {
state=
{
meField
}
state=
{
meField
}
sequence=
{
0
}
sequence=
{
0
}
position=
{
fieldPosition
(
0
)
}
position=
{
fieldPosition
(
0
)
}
rotation=
{
CONFIG
.
C
ardSlotRotation
(
false
)
}
rotation=
{
c
ardSlotRotation
(
false
)
}
clearPlaceInteractivitiesAction=
{
clearMagicPlaceInteractivities
}
clearPlaceInteractivitiesAction=
{
clearMagicPlaceInteractivities
}
/>
/>
)
:
(
)
:
(
...
@@ -32,7 +33,7 @@ const Field = () => {
...
@@ -32,7 +33,7 @@ const Field = () => {
state=
{
opField
}
state=
{
opField
}
sequence=
{
0
}
sequence=
{
0
}
position=
{
fieldPosition
(
1
)
}
position=
{
fieldPosition
(
1
)
}
rotation=
{
CONFIG
.
C
ardSlotRotation
(
true
)
}
rotation=
{
c
ardSlotRotation
(
true
)
}
clearPlaceInteractivitiesAction=
{
clearMagicPlaceInteractivities
}
clearPlaceInteractivitiesAction=
{
clearMagicPlaceInteractivities
}
/>
/>
)
:
(
)
:
(
...
@@ -44,7 +45,7 @@ const Field = () => {
...
@@ -44,7 +45,7 @@ const Field = () => {
const
fieldPosition
=
(
player
:
number
)
=>
{
const
fieldPosition
=
(
player
:
number
)
=>
{
const
x
=
player
==
0
?
-
3.3
:
3.3
;
const
x
=
player
==
0
?
-
3.3
:
3.3
;
const
y
=
Depth
/
2
+
CONFIG
.
F
loating
;
const
y
=
Depth
/
2
+
NeosConfig
.
ui
.
card
.
f
loating
;
const
z
=
player
==
0
?
-
2.0
:
2.0
;
const
z
=
player
==
0
?
-
2.0
:
2.0
;
return
new
BABYLON
.
Vector3
(
x
,
y
,
z
);
return
new
BABYLON
.
Vector3
(
x
,
y
,
z
);
...
...
src/ui/Duel/fixedSlot.tsx
View file @
ec21b1a9
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
CONFIG
from
"
../../config/ui
"
;
import
{
store
}
from
"
../../store
"
;
import
{
store
}
from
"
../../store
"
;
import
{
CardState
}
from
"
../../reducers/duel/generic
"
;
import
{
CardState
}
from
"
../../reducers/duel/generic
"
;
import
{
useRef
}
from
"
react
"
;
import
{
useRef
}
from
"
react
"
;
...
@@ -16,7 +15,13 @@ import { ActionCreatorWithPayload } from "@reduxjs/toolkit";
...
@@ -16,7 +15,13 @@ import { ActionCreatorWithPayload } from "@reduxjs/toolkit";
import
{
interactTypeToString
}
from
"
./util
"
;
import
{
interactTypeToString
}
from
"
./util
"
;
import
NeosConfig
from
"
../../../neos.config.json
"
;
import
NeosConfig
from
"
../../../neos.config.json
"
;
const
shape
=
CONFIG
.
CardSlotShape
();
const
transform
=
NeosConfig
.
ui
.
card
.
transform
;
const
defenceRotation
=
NeosConfig
.
ui
.
card
.
defenceRotation
;
const
cardDefenceRotation
=
new
BABYLON
.
Vector3
(
defenceRotation
.
x
,
defenceRotation
.
y
,
defenceRotation
.
z
);
const
FixedSlot
=
(
props
:
{
const
FixedSlot
=
(
props
:
{
state
:
CardState
;
state
:
CardState
;
...
@@ -32,7 +37,7 @@ const FixedSlot = (props: {
...
@@ -32,7 +37,7 @@ const FixedSlot = (props: {
props
.
state
.
location
.
position
===
ygopro
.
CardPosition
.
DEFENSE
||
props
.
state
.
location
.
position
===
ygopro
.
CardPosition
.
DEFENSE
||
props
.
state
.
location
.
position
===
ygopro
.
CardPosition
.
FACEUP_DEFENSE
||
props
.
state
.
location
.
position
===
ygopro
.
CardPosition
.
FACEUP_DEFENSE
||
props
.
state
.
location
.
position
===
ygopro
.
CardPosition
.
FACEDOWN_DEFENSE
props
.
state
.
location
.
position
===
ygopro
.
CardPosition
.
FACEDOWN_DEFENSE
?
props
.
deffenseRotation
||
CONFIG
.
CardSlotDefenceRotation
()
?
props
.
deffenseRotation
||
cardDefenceRotation
:
props
.
rotation
;
:
props
.
rotation
;
const
edgesWidth
=
2.0
;
const
edgesWidth
=
2.0
;
const
edgesColor
=
BABYLON
.
Color4
.
FromColor3
(
BABYLON
.
Color3
.
Yellow
());
const
edgesColor
=
BABYLON
.
Color4
.
FromColor3
(
BABYLON
.
Color3
.
Yellow
());
...
@@ -82,8 +87,8 @@ const FixedSlot = (props: {
...
@@ -82,8 +87,8 @@ const FixedSlot = (props: {
<
plane
<
plane
name=
{
`fixedslot-${props.sequence}`
}
name=
{
`fixedslot-${props.sequence}`
}
ref=
{
planeRef
}
ref=
{
planeRef
}
width=
{
shape
.
width
}
width=
{
transform
.
x
}
height=
{
shape
.
height
}
height=
{
transform
.
y
}
position=
{
props
.
position
}
position=
{
props
.
position
}
rotation=
{
rotation
}
rotation=
{
rotation
}
enableEdgesRendering
enableEdgesRendering
...
...
src/ui/Duel/hands.tsx
View file @
ec21b1a9
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
selectMeHands
,
selectOpHands
}
from
"
../../reducers/duel/handsSlice
"
;
import
{
selectMeHands
,
selectOpHands
}
from
"
../../reducers/duel/handsSlice
"
;
import
*
as
CONFIG
from
"
../../config/ui
"
;
import
{
CardState
}
from
"
../../reducers/duel/generic
"
;
import
{
CardState
}
from
"
../../reducers/duel/generic
"
;
import
{
import
{
setCardModalImgUrl
,
setCardModalImgUrl
,
...
@@ -17,10 +16,12 @@ import { useSpring, animated } from "./spring";
...
@@ -17,10 +16,12 @@ import { useSpring, animated } from "./spring";
import
{
zip
,
interactTypeToString
}
from
"
./util
"
;
import
{
zip
,
interactTypeToString
}
from
"
./util
"
;
import
NeosConfig
from
"
../../../neos.config.json
"
;
import
NeosConfig
from
"
../../../neos.config.json
"
;
const
groundShape
=
CONFIG
.
GroundShape
()
;
const
groundShape
=
NeosConfig
.
ui
.
ground
;
const
left
=
-
(
groundShape
.
width
/
2
);
const
left
=
-
(
groundShape
.
width
/
2
);
const
handShape
=
CONFIG
.
HandShape
();
const
handShape
=
NeosConfig
.
ui
.
card
.
transform
;
const
handRotation
=
CONFIG
.
HandRotation
();
const
rotation
=
NeosConfig
.
ui
.
card
.
handRotation
;
const
handRotation
=
new
BABYLON
.
Vector3
(
rotation
.
x
,
rotation
.
y
,
rotation
.
z
);
const
hoverScaling
=
NeosConfig
.
ui
.
card
.
handHoverScaling
;
const
Hands
=
()
=>
{
const
Hands
=
()
=>
{
const
meHands
=
useAppSelector
(
selectMeHands
).
inner
;
const
meHands
=
useAppSelector
(
selectMeHands
).
inner
;
...
@@ -65,7 +66,11 @@ const CHand = (props: {
...
@@ -65,7 +66,11 @@ const CHand = (props: {
rotation
:
BABYLON
.
Vector3
;
rotation
:
BABYLON
.
Vector3
;
cover
:
(
id
:
number
)
=>
string
;
cover
:
(
id
:
number
)
=>
string
;
})
=>
{
})
=>
{
const
hoverScale
=
CONFIG
.
HandHoverScaling
();
const
hoverScale
=
new
BABYLON
.
Vector3
(
hoverScaling
.
x
,
hoverScaling
.
y
,
hoverScaling
.
z
);
const
defaultScale
=
new
BABYLON
.
Vector3
(
1
,
1
,
1
);
const
defaultScale
=
new
BABYLON
.
Vector3
(
1
,
1
,
1
);
const
edgesWidth
=
2.0
;
const
edgesWidth
=
2.0
;
const
edgesColor
=
BABYLON
.
Color4
.
FromColor3
(
BABYLON
.
Color3
.
Yellow
());
const
edgesColor
=
BABYLON
.
Color4
.
FromColor3
(
BABYLON
.
Color3
.
Yellow
());
...
@@ -134,8 +139,8 @@ const CHand = (props: {
...
@@ -134,8 +139,8 @@ const CHand = (props: {
<animated.plane
<animated.plane
name={`
hand
-
$
{
props
.
sequence
}
`}
name={`
hand
-
$
{
props
.
sequence
}
`}
ref={planeRef}
ref={planeRef}
width={handShape.
width
}
width={handShape.
x
}
height={handShape.
height
}
height={handShape.
y
}
scaling={hovered ? hoverScale : defaultScale}
scaling={hovered ? hoverScale : defaultScale}
position={spring.position}
position={spring.position}
rotation={props.rotation}
rotation={props.rotation}
...
@@ -162,7 +167,7 @@ const handPositons = (player: number, hands: CardState[]) => {
...
@@ -162,7 +167,7 @@ const handPositons = (player: number, hands: CardState[]) => {
const gap = groundShape.width / (hands.length - 1);
const gap = groundShape.width / (hands.length - 1);
const x = (idx: number) =>
const x = (idx: number) =>
player == 0 ? left + gap * idx : -left - gap * idx;
player == 0 ? left + gap * idx : -left - gap * idx;
const y = handShape.
height
/ 2;
const y = handShape.
y
/ 2;
const z =
const z =
player == 0 ? -(groundShape.height / 2) - 1 : groundShape.height / 2 + 1;
player == 0 ? -(groundShape.height / 2) - 1 : groundShape.height / 2 + 1;
...
...
src/ui/Duel/magics.tsx
View file @
ec21b1a9
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
CONFIG
from
"
../../config/ui
"
;
import
{
selectMeMagics
,
selectOpMagics
}
from
"
../../reducers/duel/magicSlice
"
;
import
{
selectMeMagics
,
selectOpMagics
}
from
"
../../reducers/duel/magicSlice
"
;
import
{
CardState
}
from
"
../../reducers/duel/generic
"
;
import
{
CardState
}
from
"
../../reducers/duel/generic
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
zip
}
from
"
./util
"
;
import
{
zip
}
from
"
./util
"
;
import
FixedSlot
from
"
./fixedSlot
"
;
import
FixedSlot
from
"
./fixedSlot
"
;
import
{
clearMagicPlaceInteractivities
}
from
"
../../reducers/duel/mod
"
;
import
{
clearMagicPlaceInteractivities
}
from
"
../../reducers/duel/mod
"
;
import
NeosConfig
from
"
../../../neos.config.json
"
;
import
{
cardSlotRotation
}
from
"
./util
"
;
// TODO: use config
// TODO: use config
const
left
=
-
2.15
;
const
left
=
-
2.15
;
const
gap
=
1.05
;
const
gap
=
1.05
;
const
shape
=
CONFIG
.
CardSlotShape
()
;
const
transform
=
NeosConfig
.
ui
.
card
.
transform
;
const
Magics
=
()
=>
{
const
Magics
=
()
=>
{
const
meMagics
=
useAppSelector
(
selectMeMagics
).
inner
;
const
meMagics
=
useAppSelector
(
selectMeMagics
).
inner
;
...
@@ -29,7 +30,7 @@ const Magics = () => {
...
@@ -29,7 +30,7 @@ const Magics = () => {
key=
{
sequence
}
key=
{
sequence
}
sequence=
{
sequence
}
sequence=
{
sequence
}
position=
{
position
}
position=
{
position
}
rotation=
{
CONFIG
.
C
ardSlotRotation
(
false
)
}
rotation=
{
c
ardSlotRotation
(
false
)
}
clearPlaceInteractivitiesAction=
{
clearMagicPlaceInteractivities
}
clearPlaceInteractivitiesAction=
{
clearMagicPlaceInteractivities
}
/>
/>
);
);
...
@@ -43,7 +44,7 @@ const Magics = () => {
...
@@ -43,7 +44,7 @@ const Magics = () => {
key=
{
sequence
}
key=
{
sequence
}
sequence=
{
sequence
}
sequence=
{
sequence
}
position=
{
position
}
position=
{
position
}
rotation=
{
CONFIG
.
C
ardSlotRotation
(
true
)
}
rotation=
{
c
ardSlotRotation
(
true
)
}
clearPlaceInteractivitiesAction=
{
clearMagicPlaceInteractivities
}
clearPlaceInteractivitiesAction=
{
clearMagicPlaceInteractivities
}
/>
/>
);
);
...
@@ -55,7 +56,7 @@ const Magics = () => {
...
@@ -55,7 +56,7 @@ const Magics = () => {
const
magicPositions
=
(
player
:
number
,
magics
:
CardState
[])
=>
{
const
magicPositions
=
(
player
:
number
,
magics
:
CardState
[])
=>
{
const
x
=
(
sequence
:
number
)
=>
const
x
=
(
sequence
:
number
)
=>
player
==
0
?
left
+
gap
*
sequence
:
-
left
-
gap
*
sequence
;
player
==
0
?
left
+
gap
*
sequence
:
-
left
-
gap
*
sequence
;
const
y
=
shape
.
depth
/
2
+
CONFIG
.
F
loating
;
const
y
=
transform
.
x
/
2
+
NeosConfig
.
ui
.
card
.
f
loating
;
const
z
=
player
==
0
?
-
2.6
:
2.6
;
const
z
=
player
==
0
?
-
2.6
:
2.6
;
return
magics
.
map
((
_
,
sequence
)
=>
new
BABYLON
.
Vector3
(
x
(
sequence
),
y
,
z
));
return
magics
.
map
((
_
,
sequence
)
=>
new
BABYLON
.
Vector3
(
x
(
sequence
),
y
,
z
));
...
...
src/ui/Duel/main.tsx
View file @
ec21b1a9
...
@@ -2,7 +2,6 @@ import React, { useEffect, useRef } from "react";
...
@@ -2,7 +2,6 @@ import React, { useEffect, useRef } from "react";
import
{
Engine
,
Scene
}
from
"
react-babylonjs
"
;
import
{
Engine
,
Scene
}
from
"
react-babylonjs
"
;
import
{
ReactReduxContext
,
Provider
}
from
"
react-redux
"
;
import
{
ReactReduxContext
,
Provider
}
from
"
react-redux
"
;
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
CONFIG
from
"
../../config/ui
"
;
import
Hands
from
"
./hands
"
;
import
Hands
from
"
./hands
"
;
import
Monsters
from
"
./monsters
"
;
import
Monsters
from
"
./monsters
"
;
import
CardModal
from
"
./cardModal
"
;
import
CardModal
from
"
./cardModal
"
;
...
@@ -94,7 +93,7 @@ const Light = () => (
...
@@ -94,7 +93,7 @@ const Light = () => (
);
);
const
Ground
=
()
=>
{
const
Ground
=
()
=>
{
const
shape
=
CONFIG
.
GroundShape
()
;
const
shape
=
NeosConfig
.
ui
.
ground
;
const
texture
=
new
BABYLON
.
Texture
(
`
${
NeosConfig
.
assetsPath
}
/newfield.png`
);
const
texture
=
new
BABYLON
.
Texture
(
`
${
NeosConfig
.
assetsPath
}
/newfield.png`
);
texture
.
hasAlpha
=
true
;
texture
.
hasAlpha
=
true
;
...
...
src/ui/Duel/monsters.tsx
View file @
ec21b1a9
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
CONFIG
from
"
../../config/ui
"
;
import
{
CardState
}
from
"
../../reducers/duel/generic
"
;
import
{
CardState
}
from
"
../../reducers/duel/generic
"
;
import
"
react-babylonjs
"
;
import
"
react-babylonjs
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
...
@@ -10,8 +9,11 @@ import {
...
@@ -10,8 +9,11 @@ import {
import
{
zip
}
from
"
./util
"
;
import
{
zip
}
from
"
./util
"
;
import
FixedSlot
from
"
./fixedSlot
"
;
import
FixedSlot
from
"
./fixedSlot
"
;
import
{
clearMonsterPlaceInteractivities
}
from
"
../../reducers/duel/mod
"
;
import
{
clearMonsterPlaceInteractivities
}
from
"
../../reducers/duel/mod
"
;
import
NeosConfig
from
"
../../../neos.config.json
"
;
import
{
cardSlotRotation
,
cardSlotDefenceRotation
}
from
"
./util
"
;
const
shape
=
CONFIG
.
CardSlotShape
();
const
transform
=
NeosConfig
.
ui
.
card
.
transform
;
const
floating
=
NeosConfig
.
ui
.
card
.
floating
;
const
left
=
-
2.15
;
// TODO: config
const
left
=
-
2.15
;
// TODO: config
const
gap
=
1.05
;
const
gap
=
1.05
;
...
@@ -31,8 +33,8 @@ const Monsters = () => {
...
@@ -31,8 +33,8 @@ const Monsters = () => {
key=
{
sequence
}
key=
{
sequence
}
sequence=
{
sequence
}
sequence=
{
sequence
}
position=
{
position
}
position=
{
position
}
rotation=
{
CONFIG
.
C
ardSlotRotation
(
false
)
}
rotation=
{
c
ardSlotRotation
(
false
)
}
deffenseRotation=
{
CONFIG
.
C
ardSlotDefenceRotation
()
}
deffenseRotation=
{
c
ardSlotDefenceRotation
()
}
clearPlaceInteractivitiesAction=
{
clearMonsterPlaceInteractivities
}
clearPlaceInteractivitiesAction=
{
clearMonsterPlaceInteractivities
}
/>
/>
))
}
))
}
...
@@ -44,8 +46,8 @@ const Monsters = () => {
...
@@ -44,8 +46,8 @@ const Monsters = () => {
key=
{
sequence
}
key=
{
sequence
}
sequence=
{
sequence
}
sequence=
{
sequence
}
position=
{
position
}
position=
{
position
}
rotation=
{
CONFIG
.
C
ardSlotRotation
(
true
)
}
rotation=
{
c
ardSlotRotation
(
true
)
}
deffenseRotation=
{
CONFIG
.
C
ardSlotDefenceRotation
()
}
deffenseRotation=
{
c
ardSlotDefenceRotation
()
}
clearPlaceInteractivitiesAction=
{
clearMonsterPlaceInteractivities
}
clearPlaceInteractivitiesAction=
{
clearMonsterPlaceInteractivities
}
/>
/>
))
}
))
}
...
@@ -59,26 +61,16 @@ const ExtraMonsters = (props: {
...
@@ -59,26 +61,16 @@ const ExtraMonsters = (props: {
meMonsters
:
CardState
[];
meMonsters
:
CardState
[];
opMonsters
:
CardState
[];
opMonsters
:
CardState
[];
})
=>
{
})
=>
{
const
shape
=
CONFIG
.
CardSlotShape
();
const
meLeft
=
props
.
meMonsters
.
find
((
_
,
sequence
)
=>
sequence
==
5
);
const
meLeft
=
props
.
meMonsters
.
find
((
_
,
sequence
)
=>
sequence
==
5
);
const
meRight
=
props
.
meMonsters
.
find
((
_
,
sequence
)
=>
sequence
==
6
);
const
meRight
=
props
.
meMonsters
.
find
((
_
,
sequence
)
=>
sequence
==
6
);
const
opLeft
=
props
.
opMonsters
.
find
((
_
,
sequence
)
=>
sequence
==
5
);
const
opLeft
=
props
.
opMonsters
.
find
((
_
,
sequence
)
=>
sequence
==
5
);
const
opRight
=
props
.
opMonsters
.
find
((
_
,
sequence
)
=>
sequence
==
6
);
const
opRight
=
props
.
opMonsters
.
find
((
_
,
sequence
)
=>
sequence
==
6
);
const
leftPosition
=
new
BABYLON
.
Vector3
(
const
leftPosition
=
new
BABYLON
.
Vector3
(
-
1.1
,
transform
.
z
/
2
+
floating
,
0
);
-
1.1
,
const
rightPosition
=
new
BABYLON
.
Vector3
(
1.1
,
transform
.
z
/
2
+
floating
,
0
);
shape
.
depth
/
2
+
CONFIG
.
Floating
,
0
);
const
rightPosition
=
new
BABYLON
.
Vector3
(
1.1
,
shape
.
depth
/
2
+
CONFIG
.
Floating
,
0
);
const
meRotation
=
CONFIG
.
C
ardSlotRotation
(
false
);
const
meRotation
=
c
ardSlotRotation
(
false
);
const
opRotation
=
CONFIG
.
C
ardSlotRotation
(
true
);
const
opRotation
=
c
ardSlotRotation
(
true
);
return
(
return
(
<>
<>
...
@@ -88,7 +80,7 @@ const ExtraMonsters = (props: {
...
@@ -88,7 +80,7 @@ const ExtraMonsters = (props: {
sequence=
{
5
}
sequence=
{
5
}
position=
{
leftPosition
}
position=
{
leftPosition
}
rotation=
{
meRotation
}
rotation=
{
meRotation
}
deffenseRotation=
{
CONFIG
.
C
ardSlotDefenceRotation
()
}
deffenseRotation=
{
c
ardSlotDefenceRotation
()
}
clearPlaceInteractivitiesAction=
{
clearMonsterPlaceInteractivities
}
clearPlaceInteractivitiesAction=
{
clearMonsterPlaceInteractivities
}
/>
/>
)
:
(
)
:
(
...
@@ -100,7 +92,7 @@ const ExtraMonsters = (props: {
...
@@ -100,7 +92,7 @@ const ExtraMonsters = (props: {
sequence=
{
6
}
sequence=
{
6
}
position=
{
rightPosition
}
position=
{
rightPosition
}
rotation=
{
meRotation
}
rotation=
{
meRotation
}
deffenseRotation=
{
CONFIG
.
C
ardSlotDefenceRotation
()
}
deffenseRotation=
{
c
ardSlotDefenceRotation
()
}
clearPlaceInteractivitiesAction=
{
clearMonsterPlaceInteractivities
}
clearPlaceInteractivitiesAction=
{
clearMonsterPlaceInteractivities
}
/>
/>
)
:
(
)
:
(
...
@@ -112,7 +104,7 @@ const ExtraMonsters = (props: {
...
@@ -112,7 +104,7 @@ const ExtraMonsters = (props: {
sequence=
{
5
}
sequence=
{
5
}
position=
{
rightPosition
}
position=
{
rightPosition
}
rotation=
{
opRotation
}
rotation=
{
opRotation
}
deffenseRotation=
{
CONFIG
.
C
ardSlotDefenceRotation
()
}
deffenseRotation=
{
c
ardSlotDefenceRotation
()
}
clearPlaceInteractivitiesAction=
{
clearMonsterPlaceInteractivities
}
clearPlaceInteractivitiesAction=
{
clearMonsterPlaceInteractivities
}
/>
/>
)
:
(
)
:
(
...
@@ -124,7 +116,7 @@ const ExtraMonsters = (props: {
...
@@ -124,7 +116,7 @@ const ExtraMonsters = (props: {
sequence=
{
6
}
sequence=
{
6
}
position=
{
leftPosition
}
position=
{
leftPosition
}
rotation=
{
opRotation
}
rotation=
{
opRotation
}
deffenseRotation=
{
CONFIG
.
C
ardSlotDefenceRotation
()
}
deffenseRotation=
{
c
ardSlotDefenceRotation
()
}
clearPlaceInteractivitiesAction=
{
clearMonsterPlaceInteractivities
}
clearPlaceInteractivitiesAction=
{
clearMonsterPlaceInteractivities
}
/>
/>
)
:
(
)
:
(
...
@@ -137,7 +129,7 @@ const ExtraMonsters = (props: {
...
@@ -137,7 +129,7 @@ const ExtraMonsters = (props: {
const
monsterPositions
=
(
player
:
number
,
monsters
:
CardState
[])
=>
{
const
monsterPositions
=
(
player
:
number
,
monsters
:
CardState
[])
=>
{
const
x
=
(
sequence
:
number
)
=>
const
x
=
(
sequence
:
number
)
=>
player
==
0
?
left
+
gap
*
sequence
:
-
left
-
gap
*
sequence
;
player
==
0
?
left
+
gap
*
sequence
:
-
left
-
gap
*
sequence
;
const
y
=
shape
.
depth
/
2
+
CONFIG
.
F
loating
;
const
y
=
transform
.
z
/
2
+
f
loating
;
const
z
=
player
==
0
?
-
1.35
:
1.35
;
const
z
=
player
==
0
?
-
1.35
:
1.35
;
return
monsters
.
map
((
_
,
sequence
)
=>
new
BABYLON
.
Vector3
(
x
(
sequence
),
y
,
z
));
return
monsters
.
map
((
_
,
sequence
)
=>
new
BABYLON
.
Vector3
(
x
(
sequence
),
y
,
z
));
...
...
src/ui/Duel/singleSlot.tsx
View file @
ec21b1a9
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
CONFIG
from
"
../../config/ui
"
;
import
{
CardState
}
from
"
../../reducers/duel/generic
"
;
import
{
CardState
}
from
"
../../reducers/duel/generic
"
;
import
{
store
}
from
"
../../store
"
;
import
{
store
}
from
"
../../store
"
;
import
{
useClick
}
from
"
./hook
"
;
import
{
useClick
}
from
"
./hook
"
;
...
@@ -11,7 +10,7 @@ import {
...
@@ -11,7 +10,7 @@ import {
import
{
interactTypeToString
}
from
"
./util
"
;
import
{
interactTypeToString
}
from
"
./util
"
;
import
NeosConfig
from
"
../../../neos.config.json
"
;
import
NeosConfig
from
"
../../../neos.config.json
"
;
const
shape
=
CONFIG
.
SingleSlotShape
;
const
transform
=
NeosConfig
.
ui
.
card
.
transform
;
export
const
Depth
=
0.005
;
export
const
Depth
=
0.005
;
const
SingleSlot
=
(
props
:
{
const
SingleSlot
=
(
props
:
{
...
@@ -65,8 +64,8 @@ const SingleSlot = (props: {
...
@@ -65,8 +64,8 @@ const SingleSlot = (props: {
ref={boxRef}
ref={boxRef}
scaling={
scaling={
new BABYLON.Vector3(
new BABYLON.Vector3(
shape.width
,
transform.x
,
shape.height
,
transform.y
,
Depth * props.state.length
Depth * props.state.length
)
)
}
}
...
...
src/ui/Duel/util.ts
View file @
ec21b1a9
import
{
InteractType
}
from
"
../../reducers/duel/generic
"
;
import
{
InteractType
}
from
"
../../reducers/duel/generic
"
;
import
NeosConfig
from
"
../../../neos.config.json
"
;
import
{
Vector3
}
from
"
@babylonjs/core
"
;
export
function
zip
<
S1
,
S2
>
(
export
function
zip
<
S1
,
S2
>
(
firstCollection
:
Array
<
S1
>
,
firstCollection
:
Array
<
S1
>
,
...
@@ -42,3 +44,27 @@ export function interactTypeToString(t: InteractType): string {
...
@@ -42,3 +44,27 @@ export function interactTypeToString(t: InteractType): string {
}
}
}
}
}
}
const
cardRotation
=
NeosConfig
.
ui
.
card
.
rotation
;
const
cardReverseRotation
=
NeosConfig
.
ui
.
card
.
reverseRotation
;
const
cardDefenceRotation
=
NeosConfig
.
ui
.
card
.
defenceRotation
;
export
function
cardSlotRotation
(
reverse
?:
boolean
)
{
if
(
reverse
)
{
return
new
Vector3
(
cardReverseRotation
.
x
,
cardReverseRotation
.
y
,
cardReverseRotation
.
z
);
}
else
{
return
new
Vector3
(
cardRotation
.
x
,
cardRotation
.
y
,
cardRotation
.
z
);
}
}
export
function
cardSlotDefenceRotation
()
{
return
new
Vector3
(
cardDefenceRotation
.
x
,
cardDefenceRotation
.
y
,
cardDefenceRotation
.
z
);
}
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