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
0f3b7ef9
Commit
0f3b7ef9
authored
May 10, 2025
by
Vũ Gia Vương
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix sound
parent
a3d9668a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
107 additions
and
22 deletions
+107
-22
home.fire
assets/Scenes/home.fire
+91
-4
DevicemotionController.ts
assets/scripts/GamePlay/DevicemotionController.ts
+7
-6
SoundManager.ts
assets/scripts/SoundManager.ts
+0
-11
StartScreen.ts
assets/scripts/UI/StartScreen.ts
+9
-1
No files found.
assets/Scenes/home.fire
View file @
0f3b7ef9
...
@@ -81,10 +81,10 @@
...
@@ -81,10 +81,10 @@
"_active": true,
"_active": true,
"_components": [
"_components": [
{
{
"__id__": 2
0
"__id__": 2
2
},
},
{
{
"__id__": 2
1
"__id__": 2
3
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -340,15 +340,18 @@
...
@@ -340,15 +340,18 @@
},
},
{
{
"__id__": 11
"__id__": 11
},
{
"__id__": 18
}
}
],
],
"_active": true,
"_active": true,
"_components": [
"_components": [
{
{
"__id__":
18
"__id__":
20
},
},
{
{
"__id__":
19
"__id__":
21
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -879,6 +882,87 @@
...
@@ -879,6 +882,87 @@
},
},
"_id": "f90tlUC7RA1YLuKG15c4Pu"
"_id": "f90tlUC7RA1YLuKG15c4Pu"
},
},
{
"__type__": "cc.Node",
"_name": "beer-bottle-rolling-on-a-sidewalk-82234",
"_objFlags": 0,
"_parent": {
"__id__": 7
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 19
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "fcC9SDAdpKh6z4m06bLq2V"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 18
},
"_enabled": true,
"_clip": {
"__uuid__": "639035b2-15a3-4a79-ac7f-abd23df23aff"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"_firstlyEnabled": true,
"playOnLoad": false,
"preload": false,
"_id": "80k2g8qvZFAZ/Vd/Ci7e0G"
},
{
{
"__type__": "4cdbdL97VxHIokBkhUMm2qL",
"__type__": "4cdbdL97VxHIokBkhUMm2qL",
"_name": "",
"_name": "",
...
@@ -893,6 +977,9 @@
...
@@ -893,6 +977,9 @@
"backgroundMusic": {
"backgroundMusic": {
"__uuid__": "a61f36bb-65e5-43e9-82b6-5a8d59050d31"
"__uuid__": "a61f36bb-65e5-43e9-82b6-5a8d59050d31"
},
},
"rollingSound": {
"__id__": 19
},
"_id": "45maHBUxRJZZuwRoPaDXFL"
"_id": "45maHBUxRJZZuwRoPaDXFL"
},
},
{
{
...
...
assets/scripts/GamePlay/DevicemotionController.ts
View file @
0f3b7ef9
...
@@ -15,12 +15,13 @@ export default class DevicemotionController extends cc.Component {
...
@@ -15,12 +15,13 @@ export default class DevicemotionController extends cc.Component {
protected
onLoad
():
void
{
protected
onLoad
():
void
{
this
.
_debug
=
this
.
node
.
getComponentInChildren
(
cc
.
Label
);
this
.
_debug
=
this
.
node
.
getComponentInChildren
(
cc
.
Label
);
if
(
cc
.
sys
.
os
===
cc
.
sys
.
OS_IOS
)
{
this
.
scheduleOnce
(
this
.
setDeviceMotion
,
2
);
this
.
setDeviceMotionIOS
();
// if (cc.sys.os === cc.sys.OS_IOS) {
}
// this.setDeviceMotionIOS();
else
{
// }
this
.
scheduleOnce
(
this
.
setDeviceMotion
,
2
);
// else {
}
// this.scheduleOnce(this.setDeviceMotion, 2);
// }
}
}
private
setDeviceMotionIOS
()
{
private
setDeviceMotionIOS
()
{
...
...
assets/scripts/SoundManager.ts
View file @
0f3b7ef9
import
{
eventTarget
,
PLAY_BREAKING_SOUND
,
PLAY_DROP_SOUND
,
PLAY_ROLLING_SOUND
}
from
"./Events"
;
import
{
eventTarget
,
PLAY_BREAKING_SOUND
,
PLAY_DROP_SOUND
,
PLAY_ROLLING_SOUND
}
from
"./Events"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
@
ccclass
export
default
class
NewClass
extends
cc
.
Component
{
export
default
class
NewClass
extends
cc
.
Component
{
@
property
(
cc
.
AudioSource
)
private
rollingSound
:
cc
.
AudioSource
=
null
;
@
property
(
cc
.
AudioSource
)
@
property
(
cc
.
AudioSource
)
private
breakingSound
:
cc
.
AudioSource
=
null
;
private
breakingSound
:
cc
.
AudioSource
=
null
;
...
@@ -16,15 +10,10 @@ export default class NewClass extends cc.Component {
...
@@ -16,15 +10,10 @@ export default class NewClass extends cc.Component {
private
dropSound
:
cc
.
AudioSource
=
null
;
private
dropSound
:
cc
.
AudioSource
=
null
;
onLoad
()
{
onLoad
()
{
eventTarget
.
on
(
PLAY_ROLLING_SOUND
,
this
.
playRollingSound
,
this
);
eventTarget
.
on
(
PLAY_BREAKING_SOUND
,
this
.
playBreakingSound
,
this
);
eventTarget
.
on
(
PLAY_BREAKING_SOUND
,
this
.
playBreakingSound
,
this
);
eventTarget
.
on
(
PLAY_DROP_SOUND
,
this
.
playDropSound
,
this
);
eventTarget
.
on
(
PLAY_DROP_SOUND
,
this
.
playDropSound
,
this
);
}
}
private
playRollingSound
()
{
this
.
rollingSound
.
play
();
}
private
playBreakingSound
()
{
private
playBreakingSound
()
{
this
.
breakingSound
.
play
();
this
.
breakingSound
.
play
();
}
}
...
...
assets/scripts/UI/StartScreen.ts
View file @
0f3b7ef9
import
{
eventTarget
,
PLAY_ROLLING_SOUND
}
from
"../Events"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
...
@@ -7,14 +8,21 @@ export default class StartScreen extends cc.Component {
...
@@ -7,14 +8,21 @@ export default class StartScreen extends cc.Component {
private
selectBtnNode
:
cc
.
Node
=
null
;
private
selectBtnNode
:
cc
.
Node
=
null
;
@
property
(
cc
.
AudioClip
)
@
property
(
cc
.
AudioClip
)
private
backgroundMusic
:
cc
.
AudioClip
=
null
;
private
backgroundMusic
:
cc
.
AudioClip
=
null
;
@
property
(
cc
.
AudioSource
)
private
rollingSound
:
cc
.
AudioSource
=
null
;
protected
onLoad
():
void
{
protected
onLoad
():
void
{
this
.
selectBtnNode
.
on
(
'click'
,
this
.
onSelectBtnClick
,
this
);
this
.
selectBtnNode
.
on
(
'click'
,
this
.
onSelectBtnClick
,
this
);
cc
.
director
.
preloadScene
(
'main'
);
cc
.
director
.
preloadScene
(
'main'
);
if
(
!
cc
.
audioEngine
.
isMusicPlaying
())
{
if
(
!
cc
.
audioEngine
.
isMusicPlaying
())
{
cc
.
audioEngine
.
playMusic
(
this
.
backgroundMusic
,
true
);
cc
.
audioEngine
.
playMusic
(
this
.
backgroundMusic
,
true
);
}
}
eventTarget
.
on
(
PLAY_ROLLING_SOUND
,
this
.
playRollingSound
,
this
);
}
private
playRollingSound
()
{
this
.
rollingSound
.
play
();
}
}
private
onSelectBtnClick
()
{
private
onSelectBtnClick
()
{
...
...
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