Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
unit_demo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
template admin
unit_demo
Commits
6d1968c0
Commit
6d1968c0
authored
Jun 16, 2021
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 播放音乐
parent
be9cc5d0
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
481 additions
and
1 deletion
+481
-1
東方幻華楽~初-廃獄行進曲.mp3
play/assets/tmpGame/audios/東方幻華楽~初-廃獄行進曲.mp3
+0
-0
東方幻華楽~初-廃獄行進曲.mp3.meta
play/assets/tmpGame/audios/東方幻華楽~初-廃獄行進曲.mp3.meta
+8
-0
demo_03_fireworks_2.fire
play/assets/tmpGame/scene/demo_03_fireworks_2.fire
+1
-1
demo_04_playAudio.fire
play/assets/tmpGame/scene/demo_04_playAudio.fire
+432
-0
demo_04_playAudio.fire.meta
play/assets/tmpGame/scene/demo_04_playAudio.fire.meta
+7
-0
demo_04_playAudio.js
play/assets/tmpGame/scene/demo_04_playAudio.js
+21
-0
demo_04_playAudio.js.meta
play/assets/tmpGame/scene/demo_04_playAudio.js.meta
+9
-0
mainPage.js
play/assets/tmpGame/scene/mainPage.js
+3
-0
No files found.
play/assets/tmpGame/audios/東方幻華楽~初-廃獄行進曲.mp3
0 → 100644
View file @
6d1968c0
File added
play/assets/tmpGame/audios/東方幻華楽~初-廃獄行進曲.mp3.meta
0 → 100644
View file @
6d1968c0
{
"ver": "2.0.1",
"uuid": "d56c1d39-4cf3-4628-a118-f493a6c8395a",
"downloadMode": 0,
"duration": 194.821188,
"subMetas": {}
}
\ No newline at end of file
play/assets/tmpGame/scene/demo_03_fireworks_2.fire
View file @
6d1968c0
...
...
@@ -186,7 +186,7 @@
"array": [
0,
0,
695.4104794776155
,
757.2986206686893
,
0,
0,
0,
...
...
play/assets/tmpGame/scene/demo_04_playAudio.fire
0 → 100644
View file @
6d1968c0
[
{
"__type__": "cc.SceneAsset",
"_name": "",
"_objFlags": 0,
"_native": "",
"scene": {
"__id__": 1
}
},
{
"__type__": "cc.Scene",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
},
{
"__id__": 8
}
],
"_active": true,
"_components": [],
"_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,
"y": 0
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_is3DNode": true,
"_groupIndex": 0,
"groupIndex": 0,
"autoReleaseAssets": true,
"_id": "f1633c77-3e45-471a-9d3a-be468ed481e6"
},
{
"__type__": "cc.Node",
"_name": "Canvas",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 3
}
],
"_active": true,
"_components": [
{
"__id__": 5
},
{
"__id__": 6
},
{
"__id__": 7
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 960,
"height": 640
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
480,
320,
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": "a5esZu+45LA5mBpvttspPD"
},
{
"__type__": "cc.Node",
"_name": "Main Camera",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 4
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 960,
"height": 640
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
757.2986206686893,
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": "e1WoFrQ79G7r4ZuQE3HlNb"
},
{
"__type__": "cc.Camera",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
},
"_enabled": true,
"_cullingMask": 4294967295,
"_clearFlags": 7,
"_backgroundColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_depth": -1,
"_zoomRatio": 1,
"_targetTexture": null,
"_fov": 60,
"_orthoSize": 10,
"_nearClip": 1,
"_farClip": 4096,
"_ortho": true,
"_rect": {
"__type__": "cc.Rect",
"x": 0,
"y": 0,
"width": 1,
"height": 1
},
"_renderStages": 1,
"_alignWithScreen": true,
"_id": "81GN3uXINKVLeW4+iKSlim"
},
{
"__type__": "cc.Canvas",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_designResolution": {
"__type__": "cc.Size",
"width": 960,
"height": 640
},
"_fitWidth": false,
"_fitHeight": true,
"_id": "59Cd0ovbdF4byw5sbjJDx7"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "29zXboiXFBKoIV4PQ2liTe"
},
{
"__type__": "0d4f9/w8ZhL2IEs6BXl8WMd",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_id": "4cSDYwDdlFEo1fE2gOu7IH"
},
{
"__type__": "cc.Node",
"_name": "AudioNode",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 9
}
],
"_active": true,
"_components": [],
"_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": "49uwcnBJJGK5U3tw0+undm"
},
{
"__type__": "cc.Node",
"_name": "東方幻華楽~初-廃獄行進曲",
"_objFlags": 0,
"_parent": {
"__id__": 8
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 10
}
],
"_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": "b7NgbBvYxIW4L0gvUSmZfh"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 9
},
"_enabled": true,
"_clip": {
"__uuid__": "d56c1d39-4cf3-4628-a118-f493a6c8395a"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"playOnLoad": false,
"preload": false,
"_id": "53GTO2/95Gj4/Zh6jmnI1C"
}
]
\ No newline at end of file
play/assets/tmpGame/scene/demo_04_playAudio.fire.meta
0 → 100644
View file @
6d1968c0
{
"ver": "1.2.7",
"uuid": "f1633c77-3e45-471a-9d3a-be468ed481e6",
"asyncLoadAssets": false,
"autoReleaseAssets": true,
"subMetas": {}
}
\ No newline at end of file
play/assets/tmpGame/scene/demo_04_playAudio.js
0 → 100644
View file @
6d1968c0
// Learn cc.Class:
// - https://docs.cocos.com/creator/manual/en/scripting/class.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
cc
.
Class
({
extends
:
cc
.
Component
,
properties
:
{
},
start
()
{
const
audioName
=
'
東方幻華楽~初-廃獄行進曲
'
;
const
audioNode
=
cc
.
find
(
`AudioNode/
${
audioName
}
`
);
const
audioSourceComponent
=
audioNode
.
getComponent
(
cc
.
AudioSource
);
cc
.
audioEngine
.
play
(
audioSourceComponent
.
clip
);
},
});
play/assets/tmpGame/scene/demo_04_playAudio.js.meta
0 → 100644
View file @
6d1968c0
{
"ver": "1.0.8",
"uuid": "0d4f9ff0-f198-4bd8-812c-e815e5f1631d",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
play/assets/tmpGame/scene/mainPage.js
View file @
6d1968c0
...
...
@@ -47,6 +47,9 @@ cc.Class({
},
{
sceneName
:
'
demo_03_fireworks_2
'
,
label
:
'
翻转撒花
'
},
{
sceneName
:
'
demo_04_playAudio
'
,
label
:
'
播放音乐
'
}];
demoList
.
forEach
((
demoItem
,
idx
)
=>
{
...
...
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