Commit 6f9889a7 authored by wildfirecode's avatar wildfirecode

1

parent 24df9bcf
...@@ -37,6 +37,8 @@ import { ModuleTypes } from "./types/sceneTypes"; ...@@ -37,6 +37,8 @@ import { ModuleTypes } from "./types/sceneTypes";
import layers from "./views/layers"; import layers from "./views/layers";
import SignPrizePanel from "../../src/panels/SignPrizePanel"; import SignPrizePanel from "../../src/panels/SignPrizePanel";
import { BLOOD_NUMS_MAX } from "../../src/getHomeData"; import { BLOOD_NUMS_MAX } from "../../src/getHomeData";
import BloodPanel2 from "../../src/panels/BloodPanel2";
import ExchangePanel from "../../src/panels/ExchangePanel";
export default class MainBase extends eui.UILayer { export default class MainBase extends eui.UILayer {
constructor() { constructor() {
...@@ -55,12 +57,14 @@ export default class MainBase extends eui.UILayer { ...@@ -55,12 +57,14 @@ export default class MainBase extends eui.UILayer {
[ModuleTypes.PRIZE_PANEL, { cls: PrizePanel }], [ModuleTypes.PRIZE_PANEL, { cls: PrizePanel }],
[ModuleTypes.NO_PRIZE_PANEL, { cls: NoPrizePanel }], [ModuleTypes.NO_PRIZE_PANEL, { cls: NoPrizePanel }],
['bloodPanel', { cls: BloodPanel }], ['bloodPanel', { cls: BloodPanel }],
['blood2Panel', { cls: BloodPanel2 }],
['GoldPanel', { cls: GoldPanel }], ['GoldPanel', { cls: GoldPanel }],
['Shop', { cls: ShopPanel }], ['Shop', { cls: ShopPanel }],
['StartPanel', { cls: StartPanel }], ['StartPanel', { cls: StartPanel }],
['Buy1', { cls: Buy1Panel }], ['Buy1', { cls: Buy1Panel }],
['Buy2', { cls: Buy2Panel }], ['Buy2', { cls: Buy2Panel }],
['Buy3', { cls: Buy3Panel }], ['Buy3', { cls: Buy3Panel }],
['ExchangePanel', { cls: ExchangePanel }],
['failed', { cls: FailedPanel }], ['failed', { cls: FailedPanel }],
['quit', { cls: QuitPanel }], ['quit', { cls: QuitPanel }],
['box', { cls: BoxPanel }], ['box', { cls: BoxPanel }],
...@@ -317,10 +321,10 @@ timer.addEventListener(egret.TimerEvent.TIMER_COMPLETE, () => { ...@@ -317,10 +321,10 @@ timer.addEventListener(egret.TimerEvent.TIMER_COMPLETE, () => {
//更新bloodpanel和mapscene //更新bloodpanel和mapscene
const currentScene = SceneCtrl.instance.currentScene; const currentScene = SceneCtrl.instance.currentScene;
if (currentScene && currentScene['updateTimerView']) if (currentScene && currentScene['updateTimerView'])
currentScene['updateTimerView']; currentScene['updateTimerView']();
const current = PanelCtrl.instance._current; const current = PanelCtrl.instance._current;
if (current && current['updateTimerView']) if (current && current['updateTimerView'])
current['updateTimerView']; current['updateTimerView']();
}, window['collectRuleId']); }, window['collectRuleId']);
}, this) }, this)
export const mainTimer = timer; export const mainTimer = timer;
......
...@@ -71,6 +71,10 @@ ...@@ -71,6 +71,10 @@
{ {
"keys": "startpanel通关条件_png,startpanel数量_png,startpanel数量 副本 3_png,startpanel目标33_png,startpanel目标3_png,startpanel按钮_png,startpanel_ice1_png,startpanel_ele6_png,startpanel_block2_png", "keys": "startpanel通关条件_png,startpanel数量_png,startpanel数量 副本 3_png,startpanel目标33_png,startpanel目标3_png,startpanel按钮_png,startpanel_ice1_png,startpanel_ele6_png,startpanel_block2_png",
"name": "startpanel" "name": "startpanel"
},
{
"keys": "blood2按钮 副本1_png,blood2按钮 副本_png",
"name": "blood2"
} }
], ],
"resources": [ "resources": [
...@@ -1698,6 +1702,16 @@ ...@@ -1698,6 +1702,16 @@
"url": "assets/mainScene/stepAni10.png", "url": "assets/mainScene/stepAni10.png",
"type": "image", "type": "image",
"name": "stepAni10_png" "name": "stepAni10_png"
},
{
"url": "assets/blood2/blood2按钮 副本1.png",
"type": "image",
"name": "blood2按钮 副本1_png"
},
{
"url": "assets/blood2/blood2按钮 副本.png",
"type": "image",
"name": "blood2按钮 副本_png"
} }
] ]
} }
\ No newline at end of file
{ {
"skins": {}, "skins": {},
"autoGenerateExmlsList": true, "autoGenerateExmlsList": true,
"exmls": [ "exmls": [
"resource/skins/SignSkin.exml", "resource/skins/SignSkin.exml",
"resource/skins/SignPrizeSkin.exml", "resource/skins/SignPrizeSkin.exml",
"resource/skins/AlertSkin.exml", "resource/skins/AlertSkin.exml",
"resource/skins/BloodSkin.exml", "resource/skins/BloodSkin.exml",
"resource/skins/Box2Skin.exml", "resource/skins/Blood2Skin.exml",
"resource/skins/BoxSkin.exml", "resource/skins/Box2Skin.exml",
"resource/skins/Buy1Skin.exml", "resource/skins/BoxSkin.exml",
"resource/skins/Buy2Skin.exml", "resource/skins/Buy1Skin.exml",
"resource/skins/Buy3Skin.exml", "resource/skins/Buy2Skin.exml",
"resource/skins/FailSkin.exml", "resource/skins/Buy3Skin.exml",
"resource/skins/IconButtonSkin.exml", "resource/skins/ExchangeSkin.exml",
"resource/skins/Main2Skin.exml", "resource/skins/FailSkin.exml",
"resource/skins/MapBottomSkin.exml", "resource/skins/IconButtonSkin.exml",
"resource/skins/MapRepeatSkin.exml", "resource/skins/Main2Skin.exml",
"resource/skins/MapSkin.exml", "resource/skins/MapBottomSkin.exml",
"resource/skins/MapTopSkin.exml", "resource/skins/MapRepeatSkin.exml",
"resource/skins/NoPrizeSkin.exml", "resource/skins/MapSkin.exml",
"resource/skins/OptionItemSkin.exml", "resource/skins/MapTopSkin.exml",
"resource/skins/OptionsSkin.exml", "resource/skins/NoPrizeSkin.exml",
"resource/skins/PlaySkin.exml", "resource/skins/OptionItemSkin.exml",
"resource/skins/Prize2Skin.exml", "resource/skins/OptionsSkin.exml",
"resource/skins/PrizeSkin.exml", "resource/skins/PlaySkin.exml",
"resource/skins/QuitSkin.exml", "resource/skins/Prize2Skin.exml",
"resource/skins/RankItemSkin.exml", "resource/skins/PrizeSkin.exml",
"resource/skins/RankSkin.exml", "resource/skins/QuitSkin.exml",
"resource/skins/ReliveSkin.exml", "resource/skins/RankItemSkin.exml",
"resource/skins/RuleSkin.exml", "resource/skins/RankSkin.exml",
"resource/skins/Share2Skin.exml", "resource/skins/ReliveSkin.exml",
"resource/skins/ShareSkin.exml", "resource/skins/RuleSkin.exml",
"resource/skins/ShopSkin.exml", "resource/skins/Share2Skin.exml",
"resource/skins/ShowOffSkin.exml", "resource/skins/ShareSkin.exml",
"resource/skins/StarSkin.exml", "resource/skins/ShopSkin.exml",
"resource/skins/StartPanelSkin.exml", "resource/skins/ShowOffSkin.exml",
"resource/skins/StartSkin.exml", "resource/skins/StarSkin.exml",
"resource/skins/TargetItemSkin.exml", "resource/skins/StartPanelSkin.exml",
"resource/skins/ToastSkin.exml", "resource/skins/StartSkin.exml",
"resource/skins/VScrollBarSkin.exml" "resource/skins/TargetItemSkin.exml",
], "resource/skins/ToastSkin.exml",
"path": "resource/default.thm.json" "resource/skins/VScrollBarSkin.exml"
],
"path": "resource/default.thm.json"
} }
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="Blood2Skin" width="750" height="1206" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image y="46" horizontalCenter="0" source="blood体力补济站_png"/>
<e:Button id="closeBtn" label="" x="614" y="241">
<e:skinName>
<e:Skin states="up,down,disabled" xmlns:w="http://ns.egret.com/wing">
<e:Image width="100%" height="100%" source="closeCommonBtn_png" source.down="closeCommonBtn_png" source.disabled="closeCommonBtn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Button id="buyBtn" label="" x="433" y="522">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="blood按钮 副本_png" source.down="blood按钮 副本_png" source.disabled="blood按钮 副本_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Button id="inviteBtn" label="" x="433" y="661">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="blood按钮 副本1_png" source.down="blood按钮 副本1_png" source.disabled="blood按钮 副本1_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Label id="bloodTxt" text="你的可用体力值为:5" y="306" horizontalCenter="0" textColor="0xe2701b"/>
<e:Label id="countdownTxt" text="距离下一次体力补给时间:" y="772" textColor="0xE2701B" size="24" width="509" horizontalCenter="0" verticalAlign="middle" textAlign="center"/>
<e:Label text="使用元宝购买" y="524" textColor="0x821818" size="27" x="228"/>
<e:Label text="分享好友获得体力" y="663" textColor="0x821818" size="27" x="225.92"/>
<e:Label id="invitTxt" text="(已领0/1)" y="699" textColor="0x821818" size="27" x="232"/>
<e:Label id="price1Txt" text="20" y="565" textColor="0x821818" x="274" size="27"/>
</e:Skin>
\ No newline at end of file
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</e:Skin> </e:Skin>
</e:skinName> </e:skinName>
</e:Button> </e:Button>
<e:Button id="resumeBtn" label="" y="787" horizontalCenter="0"> <e:Button id="resumeBtn" label="" y="817" horizontalCenter="0">
<e:skinName> <e:skinName>
<e:Skin states="up,down,disabled"> <e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="blood按钮_png" source.down="blood按钮_png" source.disabled="blood按钮_png"/> <e:Image width="100%" height="100%" source="blood按钮_png" source.down="blood按钮_png" source.disabled="blood按钮_png"/>
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
</e:skinName> </e:skinName>
</e:Button> </e:Button>
<e:Label id="bloodTxt" text="你的可用体力值为:5" y="306" horizontalCenter="0" textColor="0xe2701b"/> <e:Label id="bloodTxt" text="你的可用体力值为:5" y="306" horizontalCenter="0" textColor="0xe2701b"/>
<e:Label id="bloodNumTxt" text="5" y="373" size="75" x="358" textColor="0xffffff"/> <e:Label id="countdownTxt" text="距离下一次体力补给时间:" y="772" textColor="0xE2701B" size="24" width="509" horizontalCenter="0" verticalAlign="middle" textAlign="center"/>
<e:Label text="使用元宝购买" y="524" textColor="0x821818" size="27" x="228"/> <e:Label text="使用元宝购买" y="524" textColor="0x821818" size="27" x="228"/>
<e:Label text="分享好友获得体力" y="663" textColor="0x821818" size="27" x="225.92"/> <e:Label text="分享好友获得体力" y="663" textColor="0x821818" size="27" x="225.92"/>
<e:Label id="invitTxt" text="(已领0/1)" y="699" textColor="0x821818" size="27" x="232"/> <e:Label id="invitTxt" text="(已领0/1)" y="699" textColor="0x821818" size="27" x="232"/>
......
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="ExchangeSkin" width="750" height="1206" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<w:Config id="16c984f7919"/>
<e:Image y="50" horizontalCenter="0" source="购买步数增加_png"/>
<e:Button id="buyBtn" label="" y="589" horizontalCenter="0">
<e:skinName>
<e:Skin states="up,down,disabled" xmlns:w="http://ns.egret.com/wing">
<e:Image width="100%" height="100%" source="btn_png" source.down="btn_png" source.disabled="btn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Button id="closeBtn" label="" x="614" y="187">
<e:skinName>
<e:Skin states="up,down,disabled" xmlns:w="http://ns.egret.com/wing">
<e:Image width="100%" height="100%" source="closeCommonBtn_png" source.down="closeCommonBtn_png" source.disabled="closeCommonBtn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Label id="priceTxt" text="-1000" x="350.08" y="617" bold="true" size="44" touchEnabled="false"/>
<e:Group y="706" horizontalCenter="0">
<e:Label text="可使用的元宝:" x="34.88" y="0" textColor="0x885037" size="24"/>
<e:Label id="moneyTxt" text="00000" x="192.97" y="0" textColor="0x885037" size="24"/>
<e:Image source="common_yuanbao_png" x="2.93" y="1.04"/>
</e:Group>
</e:Skin>
\ No newline at end of file
enum PropType{ enum PropType{
BOOM=2, BOOM=2,
HAMMER=3, HAMMER=3,
CHANCE_NUM=4 CHANCE_NUM=4,
CASH_NUM=5
} }
export default PropType export default PropType
\ No newline at end of file
...@@ -44,5 +44,6 @@ export default class CountDown extends egret.EventDispatcher { ...@@ -44,5 +44,6 @@ export default class CountDown extends egret.EventDispatcher {
this._timer.repeatCount = repeatCount; this._timer.repeatCount = repeatCount;
this._timer.reset(); this._timer.reset();
this._timer.start(); this._timer.start();
this.updateTxt();
} }
} }
\ No newline at end of file
...@@ -29,7 +29,7 @@ export default class MapScene extends Scene { ...@@ -29,7 +29,7 @@ export default class MapScene extends Scene {
static starHash: any = {}; static starHash: any = {};
_data; _data;
async start(data?) { async start(data?) {
super.start(); super.start();
if (getBgOn() && MapScene['firstPlayBgTag'] == true) { if (getBgOn() && MapScene['firstPlayBgTag'] == true) {
playBg(); playBg();
...@@ -225,7 +225,7 @@ export default class MapScene extends Scene { ...@@ -225,7 +225,7 @@ export default class MapScene extends Scene {
this['boxiconWrapper'].visible = homeData.canReceiveTreasureBoxNum > 0; this['boxiconWrapper'].visible = homeData.canReceiveTreasureBoxNum > 0;
this['totalStarTxt'].text = `${homeData.totalStars}/${homeData.nextRangeStarsNum}`; this['totalStarTxt'].text = `${homeData.totalStars}/${homeData.nextRangeStarsNum}`;
this['boxNumsTxt'].text = `${homeData.canReceiveTreasureBoxNum}`; this['boxNumsTxt'].text = `${homeData.canReceiveTreasureBoxNum}`;
this['treasureboxBtn'].visible= !homeData.isGetAllTreasureBox; this['treasureboxBtn'].visible = !homeData.isGetAllTreasureBox;
} }
updateScene() { updateScene() {
...@@ -233,7 +233,7 @@ export default class MapScene extends Scene { ...@@ -233,7 +233,7 @@ export default class MapScene extends Scene {
} }
updateHomeData() { updateHomeData() {
const homeData = getHomeData(); const homeData = getHomeData();
this['bloodTxt'].text = `${homeData.remainEnargy}/5`;
this['goldTxt'].text = `${homeData.wealth}`; this['goldTxt'].text = `${homeData.wealth}`;
for (let j = 1; j < window['total_level']; j++) { for (let j = 1; j < window['total_level']; j++) {
...@@ -261,32 +261,24 @@ export default class MapScene extends Scene { ...@@ -261,32 +261,24 @@ export default class MapScene extends Scene {
} }
this.updateTimerView(); this.updateTimerView();
} }
private _countDown:CountDown; private _countDown: CountDown;
updateTimerView(){ updateTimerView() {
//更新倒计时 //更新倒计时
if(this._countDown == null ) { if (this._countDown == null) {
this._countDown = new CountDown(this['countdown']); this._countDown = new CountDown(this['countdown']);
this._countDown.addEventListener(egret.TimerEvent.TIMER_COMPLETE,this.onTimerComplete,this)
} }
const data =getHomeData(); const data = getHomeData();
if(data.remainEnargy >= BLOOD_NUMS_MAX) { //满了 if (data.remainEnargy >= BLOOD_NUMS_MAX) { //满了
this._countDown.stop(); this._countDown.stop();
}else { this['countdown'].visible = false;
} else {
const left = data.countdown - Math.floor(new Date().getTime() / 1000); const left = data.countdown - Math.floor(new Date().getTime() / 1000);
this._countDown.reset(left); this._countDown.reset(left);
this['countdown'].visible = true;
} }
} this['bloodTxt'].text = `${data.remainEnargy}/5`;
onTimerComplete(){
//这里不做操作,等待主倒计时进程的通知
// console.log(1)
// setTimeout(() => {
// this._countDown.reset(6000);
// }, 3000);
} }
protected initEvents() { protected initEvents() {
...@@ -444,7 +436,10 @@ export default class MapScene extends Scene { ...@@ -444,7 +436,10 @@ export default class MapScene extends Scene {
onTap_bloodBtn() { onTap_bloodBtn() {
NetManager.ins.clickLog(getlogItem(2)); NetManager.ins.clickLog(getlogItem(2));
PanelCtrl.instance.show('bloodPanel') if (getHomeData().remainEnargy > 0)
PanelCtrl.instance.show('bloodPanel')
else
PanelCtrl.instance.show('blood2Panel')
} }
setGray(order: number) { setGray(order: number) {
......
...@@ -10,6 +10,7 @@ import { iswx } from "../iswx"; ...@@ -10,6 +10,7 @@ import { iswx } from "../iswx";
import getShowOffPic from "../getShowOffPic"; import getShowOffPic from "../getShowOffPic";
import getSharePic, { getShareUrl } from "../getSharePic"; import getSharePic, { getShareUrl } from "../getSharePic";
import CountDown from "../mapScene/CountDown"; import CountDown from "../mapScene/CountDown";
import { updateMainTimer } from "../../libs/new_wx/MainBase";
export default class BloodPanel extends Panel { export default class BloodPanel extends Panel {
start(data) { start(data) {
...@@ -29,8 +30,7 @@ this['price1Txt'].text = window['price1']; ...@@ -29,8 +30,7 @@ this['price1Txt'].text = window['price1'];
private _countDown:CountDown; private _countDown:CountDown;
private updateData() { private updateData() {
if(this._countDown == null ) { if(this._countDown == null ) {
this._countDown = new CountDown(this['countdown']); this._countDown = new CountDown(this['countdownTxt'],(str)=>`距离下一次体力补给时间:${str}`);
this._countDown.addEventListener(egret.TimerEvent.TIMER_COMPLETE,this.onTimerComplete,this)
} }
const homeData = getHomeData(); const homeData = getHomeData();
this['bloodTxt'].text = `你的可用体力值为:${homeData.remainEnargy}`; this['bloodTxt'].text = `你的可用体力值为:${homeData.remainEnargy}`;
...@@ -42,8 +42,11 @@ this['price1Txt'].text = window['price1']; ...@@ -42,8 +42,11 @@ this['price1Txt'].text = window['price1'];
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;
}else { }else {
this._countDown.reset(10); this['countdownTxt'].visible=true;
const left = data.countdown - Math.floor(new Date().getTime() / 1000);
this._countDown.reset(left);
} }
} }
...@@ -51,10 +54,6 @@ this['price1Txt'].text = window['price1']; ...@@ -51,10 +54,6 @@ this['price1Txt'].text = window['price1'];
this.updateData(); this.updateData();
} }
onTimerComplete(){
//这里不做操作,等待主倒计时进程的通知
}
initEvents() { initEvents() {
super.initEvents(); super.initEvents();
this['inviteBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapInvite, this) this['inviteBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapInvite, this)
...@@ -70,6 +69,7 @@ this['price1Txt'].text = window['price1']; ...@@ -70,6 +69,7 @@ this['price1Txt'].text = window['price1'];
showToast('购买成功'); showToast('购买成功');
NetManager.ins.hc_home(() => { NetManager.ins.hc_home(() => {
this.updateData(); this.updateData();
updateMainTimer();
SceneCtrl.instance.updateScene(); SceneCtrl.instance.updateScene();
}, window['collectRuleId']); }, window['collectRuleId']);
...@@ -97,6 +97,7 @@ this['price1Txt'].text = window['price1']; ...@@ -97,6 +97,7 @@ this['price1Txt'].text = window['price1'];
} }
NetManager.ins.hc_home(() => { NetManager.ins.hc_home(() => {
this.updateData(); this.updateData();
updateMainTimer();
SceneCtrl.instance.updateScene(); SceneCtrl.instance.updateScene();
}, window['collectRuleId']); }, window['collectRuleId']);
wait(2000).then(()=>{ wait(2000).then(()=>{
......
import Panel from "../../libs/new_wx/components/Panel";
import getHomeData, { BLOOD_NUMS_MAX } 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";
import { getlogItem } from "../Main";
import wait from "../../libs/new_tc/wait";
import { showShare } from "../shareCtrl";
import { iswx } from "../iswx";
import getShowOffPic from "../getShowOffPic";
import getSharePic, { getShareUrl } from "../getSharePic";
import CountDown from "../mapScene/CountDown";
import { updateMainTimer } from "../../libs/new_wx/MainBase";
export default class BloodPanel2 extends Panel {
start(data) {
super.start();
this.updateData();
this.showlog();
this['price1Txt'].text = window['price1'];
}
showlog(){
NetManager.ins.showLog(getlogItem(3));
NetManager.ins.showLog(getlogItem(4));
}
private _countDown:CountDown;
private updateData() {
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 = `(已领0/1)`;
if (data.askForEnergy)
this['invitTxt'].text = `(已领1/1)`;
if(data.remainEnargy >= BLOOD_NUMS_MAX) { //满了
this['bloodTxt'].text = `你的可用体力值为:${homeData.remainEnargy}`;
this._countDown.stop();
this['countdownTxt'].visible=false;
}else {
this['countdownTxt'].visible=true;
const left = data.countdown - Math.floor(new Date().getTime() / 1000);
this._countDown.reset(left);
}
}
updateTimerView(){
this.updateData();
}
initEvents() {
super.initEvents();
this['inviteBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapInvite, this)
this['buyBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapBuy, this)
}
onTapBuy() {
NetManager.ins.clickLog(getlogItem(3));
this['buyBtn'].enabled = false;
NetManager.ins.hc_exchange((success) => {
this['buyBtn'].enabled = true;
if (success) {
showToast('购买成功');
NetManager.ins.hc_home(() => {
this.updateData();
updateMainTimer();
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
}
}, 1);
}
onTapInvite() {
if (iswx()) {
getShareUrl(this.stage);
} else
showShare(1);
NetManager.ins.clickLog(getlogItem(4));
const data = getHomeData();
if (data.askForEnergy) {
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();
updateMainTimer();
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
wait(2000).then(()=>{
showToast('分享成功~');
});
})
}
protected get closeBtns(): eui.Button[] { return [this['closeBtn']] }
get skinKey() { return 'Blood2' }
}
\ 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";
import { getlogItem } from "../Main";
import { showToast } from "../../libs/new_wx/ctrls/toastCtrl";
import setGlow from "../setGlow";
import getHomeData from "../getHomeData";
export default class ExchangePanel extends Panel {
start(data) {
super.start();
this['buyBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.ontap, this);
this.showlog();
this['priceTxt'].text = '-'+window['price5'];
setGlow(this['priceTxt'], 0x0083e8, 1);
this['moneyTxt'].text = getHomeData().wealth;
}
showlog() {
}
buyBtn: eui.Button
get skinKey() { return 'Exchange' }
ontap() {
this.buyBtn.enabled = false;
NetManager.ins.hc_exchange((success) => {
showToast('购买成功!去玩游戏~');
this.buyBtn.enabled = true;
if (success) {
this.hidePanel();
NetManager.ins.hc_home(() => {
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
}
}, PropType.CASH_NUM);//兑换道具
}
}
\ No newline at end of file
...@@ -28,18 +28,9 @@ export default class ShopPanel extends Panel { ...@@ -28,18 +28,9 @@ export default class ShopPanel extends Panel {
} }
onBuy4() { onBuy4() {
console.log('4444444');
//这里应该是订制接口
// this.buyBtn1.enabled = false; PanelCtrl.instance.show('ExchangePanel');
// NetManager.ins.hc_exchange((success) => {
// this.buyBtn1.enabled = true;
// if (success) {
// NetManager.ins.hc_home(() => {
// SceneCtrl.instance.updateScene();
// }, window['collectRuleId'])
// }
// }, 2, PropType.HAMMER);//兑换道具
} }
onBuy1() { onBuy1() {
PanelCtrl.instance.show('Buy1'); PanelCtrl.instance.show('Buy1');
......
...@@ -71,7 +71,7 @@ export default class StartPanel extends Panel { ...@@ -71,7 +71,7 @@ export default class StartPanel extends Panel {
const homeData = getHomeData(); const homeData = getHomeData();
if (homeData.remainEnargy <= 0) { if (homeData.remainEnargy <= 0) {
if (homeData.askForEnergy) { if (homeData.askForEnergy) {
PanelCtrl.instance.show('bloodPanel'); PanelCtrl.instance.show('blood2Panel');
} else { } else {
if (iswx()) { if (iswx()) {
getShareUrl(this.stage); getShareUrl(this.stage);
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
"success": true, "success": true,
"code": "0000000000", "code": "0000000000",
"desc": "OK", "desc": "OK",
"timestamp": 1566885811031, "timestamp": 1566885811001,
"data": { "data": {
"countdown": 1569037996, "countdown": 1569058731,
"remainEnargy": 4, "remainEnargy": 5,
"isGetAllTreasureBox": 0, "isGetAllTreasureBox": 0,
"wealth": 7960, "wealth": 7960,
"totalStars": 145, "totalStars": 145,
...@@ -156,7 +156,7 @@ ...@@ -156,7 +156,7 @@
} }
], ],
"askForEnergy": false, "askForEnergy": true,
"canReceiveTreasureBoxNum": 10, "canReceiveTreasureBoxNum": 10,
"nextRangeStarsNum": 150 "nextRangeStarsNum": 150
} }
......
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