ADClearSickData.ts 1019 B

1234567891011121314151617181920212223242526272829303132
  1. /** 清除害虫数据类 */
  2. import { FactroyState, FarmState, PastureState, ProductType } from "../../../game/data/GameData";
  3. const { ccclass } = cc._decorator;
  4. @ccclass
  5. export default class ADClearSickData {
  6. curConfigID = -1;
  7. tab = null;
  8. openPanel(tab, id) {
  9. this.tab = tab;
  10. this.curConfigID = id;
  11. mk.ui.openPanel('game/prefab/uiPanel/ADClearSickPanel');
  12. }
  13. clearSick() {
  14. if (this.tab == ProductType.nzw) {
  15. let farm = gData.gameData.getFarmDataMap(this.curConfigID);
  16. farm.state = FarmState.Ripe;
  17. }
  18. else if (this.tab == ProductType.dw) {
  19. let pasture = gData.gameData.getPastureDataMap(this.curConfigID);
  20. pasture.state = PastureState.Ripe;
  21. }
  22. else {
  23. let factory = gData.gameData.getFactoryDataMap(this.curConfigID);
  24. factory.state = FactroyState.Ripe;
  25. }
  26. gData.gameData.needFreshArr.push(this.curConfigID);
  27. }
  28. }