97 lines
2.7 KiB
TypeScript
97 lines
2.7 KiB
TypeScript
// Learn TypeScript:
|
|
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
|
|
// Learn Attribute:
|
|
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
|
|
// Learn life-cycle callbacks:
|
|
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
|
|
|
|
import { PanelType } from "../../common/ui/config/SysDefine";
|
|
import UIBaseEv from "../../common/ui/uiEv/UIBaseEv";
|
|
import { offLineData } from "../Model/ProxyClientDataMgr";
|
|
|
|
const {ccclass, property} = cc._decorator;
|
|
|
|
@ccclass
|
|
export default class UIOnlineLayer extends UIBaseEv {
|
|
|
|
panelType:PanelType = PanelType.PopUp;
|
|
|
|
@property(cc.Label)
|
|
offlineEarningsLabel: cc.Label = null;
|
|
@property(cc.Label)
|
|
offlineTimeLabel: cc.Label = null;
|
|
@property(cc.Label)
|
|
offlineFishingLabel: cc.Label = null;
|
|
@property(cc.Label)
|
|
unlockFishLabel: cc.Label = null;
|
|
@property(cc.Button)
|
|
cancleBtn: cc.Button = null;
|
|
@property(cc.Button)
|
|
confirmBtn: cc.Button = null;
|
|
|
|
offlineDt:offLineData = null;
|
|
onClickEvent(event,customEventData)
|
|
{
|
|
switch (+customEventData) {
|
|
case 0:
|
|
this.closeUIPanel();
|
|
break;
|
|
case 1:
|
|
this.closeUIPanel();
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
onShow(offlineDt:offLineData)
|
|
{
|
|
this.offlineDt = offlineDt;
|
|
this.updateUI();
|
|
}
|
|
|
|
updateUI()
|
|
{
|
|
this.offlineEarningsLabel.string = ""+this.offlineDt.addCoin;
|
|
let tempDay = Math.floor(this.offlineDt.offLineTime/(3600*24));//天
|
|
let tempHour = Math.floor((this.offlineDt.offLineTime - tempDay*(3600*24))/3600);
|
|
let tempMin = Math.floor((this.offlineDt.offLineTime - tempDay*(3600*24)- tempHour*3600)/60);
|
|
let tempTimeStr = "";
|
|
if(tempDay > 0)
|
|
{
|
|
tempTimeStr = tempTimeStr + tempDay + "天";
|
|
}
|
|
if(tempHour > 0)
|
|
{
|
|
tempTimeStr = tempTimeStr + tempHour + "小时";
|
|
}
|
|
if(tempMin > 0)
|
|
{
|
|
tempTimeStr = tempTimeStr + tempMin + "分";
|
|
}
|
|
|
|
this.offlineTimeLabel.string = ""+tempTimeStr;
|
|
this.offlineFishingLabel.string = "共收获"+this.offlineDt.fishNums+"条鱼";
|
|
if(this.offlineDt.fishNew == 0)
|
|
{
|
|
this.unlockFishLabel.node.active = false;
|
|
}
|
|
else
|
|
{
|
|
this.unlockFishLabel.string = " (其中有"+this.offlineDt.fishNew+"条新解锁鱼儿,可以前往图鉴查看)";
|
|
this.unlockFishLabel.node.active = true;
|
|
}
|
|
|
|
|
|
}
|
|
// LIFE-CYCLE CALLBACKS:
|
|
|
|
// onLoad () {}
|
|
|
|
start () {
|
|
|
|
}
|
|
|
|
// update (dt) {}
|
|
}
|