Commit b2e95b2d authored by 邱旭's avatar 邱旭

1

parent fb7314ea
...@@ -1020,9 +1020,9 @@ export default class MapScene extends Scene { ...@@ -1020,9 +1020,9 @@ export default class MapScene extends Scene {
onTap_bloodBtn() { onTap_bloodBtn() {
NetManager.ins.clickLog(getlogItem(2)); NetManager.ins.clickLog(getlogItem(2));
if(getHomeData().remainEnargy > 0) if(getHomeData().remainEnargy > 0)
PanelCtrl.instance.show('bloodPanel') PanelCtrl.instance.show('bloodPanel');
else else
PanelCtrl.instance.show('blood2Panel') PanelCtrl.instance.show('blood2Panel');
} }
setGray(order: number) { setGray(order: number) {
......
...@@ -71,7 +71,7 @@ export default class BloodPanel extends Panel { ...@@ -71,7 +71,7 @@ export default class BloodPanel extends Panel {
onTapBuy() { onTapBuy() {
NetManager.ins.clickLog(getlogItem(30)); NetManager.ins.clickLog(getlogItem(30));
this['buyBtn'].enabled = false; this['buyBtn'].enabled = false;
NetManager.ins.hc_exchange((success) => { NetManager.ins.hc_exchange((success, res) => {
this['buyBtn'].enabled = true; this['buyBtn'].enabled = true;
if(success) { if(success) {
showToast('兑换成功'); showToast('兑换成功');
...@@ -81,7 +81,11 @@ export default class BloodPanel extends Panel { ...@@ -81,7 +81,11 @@ export default class BloodPanel extends Panel {
SceneCtrl.instance.updateScene(); SceneCtrl.instance.updateScene();
}, window['collectRuleId']); }, window['collectRuleId']);
} else { } else {
PanelCtrl.instance.show('shopTip', {from: 'bloodPanel', data: null}); if(res.code == '600005') {
showToast('体力已满,快去闯关吧');
} else {
PanelCtrl.instance.show('shopTip', {from: 'bloodPanel', data: null});
}
} }
}, 1); }, 1);
} }
......
...@@ -11,46 +11,48 @@ import { getlogItem } from "../Main"; ...@@ -11,46 +11,48 @@ import { getlogItem } from "../Main";
import CountDown from "../mapScene/CountDown"; import CountDown from "../mapScene/CountDown";
import { showShare } from "../shareCtrl"; import { showShare } from "../shareCtrl";
import BloodPanel from "./BloodPanel"; import BloodPanel from "./BloodPanel";
import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl";
export default class BloodPanel2 extends Panel { export default class BloodPanel2 extends Panel {
start(data) { start(data) {
super.start(); super.start();
this.updateData(); this.updateData();
this.showlog(); this.showlog();
this['price1Txt'].text =`${ window['price1']}个元宝=1个体力值`; this['price1Txt'].text = `${window['price1']}个元宝=1个体力值`;
} }
showlog(){ showlog() {
NetManager.ins.showLog(getlogItem(3)); NetManager.ins.showLog(getlogItem(3));
NetManager.ins.showLog(getlogItem(4)); NetManager.ins.showLog(getlogItem(4));
} }
private _countDown:CountDown; private _countDown: CountDown;
private updateData() { private updateData() {
if(this._countDown == null ) { if(this._countDown == null) {
this._countDown = new CountDown(this['countdownTxt'],(str)=>`距离下一次体力补给时间:${str}`); this._countDown = new CountDown(this['countdownTxt'], (str) => `距离下一次体力补给时间:${str}`);
} }
const homeData = getHomeData(); const homeData = getHomeData();
this['bloodTxt'].text = `你的可用体力值为:${homeData.remainEnargy}`; this['bloodTxt'].text = `你的可用体力值为:${homeData.remainEnargy}`;
const data = getHomeData(); const data = getHomeData();
this['invitTxt'].text = `(已领${data.askForEnergy}/${BloodPanel.MAX})`; this['invitTxt'].text = `(已领${data.askForEnergy}/${BloodPanel.MAX})`;
if (data.askForEnergy >= BloodPanel.MAX){ if(data.askForEnergy >= BloodPanel.MAX) {
this['inviteBtn2'].visible=true; this['inviteBtn2'].visible = true;
} }
if(data.remainEnargy >= BLOOD_NUMS_MAX) { //满了 if(data.remainEnargy >= BLOOD_NUMS_MAX) { //满了
this['bloodTxt'].text = `你的可用体力值为:${homeData.remainEnargy}`; this['bloodTxt'].text = `你的可用体力值为:${homeData.remainEnargy}`;
this._countDown.stop(); this._countDown.stop();
this['countdownTxt'].visible=false; this['countdownTxt'].visible = false;
}else { } else {
this['countdownTxt'].visible=true; this['countdownTxt'].visible = true;
const left = data.refectionCountdown - Math.floor(new Date().getTime() / 1000); const left = data.refectionCountdown - Math.floor(new Date().getTime() / 1000);
this._countDown.reset(left); this._countDown.reset(left);
} }
} }
updateTimerView(){ updateTimerView() {
this.updateData(); this.updateData();
} }
...@@ -64,48 +66,60 @@ this['price1Txt'].text =`${ window['price1']}个元宝=1个体力值`; ...@@ -64,48 +66,60 @@ this['price1Txt'].text =`${ window['price1']}个元宝=1个体力值`;
onTapBuy() { onTapBuy() {
NetManager.ins.clickLog(getlogItem(3)); NetManager.ins.clickLog(getlogItem(3));
this['buyBtn'].enabled = false; this['buyBtn'].enabled = false;
NetManager.ins.hc_exchange((success) => { NetManager.ins.hc_exchange((success, res) => {
this['buyBtn'].enabled = true; this['buyBtn'].enabled = true;
if (success) { if(success) {
showToast('兑换成功'); showToast('兑换成功');
NetManager.ins.hc_home(() => { NetManager.ins.hc_home(() => {
this.updateData(); this.updateData();
updateMainTimer(); updateMainTimer();
SceneCtrl.instance.updateScene(); SceneCtrl.instance.updateScene();
}, window['collectRuleId']); }, window['collectRuleId']);
} else {
if(res.code == '600005') {
showToast('体力已满,快去闯关吧');
} else {
PanelCtrl.instance.show('shopTip', {from: 'blood2Panel', data: null});
}
} }
}, 1); }, 1);
} }
onTapInvite() { onTapInvite() {
if (iswx()) { if(iswx()) {
getShareUrl(this.stage); getShareUrl(this.stage);
} else } else
showShare(1); showShare(1);
NetManager.ins.clickLog(getlogItem(4)); NetManager.ins.clickLog(getlogItem(4));
const data = getHomeData(); const data = getHomeData();
if (data.askForEnergy >= BloodPanel.MAX) { if(data.askForEnergy >= BloodPanel.MAX) {
showToast('对不起,索要体力的机会已经用完了~'); showToast('对不起,索要体力的机会已经用完了~');
return; return;
} }
this['inviteBtn'].enabled = false; this['inviteBtn'].enabled = false;
NetManager.ins.hc_askForEnergy((success) => { NetManager.ins.hc_askForEnergy((success) => {
this['inviteBtn'].enabled = true; this['inviteBtn'].enabled = true;
if (success) { if(success) {
} }
NetManager.ins.hc_home(() => { NetManager.ins.hc_home(() => {
this.updateData(); this.updateData();
updateMainTimer(); updateMainTimer();
SceneCtrl.instance.updateScene(); SceneCtrl.instance.updateScene();
}, window['collectRuleId']); }, window['collectRuleId']);
wait(2000).then(()=>{ wait(2000).then(() => {
showToast('分享成功~'); showToast('分享成功~');
}); });
}) })
} }
protected get closeBtns(): eui.Button[] { return [this['closeBtn']] }
get skinKey() { return 'Blood2' } protected get closeBtns(): eui.Button[] {
return [this['closeBtn']]
}
get skinKey() {
return 'Blood2'
}
} }
\ No newline at end of file
{ {
"success":false "success": false,
"code": "600005",
"data": null,
"desc": "sss"
} }
\ No newline at end of file
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