Commit b2e95b2d authored by 邱旭's avatar 邱旭

1

parent fb7314ea
......@@ -1020,9 +1020,9 @@ export default class MapScene extends Scene {
onTap_bloodBtn() {
NetManager.ins.clickLog(getlogItem(2));
if(getHomeData().remainEnargy > 0)
PanelCtrl.instance.show('bloodPanel')
PanelCtrl.instance.show('bloodPanel');
else
PanelCtrl.instance.show('blood2Panel')
PanelCtrl.instance.show('blood2Panel');
}
setGray(order: number) {
......
......@@ -71,7 +71,7 @@ export default class BloodPanel extends Panel {
onTapBuy() {
NetManager.ins.clickLog(getlogItem(30));
this['buyBtn'].enabled = false;
NetManager.ins.hc_exchange((success) => {
NetManager.ins.hc_exchange((success, res) => {
this['buyBtn'].enabled = true;
if(success) {
showToast('兑换成功');
......@@ -81,7 +81,11 @@ export default class BloodPanel extends Panel {
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
} else {
PanelCtrl.instance.show('shopTip', {from: 'bloodPanel', data: null});
if(res.code == '600005') {
showToast('体力已满,快去闯关吧');
} else {
PanelCtrl.instance.show('shopTip', {from: 'bloodPanel', data: null});
}
}
}, 1);
}
......
......@@ -11,46 +11,48 @@ import { getlogItem } from "../Main";
import CountDown from "../mapScene/CountDown";
import { showShare } from "../shareCtrl";
import BloodPanel from "./BloodPanel";
import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl";
export default class BloodPanel2 extends Panel {
start(data) {
super.start();
this.updateData();
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(4));
}
private _countDown:CountDown;
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();
}
......@@ -64,48 +66,60 @@ this['price1Txt'].text =`${ window['price1']}个元宝=1个体力值`;
onTapBuy() {
NetManager.ins.clickLog(getlogItem(3));
this['buyBtn'].enabled = false;
NetManager.ins.hc_exchange((success) => {
NetManager.ins.hc_exchange((success, res) => {
this['buyBtn'].enabled = true;
if (success) {
if(success) {
showToast('兑换成功');
NetManager.ins.hc_home(() => {
this.updateData();
updateMainTimer();
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
} else {
if(res.code == '600005') {
showToast('体力已满,快去闯关吧');
} else {
PanelCtrl.instance.show('shopTip', {from: 'blood2Panel', data: null});
}
}
}, 1);
}
onTapInvite() {
if (iswx()) {
if(iswx()) {
getShareUrl(this.stage);
} else
showShare(1);
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']] }
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