| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- /** 清除害虫数据类 */
- import { FactroyState, FarmState, PastureState, ProductType } from "../../../game/data/GameData";
- const { ccclass } = cc._decorator;
- @ccclass
- export default class ADClearSickData {
- curConfigID = -1;
- tab = null;
- openPanel(tab, id) {
- this.tab = tab;
- this.curConfigID = id;
- mk.ui.openPanel('game/prefab/uiPanel/ADClearSickPanel');
- }
- clearSick() {
- if (this.tab == ProductType.nzw) {
- let farm = gData.gameData.getFarmDataMap(this.curConfigID);
- farm.state = FarmState.Ripe;
- if (gData.gameData.RawInsectCurArr[0] > 0) {
- gData.gameData.RawInsectCurArr[0]--;
- }
- }
- else if (this.tab == ProductType.dw) {
- let pasture = gData.gameData.getPastureDataMap(this.curConfigID);
- pasture.state = PastureState.Ripe;
- if (gData.gameData.RawInsectCurArr[1] > 0) {
- gData.gameData.RawInsectCurArr[1]--;
- }
- }
- else {
- let factory = gData.gameData.getFactoryDataMap(this.curConfigID);
- factory.state = FactroyState.Ripe;
- if (gData.gameData.RawInsectCurArr[2] > 0) {
- gData.gameData.RawInsectCurArr[2]--;
- }
- }
- gData.gameData.needFreshArr.push(this.curConfigID);
- }
- }
|