Commit 693f1945 authored by wildfirecode's avatar wildfirecode

1

parent 38c5f54d
No preview for this file type
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<script src="libs/security.js"></script> <script src="libs/security.js"></script>
<script src="libs/downloadApp.js"></script> <script src="libs/downloadApp.js"></script>
<script> <script>
window['numsP'] = 1; window['numsP'] = .1;
// window['debugPhysics']=true; // window['debugPhysics']=true;
window['renderMode']='webgl'; window['renderMode']='webgl';
window['development'] = true; window['development'] = true;
......
...@@ -9,13 +9,15 @@ export default class Alert extends Panel { ...@@ -9,13 +9,15 @@ export default class Alert extends Panel {
this.data.btnTxt = btnTxt || '确定'; this.data.btnTxt = btnTxt || '确定';
} }
get skinKey() { return 'Alert' } get skinKey() { return 'Alert' }
get skinResKey() { return 'common' }
protected get closeBtns(): eui.Button[] { protected get closeBtns(): eui.Button[] {
return [this['closeBtn']] return [this['closeBtn']]
} }
hidePanel(){ hidePanel() {
super.hidePanel(); super.hidePanel();
SceneCtrl.instance.change(ModuleTypes.START_SCENE); SceneCtrl.instance.change(ModuleTypes.START_SCENE);
} }
......
...@@ -5,6 +5,8 @@ export default class Panel extends ComponentBase { ...@@ -5,6 +5,8 @@ export default class Panel extends ComponentBase {
super(); super();
} }
get skinResKey(){return null}
initEvents() { initEvents() {
this.closeBtns.forEach( this.closeBtns.forEach(
btn => { if (btn) btn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap_closeBtn, this) } btn => { if (btn) btn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap_closeBtn, this) }
......
...@@ -21,7 +21,8 @@ export default class PanelCtrl { ...@@ -21,7 +21,8 @@ export default class PanelCtrl {
if (!window['development']) { if (!window['development']) {
Loading.instace.show(); Loading.instace.show();
const key = panel.skinKey.toLowerCase(); const key = panel.skinKey.toLowerCase();
const p = Promise.all([RES.getResAsync(`${key}_json`), RES.getResAsync(`${key}_png`)]); const reskey = panel.skinResKey || key;
const p = Promise.all([RES.getResAsync(`${reskey}_json`), RES.getResAsync(`${reskey}_png`)]);
p.then(() => { p.then(() => {
Loading.instace.hide(); Loading.instace.hide();
this.showAfterLoadAtlas(panel, data); this.showAfterLoadAtlas(panel, data);
......
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"common","version":5,"files":["../assets/common/alertbg.png","../assets/common/closeBtn.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"noprize","version":5,"files":["../assets/nprize/得分- 无发券.png","../assets/nprize/再来一次.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"play","version":5,"files":["../assets/playscene/tri2.png","../assets/playscene/tri1.png","../assets/playscene/testbtn.png","../assets/playscene/sq4.png","../assets/playscene/sq3.png","../assets/playscene/sq2.png","../assets/playscene/sq1.png","../assets/playscene/line.png","../assets/playscene/door.png","../assets/playscene/circle1.png","../assets/playscene/ball.png","../assets/playscene/引导.png","../assets/playscene/音乐开启.png","../assets/playscene/音乐关闭.png","../assets/playscene/炮.png","../assets/playscene/风扇1.png","../assets/playscene/风扇.png","../assets/playscene/地.png","../assets/playscene/+1.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"prize","version":5,"files":["../assets/prize/prizePanelbg.png","../assets/prize/PrizePanelX.png","../assets/prize/prizePanelUseBtn.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"rank","version":5,"files":["../assets/rank/userItemBg.png","../assets/rank/rankTitle.png","../assets/rank/num3.png","../assets/rank/num2.png","../assets/rank/num1.png","../assets/rank/dog.png","../assets/rank/commonPanelBg.png","../assets/rank/closeBtn.png","../assets/rank/bottomLine.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"rule","version":5,"files":["../assets/rule/X.png","../assets/rule/ruleBg.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"start","version":5,"files":["../assets/startScene/大标.png","../assets/startScene/地 拷贝.png","../assets/startScene/球.png","../assets/startScene/三角 拷贝 2.png","../assets/startScene/三角 拷贝.png","../assets/startScene/圆 拷贝.png","../assets/startScene/正方形 拷贝 2.png","../assets/startScene/正方形 拷贝.png","../assets/startScene/optionBtn.png","../assets/startScene/rankBtn.png","../assets/startScene/recordbtn.png","../assets/startScene/ruleBtn.png","../assets/startScene/start_btn_gray.png","../assets/startScene/start_btn.png"]}
\ No newline at end of file
...@@ -9,11 +9,11 @@ ...@@ -9,11 +9,11 @@
"name": "prize" "name": "prize"
}, },
{ {
"keys": "tri2_png,tri1_png,testbtn_png,sq4_png,sq3_png,sq2_png,sq1_png,playscenebg_jpg,line3_png,door_png,circle1_png,ball_png,引导_png,音乐开启_png,音乐关闭_png,炮_png,风扇1_png,风扇_png,地_png,+1_png", "keys": "tri2_png,tri1_png,testbtn_png,sq4_png,sq3_png,sq2_png,sq1_png,playscenebg_jpg,door_png,circle1_png,ball_png,引导_png,音乐开启_png,音乐关闭_png,炮_png,风扇1_png,风扇_png,地_png,+1_png,shootline_png",
"name": "play" "name": "play"
}, },
{ {
"keys": "userItemBg_png,rankTitle_png,num3_png,num2_png,num1_png,dog_png,commonPanelBg_png,closeBtn_png,bottomLine_png", "keys": "userItemBg_png,rankTitle_png,num3_png,num2_png,num1_png,dog_png,commonPanelBg_png,bottomLine_png",
"name": "rank" "name": "rank"
}, },
{ {
...@@ -21,12 +21,16 @@ ...@@ -21,12 +21,16 @@
"name": "rule" "name": "rule"
}, },
{ {
"keys": "alertbg_png,closeBtn2_png", "keys": "alertbg_png,closeCommonBtn_png",
"name": "common" "name": "common"
}, },
{ {
"keys": "得分- 无发券_png,再来一次_png", "keys": "得分- 无发券_png,再来一次_png",
"name": "noprize" "name": "noprize"
},
{
"keys": "relivebtn_png,relivebg_png",
"name": "relive"
} }
], ],
"resources": [ "resources": [
...@@ -150,11 +154,6 @@ ...@@ -150,11 +154,6 @@
"type": "image", "type": "image",
"name": "userItemBg_png" "name": "userItemBg_png"
}, },
{
"url": "assets/rank/closeBtn.png",
"type": "image",
"name": "closeBtn_png"
},
{ {
"url": "assets/rank/dog.png", "url": "assets/rank/dog.png",
"type": "image", "type": "image",
...@@ -245,11 +244,6 @@ ...@@ -245,11 +244,6 @@
"type": "image", "type": "image",
"name": "风扇1_png" "name": "风扇1_png"
}, },
{
"url": "assets/playscene/line.png",
"type": "image",
"name": "line3_png"
},
{ {
"url": "assets/startScene/地 拷贝.png", "url": "assets/startScene/地 拷贝.png",
"type": "image", "type": "image",
...@@ -300,11 +294,6 @@ ...@@ -300,11 +294,6 @@
"type": "image", "type": "image",
"name": "relivebtn_png" "name": "relivebtn_png"
}, },
{
"url": "assets/common/closeBtn.png",
"type": "image",
"name": "closeBtn2_png"
},
{ {
"url": "assets/relive/relivebg.png", "url": "assets/relive/relivebg.png",
"type": "image", "type": "image",
...@@ -324,6 +313,46 @@ ...@@ -324,6 +313,46 @@
"url": "assets/nprize/得分- 无发券.png", "url": "assets/nprize/得分- 无发券.png",
"type": "image", "type": "image",
"name": "得分- 无发券_png" "name": "得分- 无发券_png"
},
{
"url": "assets/sounds/bg.mp3",
"type": "sound",
"name": "bg_mp3"
},
{
"url": "assets/sounds/bounce.mp3",
"type": "sound",
"name": "bounce_mp3"
},
{
"url": "assets/sounds/good.mp3",
"type": "sound",
"name": "good_mp3"
},
{
"url": "assets/sounds/shoot.mp3",
"type": "sound",
"name": "shoot_mp3"
},
{
"url": "assets/sounds/recover.mp3",
"type": "sound",
"name": "recover_mp3"
},
{
"url": "assets/sounds/click.mp3",
"type": "sound",
"name": "click_mp3"
},
{
"url": "assets/common/closeCommonBtn.png",
"type": "image",
"name": "closeCommonBtn_png"
},
{
"url": "assets/playscene/shootline.png",
"type": "image",
"name": "shootline_png"
} }
] ]
} }
\ No newline at end of file
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
<e:Image source="得分- 无发券_png" y="221.55" horizontalCenter="0"/> <e:Image source="得分- 无发券_png" y="221.55" horizontalCenter="0"/>
<e:Button id="closeBtn" label="" x="622" y="200"> <e:Button id="closeBtn" label="" x="622" y="200">
<e:skinName> <e:skinName>
<e:Skin states="up,down,disabled"> <e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="closeBtn2_png" source.down="closeBtn2_png" source.disabled="closeBtn2_png"/> <e:Image width="100%" height="100%" source="closeCommonBtn_png" source.down="closeCommonBtn_png" source.disabled="closeCommonBtn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/> <e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin> </e:Skin>
</e:skinName> </e:skinName>
</e:Button> </e:Button>
<e:Button id="onceAgainBtn" label="" y="478" horizontalCenter="0"> <e:Button id="onceAgainBtn" label="" y="478" horizontalCenter="0">
......
...@@ -22,6 +22,6 @@ ...@@ -22,6 +22,6 @@
<e:Label id="ballNums" text="{data.currentBallNums}" y="202.96" verticalAlign="middle" textAlign="center" width="84.61" size="38" fontFamily="Tahoma" anchorOffsetX="0" anchorOffsetY="0" height="43" x="333.16" textColor="0xee5f00" touchEnabled="false"/> <e:Label id="ballNums" text="{data.currentBallNums}" y="202.96" verticalAlign="middle" textAlign="center" width="84.61" size="38" fontFamily="Tahoma" anchorOffsetX="0" anchorOffsetY="0" height="43" x="333.16" textColor="0xee5f00" touchEnabled="false"/>
<e:Image id="musicOff" source="音乐关闭_png" x="683.67" y="7"/> <e:Image id="musicOff" source="音乐关闭_png" x="683.67" y="7"/>
<e:Image id="musicOn" source="音乐开启_png" x="683.67" y="7"/> <e:Image id="musicOn" source="音乐开启_png" x="683.67" y="7"/>
<e:Image id="line" source="line3_png" x="375" y="222.4" anchorOffsetX="5" anchorOffsetY="-74" touchEnabled="false"/> <e:Image id="line" x="375" y="222.4" anchorOffsetX="5" anchorOffsetY="-74" touchEnabled="false" source="shootline_png"/>
<e:Image id="guide" source="引导_png" x="0" y="0"/> <e:Image id="guide" source="引导_png" x="0" y="0" locked="true"/>
</e:Skin> </e:Skin>
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<w:Config id="169001ce5a5"/> <w:Config id="169001ce5a5"/>
<e:Label id="userRankNum" text="{data.rank}" x="21.5" y="0" anchorOffsetX="0" width="126" textAlign="left" height="100%" textColor="0xb4592a" verticalAlign="middle" size="26"/> <e:Label id="userRankNum" text="{data.rank}" x="21.5" y="0" anchorOffsetX="0" width="126" textAlign="left" height="100%" textColor="0xb4592a" verticalAlign="middle" size="26"/>
<e:Label id="userId" text="{data.cid}" anchorOffsetX="0" width="191" textAlign="center" x="157" textColor="0xb4592a" verticalAlign="middle" height="100%" size="26"/> <e:Label id="userId" text="{data.cid}" anchorOffsetX="0" width="191" textAlign="center" x="157" textColor="0xb4592a" verticalAlign="middle" height="100%" size="26"/>
<e:Label id="userScore" text="{data.maxScore}" anchorOffsetX="0" width="219" textColor="0xb4592a" height="100%" x="346" verticalAlign="middle" y="0" textAlign="center" size="26"/> <e:Label id="userScore" text="{data.maxScore}" anchorOffsetX="0" width="231" textColor="0xb4592a" height="100%" x="336" verticalAlign="middle" y="0" textAlign="center" size="26"/>
<e:Image id="bottomLine" source="bottomLine_png" x="0" bottom="0"/> <e:Image id="bottomLine" source="bottomLine_png" x="0" bottom="0"/>
<e:Image id="num3" source="num3_png" x="60" y="5" visible="false"/> <e:Image id="num3" source="num3_png" x="60" y="5" visible="false"/>
<e:Image id="num2" source="num2_png" x="60" y="5" visible="false"/> <e:Image id="num2" source="num2_png" x="60" y="5" visible="false"/>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<e:Button id="closeBtn" label="" horizontalCenter="256.5" verticalCenter="-600.5"> <e:Button id="closeBtn" label="" horizontalCenter="256.5" verticalCenter="-600.5">
<e:skinName> <e:skinName>
<e:Skin states="up,down,disabled"> <e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="closeBtn2_png" source.down="closeBtn2_png" source.disabled="closeBtn2_png"/> <e:Image width="100%" height="100%" source="closeCommonBtn_png" source.down="closeCommonBtn_png" source.disabled="closeCommonBtn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/> <e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin> </e:Skin>
</e:skinName> </e:skinName>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<e:Button id="closeBtn" label="" x="606.06" y="184.88"> <e:Button id="closeBtn" label="" x="606.06" y="184.88">
<e:skinName> <e:skinName>
<e:Skin states="up,down,disabled"> <e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="closeBtn2_png" source.down="closeBtn2_png" source.disabled="closeBtn2_png"/> <e:Image width="100%" height="100%" source="closeCommonBtn_png" source.down="closeCommonBtn_png" source.disabled="closeCommonBtn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/> <e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin> </e:Skin>
</e:skinName> </e:skinName>
......
...@@ -48,11 +48,11 @@ ...@@ -48,11 +48,11 @@
</e:skinName> </e:skinName>
</e:Button> </e:Button>
<e:Image source="地 拷贝_png" x="2" y="1062"/> <e:Image source="地 拷贝_png" x="2" y="1062"/>
<e:Image source="三角 拷贝 2_png" x="375" y="630"/> <e:Image id="ele4" source="三角 拷贝 2_png" x="390" y="668" anchorOffsetX="30" anchorOffsetY="40"/>
<e:Image source="三角 拷贝_png" x="633.5" y="1012"/> <e:Image id="ele5" source="三角 拷贝_png" x="660.5" y="1042" anchorOffsetX="27" anchorOffsetY="30"/>
<e:Image source="正方形 拷贝 2_png" x="44" y="776"/> <e:Image id="ele3" source="正方形 拷贝 2_png" x="86" y="818" anchorOffsetX="42" anchorOffsetY="42"/>
<e:Image source="正方形 拷贝_png" x="596" y="198.5"/> <e:Image id="ele2" source="正方形 拷贝_png" x="634" y="235.5" anchorOffsetX="38" anchorOffsetY="37"/>
<e:Image source="圆 拷贝_png" x="52" y="188"/> <e:Image id="ele1" source="圆 拷贝_png" x="82" y="217" anchorOffsetX="30" anchorOffsetY="29"/>
<e:Image source="大标_png" x="104" y="138"/> <e:Image source="大标_png" x="104" y="138"/>
<e:Image source="球_png" x="112" y="246"/> <e:Image source="球_png" x="112" y="246"/>
</e:Skin> </e:Skin>
\ No newline at end of file
...@@ -23,11 +23,14 @@ import { getBlocks, resetCounter, getCounter } from "./blockGen"; ...@@ -23,11 +23,14 @@ import { getBlocks, resetCounter, getCounter } from "./blockGen";
import createSpeialCircle from "./factory/createSpeialCircle"; import createSpeialCircle from "./factory/createSpeialCircle";
import { NetManager } from "../../libs/tw/manager/NetManager"; import { NetManager } from "../../libs/tw/manager/NetManager";
import Effect from "../Effect"; import Effect from "../Effect";
import { toggleSound, playSound, SoundType, playBg } from "../soundCtrl";
export default class PlayScene extends Scene { export default class PlayScene extends Scene {
initEvents() { initEvents() {
this.stage.addEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this); this.stage.addEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
this.stage.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTouchBegin, this); this.stage.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTouchBegin, this);
this['musicOn'].addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTouchTap_musicOn, this);
this['musicOff'].addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTouchTap_musicOff, this);
} }
protected removeEvents() { protected removeEvents() {
...@@ -35,6 +38,21 @@ export default class PlayScene extends Scene { ...@@ -35,6 +38,21 @@ export default class PlayScene extends Scene {
this.stage.removeEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this); this.stage.removeEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
} }
onTouchTap_musicOn(e: egret.TouchEvent) {//关闭
e.stopPropagation();
this['musicOn'].visible = !this['musicOn'].visible;
this['musicOff'].visible = !this['musicOff'].visible;
playSound(SoundType.click);
toggleSound();
}
onTouchTap_musicOff(e: egret.TouchEvent) {//开启
e.stopPropagation();
toggleSound();
this['musicOn'].visible = !this['musicOn'].visible;
this['musicOff'].visible = !this['musicOff'].visible;
}
/** 重力因子,默认1 */ /** 重力因子,默认1 */
private gravity = 1; private gravity = 1;
/** 物理时间缩放因子 */ /** 物理时间缩放因子 */
...@@ -65,8 +83,14 @@ export default class PlayScene extends Scene { ...@@ -65,8 +83,14 @@ export default class PlayScene extends Scene {
async start(data?) { async start(data?) {
super.start(); super.start();
playBg();
this['musicOn'].visible = true;
this['musicOff'].visible = false;
this.startGame(); this.startGame();
egret.Tween.get(this['ele1'], { loop: true }).set({ rotation: 0 }).to({ rotation: -360 }, 3000);
egret.Tween.get(this['ele2'], { loop: true }).set({ rotation: 0 }).to({ rotation: 360 }, 3000);
createSpecialRegTriangle(this, 60, 250, 200, 55, 'specialRegTriangleTop');//2只鸡 createSpecialRegTriangle(this, 60, 250, 200, 55, 'specialRegTriangleTop');//2只鸡
createSpecialRegTriangle(this, 750 - 60, 250, 200, -55, 'specialRegTriangleTop');//2只鸡 createSpecialRegTriangle(this, 750 - 60, 250, 200, -55, 'specialRegTriangleTop');//2只鸡
createSpecialRegTriangle(this, 150, 90, 500, 4, 'specialRegTriangleTop');//顶部两根棍子 createSpecialRegTriangle(this, 150, 90, 500, 4, 'specialRegTriangleTop');//顶部两根棍子
...@@ -254,6 +278,7 @@ export default class PlayScene extends Scene { ...@@ -254,6 +278,7 @@ export default class PlayScene extends Scene {
//如果是其他特殊的,不处理 //如果是其他特殊的,不处理
if (isSpecialCircle(block)) {//如果是特殊的圆,那么创建一个新的球,移除特殊圆 if (isSpecialCircle(block)) {//如果是特殊的圆,那么创建一个新的球,移除特殊圆
this.ballCountAll++; this.ballCountAll++;
playSound(SoundType.good)
const newball = createBallItem() const newball = createBallItem()
this.addChild(newball.view); this.addChild(newball.view);
newball.view.y = ball.view.y = block.y; newball.view.y = ball.view.y = block.y;
...@@ -271,6 +296,7 @@ export default class PlayScene extends Scene { ...@@ -271,6 +296,7 @@ export default class PlayScene extends Scene {
this.shake(block); this.shake(block);
this.data.score++; this.data.score++;
block.num = block.num - 1; block.num = block.num - 1;
playSound(SoundType.bounce);
if (block.num <= 0) { if (block.num <= 0) {
new Effect(block, this); new Effect(block, this);
//回收加动效 //回收加动效
...@@ -332,6 +358,7 @@ export default class PlayScene extends Scene { ...@@ -332,6 +358,7 @@ export default class PlayScene extends Scene {
useFrame: true, useFrame: true,
onComplete: () => { onComplete: () => {
ball.view.x = targX; ball.view.x = targX;
playSound(SoundType.recover);
Tween.to(ball.view, 20, { Tween.to(ball.view, 20, {
y: this.line.y - this.line.anchorOffsetY + BALL_D / 2, y: this.line.y - this.line.anchorOffsetY + BALL_D / 2,
useFrame: true, useFrame: true,
...@@ -343,6 +370,7 @@ export default class PlayScene extends Scene { ...@@ -343,6 +370,7 @@ export default class PlayScene extends Scene {
onComplete: () => { onComplete: () => {
this.data.currentBallNums++; this.data.currentBallNums++;
this.ballCount++; this.ballCount++;
if (this.ballCount == this.ballCountAll) { if (this.ballCount == this.ballCountAll) {
this.canShootTag = true; this.canShootTag = true;
this.onShootEnd(); this.onShootEnd();
...@@ -367,6 +395,7 @@ export default class PlayScene extends Scene { ...@@ -367,6 +395,7 @@ export default class PlayScene extends Scene {
let count = 0; let count = 0;
const timer = setInterval(() => { const timer = setInterval(() => {
count++; count++;
playSound(SoundType.shoot);
this.data.currentBallNums--; this.data.currentBallNums--;
if (this.data.currentBallNums < 0) if (this.data.currentBallNums < 0)
this.data.currentBallNums = 0; this.data.currentBallNums = 0;
......
let soundOn = true;
let bgChannel: egret.SoundChannel;
let loading = false;
export const getSoundOn = () => {
return soundOn
}
export const toggleSound = () => {
soundOn = !soundOn;
if (bgChannel) {
if (!soundOn) {
bgChannel.stop();
bgChannel = null;
}
} else {
if (soundOn) {
playBg();
}
}
}
export const playBg = async () => {
if (bgChannel) return;
if (loading) return;
loading = true;
const bg = await RES.getResAsync('bg_mp3');
bgChannel = bg.play();
loading = false;
}
export enum SoundType {
click = 'click',
bounce = 'bounce',
good = 'good',
recover = 'recover',
shoot = 'shoot',
}
export const playSound = (type: SoundType) => {
if (!soundOn) return;
const sound: egret.Sound = RES.getRes(type + "_mp3");
if (sound)
sound.play(0, 1);
else
RES.getResAsync(type + "_mp3")
}
\ No newline at end of file
...@@ -9,7 +9,6 @@ import SceneCtrl from "../../libs/new_wx/ctrls/sceneCtrl"; ...@@ -9,7 +9,6 @@ import SceneCtrl from "../../libs/new_wx/ctrls/sceneCtrl";
import { ModuleTypes } from "../../libs/new_wx/types/sceneTypes"; import { ModuleTypes } from "../../libs/new_wx/types/sceneTypes";
import { DataManager } from "../../libs/tw/manager/DataManager"; import { DataManager } from "../../libs/tw/manager/DataManager";
import { NetManager } from "../../libs/tw/manager/NetManager"; import { NetManager } from "../../libs/tw/manager/NetManager";
import Effect from "../Effect";
export default class StartScene extends Scene { export default class StartScene extends Scene {
ruleBtn: eui.Button; ruleBtn: eui.Button;
...@@ -25,24 +24,24 @@ export default class StartScene extends Scene { ...@@ -25,24 +24,24 @@ export default class StartScene extends Scene {
exemptionTxt: eui.Label; exemptionTxt: eui.Label;
async start(data?) { async start(data?) {
this.startBtn.visible = false; this.startBtn.visible = false;
this.updateGetInfoView(); this.updateGetInfoView();
this.updateExemptionTxt(); this.updateExemptionTxt();
super.start(); super.start();
egret.Tween.get(this.startBtn,{loop:true}).to({scaleX:.9,scaleY:.9},150).to({scaleX:1,scaleY:1},500,egret.Ease.getBackOut(5)).wait(600);
NetManager.ins.getCredits(() => { NetManager.ins.getCredits(() => {
this.data.credit = `我的${DataManager.ins.getCreditsData.unitName}:${DataManager.ins.getCreditsData.consumerCredits}`; this.data.credit = `我的${DataManager.ins.getCreditsData.unitName}:${DataManager.ins.getCreditsData.consumerCredits}`;
}); });
NetManager.ins.getPrizeInfo(() => { }, window['revivePlugId']); NetManager.ins.getPrizeInfo(() => { }, window['revivePlugId']);
// setTimeout(() => { for (let i = 1; i <= 5; i++) {
// const e = new Effect('circle1_png'); const ele = this['ele' + i];
// this.addChild(e); egret.Tween.get(ele, { loop: true }).set({ rotation: 0 }).to({ rotation: Math.random() > 0.5 ? 360 : -360 }, 3000)
// e.x = 375; }
// e.y = 500;
// }, 1000);
} }
private updateGetInfoView() { private updateGetInfoView() {
...@@ -63,7 +62,7 @@ export default class StartScene extends Scene { ...@@ -63,7 +62,7 @@ export default class StartScene extends Scene {
} }
updateCountTxt() { updateCountTxt() {
this.data.count = `消耗:${getCountTxt()}`; this.data.count = `${getCountTxt()}`;
} }
updateExemptionTxt() { updateExemptionTxt() {
......
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