|
|
@@ -13,6 +13,12 @@ cc.Class({
|
|
|
serializable: true,
|
|
|
},
|
|
|
|
|
|
+ //主信息面板
|
|
|
+ infoBox: cc.Node,
|
|
|
+
|
|
|
+ //时间计算对象
|
|
|
+ showTimeOut: null,
|
|
|
+
|
|
|
/**
|
|
|
* 显示天数部分
|
|
|
*/
|
|
|
@@ -314,6 +320,7 @@ cc.Class({
|
|
|
* 重新锁定
|
|
|
*/
|
|
|
onLockLand() {
|
|
|
+
|
|
|
//显示按钮
|
|
|
if (this.notLeased) {
|
|
|
this.notLeased.active = true;
|
|
|
@@ -336,6 +343,9 @@ cc.Class({
|
|
|
|
|
|
//重置土地图片
|
|
|
this._workingBuilding.onSetGrow(0, null);
|
|
|
+
|
|
|
+ this.onSetInfoBoxActive(false);
|
|
|
+
|
|
|
},
|
|
|
//设置config的土地信息
|
|
|
setConfigLandInfo(value) {
|
|
|
@@ -352,6 +362,9 @@ cc.Class({
|
|
|
console.log("已租赁土地状态为空:", value);
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ this.onSetInfoBoxActive(false);
|
|
|
+
|
|
|
//设置意思显示相关
|
|
|
this.isShowHarvest = false;
|
|
|
this.isShowIndex = 0;
|
|
|
@@ -456,13 +469,13 @@ cc.Class({
|
|
|
let [_lDay, _lHour, _lMinutes, _lSeconds] = date.remainFromMillisecond(_leaseDaysMill);
|
|
|
//todo 处理了 this.leaseLandInfo.leaseDaysRemaining
|
|
|
if (0 !== _lDay) {
|
|
|
- this.leaseDate.string = "剩余" + _lDay + "天数,共" + this.leaseLandInfo.leaseDays + "天";
|
|
|
+ this.leaseDate.string = "剩" + _lDay + "天/" + this.leaseLandInfo.leaseDays + "天";
|
|
|
} else if (0 !== _lHour) {
|
|
|
- this.leaseDate.string = "剩余" + _lHour + "小时,共" + this.leaseLandInfo.leaseDays + "天";
|
|
|
+ this.leaseDate.string = "剩" + _lHour + "时/" + this.leaseLandInfo.leaseDays + "天";
|
|
|
} else if (0 !== _lMinutes) {
|
|
|
- this.leaseDate.string = "剩余" + _lMinutes + "分钟,共" + this.leaseLandInfo.leaseDays + "天";
|
|
|
+ this.leaseDate.string = "剩" + _lMinutes + "分/" + this.leaseLandInfo.leaseDays + "天";
|
|
|
} else {
|
|
|
- this.leaseDate.string = "剩余" + _lSeconds + "秒,共" + this.leaseLandInfo.leaseDays + "天";
|
|
|
+ this.leaseDate.string = "剩" + _lSeconds + "秒/" + this.leaseLandInfo.leaseDays + "天";
|
|
|
}
|
|
|
//todo 如果租赁时间到了,重新锁定
|
|
|
//重置锁定状态显示
|
|
|
@@ -480,11 +493,11 @@ cc.Class({
|
|
|
//todo 处理了 this.leaseLandInfo.plantDaysRemaining
|
|
|
if (0 !== _pDay) {
|
|
|
//否则显示天和小时
|
|
|
- this.midDate.string = "剩余" + _pDay + "天" + _pHour + "小时";
|
|
|
+ this.midDate.string = "剩" + _pDay + "天" + _pHour + "时";
|
|
|
} else if (0 !== _pHour) {
|
|
|
- this.midDate.string = "剩余" + _pHour + "小时" + _pMinutes + "分钟";
|
|
|
+ this.midDate.string = "剩" + _pHour + "时" + _pMinutes + "分";
|
|
|
} else {
|
|
|
- this.midDate.string = "剩余" + _pMinutes + "分钟" + _pSeconds + "秒";
|
|
|
+ this.midDate.string = "剩" + _pMinutes + "分" + _pSeconds + "秒";
|
|
|
}
|
|
|
if (!this.isShowHarvest) {
|
|
|
if (_plantDaysMill <= 0) {
|
|
|
@@ -497,7 +510,7 @@ cc.Class({
|
|
|
//如果是自己的,显示收成
|
|
|
if (bSelf) {
|
|
|
this.onShowHarvest();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
this.onShowStealHarvest();
|
|
|
}
|
|
|
} else {
|
|
|
@@ -613,10 +626,37 @@ cc.Class({
|
|
|
this.stealHarvestNode.active = true;
|
|
|
},
|
|
|
|
|
|
+ /**
|
|
|
+ * 设置总体信息面板显示
|
|
|
+ * @param {boolean} bActive
|
|
|
+ */
|
|
|
+ onSetInfoBoxActive(bActive) {
|
|
|
+ if (this.leaseLandInfo){
|
|
|
+ this.infoBox.active = bActive;
|
|
|
+ if(bActive)
|
|
|
+ {
|
|
|
+ if(this.showTimeOut){
|
|
|
+ clearTimeout(this.showTimeOut);
|
|
|
+ this.showTimeOut = null;
|
|
|
+ }
|
|
|
+ //自动隐藏面板
|
|
|
+ this.showTimeOut = setTimeout(()=>{
|
|
|
+ this.infoBox.active = false;
|
|
|
+ },5000)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
onDestroy() {
|
|
|
if (this.timeInterval) {
|
|
|
clearInterval(this.timeInterval);
|
|
|
this.timeInterval = null;
|
|
|
}
|
|
|
+ if(this.showTimeOut){
|
|
|
+ clearTimeout(this.showTimeOut);
|
|
|
+ this.showTimeOut = null;
|
|
|
+ }
|
|
|
}
|
|
|
});
|