Commit 5319c475 authored by 邱旭's avatar 邱旭

1

parent d7801716
......@@ -5,16 +5,14 @@ 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) => {
// loadSvga(getResPath() + 'resource/assets/svgas/turntable.svga').then(async (mv: any) => {
// // await wait(100);
......@@ -26,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'
}
......@@ -39,11 +40,15 @@ 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;
this['container2'].touchChildren = false;
this['nums'].text = `当前可用元宝:${getHomeData().wealth}`;
this.initUI();
}
......@@ -74,7 +79,9 @@ 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("元宝不足咯~快去闯关赢元宝吧");
}
this.queryPrize();
}
......@@ -85,12 +92,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();
}
......@@ -112,10 +121,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) {
......@@ -227,6 +236,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) {
......
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