Commit 6c0a8a2e authored by liujiangnan's avatar liujiangnan

feat: 引导音频

parent e6a58718
{
"ver": "2.0.1",
"uuid": "fdb12df0-a2e0-486f-9f4e-4f3625897e81",
"downloadMode": 0,
"duration": 7.128,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "015739cc-c2c7-4d91-9a91-ca3a1d7e8d2a",
"downloadMode": 0,
"duration": 5.544,
"subMetas": {}
}
\ No newline at end of file
......@@ -77,14 +77,14 @@
],
"_active": true,
"_components": [
{
"__id__": 61
},
{
"__id__": 62
},
{
"__id__": 63
},
{
"__id__": 64
}
],
"_prefab": null,
......@@ -257,10 +257,10 @@
"_active": true,
"_components": [
{
"__id__": 59
"__id__": 60
},
{
"__id__": 60
"__id__": 61
}
],
"_prefab": null,
......@@ -2647,6 +2647,9 @@
},
{
"__id__": 58
},
{
"__id__": 59
}
],
"_prefab": null,
......@@ -2756,6 +2759,76 @@
"_originalHeight": 0,
"_id": "04QvGAAY5ENL6gWhL8dZzI"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 56
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 0,
"transition": 0,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": {
"__id__": 56
},
"_id": "7dY8o8f9VMhZLqUKoGI2kb"
},
{
"__type__": "cc.Sprite",
"_name": "",
......@@ -2870,6 +2943,12 @@
"bgMusic1": {
"__uuid__": "506e7563-c5f2-4dc5-b6da-5539d306cc5a"
},
"monkyBegin": {
"__uuid__": "fdb12df0-a2e0-486f-9f4e-4f3625897e81"
},
"monkyWait": {
"__uuid__": "015739cc-c2c7-4d91-9a91-ca3a1d7e8d2a"
},
"_id": "eaTVUpqahPfZeO9+sUI7RP"
}
]
\ No newline at end of file
......@@ -8,6 +8,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
@property(cc.AudioClip)
bgMusic1: cc.AudioClip = null;
@property(cc.AudioClip)
monkyBegin: cc.AudioClip = null;
@property(cc.AudioClip)
monkyWait: cc.AudioClip = null;
addPreloadImage() {
// this._imageResList.push({ url: this.data.pic_url });
......@@ -32,6 +36,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
middleLayer.getComponent('middleLayer').showTips(tips);
}
playId = null;
async onLoadEnd() {
const middleLayer = cc.find('middleLayer');
......@@ -49,14 +55,17 @@ export default class SceneComponent extends MyCocosSceneComponent {
return;
}
const btnReturn = cc.find('Canvas/bg/btn_return');
buttonOnClick(btnReturn, () => {
jumpToBundle('NJ_YouLeChang');
});
this.initListener();
// 播放背景音乐
cc.audioEngine.stopMusic();
cc.audioEngine.playMusic(this.bgMusic1, true);
cc.audioEngine.setMusicVolume(0.3);
this.playId = cc.audioEngine.play(this.monkyBegin, null, 1);
cc.audioEngine.setFinishCallback(this.playId, () => {
cc.audioEngine.setMusicVolume(1);
})
if(!middleLayer) {
return;
......@@ -122,6 +131,25 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
initListener() {
const btnReturn = cc.find('Canvas/bg/btn_return');
buttonOnClick(btnReturn, () => {
jumpToBundle('NJ_YouLeChang');
});
const btnMonkey = cc.find('Canvas/bg/bg_monkey');
buttonOnClick(btnMonkey, () => {
if (this.playId) {
cc.audioEngine.stop(this.playId);
}
cc.audioEngine.setMusicVolume(0.3);
this.playId = cc.audioEngine.play(this.monkyWait, null, 1);
cc.audioEngine.setFinishCallback(this.playId, () => {
cc.audioEngine.setMusicVolume(1);
})
});
}
protected update(dt: number): void {
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment