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

1

parent d7801716
...@@ -5,16 +5,14 @@ import RotaryData from './RotaryData'; ...@@ -5,16 +5,14 @@ import RotaryData from './RotaryData';
import Panel from "../../../libs/new_wx/components/Panel"; import Panel from "../../../libs/new_wx/components/Panel";
import PanelCtrl from "../../../libs/new_wx/ctrls/panelCtrl"; import PanelCtrl from "../../../libs/new_wx/ctrls/panelCtrl";
import { ModuleTypes } from "../../../libs/new_wx/types/sceneTypes"; 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 Loading from "../../../libs/new_wx/components/Loading";
import { NetManager } from "../../../libs/tw/manager/NetManager"; import { NetManager } from "../../../libs/tw/manager/NetManager";
import Utils from "../../Utils"; import Utils from "../../Utils";
import { loadSvga } from "../../loadSvga"; import { loadSvga } from "../../loadSvga";
import getResPath from "../../../libs/new_tc/getResPath"; import getResPath from "../../../libs/new_tc/getResPath";
import wait from "../../../libs/new_tc/wait"; import wait from "../../../libs/new_tc/wait";
import tr = egret.sys.tr;
import { showToast } from "../../../libs/new_wx/ctrls/toastCtrl"; import { showToast } from "../../../libs/new_wx/ctrls/toastCtrl";
import getHomeData from "../../getHomeData";
// export const loadTurntableSvga = (callback) => { // export const loadTurntableSvga = (callback) => {
// loadSvga(getResPath() + 'resource/assets/svgas/turntable.svga').then(async (mv: any) => { // loadSvga(getResPath() + 'resource/assets/svgas/turntable.svga').then(async (mv: any) => {
// // await wait(100); // // await wait(100);
...@@ -26,6 +24,9 @@ export default class Turntable extends Panel { ...@@ -26,6 +24,9 @@ export default class Turntable extends Panel {
public start_btn: eui.Button; public start_btn: eui.Button;
public closeBtn: eui.Button; public closeBtn: eui.Button;
private nextTimeNeedCoin: number = 0;
private remainTimes: number = 0;
public get skinKey() { public get skinKey() {
return 'Turntable' return 'Turntable'
} }
...@@ -39,11 +40,15 @@ export default class Turntable extends Panel { ...@@ -39,11 +40,15 @@ export default class Turntable extends Panel {
async start(data?) { async start(data?) {
super.start(); super.start();
console.log(data.onceAgain) if(data.onceAgain) { // 再抽一次
this.onTapStart();
}
this['container'].addChild(this.data.mv); this['container'].addChild(this.data.mv);
this.hand = await loadSvga(getResPath() + 'resource/assets/svgas/hand.svga', this['container2']) this.hand = await loadSvga(getResPath() + 'resource/assets/svgas/hand.svga', this['container2'])
this['container2'].touchEnabled = false; this['container2'].touchEnabled = false;
this['container2'].touchChildren = false; this['container2'].touchChildren = false;
this['nums'].text = `当前可用元宝:${getHomeData().wealth}`;
this.initUI(); this.initUI();
} }
...@@ -74,7 +79,9 @@ export default class Turntable extends Panel { ...@@ -74,7 +79,9 @@ export default class Turntable extends Panel {
onTapStart() { onTapStart() {
this.setBtnTouch(false); // 锁定按钮 this.setBtnTouch(false); // 锁定按钮
Loading.instace.show(); Loading.instace.show();
this['container2'].visible = false; if(this.remainTimes <= 0 && (getHomeData().wealth < this.nextTimeNeedCoin)) {
showToast("元宝不足咯~快去闯关赢元宝吧");
}
this.queryPrize(); this.queryPrize();
} }
...@@ -85,12 +92,14 @@ export default class Turntable extends Panel { ...@@ -85,12 +92,14 @@ export default class Turntable extends Panel {
// 设置全部按钮是否可以点击 // 设置全部按钮是否可以点击
private setBtnTouch(touchEnabled: boolean) { private setBtnTouch(touchEnabled: boolean) {
this.start_btn.touchEnabled = touchEnabled; this.start_btn.touchEnabled = touchEnabled;
this["closeBtn"].touchEnabled = touchEnabled;
} }
/** /**
* 开始抽奖 * 开始抽奖
*/ */
private queryPrize() { private queryPrize() {
this['container2'].visible = false;
egret.Tween.removeTweens(this.panel); egret.Tween.removeTweens(this.panel);
this.doJoin(); this.doJoin();
} }
...@@ -112,10 +121,10 @@ export default class Turntable extends Panel { ...@@ -112,10 +121,10 @@ export default class Turntable extends Panel {
const data = res.data; const data = res.data;
const code = res.code; const code = res.code;
let id = data.option.categoryType; let id = data.option.categoryType;
if(data.isScratchCard) { if(!success || !data.option) {
id = "scratch";
} else if(!success || !data.option) {
id = "thanks"; id = "thanks";
} else if(data.isScratchCard) {
id = "scratch";
} }
this.rotateByPrize(id, () => { this.rotateByPrize(id, () => {
if(!success) { if(!success) {
...@@ -227,6 +236,9 @@ export default class Turntable extends Panel { ...@@ -227,6 +236,9 @@ export default class Turntable extends Panel {
this['btnLabel'].text = `${data.nextTimeNeedCoin}元宝/次`; this['btnLabel'].text = `${data.nextTimeNeedCoin}元宝/次`;
} }
this.remainTimes = data.remainTimes;
this.nextTimeNeedCoin = data.nextTimeNeedCoin;
// 添加奖品 // 添加奖品
let prizeList = []; let prizeList = [];
for(let v of data.luckyDrawInfo.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