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
22254b11
Commit
22254b11
authored
Mar 31, 2025
by
Vũ Gia Vương
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add sound
parent
07d5311e
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
640 additions
and
246 deletions
+640
-246
main.fire
assets/main.fire
+593
-231
beer-bottle-rolling-on-a-sidewalk-82234.mp3
...sources/sound/beer-bottle-rolling-on-a-sidewalk-82234.mp3
+0
-0
Events.ts
assets/scripts/Events.ts
+3
-1
BuaController.ts
assets/scripts/GamePlay/BuaController.ts
+0
-2
HuController.ts
assets/scripts/GamePlay/HuController.ts
+24
-12
SoundManager.ts
assets/scripts/SoundManager.ts
+20
-0
No files found.
assets/main.fire
View file @
22254b11
This diff is collapsed.
Click to expand it.
assets/resources/sound/beer-bottle-rolling-on-a-sidewalk-82234.mp3
0 → 100644
View file @
22254b11
File added
assets/scripts/Events.ts
View file @
22254b11
...
...
@@ -5,4 +5,6 @@ export const SHOW_START_SCREEN = 'SHOW_START_SCREEN';
export
const
SHOW_CARD_POPUP
=
'SHOW_CARD_POPUP'
;
export
const
STOP_ANIM_CHUM
=
'STOP_ANIM_CHUM'
;
export
const
SHOW_SELECT_POPUP
=
'SHOW_SELECT_POPUP'
;
\ No newline at end of file
export
const
SHOW_SELECT_POPUP
=
'SHOW_SELECT_POPUP'
;
export
const
PLAY_ROLLING_SOUND
=
'PLAY_ROLLING_SOUND'
;
\ No newline at end of file
assets/scripts/GamePlay/BuaController.ts
View file @
22254b11
...
...
@@ -20,7 +20,6 @@ export default class BuaController extends cc.Component {
this
.
_chumCtrl
=
this
.
chumNode
.
getComponent
(
ChumController
);
this
.
spine
=
this
.
node
.
getComponent
(
sp
.
Skeleton
);
// this.spine.setSkin(this._skins[this.index % this._skins.length]);
this
.
spine
.
setSkin
(
'Bua'
);
this
.
node
.
on
(
cc
.
Node
.
EventType
.
TOUCH_START
,
this
.
onTouchStart
,
this
);
...
...
@@ -33,7 +32,6 @@ export default class BuaController extends cc.Component {
private
onTouchStart
():
void
{
this
.
_actions
[
this
.
_count
].
bind
(
this
)();
console
.
log
(
'this._count'
,
this
.
_count
)
this
.
_count
=
(
this
.
_count
+
1
)
%
this
.
_actions
.
length
;
}
...
...
assets/scripts/GamePlay/HuController.ts
View file @
22254b11
import
{
eventTarget
,
PLAY_ROLLING_SOUND
}
from
"../Events"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
HuController
extends
cc
.
Component
{
@
property
(
cc
.
Label
)
private
text
:
cc
.
Label
=
null
;
private
spine
:
sp
.
Skeleton
=
null
;
...
...
@@ -16,16 +19,17 @@ export default class HuController extends cc.Component {
protected
onLoad
():
void
{
this
.
spine
=
this
.
node
.
getComponent
(
sp
.
Skeleton
);
// this.setRotateAnim();
// this.node.on(cc.Node.EventType.TOUCH_START, this.toggleAnim, this);
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
)
this
.
spine
.
setCompleteListener
(()
=>
this
.
setRotateAnim
());
this
.
scheduleOnce
(()
=>
this
.
testDevice
,
1
);
}
protected
start
():
void
{
this
.
scheduleOnce
(()
=>
this
.
testDevice
,
1
);
console
.
log
(
'testDevice'
,)
}
private
testDevice
()
{
...
...
@@ -33,7 +37,11 @@ export default class HuController extends cc.Component {
if
(
!
event
.
accelerationIncludingGravity
)
{
return
;
}
this
.
text
.
string
=
`
x:
${
event
.
accelerationIncludingGravity
.
x
}
,
y:
${
event
.
accelerationIncludingGravity
.
y
}
,
z:
${
event
.
accelerationIncludingGravity
.
z
}
`
;
const
x
=
event
.
accelerationIncludingGravity
.
x
;
const
y
=
event
.
accelerationIncludingGravity
.
y
;
const
z
=
event
.
accelerationIncludingGravity
.
z
;
...
...
@@ -58,22 +66,26 @@ export default class HuController extends cc.Component {
if
(
this
.
_count
>
5
)
{
this
.
_count
=
0
;
cc
.
tween
(
this
.
node
)
.
to
(
0.2
,
{
position
:
cc
.
v3
(
20
,
0
,
0
)
})
.
to
(
0.2
,
{
position
:
cc
.
v3
(
-
20
,
0
,
0
)
})
.
to
(
0.2
,
{
position
:
cc
.
v3
(
20
,
0
,
0
)
})
.
to
(
0.2
,
{
position
:
cc
.
v3
(
-
20
,
0
,
0
)
})
.
to
(
0.2
,
{
position
:
cc
.
v3
(
0
,
0
,
0
)
})
.
start
();
this
.
shakeBottle
();
}
this
.
_x
=
x
;
this
.
_y
=
y
;
this
.
_z
=
z
;
});
}
private
shakeBottle
()
{
eventTarget
.
emit
(
PLAY_ROLLING_SOUND
);
cc
.
tween
(
this
.
node
)
.
to
(
0.2
,
{
position
:
cc
.
v3
(
20
,
0
,
0
)
})
.
to
(
0.2
,
{
position
:
cc
.
v3
(
-
20
,
0
,
0
)
})
.
to
(
0.2
,
{
position
:
cc
.
v3
(
20
,
0
,
0
)
})
.
to
(
0.2
,
{
position
:
cc
.
v3
(
-
20
,
0
,
0
)
})
.
to
(
0.2
,
{
position
:
cc
.
v3
(
0
,
0
,
0
)
})
.
start
();
}
private
onTouchStart
(
event
:
cc
.
Event
.
EventTouch
):
void
{
if
(
!
this
.
_pointStart
)
{
this
.
setRotateAnim
();
...
...
assets/scripts/SoundManager.ts
0 → 100644
View file @
22254b11
import
{
eventTarget
,
PLAY_ROLLING_SOUND
}
from
"./Events"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
NewClass
extends
cc
.
Component
{
@
property
(
cc
.
AudioSource
)
private
rollingSound
:
cc
.
AudioSource
=
null
;
onLoad
()
{
eventTarget
.
on
(
PLAY_ROLLING_SOUND
,
this
.
playRollingSound
,
this
);
}
private
playRollingSound
()
{
this
.
rollingSound
.
play
();
}
}
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