Commit f41fe2d1 authored by 邱旭's avatar 邱旭

1

parent ee2d4568
......@@ -37,13 +37,13 @@ export default class TurntableIcon extends IconBase {
return;
}
let data = res.data;
this.visible = res.data.luckyDrawInfo.enable;
if (data.remainTimes > 0 || (getHomeData().wealth > data.nextTimeNeedCoin)) {
this.tipsVisible = true;
this.iconTips.text = "有优惠"
} else {
this.tipsVisible = false;
}
this.visible = res.data.luckyDrawInfo.enable;
if(!res.data.luckyDrawInfo.enable)
GDispatcher.dispatchEvent('updateScratchPosition');
})
......
......@@ -11,8 +11,9 @@ export default class BagQuitPanel extends Panel {
panel: string
start(data) {
super.start();
this.data = data;
this.showlog();
this.panel = data;
this.panel = data.from;
}
showlog() {
......@@ -26,7 +27,7 @@ export default class BagQuitPanel extends Panel {
}
onresumebtn() {
PanelCtrl.instance.show(this.panel)
PanelCtrl.instance.show(this.panel, this.data.data);
NetManager.ins.clickLog(getlogItem(42));
}
......
......@@ -12,6 +12,7 @@ import CountDown from "../mapScene/CountDown";
import { showShare } from "../shareCtrl";
import { gotoNextLevel } from "./gotoNextLevel";
import BloodPanel2 from "./BloodPanel2";
import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl";
export default class BloodPanel extends Panel {
start(data) {
......@@ -19,43 +20,44 @@ export default class BloodPanel extends Panel {
this.updateData();
this.showlog();
this['price1Txt'].text =`${ window['price1']}个元宝=1个体力值`;
this['resumeBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP,()=>{
this['price1Txt'].text = `${window['price1']}个元宝=1个体力值`;
this['resumeBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
gotoNextLevel();
},this);
}, this);
}
showlog(){
showlog() {
NetManager.ins.showLog(getlogItem(3));
NetManager.ins.showLog(getlogItem(4));
NetManager.ins.showLog(getlogItem(30));
}
static MAX =3;
private _countDown:CountDown;
static MAX = 3;
private _countDown: CountDown;
private updateData() {
if(this._countDown == null ) {
this._countDown = new CountDown(this['countdownTxt'],(str)=>`距离下一次体力补给时间:${str}`);
if(this._countDown == null) {
this._countDown = new CountDown(this['countdownTxt'], (str) => `距离下一次体力补给时间:${str}`);
}
const homeData = getHomeData();
this['bloodTxt'].text = `你的可用体力值为:${homeData.remainEnargy}`;
const data = getHomeData();
this['invitTxt'].text = `(已领${data.askForEnergy}/${BloodPanel.MAX})`;
if (data.askForEnergy >= BloodPanel.MAX){
this['inviteBtn2'].visible=true;
if(data.askForEnergy >= BloodPanel.MAX) {
this['inviteBtn2'].visible = true;
}
if(data.remainEnargy >= BLOOD_NUMS_MAX) { //满了
this['bloodTxt'].text = `你的可用体力值为:${homeData.remainEnargy}`;
this._countDown.stop();
this['countdownTxt'].visible=false;
}else {
this['countdownTxt'].visible=true;
this['countdownTxt'].visible = false;
} else {
this['countdownTxt'].visible = true;
const left = data.refectionCountdown - Math.floor(new Date().getTime() / 1000);
this._countDown.reset(left);
}
}
updateTimerView(){
updateTimerView() {
this.updateData();
}
......@@ -71,45 +73,52 @@ export default class BloodPanel extends Panel {
this['buyBtn'].enabled = false;
NetManager.ins.hc_exchange((success) => {
this['buyBtn'].enabled = true;
if (success) {
if(success) {
showToast('兑换成功');
NetManager.ins.hc_home(() => {
this.updateData();
updateMainTimer();
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
} else {
PanelCtrl.instance.show('shopTip', {from: 'bloodPanel', data: null});
}
}, 1);
}
onTapInvite() {
if (iswx()) {
if(iswx()) {
getShareUrl(this.stage);
} else
showShare(1);
NetManager.ins.clickLog(getlogItem(4));
const data = getHomeData();
if (data.askForEnergy >= BloodPanel.MAX) {
if(data.askForEnergy >= BloodPanel.MAX) {
showToast('对不起,索要体力的机会已经用完了~');
return;
}
this['inviteBtn'].enabled = false;
NetManager.ins.hc_askForEnergy((success) => {
this['inviteBtn'].enabled = true;
if (success) {
if(success) {
}
NetManager.ins.hc_home(() => {
this.updateData();
updateMainTimer();
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
wait(2000).then(()=>{
wait(2000).then(() => {
showToast('分享成功~');
});
})
}
protected get closeBtns(): eui.Button[] { return [this['closeBtn'], this['resumeBtn']] }
get skinKey() { return 'Blood' }
protected get closeBtns(): eui.Button[] {
return [this['closeBtn'], this['resumeBtn']]
}
get skinKey() {
return 'Blood'
}
}
\ No newline at end of file
......@@ -13,17 +13,17 @@ import MainScene from "../mainScene/MainScene";
export default class Buy1Panel extends Panel {
buyBtn: eui.Button
onTouchTap_closeBtn(){
onTouchTap_closeBtn() {
super.onTouchTap_closeBtn();
PanelCtrl.instance.show('bagquit','Buy1')
PanelCtrl.instance.show('bagquit', {from: 'Buy1', data: this.data});
}
start(data) {
super.start();
this.data = data;
this['buyBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.ontap, this);
this.showlog();
this['priceTxt'].text = '-'+window['price3'];
this['priceTxt'].text = '-' + window['price3'];
this['moneyTxt'].text = getHomeData().wealth;
setGlow(this['priceTxt'], 0x0083e8, 1);
......@@ -38,22 +38,24 @@ export default class Buy1Panel extends Panel {
this.buyBtn.enabled = false;
NetManager.ins.hc_exchange((success) => {
this.buyBtn.enabled = true;
if (success) {
if(success) {
this.hidePanel();
if(SceneCtrl.instance.currentScene instanceof MainScene){
if(SceneCtrl.instance.currentScene instanceof MainScene) {
showToast('兑换成功');
}else {
} else {
showToast2();
}
NetManager.ins.hc_home(() => {
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
}else {
PanelCtrl.instance.show('shopTip');
} else {
PanelCtrl.instance.show('shopTip', this.data);
}
}, PropType.HAMMER);//兑换道具
}
get skinKey() { return 'Buy1' }
get skinKey() {
return 'Buy1'
}
}
\ No newline at end of file
......@@ -13,10 +13,11 @@ import MainScene from "../mainScene/MainScene";
export default class Buy2Panel extends Panel {
onTouchTap_closeBtn(){
super.onTouchTap_closeBtn();
PanelCtrl.instance.show('bagquit','Buy2')
PanelCtrl.instance.show('bagquit',{from: 'Buy2', data: this.data})
}
start(data) {
super.start();
this.data = data;
this['buyBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.ontap, this);
this.showlog();
......@@ -44,7 +45,7 @@ export default class Buy2Panel extends Panel {
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
}else{
PanelCtrl.instance.show('shopTip');
PanelCtrl.instance.show('shopTip', this.data);
}
}, PropType.BOOM);//兑换道具
}
......
......@@ -11,41 +11,49 @@ import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl";
import MainScene from "../mainScene/MainScene";
export default class Buy3Panel extends Panel {
onTouchTap_closeBtn(){
onTouchTap_closeBtn() {
super.onTouchTap_closeBtn();
PanelCtrl.instance.show('bagquit','Buy3')
PanelCtrl.instance.show('bagquit', {from: 'Buy3', data: this.data})
}
start(data) {
super.start();
this.data = data;
this['buyBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.ontap, this);
this.showlog();
this['priceTxt'].text = '-'+window['price4'];
this['priceTxt'].text = '-' + window['price4'];
setGlow(this['priceTxt'], 0x0083e8, 1);
this['moneyTxt'].text = getHomeData().wealth;
}
showlog() {
NetManager.ins.showLog(getlogItem(14));
}
buyBtn: eui.Button
get skinKey() { return 'Buy3' }
get skinKey() {
return 'Buy3'
}
ontap() {
NetManager.ins.clickLog(getlogItem(14));
this.buyBtn.enabled = false;
NetManager.ins.hc_exchange((success) => {
this.buyBtn.enabled = true;
if (success) {
if(SceneCtrl.instance.currentScene instanceof MainScene){
if(success) {
if(SceneCtrl.instance.currentScene instanceof MainScene) {
showToast('兑换成功');
}else {
} else {
showToast2();
}
this.hidePanel();
NetManager.ins.hc_home(() => {
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
}else{
PanelCtrl.instance.show('shopTip');
} else {
PanelCtrl.instance.show('shopTip', this.data);
}
}, PropType.CHANCE_NUM);//兑换道具
}
......
......@@ -10,37 +10,44 @@ import { showToast2 } from "../../libs/new_wx/ctrls/toastCtrl2";
import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl";
export default class ExchangePanel extends Panel {
onTouchTap_closeBtn(){
onTouchTap_closeBtn() {
super.onTouchTap_closeBtn();
PanelCtrl.instance.show('bagquit','ExchangePanel')
PanelCtrl.instance.show('bagquit', {from: 'ExchangePanel', data: this.data})
}
start(data) {
super.start();
this.data = data;
this['buyBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.ontap, this);
this.showlog();
this['priceTxt'].text = '-'+window['price5'];
this['priceTxt'].text = '-' + window['price5'];
setGlow(this['priceTxt'], 0x0083e8, 1);
this['moneyTxt'].text = getHomeData().wealth;
}
showlog() {
NetManager.ins.showLog(getlogItem(41));
}
buyBtn: eui.Button
get skinKey() { return 'Exchange' }
get skinKey() {
return 'Exchange'
}
ontap() {
NetManager.ins.clickLog(getlogItem(41));
this.buyBtn.enabled = false;
NetManager.ins.hc_exchange((success) => {
this.buyBtn.enabled = true;
if (success) {
if(success) {
showToast2();
this.hidePanel();
NetManager.ins.hc_home(() => {
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
}else{
PanelCtrl.instance.show('shopTip');
} else {
PanelCtrl.instance.show('shopTip', this.data);
}
}, PropType.CASH_NUM);//兑换道具
}
......
......@@ -5,6 +5,8 @@ import { getlogItem } from "../Main";
import Utils from "../Utils";
import { showToast } from "../../libs/new_wx/ctrls/toastCtrl";
import SceneCtrl from "../../libs/new_wx/ctrls/sceneCtrl";
import { loadSvga } from "../loadSvga";
import getResPath from "../../libs/new_tc/getResPath";
const MIN: number = 1;
const MAX: number = 100;
......@@ -33,6 +35,7 @@ export default class RechargePanel extends Panel {
start(data) {
super.start();
this.data = data;
this.getYunZuan();
this.setNum();
NetManager.ins.showLog(getlogItem(70));
......@@ -160,9 +163,17 @@ export default class RechargePanel extends Panel {
}, this.nowNumber);
}
onTouchTap_closeBtn() {
public onTouchTap_closeBtn() {
super.onTouchTap_closeBtn();
PanelCtrl.instance.show('Shop');
if(!this.data) return;
if(this.data.from == 'turnTable') {
loadSvga(getResPath() + 'resource/assets/svgas/turntable.svga').then(async (mv: any) => {
// await wait(100);
PanelCtrl.instance.show('turnTable', {mv: mv})
})
} else {
PanelCtrl.instance.show(this.data.from, this.data.data);
}
}
private getYunZuan() {
......
......@@ -26,7 +26,7 @@ export default class ShopPanel extends Panel {
private goRecharge() {
NetManager.ins.clickLog(getlogItem(68));
PanelCtrl.instance.show('recharge');
PanelCtrl.instance.show('recharge', {from: 'Shop', data: null});
}
destroy() {
......@@ -47,12 +47,12 @@ export default class ShopPanel extends Panel {
}
onBuy4() {
PanelCtrl.instance.show('ExchangePanel');
PanelCtrl.instance.show('ExchangePanel', {from: 'Shop', data: null});
NetManager.ins.clickLog(getlogItem(40));
}
onBuy1() {
PanelCtrl.instance.show('Buy1');
PanelCtrl.instance.show('Buy1', {from: 'Shop', data: null});
NetManager.ins.clickLog(getlogItem(9));
// this.buyBtn1.enabled = false;
// NetManager.ins.hc_exchange((success) => {
......@@ -66,7 +66,7 @@ export default class ShopPanel extends Panel {
}
onBuy2() {
PanelCtrl.instance.show('Buy2');
PanelCtrl.instance.show('Buy2', {from: 'Shop', data: null});
NetManager.ins.clickLog(getlogItem(6));
// this.buyBtn2.enabled = false;
// NetManager.ins.hc_exchange((success) => {
......@@ -81,7 +81,7 @@ export default class ShopPanel extends Panel {
onBuy3() {
NetManager.ins.clickLog(getlogItem(12));
PanelCtrl.instance.show('Buy3');
PanelCtrl.instance.show('Buy3', {from: 'Shop', data: null});
// this.buyBtn3.enabled = false;
// NetManager.ins.hc_exchange((success) => {
// this.buyBtn3.enabled = true;
......
......@@ -2,6 +2,8 @@ import Panel from "../../libs/new_wx/components/Panel";
import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl";
import { NetManager } from "../../libs/tw/manager/NetManager";
import { getlogItem } from "../Main";
import { loadSvga } from "../loadSvga";
import getResPath from "../../libs/new_tc/getResPath";
export default class ShopTipPanel extends Panel {
public closeBtn: eui.Button;
......@@ -9,9 +11,23 @@ export default class ShopTipPanel extends Panel {
start(data) {
super.start();
this.data = data;
NetManager.ins.showLog(getlogItem(69));
}
public onTouchTap_closeBtn() {
super.onTouchTap_closeBtn();
if(!this.data) return;
if(this.data.from == 'turnTable') {
loadSvga(getResPath() + 'resource/assets/svgas/turntable.svga').then(async (mv: any) => {
// await wait(100);
PanelCtrl.instance.show('turnTable', {mv: mv})
})
} else {
PanelCtrl.instance.show(this.data.from, this.data.data);
}
}
initEvents() {
super.initEvents();
this.btn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchBtn, this);
......@@ -19,8 +35,7 @@ export default class ShopTipPanel extends Panel {
onTouchBtn() {
NetManager.ins.clickLog(getlogItem(69));
PanelCtrl.instance.show('recharge');
// this.onTouchTap_closeBtn();
PanelCtrl.instance.show('recharge', this.data);
}
removeEvents() {
......
......@@ -25,9 +25,11 @@ export default class StartPanel extends Panel {
static currlevel;
private _level;
private list: eui.List;
showlog(){
}
showlog() {
}
start(data) {
this.showlog()
super.start();
......@@ -36,12 +38,11 @@ showlog(){
this['price4'].text = `-${window['price4']}元宝`;
const homedata = getHomeData();
if (data > homedata.levels.length) {
addAdComp(84, 901, this,29);
if(data > homedata.levels.length) {
addAdComp(84, 901, this, 29);
NetManager.ins.showLog(getlogItem(29));
}
else
addRankFriendList(84, 901, this,data);
} else
addRankFriendList(84, 901, this, data);
setGlow(this['levelTxt'], 0xfa4b09, 1);
this['levelTxt'].text = `第${data}关`;
......@@ -50,7 +51,7 @@ showlog(){
this['targetGroup'].visible = false;
this['scoreGroup'].visible = false;
const levelType = getChapterData(mapDataIndex).passTarget.type;
if (levelType == PassType.ELEMENT_TARGET) {
if(levelType == PassType.ELEMENT_TARGET) {
this['targetGroup'].visible = true;
// this['targetTxt'].text = '在规定步数内\n消除足够数量目标';
......@@ -58,10 +59,9 @@ showlog(){
const ac = new eui.ArrayCollection(getChapterData(mapDataIndex).passTarget.elements);
this.list.dataProvider = ac;
const elements = getChapterData(mapDataIndex).passTarget.elements;
if (elements.length == 1 && elements[0].type == ElementType.LOLLIPOP)
if(elements.length == 1 && elements[0].type == ElementType.LOLLIPOP)
this['tips'].text = '在指定步数内将目标元素移至最底部';
}
else if (levelType == PassType.SCORE_TARGET) {
} else if(levelType == PassType.SCORE_TARGET) {
this['scoreGroup'].visible = true;
this['targetScoreTxt'].text = `${getChapterData(mapDataIndex).passTarget.score}`;
// this['targetTxt'].text = `在规定步数内\n分数达到${getChapterData(mapDataIndex).passTarget.score}分`;
......@@ -85,11 +85,11 @@ showlog(){
onTap_startBtn() {
const homeData = getHomeData();
if (homeData.remainEnargy <= 0) {
if (homeData.askForEnergy) {
if(homeData.remainEnargy <= 0) {
if(homeData.askForEnergy) {
PanelCtrl.instance.show('blood2Panel');
} else {
if (iswx()) {
if(iswx()) {
getShareUrl(this.stage);
} else
showShare(1);
......@@ -121,7 +121,7 @@ showlog(){
wait(5000).then(() => {
updateMainTimerAfterGetData();
});
if (success) {
if(success) {
// Loading.instace.show();
this.hidePanel();
try {
......@@ -129,27 +129,32 @@ showlog(){
await Promise.all([
RES.getResAsync(`${key}_json`),
RES.getResAsync(`${key}_png`)]);
} catch (error) {
} catch(error) {
}
// Loading.instace.hide();
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE, { chapter: this._level });
StartPanel.currlevel=this._level
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE, {chapter: this._level});
StartPanel.currlevel = this._level
}
}, this._level);
}
onTap_buy1btn() {
PanelCtrl.instance.show('Buy1');
PanelCtrl.instance.show('Buy1', {from: 'StartPanel', data: this._level});
}
onTap_buy2btn() {
PanelCtrl.instance.show('Buy2');
PanelCtrl.instance.show('Buy2', {from: 'StartPanel', data: this._level});
}
onTap_buy3btn() {
PanelCtrl.instance.show('Buy3');
PanelCtrl.instance.show('Buy3', {from: 'StartPanel', data: this._level});
}
get skinKey() { return 'StartPanel' }
get skinKey() {
return 'StartPanel'
}
}
\ No newline at end of file
......@@ -84,7 +84,8 @@ export default class Turntable extends Panel {
this.setBtnTouch(false); // 锁定按钮
Loading.instace.show();
if(this.remainTimes <= 0 && (getHomeData().wealth < this.nextTimeNeedCoin)) {
showToast("元宝不足咯~快去闯关赢元宝吧");
// showToast("元宝不足咯~快去闯关赢元宝吧");
PanelCtrl.instance.show('shopTip', {from: 'turnTable', data: null});
Loading.instace.hide();
this.setBtnTouch(true);
return;
......
......@@ -1136,7 +1136,7 @@
"remainProp": [
{
"type": 2,
"num": 1
"num": 0
},
{
"type": 3,
......
......@@ -4,113 +4,10 @@
"remainTimes": 0,
"costCoinJoinTimes": 2,
"luckyDrawInfo": {
"baseCount": 30,
"baseCount": 0,
"bonusCount": 0,
"enable": true,
"prizeList": [
{
"appItemId": null,
"coinType": 1,
"img": "",
"maxValue": 50,
"num": null,
"title": "50元宝",
"categoryType": 4,
"minValue": 50,
"realValue": null,
"rate": "40",
"name": "",
"id": "",
"propType": null,
"day": null,
"value": ""
},
{
"appItemId": null,
"coinType": null,
"img": "",
"maxValue": null,
"num": null,
"title": "道具",
"categoryType": 3,
"minValue": null,
"realValue": null,
"rate": "11",
"name": "",
"id": "",
"propType": 2,
"day": null,
"value": ""
},
{
"appItemId": 2191088,
"coinType": null,
"img": "//yun.duiba.com.cn/images/201911/pktvju5tgn.png",
"maxValue": null,
"num": null,
"title": "0.68元",
"categoryType": 7,
"minValue": null,
"realValue": null,
"rate": "1",
"name": "邀请5人0.68元现金券",
"id": "",
"propType": null,
"day": null,
"value": "297775348866940929"
},
{
"appItemId": null,
"coinType": null,
"img": "",
"maxValue": null,
"num": 3,
"title": "3体力",
"categoryType": 2,
"minValue": null,
"realValue": null,
"rate": "25",
"name": "",
"id": "",
"propType": null,
"day": null,
"value": ""
},
{
"appItemId": null,
"coinType": null,
"img": "",
"maxValue": null,
"num": null,
"title": "道具 锤子",
"categoryType": 3,
"minValue": null,
"realValue": null,
"rate": "11",
"name": "",
"id": "",
"propType": 1,
"day": null,
"value": ""
},
{
"appItemId": null,
"coinType": null,
"img": "",
"maxValue": null,
"num": null,
"title": "炸弹",
"categoryType": 3,
"minValue": null,
"realValue": null,
"rate": "12",
"name": "",
"id": "",
"propType": 3,
"day": null,
"value": ""
}
],
"prizeList": [],
"id": null
},
"nextTimeNeedCoin": 1
......
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