Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dap-hu
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Gia Vương
dap-hu
Commits
7273b42a
Commit
7273b42a
authored
May 07, 2025
by
Vũ Gia Vương
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clear not use in HuController
parent
655f27ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
54 deletions
+1
-54
HuController.ts
assets/scripts/GamePlay/HuController.ts
+1
-54
No files found.
assets/scripts/GamePlay/HuController.ts
View file @
7273b42a
import
{
eventTarget
,
PLAY_ROLLING_SOUND
,
ROTATE_GUILD
,
STOP_GUILD_ROTATE
}
from
"../Events"
;
import
{
TrackEntry
}
from
"../Utils"
;
import
{
eventTarget
,
PLAY_ROLLING_SOUND
}
from
"../Events"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
...
...
@@ -7,28 +6,17 @@ const { ccclass, property } = cc._decorator;
export
default
class
HuController
extends
cc
.
Component
{
private
_spine
:
sp
.
Skeleton
=
null
;
private
_pointStart
:
cc
.
Vec2
=
null
;
private
_x
:
number
=
0
;
private
_y
:
number
=
0
;
private
_z
:
number
=
0
;
private
_count
=
0
;
private
_isShake
=
false
;
private
_track
:
TrackEntry
=
null
;
private
_debug
:
cc
.
Label
=
null
;
protected
onLoad
():
void
{
this
.
_spine
=
this
.
node
.
getComponent
(
sp
.
Skeleton
);
this
.
_debug
=
this
.
node
.
getComponentInChildren
(
cc
.
Label
);
this
.
node
.
on
(
cc
.
Node
.
EventType
.
TOUCH_START
,
this
.
onTouchStart
,
this
);
this
.
node
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onTouchEnd
,
this
)
this
.
node
.
on
(
cc
.
Node
.
EventType
.
TOUCH_MOVE
,
this
.
onTouchMove
,
this
)
eventTarget
.
on
(
ROTATE_GUILD
,
this
.
onRotateGuild
,
this
);
this
.
_spine
.
setCompleteListener
(()
=>
{
this
.
initBottle
();
});
if
(
cc
.
sys
.
os
===
cc
.
sys
.
OS_IOS
)
{
this
.
setDeviceMotionIOS
();
}
...
...
@@ -36,11 +24,9 @@ export default class HuController extends cc.Component {
this
.
scheduleOnce
(
this
.
setDeviceMotion
,
2
);
}
this
.
initBottle
();
this
.
_spine
.
timeScale
=
0
;
}
private
setDeviceMotionIOS
()
{
const
debug
=
(
text
:
string
)
=>
{
this
.
_debug
.
string
=
text
;
...
...
@@ -77,45 +63,6 @@ export default class HuController extends cc.Component {
}
}
private
initBottle
()
{
// this._spine.setAnimation(1, "Rotate", false);
// this._track = this._spine.getState().tracks[1];
}
private
onTouchStart
(
event
:
cc
.
Event
.
EventTouch
):
void
{
eventTarget
.
emit
(
STOP_GUILD_ROTATE
);
this
.
_pointStart
=
event
.
getLocation
();
this
.
_spine
.
timeScale
=
0
;
}
private
onTouchEnd
():
void
{
this
.
scheduleOnce
(()
=>
{
this
.
_spine
.
timeScale
=
0
;
},
0.5
);
}
private
onTouchMove
(
event
:
cc
.
Event
.
EventTouch
):
void
{
const
newPoint
=
event
.
getLocation
();
const
distance
=
newPoint
.
x
-
this
.
_pointStart
.
x
;
if
(
Math
.
abs
(
distance
)
<
10
)
{
this
.
_spine
.
timeScale
=
0
;
return
;
}
if
(
this
.
_track
.
trackTime
<
0
)
{
this
.
_track
.
trackTime
=
this
.
_track
.
animationEnd
-
1
e
-
3
;
}
this
.
_pointStart
=
newPoint
;
this
.
_spine
.
timeScale
=
distance
>
0
?
-
1.5
:
1.5
;
}
private
onRotateGuild
()
{
this
.
_spine
.
timeScale
=
0.8
;
this
.
scheduleOnce
(()
=>
{
this
.
_spine
.
timeScale
=
0
;
},
1
);
}
private
setDeviceMotion
()
{
window
.
addEventListener
(
"devicemotion"
,
(
event
)
=>
{
if
(
!
event
.
accelerationIncludingGravity
)
{
...
...
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