Commit 6f9889a7 authored by wildfirecode's avatar wildfirecode

1

parent 24df9bcf
......@@ -37,6 +37,8 @@ import { ModuleTypes } from "./types/sceneTypes";
import layers from "./views/layers";
import SignPrizePanel from "../../src/panels/SignPrizePanel";
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 {
constructor() {
......@@ -55,12 +57,14 @@ export default class MainBase extends eui.UILayer {
[ModuleTypes.PRIZE_PANEL, { cls: PrizePanel }],
[ModuleTypes.NO_PRIZE_PANEL, { cls: NoPrizePanel }],
['bloodPanel', { cls: BloodPanel }],
['blood2Panel', { cls: BloodPanel2 }],
['GoldPanel', { cls: GoldPanel }],
['Shop', { cls: ShopPanel }],
['StartPanel', { cls: StartPanel }],
['Buy1', { cls: Buy1Panel }],
['Buy2', { cls: Buy2Panel }],
['Buy3', { cls: Buy3Panel }],
['ExchangePanel', { cls: ExchangePanel }],
['failed', { cls: FailedPanel }],
['quit', { cls: QuitPanel }],
['box', { cls: BoxPanel }],
......@@ -317,10 +321,10 @@ timer.addEventListener(egret.TimerEvent.TIMER_COMPLETE, () => {
//更新bloodpanel和mapscene
const currentScene = SceneCtrl.instance.currentScene;
if (currentScene && currentScene['updateTimerView'])
currentScene['updateTimerView'];
currentScene['updateTimerView']();
const current = PanelCtrl.instance._current;
if (current && current['updateTimerView'])
current['updateTimerView'];
current['updateTimerView']();
}, window['collectRuleId']);
}, this)
export const mainTimer = timer;
......
......@@ -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",
"name": "startpanel"
},
{
"keys": "blood2按钮 副本1_png,blood2按钮 副本_png",
"name": "blood2"
}
],
"resources": [
......@@ -1698,6 +1702,16 @@
"url": "assets/mainScene/stepAni10.png",
"type": "image",
"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
......@@ -6,11 +6,13 @@
"resource/skins/SignPrizeSkin.exml",
"resource/skins/AlertSkin.exml",
"resource/skins/BloodSkin.exml",
"resource/skins/Blood2Skin.exml",
"resource/skins/Box2Skin.exml",
"resource/skins/BoxSkin.exml",
"resource/skins/Buy1Skin.exml",
"resource/skins/Buy2Skin.exml",
"resource/skins/Buy3Skin.exml",
"resource/skins/ExchangeSkin.exml",
"resource/skins/FailSkin.exml",
"resource/skins/IconButtonSkin.exml",
"resource/skins/Main2Skin.exml",
......
<?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 @@
</e:Skin>
</e:skinName>
</e:Button>
<e:Button id="resumeBtn" label="" y="787" horizontalCenter="0">
<e:Button id="resumeBtn" label="" y="817" horizontalCenter="0">
<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"/>
......@@ -34,7 +34,7 @@
</e:skinName>
</e:Button>
<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="663" textColor="0x821818" size="27" x="225.92"/>
<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{
BOOM=2,
HAMMER=3,
CHANCE_NUM=4
CHANCE_NUM=4,
CASH_NUM=5
}
export default PropType
\ No newline at end of file
......@@ -44,5 +44,6 @@ export default class CountDown extends egret.EventDispatcher {
this._timer.repeatCount = repeatCount;
this._timer.reset();
this._timer.start();
this.updateTxt();
}
}
\ No newline at end of file
......@@ -225,7 +225,7 @@ export default class MapScene extends Scene {
this['boxiconWrapper'].visible = homeData.canReceiveTreasureBoxNum > 0;
this['totalStarTxt'].text = `${homeData.totalStars}/${homeData.nextRangeStarsNum}`;
this['boxNumsTxt'].text = `${homeData.canReceiveTreasureBoxNum}`;
this['treasureboxBtn'].visible= !homeData.isGetAllTreasureBox;
this['treasureboxBtn'].visible = !homeData.isGetAllTreasureBox;
}
updateScene() {
......@@ -233,7 +233,7 @@ export default class MapScene extends Scene {
}
updateHomeData() {
const homeData = getHomeData();
this['bloodTxt'].text = `${homeData.remainEnargy}/5`;
this['goldTxt'].text = `${homeData.wealth}`;
for (let j = 1; j < window['total_level']; j++) {
......@@ -261,32 +261,24 @@ export default class MapScene extends Scene {
}
this.updateTimerView();
}
private _countDown:CountDown;
updateTimerView(){
private _countDown: CountDown;
updateTimerView() {
//更新倒计时
if(this._countDown == null ) {
if (this._countDown == null) {
this._countDown = new CountDown(this['countdown']);
this._countDown.addEventListener(egret.TimerEvent.TIMER_COMPLETE,this.onTimerComplete,this)
}
const data =getHomeData();
if(data.remainEnargy >= BLOOD_NUMS_MAX) { //满了
const data = getHomeData();
if (data.remainEnargy >= BLOOD_NUMS_MAX) { //满了
this._countDown.stop();
}else {
this['countdown'].visible = false;
} else {
const left = data.countdown - Math.floor(new Date().getTime() / 1000);
this._countDown.reset(left);
this['countdown'].visible = true;
}
}
onTimerComplete(){
//这里不做操作,等待主倒计时进程的通知
// console.log(1)
// setTimeout(() => {
// this._countDown.reset(6000);
// }, 3000);
this['bloodTxt'].text = `${data.remainEnargy}/5`;
}
protected initEvents() {
......@@ -444,7 +436,10 @@ export default class MapScene extends Scene {
onTap_bloodBtn() {
NetManager.ins.clickLog(getlogItem(2));
if (getHomeData().remainEnargy > 0)
PanelCtrl.instance.show('bloodPanel')
else
PanelCtrl.instance.show('blood2Panel')
}
setGray(order: number) {
......
......@@ -10,6 +10,7 @@ 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 BloodPanel extends Panel {
start(data) {
......@@ -29,8 +30,7 @@ this['price1Txt'].text = window['price1'];
private _countDown:CountDown;
private updateData() {
if(this._countDown == null ) {
this._countDown = new CountDown(this['countdown']);
this._countDown.addEventListener(egret.TimerEvent.TIMER_COMPLETE,this.onTimerComplete,this)
this._countDown = new CountDown(this['countdownTxt'],(str)=>`距离下一次体力补给时间:${str}`);
}
const homeData = getHomeData();
this['bloodTxt'].text = `你的可用体力值为:${homeData.remainEnargy}`;
......@@ -42,8 +42,11 @@ this['price1Txt'].text = window['price1'];
if(data.remainEnargy >= BLOOD_NUMS_MAX) { //满了
this['bloodTxt'].text = `你的可用体力值为:${homeData.remainEnargy}`;
this._countDown.stop();
this['countdownTxt'].visible=false;
}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'];
this.updateData();
}
onTimerComplete(){
//这里不做操作,等待主倒计时进程的通知
}
initEvents() {
super.initEvents();
this['inviteBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapInvite, this)
......@@ -70,6 +69,7 @@ this['price1Txt'].text = window['price1'];
showToast('购买成功');
NetManager.ins.hc_home(() => {
this.updateData();
updateMainTimer();
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
......@@ -97,6 +97,7 @@ this['price1Txt'].text = window['price1'];
}
NetManager.ins.hc_home(() => {
this.updateData();
updateMainTimer();
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
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 {
}
onBuy4() {
console.log('4444444');
//这里应该是订制接口
// this.buyBtn1.enabled = false;
// NetManager.ins.hc_exchange((success) => {
// this.buyBtn1.enabled = true;
// if (success) {
// NetManager.ins.hc_home(() => {
// SceneCtrl.instance.updateScene();
// }, window['collectRuleId'])
// }
// }, 2, PropType.HAMMER);//兑换道具
PanelCtrl.instance.show('ExchangePanel');
}
onBuy1() {
PanelCtrl.instance.show('Buy1');
......
......@@ -71,7 +71,7 @@ export default class StartPanel extends Panel {
const homeData = getHomeData();
if (homeData.remainEnargy <= 0) {
if (homeData.askForEnergy) {
PanelCtrl.instance.show('bloodPanel');
PanelCtrl.instance.show('blood2Panel');
} else {
if (iswx()) {
getShareUrl(this.stage);
......
......@@ -2,10 +2,10 @@
"success": true,
"code": "0000000000",
"desc": "OK",
"timestamp": 1566885811031,
"timestamp": 1566885811001,
"data": {
"countdown": 1569037996,
"remainEnargy": 4,
"countdown": 1569058731,
"remainEnargy": 5,
"isGetAllTreasureBox": 0,
"wealth": 7960,
"totalStars": 145,
......@@ -156,7 +156,7 @@
}
],
"askForEnergy": false,
"askForEnergy": true,
"canReceiveTreasureBoxNum": 10,
"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