Commit 33a168ea authored by wildfirecode's avatar wildfirecode

1

parents decc8e69 9f26a250
......@@ -5,15 +5,12 @@ import RotaryData from './RotaryData';
import Panel from "../../../libs/new_wx/components/Panel";
import PanelCtrl from "../../../libs/new_wx/ctrls/panelCtrl";
import { ModuleTypes } from "../../../libs/new_wx/types/sceneTypes";
import hdGameDoDojoin from "../../../libs/new_tw/ctrls/hdGameDoDojoin";
import submit from "../../../libs/new_tw/ctrls/submit";
import Loading from "../../../libs/new_wx/components/Loading";
import { NetManager } from "../../../libs/tw/manager/NetManager";
import Utils from "../../Utils";
import { loadSvga } from "../../loadSvga";
import getResPath from "../../../libs/new_tc/getResPath";
import wait from "../../../libs/new_tc/wait";
import tr = egret.sys.tr;
import { showToast } from "../../../libs/new_wx/ctrls/toastCtrl";
import getHomeData from "../../getHomeData";
// export const loadTurntableSvga = (callback) => {
......@@ -27,6 +24,9 @@ export default class Turntable extends Panel {
public start_btn: eui.Button;
public closeBtn: eui.Button;
private nextTimeNeedCoin: number = 0;
private remainTimes: number = 0;
public get skinKey() {
return 'Turntable'
}
......@@ -40,7 +40,9 @@ export default class Turntable extends Panel {
async start(data?) {
super.start();
console.log(data.onceAgain)
if(data.onceAgain) { // 再抽一次
this.onTapStart();
}
this['container'].addChild(this.data.mv);
this.hand = await loadSvga(getResPath() + 'resource/assets/svgas/hand.svga', this['container2'])
this['container2'].touchEnabled = false;
......@@ -76,7 +78,11 @@ export default class Turntable extends Panel {
onTapStart() {
this.setBtnTouch(false); // 锁定按钮
Loading.instace.show();
this['container2'].visible = false;
if(this.remainTimes <= 0 && (getHomeData().wealth < this.nextTimeNeedCoin)) {
showToast("元宝不足咯~快去闯关赢元宝吧");
Loading.instace.hide();
return;
}
this.queryPrize();
}
......@@ -87,12 +93,14 @@ export default class Turntable extends Panel {
// 设置全部按钮是否可以点击
private setBtnTouch(touchEnabled: boolean) {
this.start_btn.touchEnabled = touchEnabled;
this["closeBtn"].touchEnabled = touchEnabled;
}
/**
* 开始抽奖
*/
private queryPrize() {
this['container2'].visible = false;
egret.Tween.removeTweens(this.panel);
this.doJoin();
}
......@@ -114,10 +122,10 @@ export default class Turntable extends Panel {
const data = res.data;
const code = res.code;
let id = data.option.categoryType;
if(data.isScratchCard) {
id = "scratch";
} else if(!success || !data.option) {
if(!success || !data.option) {
id = "thanks";
} else if(data.isScratchCard) {
id = "scratch";
}
this.rotateByPrize(id, () => {
if(!success) {
......@@ -145,11 +153,16 @@ export default class Turntable extends Panel {
loadSvga(getResPath() + 'resource/assets/svgas/turnprize.svga').then(async (mv: any) => {
let _data = Utils.deepClone(data);
_data.mv = mv;
console.log(_data);
PanelCtrl.instance.show('TurnPrize2Panel', _data);
});
} else if(!data.option) {
PanelCtrl.instance.show("TurntableNoPrizePanel", {type: 3});
} else {
loadSvga(getResPath() + 'resource/assets/svgas/turnprize.svga').then(async (mv: any) => {
let _data = Utils.deepClone(data);
_data.mv = mv;
PanelCtrl.instance.show('TurnPrizePanel', _data);
});
}
});
})
......@@ -224,6 +237,9 @@ export default class Turntable extends Panel {
this['btnLabel'].text = `${data.nextTimeNeedCoin}元宝/次`;
}
this.remainTimes = data.remainTimes;
this.nextTimeNeedCoin = data.nextTimeNeedCoin;
// 添加奖品
let prizeList = [];
for(let v of data.luckyDrawInfo.prizeList) {
......
......@@ -42,7 +42,7 @@
},
"remainTimes":0,
"costCoinJoinTimes":10,
"nextTimeNeedCoin":150
"nextTimeNeedCoin":10000
},
"desc":"OK",
"success":true,
......
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