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
deft
Neos
Commits
5eff3f54
Commit
5eff3f54
authored
Dec 10, 2022
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update setupHandInteractivity
parent
49e2424b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
26 deletions
+36
-26
src/config/ui.ts
src/config/ui.ts
+1
-1
src/ui/Duel/simpleDuel/hands.ts
src/ui/Duel/simpleDuel/hands.ts
+35
-25
No files found.
src/config/ui.ts
View file @
5eff3f54
...
...
@@ -64,7 +64,7 @@ export const HandHoverOutScaling = () => {
export
const
HandInteractShape
=
()
=>
{
return
{
width
:
0.8
,
height
:
0.2
};
};
export
const
HandInteractFontSize
=
3
00
;
export
const
HandInteractFontSize
=
2
00
;
// 怪兽区
export
const
MonsterColor
=
()
=>
{
...
...
src/ui/Duel/simpleDuel/hands.ts
View file @
5eff3f54
import
*
as
BABYLON
from
"
@babylonjs/core
"
;
import
*
as
BABYLON_GUI
from
"
@babylonjs/gui
"
;
import
*
as
CONFIG
from
"
../../../config/ui
"
;
import
{
Card
}
from
"
../../../reducers/duel/util
"
;
import
{
Card
,
InteractType
}
from
"
../../../reducers/duel/util
"
;
export
default
(
hands
:
Card
[],
scene
:
BABYLON
.
Scene
)
=>
{
const
handShape
=
CONFIG
.
HandShape
();
...
...
@@ -59,31 +59,37 @@ function setupHandInteractivity(
scene
:
BABYLON
.
Scene
)
{
const
interactShape
=
CONFIG
.
HandInteractShape
();
const
interact
=
BABYLON
.
MeshBuilder
.
CreatePlane
(
`handInteract
${
handIdx
}
`
,
interactShape
,
scene
);
interact
.
parent
=
mesh
;
// 调整位置
interact
.
translate
(
new
BABYLON
.
Vector3
(
0
,
1
,
0
),
CONFIG
.
HandShape
().
height
/
2
+
interactShape
.
height
/
2
);
const
interactivities
=
state
.
interactivities
;
const
advancedTexture
=
BABYLON_GUI
.
AdvancedDynamicTexture
.
CreateForMesh
(
interact
);
const
button
=
BABYLON_GUI
.
Button
.
CreateImageWithCenterTextButton
(
`handInteractButtion
${
handIdx
}
`
,
"
test
"
,
"
http://localhost:3030/images/interact_button.png
"
);
button
.
fontSize
=
CONFIG
.
HandInteractFontSize
;
button
.
color
=
"
white
"
;
button
.
onPointerClickObservable
.
add
(()
=>
{
console
.
log
(
`<Interact>hand
${
handIdx
}
`
);
});
advancedTexture
.
addControl
(
button
);
for
(
let
i
=
0
;
i
<
interactivities
.
length
;
i
++
)
{
const
interact
=
BABYLON
.
MeshBuilder
.
CreatePlane
(
`handInteract_
${
handIdx
}
_
${
i
}
`
,
interactShape
,
scene
);
interact
.
parent
=
mesh
;
// 调整位置
interact
.
translate
(
new
BABYLON
.
Vector3
(
0
,
1
,
0
),
CONFIG
.
HandShape
().
height
/
2
+
interactShape
.
height
/
2
+
interactShape
.
height
*
i
);
const
advancedTexture
=
BABYLON_GUI
.
AdvancedDynamicTexture
.
CreateForMesh
(
interact
);
const
button
=
BABYLON_GUI
.
Button
.
CreateImageWithCenterTextButton
(
`handInteractButtion_
${
handIdx
}
_
${
i
}
`
,
interactTypeToString
(
interactivities
[
i
].
interactType
),
"
http://localhost:3030/images/interact_button.png
"
);
button
.
fontSize
=
CONFIG
.
HandInteractFontSize
;
button
.
color
=
"
white
"
;
button
.
onPointerClickObservable
.
add
(()
=>
{
console
.
log
(
`<Interact>hand
${
handIdx
}
`
);
});
advancedTexture
.
addControl
(
button
);
}
}
function
setupHandAction
(
...
...
@@ -149,3 +155,7 @@ function setupHandAction(
)
);
}
function
interactTypeToString
(
t
:
InteractType
):
string
{
return
InteractType
[
t
];
}
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