From fa703d4297a36f0e1f0e43bc6d64efa9bfede329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=83=E9=9B=AA=E5=AF=92?= <fanxuehan@xuexuehanhandeMacBook-Pro.local> Date: Tue, 13 Oct 2020 13:38:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- play/assets/tmpGame/script/Scene.js | 42 ++++++++++++++--------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/play/assets/tmpGame/script/Scene.js b/play/assets/tmpGame/script/Scene.js index 59a6ba8..139fb8e 100644 --- a/play/assets/tmpGame/script/Scene.js +++ b/play/assets/tmpGame/script/Scene.js @@ -60,12 +60,12 @@ cc.Class({ // 生命周期 start - start() { + start() { let getData = this.getData.bind(this); if (window && window.courseware) { getData = window.courseware.getData; } - + getData((data) => { console.log('data:', data); this.data = data || this.getDefaultData(); @@ -84,7 +84,7 @@ cc.Class({ const data = JSON.parse(dataJson); return data; }, - + preloadItem() { this.addPreloadImage(); this.addPreloadAudio(); @@ -95,13 +95,13 @@ cc.Class({ addPreloadImage() { - this._imageResList.push({url: this.data.pic_url}); - this._imageResList.push({url: this.data.pic_url_2}); + this._imageResList.push({ url: this.data.pic_url }); + this._imageResList.push({ url: this.data.pic_url_2 }); }, addPreloadAudio() { - this._audioResList.push({url: this.data.audio_url}); + this._audioResList.push({ url: this.data.audio_url }); }, addPreloadAnima() { @@ -117,7 +117,7 @@ cc.Class({ if (window && window["air"]) { window["air"].hideAirClassLoading(); } - + cc.debug.setDisplayStats(false); }); }, @@ -135,7 +135,7 @@ cc.Class({ // 所有全局å˜é‡ 默认都是null this._cantouch = true; }, - + audioBtn: null, initAudio() { const audioNode = cc.find('Canvas/res/audio'); @@ -173,7 +173,7 @@ cc.Class({ picNode1.scale = maxW / picNode1.width; picNode1.baseX = picNode1.x; canvas.addChild(picNode1); - this.pic1 = picNode1; + this.pic1 = picNode1; const labelNode = new cc.Node(); labelNode.color = cc.Color.YELLOW; @@ -224,11 +224,11 @@ cc.Class({ this.curPage = 0; const bottomPart = cc.find('Canvas/bottomPart'); bottomPart.zIndex = 5; // æé«˜å±‚级 - + bottomPart.x = bottomPart.parent.width / 2; bottomPart.y = -bottomPart.parent.height / 2; - const leftBtnNode = bottomPart.getChildByName('btn_left'); + const leftBtnNode = bottomPart.getChildByName('btn_left'); //èŠ‚ç‚¹ä¸æ·»åŠ äº†button组件 则å¯ä»¥æ·»åŠ clickäº‹ä»¶ç›‘å¬ leftBtnNode.on('click', () => { if (!this._cantouch) { @@ -243,7 +243,7 @@ cc.Class({ cc.audioEngine.play(this.audioBtn.clip, false, 0.8) }) - const rightBtnNode = bottomPart.getChildByName('btn_right'); + const rightBtnNode = bottomPart.getChildByName('btn_right'); //èŠ‚ç‚¹ä¸æ·»åŠ äº†button组件 则å¯ä»¥æ·»åŠ clickäº‹ä»¶ç›‘å¬ rightBtnNode.on('click', () => { if (!this._cantouch) { @@ -252,7 +252,7 @@ cc.Class({ if (this.curPage == 1) { return; } - + this.curPage = 1 this.rightMove(); @@ -264,11 +264,11 @@ cc.Class({ this._cantouch = false; const len = this.pic1.parent.width; cc.tween(this.pic1) - .to(1, {x: this.pic1.baseX}, {easing: 'cubicInOut'}) + .to(1, { x: this.pic1.baseX }, { easing: 'cubicInOut' }) .start(); cc.tween(this.pic2) - .to(1, {x: this.pic2.baseX}, {easing: 'cubicInOut'}) + .to(1, { x: this.pic2.baseX }, { easing: 'cubicInOut' }) .call(() => { this._cantouch = true; }) @@ -279,18 +279,18 @@ cc.Class({ this._cantouch = false; const len = this.pic1.parent.width; cc.tween(this.pic1) - .to(1, {x: this.pic1.baseX - len}, {easing: 'cubicInOut'}) + .to(1, { x: this.pic1.baseX - len }, { easing: 'cubicInOut' }) .start(); cc.tween(this.pic2) - .to(1, {x: this.pic2.baseX - len}, {easing: 'cubicInOut'}) + .to(1, { x: this.pic2.baseX - len }, { easing: 'cubicInOut' }) .call(() => { this._cantouch = true; }) .start(); }, - // update (dt) {}, - + // update (dt) {}, + @@ -324,7 +324,7 @@ cc.Class({ getSpriteFrimeByUrl(url, cb) { - cc.loader.load({url}, (err, img) => { + cc.loader.load({ url }, (err, img) => { const spriteFrame = new cc.SpriteFrame(img) if (cb) { cb(spriteFrame); @@ -343,7 +343,7 @@ cc.Class({ }) }, - playAudioByUrl(audio_url, cb=null) { + playAudioByUrl(audio_url, cb = null) { if (audio_url) { cc.assetManager.loadRemote(audio_url, (err, audioClip) => { const audioId = cc.audioEngine.play(audioClip, false, 0.8); -- 2.21.0