LeaseFarmlandInfo.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. import date from "../Unit/date.js"
  2. import gameToast from "../Network/gameToast"
  3. /**
  4. * 操作租赁土地的相关业务
  5. */
  6. cc.Class({
  7. extends: cc.Component,
  8. properties: {
  9. leasePanelPrefabs: {
  10. default: null,
  11. type: cc.Prefab,
  12. serializable: true,
  13. },
  14. /**
  15. * 显示天数部分
  16. */
  17. upSliderNode: {
  18. default: null,
  19. type: cc.Node,
  20. serializable: true,
  21. },
  22. multipleLabel: {
  23. default: null,
  24. type: cc.Label,
  25. serializable: true,
  26. toolTip: "显示的倍数"
  27. },
  28. leaseDate: {
  29. default: null,
  30. type: cc.Label,
  31. serializable: true,
  32. toolTip: "剩余天数/总天数"
  33. },
  34. /**
  35. * 成熟期部分
  36. */
  37. midSliderNode: {
  38. default: null,
  39. type: cc.Node,
  40. serializable: true,
  41. },
  42. midDate: {
  43. default: null,
  44. type: cc.Label,
  45. serializable: true,
  46. toolTip: "剩余天数/总天数"
  47. },
  48. midSliderProgressNode: {
  49. default: null,
  50. type: cc.Node,
  51. serializable: true,
  52. toolTip: "进度条"
  53. },
  54. notLeased: {
  55. default: null,
  56. type: cc.Node,
  57. serializable: true,
  58. },
  59. //初始化时候对应的土地的id
  60. initConfigLandId: -1,
  61. // configLandId: 1
  62. // createTime: "2022-01-10 21:25:30"
  63. // id: 1
  64. // isLease: 1
  65. // isPlant: 0
  66. // landDescribe: "土地1xxx"
  67. // leaseMultiple: 1
  68. // leaseTime: "2022-01-10 21:25:17"
  69. // name: "土地1"
  70. // plantMature: 0
  71. // plantStart: "2022-01-10 21:25:22"
  72. // updateTime: "2022-01-10 21:25:33"
  73. // userId: "4"
  74. // 已经租赁的土地信息
  75. leaseLandInfo: {
  76. default: null,
  77. visible: false
  78. },
  79. // createTime: "2022-01-10 21:25:30"
  80. // id: 4
  81. // initMultiple: 1
  82. // isInit: 1
  83. // isLease: 0
  84. // isPlant: 0
  85. // landDescribe: "一倍土地"
  86. // leaseMultiple: 1
  87. // leaseTime: "2022-01-10 21:25:17"
  88. // name: "土地4"
  89. // plantMature: 0
  90. // plantStart: "2022-01-10 21:25:22"
  91. // posX: 19
  92. // posY: 10
  93. // sizeX: 2
  94. // sizeY: 2
  95. // updateTime: "2022-01-10 21:25:33"
  96. // 未初始化时候的土地信息
  97. configLandInfo: {
  98. default: null,
  99. visible: false
  100. },
  101. showLandInfo: {
  102. default: null,
  103. type: cc.Node,
  104. serializable: true,
  105. toolTip: "显示土地信息"
  106. },
  107. landInfoPrefabs: {
  108. default: null,
  109. type: cc.Prefab,
  110. serializable: true,
  111. },
  112. // 已经种植的作物信息
  113. plantInfo: {
  114. default: null,
  115. visible: false
  116. },
  117. showPlantInfo: {
  118. default: null,
  119. type: cc.Node,
  120. serializable: true,
  121. toolTip: "显示种植信息"
  122. },
  123. plantInfoPrefabs: {
  124. default: null,
  125. type: cc.Prefab,
  126. serializable: true,
  127. },
  128. //收获阶段
  129. harvestNode: {
  130. default: null,
  131. type: cc.Node,
  132. serializable: true,
  133. },
  134. stealHarvestNode: {
  135. default: null,
  136. type: cc.Node,
  137. serializable: true,
  138. },
  139. isHarvest: false,
  140. /**
  141. * 成熟时候显示的图片
  142. */
  143. harvestSprite: {
  144. default: null,
  145. type: cc.SpriteFrame,
  146. },
  147. _workingBuilding: null,
  148. //时间计算对象
  149. timeInterval: null,
  150. //是否显示showHarvest
  151. isShowHarvest: false,
  152. isShowIndex: 0,
  153. //检查土地是否到期
  154. isCheckLandState: false,
  155. _buildingView: null
  156. },
  157. // LIFE-CYCLE CALLBACKS:
  158. onLoad() {
  159. this._workingBuilding = this.node.getComponent("WorkingBuilding");
  160. this._buildingView = cc.find("Canvas/UICamera/BuildingContainer/BuildingView").getComponent("BuildingView");
  161. },
  162. start() {
  163. this.harvestNode.on(cc.Node.EventType.TOUCH_START, () => {
  164. if (GlobalD.GameData.isOnAddFruit) return;
  165. console.log("点击收获");
  166. GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), "收获中..", 5);
  167. let data = { landId: this.leaseLandInfo.configLandId };
  168. //果实收入仓库,重置土地种植信息
  169. GlobalD.GameData.onAddFruit(data, (value) => {
  170. // console.log(value);
  171. if (0 === value.code) {
  172. //收成后处理相关状态
  173. this.harvestNode.active = false;
  174. this.midSliderNode.active = false
  175. this._workingBuilding.onSetGrow(0, null);
  176. //更新仓库列表
  177. this._buildingView.onUpdateList();
  178. // "收获成功!"
  179. GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), "收获成功!", 1);
  180. this.isShowHarvest = false;
  181. this.isShowIndex = 0;
  182. if (this.timeInterval) {
  183. clearInterval(this.timeInterval);
  184. this.timeInterval = null;
  185. }
  186. } else if (706 === value.code) {
  187. //土地到期,没有更新刷新的处理刷新
  188. GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), value.msg, 1);
  189. //重置锁定状态显示
  190. this.onLockLand();
  191. } else {
  192. GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), value.msg, 1);
  193. }
  194. });
  195. })
  196. this.stealHarvestNode.on(cc.Node.EventType.TOUCH_START, () => {
  197. if (GlobalD.GameData.isOnAddFruit) return;
  198. console.log("点击收获");
  199. GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), "收获中..", 5);
  200. let data = { otherLandId: this.leaseLandInfo.configLandId, otherUserId: GlobalD.GameData.OtherUserInfo.userId };
  201. //果实收入仓库,重置土地种植信息
  202. GlobalD.GameData.onStealFruit(data, (value) => {
  203. console.log(value);
  204. if (0 === value.code) {
  205. //收成后处理相关状态
  206. this.stealHarvestNode.active = false;
  207. //更新仓库列表
  208. this._buildingView.onUpdateList();
  209. // "收获成功!"
  210. GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), "收获成功!", 1);
  211. this.isShowHarvest = false;
  212. this.isShowIndex = 0;
  213. if (this.timeInterval) {
  214. clearInterval(this.timeInterval);
  215. this.timeInterval = null;
  216. }
  217. } else if (706 === value.code) {
  218. //土地到期,没有更新刷新的处理刷新
  219. GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), value.msg, 1);
  220. //重置锁定状态显示
  221. this.onLockLand();
  222. } else {
  223. GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), value.msg, 1);
  224. }
  225. });
  226. })
  227. },
  228. onSpawnLeasePanel() {
  229. let leasePanel = cc.instantiate(this.leasePanelPrefabs);
  230. let parent = cc.find('Canvas/UICamera/DAPPContainer');
  231. leasePanel.parent = parent;
  232. leasePanel.setPosition(0, 0);
  233. // leasePanel.zIndex = 999;
  234. //把操作对象传入
  235. let leasePanelScript = leasePanel.getComponent("LeaseInfo");
  236. leasePanelScript.leaseFarmlandInfoNode = this;
  237. /**
  238. * 初始化两个操作。一个是续约,续约的话,不给操作,只有续约按钮可点,相当于原来配置再购买一次
  239. *
  240. * this.leaseLandInfo 如果购买了土地,这个参数不为空
  241. */
  242. if (this.leaseLandInfo) {
  243. //续约时候拦截输入,固定倍数
  244. leasePanelScript.blockInput.active = true;
  245. //传入当前计算倍数
  246. leasePanelScript.onInitLeaseInfo(this.leaseLandInfo.leaseMultiple);
  247. } else if (0 === this.configLandInfo.initMultiple) {
  248. // 固定土地开启,限制输入,设置默认值是1
  249. leasePanelScript.blockInput.active = true;
  250. leasePanelScript.onInitLeaseInfo(1);
  251. } else {
  252. //多倍土地,可以自己输入
  253. leasePanelScript.onInitLeaseInfo(this.configLandInfo.initMultiple);
  254. }
  255. },
  256. /**
  257. * 解锁土地操作
  258. */
  259. onUnlockLand() {
  260. //直接删除此节点
  261. if (this.notLeased) {
  262. this.notLeased.active = false;
  263. // this.notLeased.destroy();
  264. // this.notLeased = null;
  265. }
  266. },
  267. /**
  268. * 获取锁定状态
  269. */
  270. onGetUnlockLandState() {
  271. return this.notLeased.active;
  272. },
  273. /**
  274. * 重新锁定
  275. */
  276. onLockLand() {
  277. //显示按钮
  278. if (this.notLeased) {
  279. this.notLeased.active = true;
  280. }
  281. //清除当前租赁数据
  282. this.leaseLandInfo = null;
  283. this.isShowHarvest = false;
  284. this.isShowIndex = 0;
  285. if (this.timeInterval) {
  286. clearInterval(this.timeInterval);
  287. this.timeInterval = null;
  288. }
  289. //去除提示框
  290. this.upSliderNode.parent.active = false;
  291. this.midSliderNode.active = false;
  292. this.harvestNode.active = false;
  293. this.stealHarvestNode.active = false;
  294. //重置土地图片
  295. this._workingBuilding.onSetGrow(0, null);
  296. },
  297. //设置config的土地信息
  298. setConfigLandInfo(value) {
  299. this.configLandInfo = value;
  300. },
  301. /**
  302. * 设置其他用户租赁的土地信息
  303. * 比如去其他用户家里偷取物品,目前统一在这处理
  304. */
  305. setLeaseLandInfo(value, bSelf) {
  306. console.log("土地信息是,bSelf:", bSelf);
  307. if (!value) {
  308. console.log("已租赁土地状态为空:", value);
  309. return;
  310. }
  311. //设置意思显示相关
  312. this.isShowHarvest = false;
  313. this.isShowIndex = 0;
  314. //重新设置租赁检测状态
  315. this.isCheckLandState = false;
  316. this.leaseLandInfo = value;
  317. //先解绑一下信息
  318. this.showLandInfo.off(cc.Node.EventType.TOUCH_START, this._showLandInfo, this);
  319. this.showPlantInfo.off(cc.Node.EventType.TOUCH_START, this._showPlantInfo, this);
  320. //每个作物直接实时计算时间
  321. if (this.timeInterval) {
  322. clearInterval(this.timeInterval);
  323. this.timeInterval = null;
  324. }
  325. //删除解锁图标
  326. this.onUnlockLand();
  327. //更新一下土地信息
  328. this.updateLandState(bSelf);
  329. },
  330. updateLandState(bSelf) {
  331. //显示剩余天数
  332. this.upSliderNode.parent.active = bSelf;
  333. this.multipleLabel.string = this.leaseLandInfo.leaseMultiple;
  334. // 进去条按天算
  335. let sliderProgressScript = this.upSliderNode.getComponent("slider_progress");
  336. let _proccess = this.leaseLandInfo.leaseDays === 0 ? 0 : this.leaseLandInfo.leaseDaysRemaining / this.leaseLandInfo.leaseDays;
  337. sliderProgressScript.onSetProcgress(_proccess);
  338. /**
  339. * 绑定生成显示信息面板,现在土地信息
  340. */
  341. this.showLandInfo.on(cc.Node.EventType.TOUCH_START, this._showLandInfo, this);
  342. //如果是种植状态并且有返回种植信息
  343. if (1 === this.leaseLandInfo.isPlant && this.leaseLandInfo.seedInfo) {
  344. //种植信息
  345. //如果土地是租赁转态并且同时种植了 ,这里处理土地状态,显示种植信息
  346. let _spriteFrame;
  347. switch (this.leaseLandInfo.seedInfo.picture) {
  348. case "Cabbage":
  349. _spriteFrame = this._buildingView.fruitSpriteFrame[0];
  350. break;
  351. case "Potato":
  352. _spriteFrame = this._buildingView.fruitSpriteFrame[1];
  353. break;
  354. case "Carrot":
  355. _spriteFrame = this._buildingView.fruitSpriteFrame[2];
  356. break;
  357. case "Broccoli":
  358. _spriteFrame = this._buildingView.fruitSpriteFrame[3];
  359. break;
  360. case "Tomato":
  361. _spriteFrame = this._buildingView.fruitSpriteFrame[4];
  362. break;
  363. case "Squash":
  364. _spriteFrame = this._buildingView.fruitSpriteFrame[5];
  365. break;
  366. case "Eggplant":
  367. _spriteFrame = this._buildingView.fruitSpriteFrame[6];
  368. break;
  369. case "Pepper":
  370. _spriteFrame = this._buildingView.fruitSpriteFrame[7];
  371. break;
  372. case "Lentil":
  373. _spriteFrame = this._buildingView.fruitSpriteFrame[8];
  374. break;
  375. default:
  376. break;
  377. }
  378. //设置一个收获时候的图片
  379. this.harvestSprite = _spriteFrame;
  380. this.midSliderNode.active = bSelf;
  381. // 进度条按小时计算
  382. let _maturityAllHour = this.leaseLandInfo.seedInfo.maturity * 24
  383. let _remainAllHour = this.leaseLandInfo.plantDaysRemaining * 24 + this.leaseLandInfo.plantHoursRemaining;
  384. //计算剩余时间显示(进度条)
  385. let _midProccess = _maturityAllHour === 0 ? 0 : _remainAllHour / _maturityAllHour;
  386. this.midSliderProgressNode.getComponent(cc.ProgressBar).progress = _midProccess;
  387. /**
  388. * 绑定生成显示信息面板,种植信息
  389. */
  390. this.showPlantInfo.on(cc.Node.EventType.TOUCH_START, this._showPlantInfo, this);
  391. }
  392. let lastUpdateTime = Date.now();
  393. let elapsedTime = 0;
  394. let updateFrequency = 1; //ms
  395. this.timeInterval = setInterval(() => {
  396. let currentTime = Date.now();
  397. let deltaTime = currentTime - lastUpdateTime;
  398. elapsedTime += deltaTime;
  399. if (elapsedTime >= updateFrequency) {
  400. elapsedTime -= updateFrequency;
  401. let _leaseDaysMill = this.leaseLandInfo.leaseDaysMill - elapsedTime;
  402. let _plantDaysMill = this.leaseLandInfo.plantDaysMill - elapsedTime;
  403. lastUpdateTime = currentTime;
  404. // 更新计时显示
  405. let [_lDay, _lHour, _lMinutes, _lSeconds] = date.remainFromMillisecond(_leaseDaysMill);
  406. //todo 处理了 this.leaseLandInfo.leaseDaysRemaining
  407. if (0 !== _lDay) {
  408. this.leaseDate.string = "剩余" + _lDay + "天数,共" + this.leaseLandInfo.leaseDays + "天";
  409. } else if (0 !== _lHour) {
  410. this.leaseDate.string = "剩余" + _lHour + "小时,共" + this.leaseLandInfo.leaseDays + "天";
  411. } else if (0 !== _lMinutes) {
  412. this.leaseDate.string = "剩余" + _lMinutes + "分钟,共" + this.leaseLandInfo.leaseDays + "天";
  413. } else {
  414. this.leaseDate.string = "剩余" + _lSeconds + "秒,共" + this.leaseLandInfo.leaseDays + "天";
  415. }
  416. //todo 如果租赁时间到了,重新锁定
  417. //重置锁定状态显示
  418. if (!this.isCheckLandState) {
  419. if (_leaseDaysMill <= 0) {
  420. this.isCheckLandState = true;
  421. //检查一次土地
  422. this.onCheckLand(this.leaseLandInfo.configLandId);
  423. }
  424. }
  425. if (1 === this.leaseLandInfo.isPlant && this.leaseLandInfo.seedInfo) {
  426. //获得服务器种植日期毫秒
  427. let [_pDay, _pHour, _pMinutes, _pSeconds] = date.remainFromMillisecond(_plantDaysMill);
  428. //todo 处理了 this.leaseLandInfo.plantDaysRemaining
  429. if (0 !== _pDay) {
  430. //否则显示天和小时
  431. this.midDate.string = "剩余" + _pDay + "天" + _pHour + "小时";
  432. } else if (0 !== _pHour) {
  433. this.midDate.string = "剩余" + _pHour + "小时" + _pMinutes + "分钟";
  434. } else {
  435. this.midDate.string = "剩余" + _pMinutes + "分钟" + _pSeconds + "秒";
  436. }
  437. if (!this.isShowHarvest) {
  438. if (_plantDaysMill <= 0) {
  439. this.isShowHarvest = true;
  440. this.isShowIndex = 3;
  441. //如果传回的毫秒是小于零,说明成熟了
  442. //成熟阶段
  443. this._workingBuilding.onSetGrow(3, this.harvestSprite);
  444. // console.log("土地:", _userLeaseLand[j].configLandId, "已经成熟,可以操作收取果实了!!");
  445. //如果是自己的,显示收成
  446. if (bSelf) {
  447. this.onShowHarvest();
  448. }else{
  449. this.onShowStealHarvest();
  450. }
  451. } else {
  452. let _maturityHour = this.leaseLandInfo.seedInfo.maturity * 24
  453. let _ratio = (_pDay * 24 + _pHour) / _maturityHour;
  454. if (_ratio > 0.5 && 1 !== this.isShowIndex) {
  455. this.isShowIndex = 1;
  456. this._workingBuilding.onSetGrow(1, this.harvestSprite);
  457. console.log("_ratio:" + _ratio + "=" + this.leaseLandInfo.configLandId + ",状态:" + this.isShowIndex);
  458. } else if (_ratio <= 0.5 && _ratio >= 0 && 2 !== this.isShowIndex) {
  459. this.isShowIndex = 2;
  460. this._workingBuilding.onSetGrow(2, this.harvestSprite);
  461. console.log("_ratio:" + _ratio + "=" + this.leaseLandInfo.configLandId + ",状态:" + this.isShowIndex);
  462. }
  463. }
  464. }
  465. }
  466. }
  467. });
  468. },
  469. _showLandInfo() {
  470. let leasePanel = cc.instantiate(this.landInfoPrefabs);
  471. let parent = cc.find('Canvas/UICamera/DAPPContainer');
  472. leasePanel.parent = parent;
  473. leasePanel.setPosition(0, 0);
  474. let leasePanelScript = leasePanel.getComponent("LandInfo");
  475. let _date = date.datedifference(this.leaseLandInfo.createTime, this.leaseLandInfo.leaseTime);
  476. let { configLandId, rentalExpenses, createTime, leaseTime, leaseMultiple, landDescribe } = this.leaseLandInfo;
  477. leasePanelScript.setInfo(configLandId, rentalExpenses, _date + "天", createTime, leaseTime, leaseMultiple + "倍", landDescribe);
  478. },
  479. _showPlantInfo() {
  480. let leasePanel = cc.instantiate(this.plantInfoPrefabs);
  481. let parent = cc.find('Canvas/UICamera/DAPPContainer');
  482. leasePanel.parent = parent;
  483. leasePanel.setPosition(0, 0);
  484. // leasePanel.zIndex = 999;
  485. let leasePanelScript = leasePanel.getComponent("PlantInfo");
  486. let _harvest = 0;
  487. if (this.leaseLandInfo.leaseDate === 1) {
  488. _harvest = this.leaseLandInfo.seedInfo.harvest1;
  489. } else if (this.leaseLandInfo.leaseDate === 2) {
  490. _harvest = this.leaseLandInfo.seedInfo.harvest2;
  491. } else if (this.leaseLandInfo.leaseDate === 3) {
  492. _harvest = this.leaseLandInfo.seedInfo.harvest3;
  493. }
  494. //price,maturity,plantStart,harvestQuantity,describe
  495. let { name, priceCnt, maturity, seedDescribe } = this.leaseLandInfo.seedInfo;
  496. leasePanelScript.setInfo(name, priceCnt, maturity + "天", this.leaseLandInfo.plantStart, _harvest, seedDescribe);
  497. },
  498. //更新收获的状态
  499. updateHarvest() {
  500. //todo 后续看看如何刷新,现在走的是开始刷新一次
  501. // let _workingBuilding = housingTemp_farmland.getComponent("WorkingBuilding");
  502. // //获得服务器种植日期毫秒
  503. // let [_day, _hour, _minutes, _seconds] = date.remainFromMillisecond(_leaseLandInfo.plantDaysMill);
  504. // let _maturityHour = _leaseLandInfo.seedInfo.maturity * 24
  505. // let _ratio = _hour / _maturityHour;
  506. // // console.log("生成的:" + _ratio);
  507. // if (_ratio > 0.5) {
  508. // _workingBuilding.onSetGrow(1, _spriteFrame);
  509. // } else if (_ratio >= 0) {
  510. // _workingBuilding.onSetGrow(2, _spriteFrame);
  511. // }else if (_leaseLandInfo.plantDaysMill <= 0) {
  512. // //如果传回的毫秒是小于零,说明成熟了
  513. // //成熟阶段
  514. // _workingBuilding.onSetGrow(3, _spriteFrame);
  515. // //todo,如果时间小的,走收获,收获成果实
  516. // // console.log("土地:", _userLeaseLand[j].configLandId, "已经成熟,可以操作收取果实了!!");
  517. // //todo 土地可收获状态
  518. // leaseFarmlandInfoScript.onShowHarvest();
  519. // }
  520. },
  521. //检查土地状态
  522. onCheckLand(configLandId) {
  523. GlobalD.GameData.getLandState({
  524. landId: configLandId,
  525. callback: (value) => {
  526. console.log("检查土地数据:" + JSON.stringify(value.msg));
  527. //这里只判断土地是否过期
  528. if (706 === value.code) {
  529. //土地到期,没有更新刷新的处理刷新
  530. GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), configLandId + "号," + value.msg, 2);
  531. //重置锁定状态显示
  532. this.onLockLand();
  533. }
  534. }
  535. });
  536. },
  537. /**
  538. * 场景有多个收获预制时候,用GameData限制
  539. * 点击之后,重置土地信息, 并且收入进仓库果实列表中去
  540. * 需要防多次触发
  541. */
  542. onShowHarvest() {
  543. this.harvestNode.active = true;
  544. },
  545. /**
  546. * 场景有多个收获预制时候,用GameData限制
  547. * 点击之后,偷取果实
  548. * 需要防多次触发
  549. */
  550. onShowStealHarvest() {
  551. this.stealHarvestNode.active = true;
  552. },
  553. onDestroy() {
  554. if (this.timeInterval) {
  555. clearInterval(this.timeInterval);
  556. this.timeInterval = null;
  557. }
  558. }
  559. });