Commit 7ea02176 authored by wildfirecode's avatar wildfirecode

1

parent 45ab0317
......@@ -36,7 +36,7 @@ import SceneCtrl from "./ctrls/sceneCtrl";
import { ModuleTypes } from "./types/sceneTypes";
import layers from "./views/layers";
import SignPrizePanel from "../../src/panels/SignPrizePanel";
import { BLOOD_NUMS_MAX } from "../../src/getHomeData";
import getHomeData, { BLOOD_NUMS_MAX } from "../../src/getHomeData";
import BloodPanel2 from "../../src/panels/BloodPanel2";
import ExchangePanel from "../../src/panels/ExchangePanel";
......@@ -329,12 +329,12 @@ timer.addEventListener(egret.TimerEvent.TIMER_COMPLETE, () => {
}, this)
export const mainTimer = timer;
export const updateMainTimer = () => {
const { data } = DataManager.ins.getData('hc_home');
const data = getHomeData();
if (data.remainEnargy >= BLOOD_NUMS_MAX) {
mainTimer.stop();
} else {
mainTimer.reset();
const left = data.countdown - Math.floor(new Date().getTime() / 1000);
const left = data.refectionCountdown - Math.floor(new Date().getTime() / 1000);
mainTimer.repeatCount = left;
if (left >= 0)
mainTimer.start();
......
......@@ -1780,6 +1780,9 @@ export class NetManager extends ABNetManager {
* @param result 结果
*/
protected onResponse(net: INetData, result: any): void {
if(net.name == 'hc_home') {
result.data.refectionCountdown += Math.floor(new Date().getTime()/1000);
}
//数据处理
const data: Data = DataManager.ins.updateData(net.name, result, net.param);
//接口成功
......
......@@ -17,6 +17,7 @@ import { NetManager } from "../../libs/tw/manager/NetManager";
import { getlogItem } from "../Main";
import { showToast } from "../../libs/new_wx/ctrls/toastCtrl";
import wait from "../../libs/new_tc/wait";
import { updateMainTimerAfterGetData } from "../../libs/new_wx/MainBase";
export default class StartPanel extends Panel {
private _level;
......@@ -102,6 +103,7 @@ export default class StartPanel extends Panel {
// Loading.instace.hide();
this.touchChildren = true;
this.touchEnabled = true;
updateMainTimerAfterGetData();
if (success) {
// Loading.instace.show();
try {
......
......@@ -4,8 +4,8 @@
"desc": "OK",
"timestamp": 1566885811001,
"data": {
"countdown": 1569058731,
"remainEnargy": 5,
"refectionCountdown": 100,
"remainEnargy": 4,
"isGetAllTreasureBox": 0,
"wealth": 7960,
"totalStars": 145,
......
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