|
|
@@ -183,7 +183,7 @@ cc.Class({
|
|
|
_buildingView: null,
|
|
|
|
|
|
//是否是自己的土地,记录一下
|
|
|
- bSelfLand:true,
|
|
|
+ bSelfLand: true,
|
|
|
},
|
|
|
|
|
|
// LIFE-CYCLE CALLBACKS:
|
|
|
@@ -232,7 +232,7 @@ cc.Class({
|
|
|
})
|
|
|
|
|
|
this.stealHarvestNode.on(cc.Node.EventType.TOUCH_START, () => {
|
|
|
- if (!this.bSelfLand){
|
|
|
+ if (!this.bSelfLand) {
|
|
|
console.log("点击偷菜按钮收取");
|
|
|
GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), "请点击偷菜按钮收取!", 1);
|
|
|
return;
|
|
|
@@ -398,18 +398,6 @@ cc.Class({
|
|
|
},
|
|
|
|
|
|
updateLandState(bSelf) {
|
|
|
- //显示剩余天数
|
|
|
- this.upSliderNode.parent.active = bSelf;
|
|
|
- this.multipleLabel.string = this.leaseLandInfo.leaseMultiple;
|
|
|
- // 进去条按天算
|
|
|
- let sliderProgressScript = this.upSliderNode.getComponent("slider_progress");
|
|
|
- let _proccess = this.leaseLandInfo.leaseDays === 0 ? 0 : this.leaseLandInfo.leaseDaysRemaining / this.leaseLandInfo.leaseDays;
|
|
|
- sliderProgressScript.onSetProcgress(_proccess);
|
|
|
-
|
|
|
- /**
|
|
|
- * 绑定生成显示信息面板,现在土地信息
|
|
|
- */
|
|
|
- this.showLandInfo.on(cc.Node.EventType.TOUCH_START, this._showLandInfo, this);
|
|
|
//如果是种植状态并且有返回种植信息
|
|
|
if (1 === this.leaseLandInfo.isPlant && this.leaseLandInfo.seedInfo) {
|
|
|
//种植信息
|
|
|
@@ -462,6 +450,19 @@ cc.Class({
|
|
|
this.showPlantInfo.on(cc.Node.EventType.TOUCH_START, this._showPlantInfo, this);
|
|
|
}
|
|
|
|
|
|
+ //显示剩余天数
|
|
|
+ this.upSliderNode.parent.active = bSelf;
|
|
|
+ this.multipleLabel.string = this.leaseLandInfo.leaseMultiple;
|
|
|
+ // 进去条按天算
|
|
|
+ let sliderProgressScript = this.upSliderNode.getComponent("slider_progress");
|
|
|
+ let _proccess = this.leaseLandInfo.leaseDays === 0 ? 0 : this.leaseLandInfo.leaseDaysRemaining / this.leaseLandInfo.leaseDays;
|
|
|
+ sliderProgressScript.onSetProcgress(_proccess);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 绑定生成显示信息面板,现在土地信息
|
|
|
+ */
|
|
|
+ this.showLandInfo.on(cc.Node.EventType.TOUCH_START, this._showLandInfo, this);
|
|
|
+
|
|
|
let lastUpdateTime = Date.now();
|
|
|
let elapsedTime = 0;
|
|
|
let updateFrequency = 1; //ms
|
|
|
@@ -520,7 +521,10 @@ cc.Class({
|
|
|
if (bSelf) {
|
|
|
this.onShowHarvest();
|
|
|
} else {
|
|
|
- this.onShowStealHarvest();
|
|
|
+ //存在可偷的状态才设置这个图标
|
|
|
+ if (1 === this.leaseLandInfo.canSteal) {
|
|
|
+ this.onShowStealHarvest();
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
let _maturityHour = this.leaseLandInfo.seedInfo.maturity * 24
|
|
|
@@ -635,39 +639,42 @@ cc.Class({
|
|
|
this.stealHarvestNode.active = true;
|
|
|
},
|
|
|
|
|
|
+ onHideStealHarvest() {
|
|
|
+ this.stealHarvestNode.active = false;
|
|
|
+ },
|
|
|
+
|
|
|
/**
|
|
|
* 设置总体信息面板显示
|
|
|
* @param {boolean} bActive
|
|
|
*/
|
|
|
onSetInfoBoxActive(bActive) {
|
|
|
- if(!this.bSelfLand){
|
|
|
+ if (!this.bSelfLand) {
|
|
|
// console.log("其他用户的不用显示面板");
|
|
|
return;
|
|
|
}
|
|
|
- if (this.leaseLandInfo){
|
|
|
+ if (this.leaseLandInfo) {
|
|
|
this.infoBox.active = bActive;
|
|
|
- if(bActive)
|
|
|
- {
|
|
|
- if(this.showTimeOut){
|
|
|
+ if (bActive) {
|
|
|
+ if (this.showTimeOut) {
|
|
|
clearTimeout(this.showTimeOut);
|
|
|
this.showTimeOut = null;
|
|
|
}
|
|
|
//自动隐藏面板
|
|
|
- this.showTimeOut = setTimeout(()=>{
|
|
|
+ this.showTimeOut = setTimeout(() => {
|
|
|
this.infoBox.active = false;
|
|
|
- },5000)
|
|
|
+ }, 5000)
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
|
|
|
-
|
|
|
+
|
|
|
onDestroy() {
|
|
|
if (this.timeInterval) {
|
|
|
clearInterval(this.timeInterval);
|
|
|
this.timeInterval = null;
|
|
|
}
|
|
|
- if(this.showTimeOut){
|
|
|
+ if (this.showTimeOut) {
|
|
|
clearTimeout(this.showTimeOut);
|
|
|
this.showTimeOut = null;
|
|
|
}
|