Commit 86276783 authored by wildfirecode's avatar wildfirecode

1

parent ffed44d0
......@@ -4,6 +4,7 @@ interface IHomeData {
totalRemainStarts;
wealth;
heartNums;
shared;
}
export default ():IHomeData=>{
const {data} = DataManager.ins.getData('hc_home');
......
......@@ -2,6 +2,7 @@ import Panel from "../../libs/new_wx/components/Panel";
import getHomeData from "../getHomeData";
import { NetManager } from "../../libs/tw/manager/NetManager";
import SceneCtrl from "../../libs/new_wx/ctrls/sceneCtrl";
import { showToast } from "../../libs/new_wx/ctrls/toastCtrl";
export default class BloodPanel extends Panel {
start(data) {
......@@ -12,6 +13,10 @@ export default class BloodPanel extends Panel {
private updateData() {
const homeData = getHomeData();
this['bloodTxt'].text = `你的可用体力值为:${homeData.heartNums}`;
const data = getHomeData();
this['invitTxt'].text = `(已领0/1)`;
if (data.shared)
this['invitTxt'].text = `(已领1/1)`;
}
initEvents() {
......@@ -34,8 +39,23 @@ export default class BloodPanel extends Panel {
}
onTapInvite() {
const data = getHomeData();
if (data.shared) {
showToast('今日已经分享过了.');
return;
}
this['inviteBtn'].enabled = false;
NetManager.ins.hc_askForEnergy((success) => {
this['inviteBtn'].enabled = true;
if (success) {
this['invitTxt'].text = `(已领1/1)`;
}
NetManager.ins.hc_home(() => {
this.updateData();
SceneCtrl.instance.updateScene();
}, window['collectRuleId'])
})
}
protected get closeBtns(): eui.Button[] { return [this['closeBtn'], this['resumeBtns']] }
protected get closeBtns(): eui.Button[] { return [this['closeBtn'], this['resumeBtn']] }
get skinKey() { return 'Blood' }
}
\ No newline at end of file
import Panel from "../../libs/new_wx/components/Panel";
import { NetManager } from "../../libs/tw/manager/NetManager";
import PropType from "../PropType";
import SceneCtrl from "../../libs/new_wx/ctrls/sceneCtrl";
export default class Buy1Panel extends Panel {
buyBtn: eui.Button
......@@ -16,6 +17,9 @@ export default class Buy1Panel extends Panel {
this.buyBtn.enabled = true;
if (success) {
this.hidePanel();
NetManager.ins.hc_home(() => {
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
}
}, 2, PropType.HAMMER);//兑换道具
}
......
import Panel from "../../libs/new_wx/components/Panel";
import { NetManager } from "../../libs/tw/manager/NetManager";
import PropType from "../PropType";
import SceneCtrl from "../../libs/new_wx/ctrls/sceneCtrl";
export default class Buy2Panel extends Panel {
start(data) {
......@@ -15,6 +16,9 @@ export default class Buy2Panel extends Panel {
this.buyBtn.enabled = true;
if (success) {
this.hidePanel();
NetManager.ins.hc_home(() => {
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
}
}, 2, PropType.BOOM);//兑换道具
}
......
import Panel from "../../libs/new_wx/components/Panel";
import { NetManager } from "../../libs/tw/manager/NetManager";
import PropType from "../PropType";
import SceneCtrl from "../../libs/new_wx/ctrls/sceneCtrl";
export default class Buy3Panel extends Panel {
start(data) {
......@@ -16,6 +17,9 @@ export default class Buy3Panel extends Panel {
this.buyBtn.enabled = true;
if (success) {
this.hidePanel();
NetManager.ins.hc_home(() => {
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
}
}, 2, PropType.CHANCE_NUM);//兑换道具
}
......
import Panel from "../../libs/new_wx/components/Panel";
import { NetManager } from "../../libs/tw/manager/NetManager";
import PropType from "../PropType";
import SceneCtrl from "../../libs/new_wx/ctrls/sceneCtrl";
export default class ShopPanel extends Panel {
buyBtn1:eui.Button;
......@@ -18,7 +19,9 @@ export default class ShopPanel extends Panel {
NetManager.ins.hc_exchange((success) => {
this.buyBtn1.enabled = true;
if (success) {
NetManager.ins.hc_home(() => {
SceneCtrl.instance.updateScene();
}, window['collectRuleId'])
}
}, 2, PropType.HAMMER);//兑换道具
}
......@@ -28,7 +31,9 @@ export default class ShopPanel extends Panel {
NetManager.ins.hc_exchange((success) => {
this.buyBtn2.enabled = true;
if (success) {
NetManager.ins.hc_home(() => {
SceneCtrl.instance.updateScene();
}, window['collectRuleId'])
}
}, 2, PropType.BOOM);//兑换道具
}
......@@ -38,7 +43,9 @@ export default class ShopPanel extends Panel {
NetManager.ins.hc_exchange((success) => {
this.buyBtn3.enabled = true;
if (success) {
NetManager.ins.hc_home(() => {
SceneCtrl.instance.updateScene();
}, window['collectRuleId'])
}
}, 2, PropType.CHANCE_NUM);//兑换道具
}
......
{
"code":"0000000000",
"data":{
"shared":1,
"heartNums":1,
"levels":[
{
......
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