Commit 8caa7f48 authored by liujiangnan's avatar liujiangnan

feat: 不同的背景音乐

parent 53cb070d
{
"ver": "2.0.1",
"uuid": "cb0ee4c7-00bc-4d48-ae9c-497cec3eb4de",
"downloadMode": 0,
"duration": 107.6657,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "5e0ccbca-213f-4395-9c14-99722e630f8c",
"downloadMode": 0,
"duration": 90.3614,
"subMetas": {}
}
\ No newline at end of file
...@@ -17571,6 +17571,12 @@ ...@@ -17571,6 +17571,12 @@
"bgMusic2": { "bgMusic2": {
"__uuid__": "e16e2ad2-276a-495a-83d0-5b16756e02a6" "__uuid__": "e16e2ad2-276a-495a-83d0-5b16756e02a6"
}, },
"bgMusic3": {
"__uuid__": "cb0ee4c7-00bc-4d48-ae9c-497cec3eb4de"
},
"bgMusic4": {
"__uuid__": "5e0ccbca-213f-4395-9c14-99722e630f8c"
},
"_id": "81fxhA6JRHm6B5tHECQZAH" "_id": "81fxhA6JRHm6B5tHECQZAH"
}, },
{ {
......
...@@ -22,6 +22,10 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -22,6 +22,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
bgMusic1: cc.AudioClip = null; bgMusic1: cc.AudioClip = null;
@property(cc.AudioClip) @property(cc.AudioClip)
bgMusic2: cc.AudioClip = null; bgMusic2: cc.AudioClip = null;
@property(cc.AudioClip)
bgMusic3: cc.AudioClip = null;
@property(cc.AudioClip)
bgMusic4: cc.AudioClip = null;
tws: any[] = []; tws: any[] = [];
gameMachineService: any = null; gameMachineService: any = null;
...@@ -161,9 +165,14 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -161,9 +165,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
createFiniteStateMachines() { createFiniteStateMachines() {
let pid = 21228; // 本地测试用 let pid = 21228; // 本地测试用
let pname = 'level 1'; // 本地测试用
const middleLayer = cc.find('middleLayer'); const middleLayer = cc.find('middleLayer');
if(middleLayer) { if(middleLayer) {
pid = middleLayer.getComponent('middleLayer').getData('NJ_MonkyTree'); pid = middleLayer.getComponent('middleLayer').getData('NJ_MonkyTree');
pname = middleLayer.getComponent('middleLayer').getData('NJ_MonkyTree_name');
if (pname) {
pname = pname.toLowerCase().trim();
}
} }
const operationState = { const operationState = {
...@@ -178,7 +187,15 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -178,7 +187,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
entry: (ctx, event) => { entry: (ctx, event) => {
console.log('entry UnitView stage'); console.log('entry UnitView stage');
this.UnitView.active = true; this.UnitView.active = true;
if (pname == 'level 1') {
this.playBgMusic(this.bgMusic2); this.playBgMusic(this.bgMusic2);
} else if (pname == 'level 2') {
this.playBgMusic(this.bgMusic3);
} else if (pname == 'level 3') {
this.playBgMusic(this.bgMusic4);
}
const lessonsBtn = this.rootAttrTree.querySelectorAll('.lesson-button'); const lessonsBtn = this.rootAttrTree.querySelectorAll('.lesson-button');
lessonsBtn.forEach(b => { lessonsBtn.forEach(b => {
......
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