GameData.ts 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414
  1. import Util from "../../before/util/Util";
  2. import FunBtns from "../game/FunBtns";
  3. import Game from "../game/Game";
  4. /**
  5. * @description 游戏核心玩法数据
  6. * @author 邹勇
  7. */
  8. export class GameData {
  9. public dataFinish: boolean = false;
  10. public savePropFinish: boolean = false;
  11. public savePropsFinish: boolean = false;
  12. public getPropsFnish: boolean = false;
  13. //是否触摸屏幕
  14. public isTouchScreen: boolean = false;
  15. public configs: any = {};
  16. public adShowConfig: ADShowCfg;
  17. /** 功能开启 */
  18. public funOpenData: string[] = [];
  19. public gameData: PlayerProp = null;
  20. /** 标志位:刷新主界面货币 */
  21. public init_coin: boolean = false;
  22. public updatePiggyBankValue: boolean = false;
  23. /** 标志位:刷新主界面头像 */
  24. public init_head: boolean = false;
  25. public init_add: boolean = false;
  26. /** 标志位:刷新主界面红点 */
  27. public init_red_point: boolean = true;
  28. //标志位,刷新提现界面的红包币
  29. public init_wallet_redMoney = false;
  30. /** 属性存储字典 */
  31. public props: Map<number, any> = new Map<number, any>();
  32. public pools = [
  33. { url: "game/prefab/tips", num: 20 },
  34. { url: "game/prefab/coin", num: 20 }
  35. ];
  36. /** 主页样式脚本 */
  37. public gameStyle: Game = null;
  38. /** 入口按钮 */
  39. public funBtns: FunBtns = null;
  40. /** 剩余可种植次数 */
  41. public leftTimes: number = -1;
  42. /** 最大可种植次数 */
  43. public maxTimes: number = -1;
  44. /** 恢复种植次数间隔 */
  45. public ProductionRecovery: number = 15;
  46. public init_leftTimes: boolean = false;
  47. /** 可生产商品配置 */
  48. public nextCanProduct = null;
  49. /** 按钮生产选中的农田、牧场或工厂 */
  50. public nextMake = null;
  51. /** 类型标识 */
  52. private nextType = 0;
  53. /** 刷新生产按钮信息 */
  54. public init_makeInfo = false;
  55. /** 正在生产 */
  56. public isProducting = false;
  57. /** 标志位 刷新任务描述 */
  58. public init_task = false;
  59. public init_expLevel = false;
  60. //标志位任务跟新
  61. public init_redBagTask = true;
  62. /**
  63. * 初始化游戏数据:网络配置信息,用户信息
  64. * @returns
  65. */
  66. public async init() {
  67. let data: any = { "versionCode": gData.appData.version };
  68. let response = await mk.http.sendData('getAllConfigInfo', data);
  69. if (response.errcode != 0) {
  70. if (response.errcode == -10003 || response.errcode == -20003) {
  71. //清除缓存
  72. gData.loginData.reload();
  73. }
  74. return;
  75. }
  76. mk.console.logSingle("getAllConfigInfo", response.data);
  77. this.initConfigs(response.data);
  78. //初始化topon
  79. mk.ad.init();
  80. data = {};
  81. response = await mk.http.sendData('getInfoCrypt', data);
  82. if (response.errcode != 0) {
  83. return;
  84. }
  85. mk.console.logSingle("getInfoCrypt", response.data);
  86. this.initPlayerProp(response.data)
  87. this.initProps(response.data.gameUserData);
  88. data = {};
  89. response = await mk.http.sendData('user/adShowConfig', data);
  90. if (response.errcode != 0) {
  91. return;
  92. }
  93. this.adShowConfig = response.data;
  94. mk.console.logSingle("user/adShowConfig", response.data);
  95. gData.adData.initEcpmData();
  96. // data = {};
  97. // response = await mk.http.sendData('noviceWeFare/getNoviceWeFareInfo', data);
  98. // if (response.errcode != 0) {
  99. // return;
  100. // }
  101. // this.gameData.userTuCaoInfo = response.data.userWelFareTaskInfo;
  102. // mk.console.logSingle("welFare/getUserWelFareTaskInfo", response.data);
  103. gData.guideData.init();
  104. gData.guideWeakData.init();
  105. gData.moduleData.forEach(element => {
  106. element.init();
  107. });
  108. this.dataFinish = true;
  109. }
  110. private initConfigs(data) {
  111. // console.log('config ', data);
  112. this.configs = data;
  113. this.funOpenData = this.configs.ServerConfig.Functionswitch.split(",");
  114. //从服务器解析配置
  115. // this.setProductMapFromJson();
  116. }
  117. /**
  118. * 初始化玩家数据
  119. */
  120. private initPlayerProp(res_data) {
  121. this.gameData = new PlayerProp();
  122. this.gameData.cashIndex = res_data.cashIndex;
  123. this.gameData.gameUserData = res_data.gameUserData;
  124. this.gameData.isSignInToday = res_data.isSignInToday;
  125. this.gameData.isWithdrawable = res_data.isWithdrawable;
  126. this.gameData.lastTime = res_data.lastTime;
  127. this.gameData.loginDays = res_data.loginDays;
  128. this.gameData.newPlayer = res_data.newPlayer;
  129. this.gameData.initPiggyBank(res_data.piggyBank);
  130. this.gameData.piggyBankCashTimes = res_data.piggyBankCashTimes;
  131. this.gameData.redMoney = res_data.redMoney == null ? 0 : res_data.redMoney;
  132. this.gameData.signInDay = res_data.signInDay;
  133. this.gameData.totalPiggyBankCashTimes = res_data.totalPiggyBankCashTimes;
  134. this.gameData.turntableTimes = res_data.turntableTimes;
  135. this.gameData.versioncfg = res_data.versioncfg;
  136. this.gameData.isFirstRedMoney = res_data.isFirstRedMoney;
  137. gData.adData.watchNumToday = res_data.dayVideoTimesForRedMoney == null ? 0 : res_data.dayVideoTimesForRedMoney;
  138. this.gameData.gradeLevel = res_data.farmLevel
  139. this.gameData.userTuCaoInfo = res_data.userWelFareTaskInfo;
  140. this.gameData.farmExpValue = res_data.userExp;
  141. this.gameData.farmGradeData = res_data.userFarmGrageRewardInfo;
  142. this.gameData.userNoviceWeFareInfo = res_data.userNoviceWeFareInfo;
  143. this.gameData.redMoneyCashPayRecordList = res_data.redMoneyCashPayRecordList;
  144. mk.console.logSingle('redMoneyCashPayRecordList==>', res_data.redMoneyCashPayRecordList);
  145. this.gameData.userFarmTaskInfo = res_data.userFarmTaskInfo;
  146. mk.data.setTAUserID(gData.loginData.uin);
  147. if (gData.loginData.isFirstIn) {
  148. gData.loginData.isFirstIn = false;
  149. mk.data.setTAEventRegister();
  150. mk.data.sendDataEvent('ABTest', `触发${this.gameData.groupCode}方案`);
  151. //注册时版本号
  152. mk.data.setTAEventUserStr(0, 'regtime_app_id', gData.appData.appVersion);
  153. }
  154. //当前版本号
  155. mk.data.setTAEventUserStr(0, 'now_app_id', gData.appData.appVersion);
  156. //渠道号
  157. mk.data.setTAEventUserStr(0, 'channel_id', gData.appData.umengChannel);
  158. }
  159. /**
  160. * 保存单个数据
  161. */
  162. public async setProp(key: GameProp, value: any) {
  163. let data = {
  164. key: key + '',
  165. value: value
  166. };
  167. this.props.set(key, value);
  168. await mk.http.sendData('savePlayerProp', data);
  169. this.savePropFinish = true;
  170. }
  171. /**
  172. * 保存多个数据
  173. */
  174. public async setProps(arr: { key: GameProp, value: any }[]) {
  175. let needProp = {};
  176. for (let i = 0; i < arr.length; i++) {
  177. needProp[arr[i].key + ''] = arr[i].value;
  178. }
  179. let data = {
  180. needProp: needProp
  181. };
  182. for (let i = 0; i < arr.length; i++) {
  183. this.props.set(arr[i].key, arr[i].value);
  184. }
  185. await mk.http.sendData('saveAllPlayerProp', data);
  186. this.savePropsFinish = true;
  187. }
  188. /** 获取属性 */
  189. public getProp(key: GameProp): any {
  190. if (this.props == null) {
  191. return 0;
  192. }
  193. let value = this.props.get(key);
  194. return value;
  195. }
  196. /**
  197. * 向服务器请求所有属性后更新
  198. */
  199. public async getAllProps() {
  200. let response = await mk.http.sendData('getAllPlayerProp', {});
  201. if (response.errcode != 0) {
  202. return;
  203. }
  204. this.initProps(response.data);
  205. this.getPropsFnish = true;
  206. }
  207. private initProps(data) {
  208. if (data == null) {
  209. return;
  210. }
  211. for (let key in data) {
  212. this.props.set(parseInt(key), data[key]);
  213. }
  214. this.setFramDataMapByServer();
  215. this.setPastureDataMapByServer();
  216. this.setFactoryDataMapByServer();
  217. this.initSetMaxProduct();
  218. this.initProductTimes();
  219. this.initLeftTimes();
  220. this.initFarmMapGetRewardData();
  221. let isNewTask = this.getProp(GameProp.redBagTaskRefresh);
  222. if (isNewTask != undefined) {
  223. this.init_redBagTask = isNewTask;
  224. }
  225. }
  226. private initLeftTimes() {
  227. let lefttimes = this.getProp(GameProp.leftTimes);
  228. if (lefttimes == undefined) {
  229. this.leftTimes = parseInt(this.configs.ServerConfig.FreeProduction);
  230. this.setProp(GameProp.leftTimes, this.leftTimes);
  231. }
  232. else {
  233. this.leftTimes = lefttimes;
  234. }
  235. this.maxTimes = parseInt(this.configs.ServerConfig.ProductionMax);
  236. this.ProductionRecovery = parseInt(this.configs.ServerConfig.ProductionRecovery);
  237. // //test
  238. // this.leftTimes = 1;
  239. // this.maxTimes = 20;
  240. // this.ProductionRecovery = 1;
  241. }
  242. /** 增加减少生产次数
  243. * @param add 增减变量
  244. */
  245. public changeLeftTimes(add) {
  246. gData.gameData.leftTimes += add;
  247. gData.gameData.leftTimes = (gData.gameData.leftTimes > gData.gameData.maxTimes ? gData.gameData.maxTimes : gData.gameData.leftTimes);
  248. if (gData.gameData.leftTimes < 0) {
  249. gData.gameData.leftTimes = 0;
  250. }
  251. gData.gameData.setProp(GameProp.leftTimes, gData.gameData.leftTimes);
  252. gData.gameData.init_leftTimes = true;
  253. }
  254. //图鉴领取数据
  255. private _farmMapRewardData = [];
  256. public getFarmMapRewardState(index) {
  257. if (index.i < this._farmMapRewardData.length) {
  258. if (index.j < this._farmMapRewardData[index.i].length) {
  259. return this._farmMapRewardData[index.i][index.j];
  260. }
  261. }
  262. return 1;
  263. }
  264. public setFarmMapRewardState(index, state) {
  265. if (index.i < this._farmMapRewardData.length) {
  266. if (index.j < this._farmMapRewardData[index.i].length) {
  267. this._farmMapRewardData[index.i][index.j] = state;
  268. this.setProp(GameProp.farmMapGetRewardData, this._farmMapRewardData);
  269. }
  270. }
  271. }
  272. private initFarmMapGetRewardData() {
  273. this._farmMapRewardData = this.getProp(GameProp.farmMapGetRewardData);
  274. if (!this._farmMapRewardData) {
  275. this._farmMapRewardData = [];
  276. }
  277. let needSync = false;
  278. let index = 0;
  279. this._productTypeMap.forEach((value, key) => {
  280. if (this._farmMapRewardData.length <= index) {
  281. let len = value.length;
  282. let arr = [];
  283. for (let i = 0; i != len; ++i) {
  284. arr.push(0);
  285. }
  286. this._farmMapRewardData.push(arr);
  287. needSync = true;
  288. console.log("-----add 数组数据")
  289. } else {
  290. let data = this._farmMapRewardData[index];
  291. let len = value.length;
  292. for (let i = 0; i != len; ++i) {
  293. if (i >= data.length) {
  294. data.push(0);
  295. needSync = true;
  296. console.log("-----add 单个数据")
  297. }
  298. }
  299. }
  300. ++index;
  301. });
  302. if (needSync) {
  303. this.setProp(GameProp.farmMapGetRewardData, this._farmMapRewardData);
  304. }
  305. }
  306. /**
  307. * 第二天需要重置的数据
  308. */
  309. public resetProps() {
  310. let arr = [];
  311. arr.push({ key: GameProp.sign_can, value: 1 });
  312. arr.push({ key: GameProp.isAutoOpenPanel, value: 1 });
  313. arr.push({ key: GameProp.isOpenBankOnCloseCash, value: 0 });
  314. this.setProps(arr);
  315. }
  316. /** 是否是新用户 */
  317. public isNewPlayer(): boolean {
  318. let v = this.getProp(GameProp.newPlayer);
  319. return v == 0;
  320. }
  321. //*********** ================= 农场数据 ================== */
  322. /** 农田数据 服务器数据 */
  323. private _farmData = [];
  324. /** 农田字典 本地数据,方便操作*/
  325. private _farmDataMap: Map<number, any> = new Map();
  326. //刷新农田
  327. public needFreshArr = [];
  328. /** 随机获取可种植物品 */
  329. getRandomPlantConfig() {
  330. let id = Util.rnd(10001, this.getMaxProduct(ProductType.nzw));
  331. return this.getProductMap(id);
  332. }
  333. /** 随机获取可生产产品 */
  334. getRandomFactoryConfig(configID) {
  335. let tab = gData.gameData.getTabByConfigID(configID);
  336. let arr = this.getProductArrByType(tab);
  337. let max = this.getMaxProduct(tab);
  338. let canArr = [];
  339. let len = arr.length;
  340. for (var i = 0; i < len; i++) {
  341. if (arr[i].picture <= max) {
  342. canArr.push(arr[i].picture);
  343. if (arr[i].picture == max) {
  344. break;
  345. }
  346. }
  347. }
  348. let index = Util.rnd(0, canArr.length - 1);
  349. let id = canArr[index];
  350. return this.getProductMap(id);
  351. }
  352. /** 自动生产选中下一个 */
  353. setNextProduct(sel = true) {
  354. if (this.nextMake) {
  355. return;
  356. }
  357. let next = gData.farmSystem.selectNextFarm(sel);
  358. if (!next) {
  359. let next1 = gData.pastureSystem.nextPasture();
  360. if (!next1) {
  361. let next2 = gData.factorySystem.nextFactory();
  362. if (!next2) {
  363. this.nextType = 0;
  364. }
  365. else {
  366. this.nextType = 3;
  367. }
  368. }
  369. else {
  370. this.nextType = 2;
  371. }
  372. }
  373. else {
  374. this.nextType = 1;
  375. }
  376. this.init_makeInfo = true;
  377. }
  378. hasFirstCheck = false;
  379. firstCheckNext() {
  380. if (!this.hasFirstCheck && gData.farmSystem.farms.length >= 18
  381. && gData.pastureSystem.pastureIcons.length >= 3 && gData.factorySystem.factoryIcons.length >= 6) {
  382. this.hasFirstCheck = true;
  383. Util.objSortByKey(gData.farmSystem.farms, 'sortID');
  384. Util.objSortByKey(gData.pastureSystem.pastureIcons, 'sortID');
  385. Util.objSortByKey(gData.factorySystem.factoryIcons, 'sortID');
  386. gData.gameData.setNextProduct(false);
  387. }
  388. }
  389. makeProduct() {
  390. switch (this.nextType) {
  391. case 0:
  392. mk.tip.pop('农场已满,无法继续生产');
  393. break;
  394. case 1:
  395. gData.farmSystem.btnMake();
  396. gData.gameData.nextMake = null;
  397. this.nextMake = null;
  398. this.setNextProduct(false);
  399. gData.adData.checkPopRed();
  400. break;
  401. case 2:
  402. gData.pastureSystem.btnMake();
  403. gData.gameData.nextMake = null;
  404. this.nextMake = null;
  405. this.setNextProduct(false);
  406. gData.adData.checkPopRed();
  407. break;
  408. case 3:
  409. gData.factorySystem.btnMake();
  410. gData.gameData.nextMake = null;
  411. this.nextMake = null;
  412. this.setNextProduct(false);
  413. gData.adData.checkPopRed();
  414. break;
  415. }
  416. }
  417. public setFarmDataMap(id, data, sendToServer = true) {
  418. this._farmDataMap.set(id, data);
  419. let len = this._farmData.length;
  420. for (var i = 0; i < len; i++) {
  421. if (this._farmData[i].id == id) {
  422. this._farmData[i].state = data.state;
  423. this._farmData[i].productID = data.productID;
  424. this._farmData[i].growSpan = data.growSpan;
  425. break;
  426. }
  427. }
  428. this.needFreshArr.push(id);
  429. //更新到服务器
  430. if (sendToServer) {
  431. this.setProp(GameProp.farmData, this._farmData);
  432. }
  433. }
  434. public getFarmDataMap(id) {
  435. return this._farmDataMap.get(id);
  436. }
  437. /** 服务器数据设置到本地 */
  438. public setFramDataMapByServer() {
  439. this._farmData = this.getProp(GameProp.farmData);
  440. if (!this._farmData) {
  441. this._farmData = [];
  442. }
  443. let len = this._farmData.length;
  444. //新玩家初始化农田数据
  445. if (len < 18) {
  446. let id = 31000;
  447. let data = null;
  448. for (var i = 0; i < 18; i++) {
  449. if (i < 9) {
  450. data = { id: id, state: FarmState.Empty, productID: 0, growSpan: 0 };
  451. }
  452. else if (i == 9) {
  453. data = { id: id, state: FarmState.CanUnlock, productID: 0, growSpan: 0 };
  454. }
  455. else {
  456. data = { id: id, state: FarmState.Lock, productID: 0, growSpan: 0 };
  457. }
  458. this._farmData.push(data);
  459. this._farmDataMap.set(id, data);
  460. id++;
  461. }
  462. //第一次初始数据
  463. this.setMaxProduct(ProductType.nzw, 10003);
  464. //更新到服务器
  465. this.setProp(GameProp.farmData, this._farmData);
  466. }
  467. else {
  468. for (var i = 0; i < len; i++) {
  469. this._farmDataMap.set(this._farmData[i].id, this._farmData[i]);
  470. }
  471. }
  472. //初始化产品最大次数
  473. }
  474. /** puduct配置数据 <picture, config> */
  475. private _productMap: Map<number, any> = new Map();
  476. /** puduct类型配置数据 <tab, 类型数组> */
  477. private _productTypeMap: Map<string, any> = new Map();
  478. /** 设置puduct配置数据 */
  479. public setProductMapFromJson() {
  480. // let productJson = this.configs.product;
  481. //先用本地数据
  482. let productJson = gData.configData.configMap.get('product');
  483. let len = productJson.length;
  484. let product = null;
  485. let tab = '';
  486. let arr = [];
  487. for (var i = 0; i < len; i++) {
  488. product = productJson[i];
  489. this._productMap.set(product.picture, product);
  490. if (tab != product.tab) {
  491. arr = [];
  492. this._productTypeMap.set(product.tab, arr);
  493. tab = product.tab;
  494. }
  495. arr.push(product);
  496. }
  497. }
  498. /** 根据id获取单个数据 */
  499. public getProductMap(id) {
  500. return this._productMap.get(id);
  501. }
  502. /** 根据tab获取数组 */
  503. public getProductArrByType(type: ProductType) {
  504. return this._productTypeMap.get(type);
  505. }
  506. /** 产品生产/种植次数 服务器数据 */
  507. private _productMakeTimesData = [];
  508. /** 产品生产/种植次数 */
  509. private _productMakeTimesMap: Map<number, number> = new Map();
  510. addProductMakeTimesById(id: number) {
  511. let times = this._productMakeTimesMap.get(id);
  512. if (!times) {
  513. times = 0;
  514. }
  515. times++;
  516. this._productMakeTimesMap.set(id, times);
  517. //更新到服务器
  518. let has = false;
  519. let len = this._productMakeTimesData.length;
  520. for (var i = 0; i < len; i++) {
  521. if (this._productMakeTimesData[i].id == id) {
  522. this._productMakeTimesData[i].times = times;
  523. has = true;
  524. break;
  525. }
  526. }
  527. if (!has) {
  528. let data = { 'id': id, 'times': times };
  529. this._productMakeTimesData.push(data);
  530. }
  531. //设置可种植/生产最大id
  532. let nextID = id + 1;
  533. let curConfig = this.getProductMap(id);
  534. let nextConfig = this.getProductMap(nextID);
  535. if (id == this.getMaxProduct(curConfig.tab)) {
  536. if (nextConfig) {
  537. gData.plantData.init_itemIndex = nextID;
  538. }
  539. }
  540. if (nextConfig) {
  541. if (nextConfig.tab == curConfig.tab && nextID > this.getMaxProduct(curConfig.tab)) {
  542. if (nextConfig.unlock == 1 && nextConfig.value <= times) {
  543. this.setMaxProduct(curConfig.tab, nextID);
  544. let nConfig = this.getProductMap(nextID + 1);
  545. if (nConfig) {
  546. gData.plantData.init_lock = nextID + 1;
  547. }
  548. }
  549. }
  550. }
  551. this.setProp(GameProp.productMakeTimes, this._productMakeTimesData);
  552. }
  553. getProductMakeTimesById(id: number) {
  554. let times = this._productMakeTimesMap.get(id);
  555. if (!times) {
  556. times = 0
  557. }
  558. return times;
  559. }
  560. //------------- 养殖场数据-----------
  561. /** 养殖场数据 服务器数据 */
  562. private _pastureData = [];
  563. /** 养殖场字典 本地数据,方便操作*/
  564. private _pastureDataMap: Map<number, any> = new Map();
  565. public setPastureDataMap(id, data, sendToServer = true) {
  566. this._pastureDataMap.set(id, data);
  567. let len = this._pastureData.length;
  568. for (var i = 0; i < len; i++) {
  569. if (this._pastureData[i].id == id) {
  570. this._pastureData[i].state = data.state;
  571. this._pastureData[i].productID = data.productID;
  572. this._pastureData[i].growSpan = data.growSpan;
  573. break;
  574. }
  575. }
  576. this.needFreshArr.push(id);
  577. //更新到服务器
  578. if (sendToServer) {
  579. this.setProp(GameProp.pastureData, this._pastureData);
  580. }
  581. }
  582. public getPastureDataMap(id) {
  583. return this._pastureDataMap.get(id);
  584. }
  585. /** 服务器数据设置到本地 */
  586. public setPastureDataMapByServer() {
  587. this._pastureData = this.getProp(GameProp.pastureData);
  588. if (!this._pastureData) {
  589. this._pastureData = [];
  590. }
  591. let len = this._pastureData.length;
  592. //新玩家初始化养殖场数据
  593. if (len < 3) {
  594. let arr = this.getProductArrByType(ProductType.dw);
  595. let len1 = arr.length;
  596. let id = 30001;
  597. let data = null;
  598. for (var i = 0; i < len1; i++) {
  599. if (arr[i].value < this.gameData.gradeLevel) {
  600. data = { id: id, state: PastureState.Lock, productID: arr[i].picture, growSpan: 0 };
  601. }
  602. else {
  603. data = { id: id, state: PastureState.Empty, productID: arr[i].picture, growSpan: 0 };
  604. }
  605. this._pastureData.push(data);
  606. this._pastureDataMap.set(id, data);
  607. id++;
  608. }
  609. //更新到服务器
  610. this.setProp(GameProp.pastureData, this._pastureData);
  611. }
  612. else {
  613. for (var i = 0; i < len; i++) {
  614. this._pastureDataMap.set(this._pastureData[i].id, this._pastureData[i]);
  615. }
  616. }
  617. }
  618. //------------- 工厂数据-----------
  619. /** 工厂数据 服务器数据 */
  620. private _factoryData = [];
  621. /** 工厂字典 本地数据,方便操作*/
  622. private _factoryDataMap: Map<number, any> = new Map();
  623. public setFactoryDataMap(id, data, sendToServer = true) {
  624. this._factoryDataMap.set(id, data);
  625. let len = this._factoryData.length;
  626. for (var i = 0; i < len; i++) {
  627. if (this._factoryData[i].id == id) {
  628. this._factoryData[i].state = data.state;
  629. this._factoryData[i].productID = data.productID;
  630. this._factoryData[i].growSpan = data.growSpan;
  631. break;
  632. }
  633. }
  634. this.needFreshArr.push(id);
  635. //更新到服务器
  636. if (sendToServer) {
  637. this.setProp(GameProp.factoryData, this._factoryData);
  638. }
  639. }
  640. public getFactoryDataMap(id) {
  641. return this._factoryDataMap.get(id);
  642. }
  643. /** 服务器数据设置到本地 */
  644. public setFactoryDataMapByServer() {
  645. this._factoryData = this.getProp(GameProp.factoryData);
  646. if (!this._factoryData) {
  647. this._factoryData = [];
  648. }
  649. let len = this._factoryData.length;
  650. //新玩家初始化工厂数据
  651. if (len < 6) {
  652. let id = 30004;
  653. let data = null;
  654. let tab = null;
  655. for (var i = 0; i < 6; i++) {
  656. tab = this.getTabByConfigID(id);
  657. let arr = this.getProductArrByType(tab);
  658. if (arr[0].value < this.gameData.gradeLevel) {
  659. data = { id: id, state: FactroyState.Lock, productID: 0, growSpan: 0 };
  660. }
  661. else {
  662. data = { id: id, state: FactroyState.Empty, productID: 0, growSpan: 0 };
  663. //更新最大可购买商品
  664. this.setMaxProduct(tab, arr[0].picture, false);
  665. }
  666. this._factoryData.push(data);
  667. this._factoryDataMap.set(id, data);
  668. id++;
  669. }
  670. //更新到服务器
  671. this.setProp(GameProp.maxProduct, this._maxProduct);
  672. this.setProp(GameProp.factoryData, this._factoryData);
  673. }
  674. else {
  675. for (var i = 0; i < len; i++) {
  676. this._factoryDataMap.set(this._factoryData[i].id, this._factoryData[i]);
  677. }
  678. }
  679. }
  680. /** 通过工厂建筑物ID获取标签 */
  681. getTabByConfigID(configID: number): ProductType {
  682. let tab = ProductType.bmhc;
  683. switch (configID) {
  684. case 30004:
  685. tab = ProductType.bmhc;
  686. break;
  687. case 30005:
  688. tab = ProductType.gdp;
  689. break;
  690. case 30006:
  691. tab = ProductType.ztc;
  692. break;
  693. case 30007:
  694. tab = ProductType.lrc;
  695. break;
  696. case 30008:
  697. tab = ProductType.gfmg;
  698. break;
  699. case 30009:
  700. tab = ProductType.kcd;
  701. break;
  702. }
  703. return tab;
  704. }
  705. /** 通过标签获取工厂建筑物ID */
  706. getConfigIDByTab(tab: ProductType): number {
  707. let configID = 0;
  708. switch (tab) {
  709. case ProductType.bmhc:
  710. configID = 30004;
  711. break;
  712. case ProductType.gdp:
  713. configID = 30005;
  714. break;
  715. case ProductType.ztc:
  716. configID = 30006;
  717. break;
  718. case ProductType.lrc:
  719. configID = 30007;
  720. break;
  721. case ProductType.gfmg:
  722. configID = 30008;
  723. break;
  724. case ProductType.kcd:
  725. configID = 30009;
  726. break;
  727. }
  728. return configID;
  729. }
  730. /** 最大可种植/生产商品数组 */
  731. private _maxProduct = [];
  732. public getMaxProduct(tab) {
  733. if (this._maxProduct) {
  734. let len = this._maxProduct.length;
  735. let data = null;
  736. for (var i = 0; i < len; i++) {
  737. data = this._maxProduct[i];
  738. if (data.tab == tab) {
  739. return data.productID;
  740. }
  741. }
  742. }
  743. return null;
  744. }
  745. public setMaxProduct(tab, id, sendToServer = true) {
  746. if (!this._maxProduct) {
  747. this._maxProduct = [];
  748. }
  749. let len = this._maxProduct.length;
  750. let data = null;
  751. let has = false;
  752. for (var i = 0; i < len; i++) {
  753. data = this._maxProduct[i];
  754. if (data.tab == tab) {
  755. data.productID = id;
  756. has = true;
  757. break;
  758. }
  759. }
  760. if (!has) {
  761. data = { tab: tab, productID: id };
  762. this._maxProduct.push(data);
  763. }
  764. if (sendToServer) {
  765. this.setProp(GameProp.maxProduct, this._maxProduct);
  766. }
  767. }
  768. public initSetMaxProduct() {
  769. if (this._maxProduct.length <= 0) {
  770. this._maxProduct = this.getProp(GameProp.maxProduct);
  771. }
  772. }
  773. private initProductTimes() {
  774. this._productMakeTimesData = this.getProp(GameProp.productMakeTimes);
  775. if (!this._productMakeTimesData) {
  776. this._productMakeTimesData = [];
  777. }
  778. let len = this._productMakeTimesData.length;
  779. for (var i = 0; i < len; i++) {
  780. this._productMakeTimesMap.set(this._productMakeTimesData[i].id, this._productMakeTimesData[i].times);
  781. }
  782. }
  783. /** 农场升级时解锁工厂,检查最大可种植/生产商品 */
  784. public checkGradeUpUnLock() {
  785. for (var key in ProductType) {
  786. let tab = ProductType[key];
  787. let configArr = this.getProductArrByType(tab);
  788. let len = configArr.length;
  789. let data = null;
  790. let needUpdate = false;
  791. switch (tab) {
  792. case ProductType.nzw:
  793. //不做处理,游戏最开始已解锁
  794. break;
  795. case ProductType.dw:
  796. let id = 30001;
  797. needUpdate = false;
  798. for (var i = 0; i < len; i++) {
  799. data = this.getPastureDataMap(id);
  800. if (data.state == PastureState.Lock && configArr[i].value <= this.gameData.gradeLevel) {
  801. data = { id: id, state: PastureState.Empty, productID: configArr[i].picture, growSpan: 0 };
  802. this.setPastureDataMap(id, data, false);
  803. needUpdate = true;
  804. }
  805. id++;
  806. }
  807. //更新到服务器
  808. if (needUpdate) {
  809. this.setProp(GameProp.pastureData, this._pastureData);
  810. this.setNextProduct();
  811. }
  812. break;
  813. default:
  814. //工厂解锁根据第一个商品
  815. needUpdate = false;
  816. let configID = this.getConfigIDByTab(tab);
  817. data = this.getFactoryDataMap(configID);
  818. if (data.state == FactroyState.Lock && configArr[0].value <= this.gameData.gradeLevel) {
  819. data = { id: id, state: FactroyState.Empty, productID: 0, growSpan: 0 };
  820. this.setFactoryDataMap(configID, data, false);
  821. needUpdate = true;
  822. //更新最大可购买商品
  823. this.setMaxProduct(tab, configArr[0].picture);
  824. }
  825. if (needUpdate) {
  826. this.setProp(GameProp.factoryData, this._factoryData);
  827. this.setNextProduct();
  828. }
  829. break;
  830. }
  831. }
  832. }
  833. }
  834. /**
  835. * 所有模块的非校验数据
  836. */
  837. export enum GameProp {
  838. /** -------------------- 通用玩家数据 ------------------------- */
  839. /** 是否新手 0新手 1老手 */
  840. newPlayer = 1,
  841. /** 当前新手引导步骤 */
  842. guideID = 2,
  843. /** 需要自动弹界面 每次登录都弹 除首次 表示今日是否要自动开 1自动开 2不自动开 其他不处理*/
  844. isAutoOpenPanel = 3,
  845. /** 关闭常规提现时需要自动开存钱罐 每天一次 表示今日有没有开过 */
  846. isOpenBankOnCloseCash = 4,
  847. //看视频次数
  848. videoTimes = 5,
  849. //提现次数
  850. cashTimes = 6,
  851. /** ------------------ 游戏核心数据 --------------------------- */
  852. /** 农田数据 */
  853. farmData = 11,
  854. /** 产品生产次数 */
  855. productMakeTimes = 12,
  856. /** 可生产最大产品字典 */
  857. maxProduct = 13,
  858. /** 养殖场数据 */
  859. pastureData = 14,
  860. /** 工厂数据 */
  861. factoryData = 15,
  862. /** 剩余可种植次数 */
  863. leftTimes = 16,
  864. /**
  865. 图鉴领取数据*/
  866. farmMapGetRewardData = 17,
  867. //红包任务tag
  868. redBagTaskRefresh = 18,
  869. /** ------------------ 转盘数据 ------------------------------ */
  870. turnable_leftTimes = 20,
  871. /** ------------------ 存钱罐数据 ----------------------------- */
  872. /** ------------------ 签到数据 ----------------------------- */
  873. /** 上次签到进度 */
  874. sign_last_bar = 120,
  875. /** 当前能否签到 */
  876. sign_can = 121,
  877. /** ------------------ 红包提现 ----------------------------- */
  878. /** 提现进度 */
  879. redBag_cash_bar = 220,
  880. }
  881. /**
  882. * 玩家数据
  883. */
  884. class PlayerProp {
  885. /** 自定义不需要校验的数据 */
  886. gameUserData = 0;
  887. _isSignInToday = 0;
  888. /**
  889. * 今日是否有签到
  890. * - 0 未签到,表示可以签到
  891. * - 1 有签到,表示不可签到
  892. */
  893. set isSignInToday(value: number) {
  894. this._isSignInToday = value;
  895. gData.sign.init_data = true;
  896. gData.gameData.init_red_point = true;
  897. }
  898. get isSignInToday(): number {
  899. return this._isSignInToday;
  900. }
  901. private _piggyBank: number = 0;
  902. /** 存钱罐存款 */
  903. set piggyBank(value: number) {
  904. if (this._piggyBank === value) return;
  905. if (gData.gameData.gameData.isWithdrawable && value > 0) return;// 存钱罐可提现状态,不能增加存钱罐金额
  906. this._piggyBank = value;
  907. gData.gameData.init_coin = true;
  908. gData.pigbank.init_data = true;
  909. gData.gameData.init_red_point = true;
  910. }
  911. get piggyBank(): number {
  912. return this._piggyBank;
  913. }
  914. /** 初始化 */
  915. initPiggyBank(v) {
  916. this._piggyBank = v;
  917. }
  918. _isWithdrawable = 0;
  919. /**
  920. * 存钱罐能否提现
  921. * - 0 不能提现
  922. * - 1 能提现
  923. */
  924. set isWithdrawable(value: number) {
  925. if (this._isWithdrawable != value) {
  926. this._isWithdrawable = value;
  927. gData.pigbank.init_data = true;
  928. gData.gameData.init_red_point = true;
  929. }
  930. }
  931. get isWithdrawable(): number {
  932. return this._isWithdrawable;
  933. }
  934. /** 存钱罐每日提现次数 */
  935. piggyBankCashTimes = 0;
  936. /** 累计存钱罐每日提现次数 */
  937. totalPiggyBankCashTimes = 0;
  938. /** 提现进度 */
  939. cashIndex = 0;
  940. /** 上次登录时间 */
  941. lastTime = 0;
  942. /** 登录天数 */
  943. loginDays = 0;
  944. newPlayer = 0;
  945. private _redMoney: number = 0;
  946. /** 红包币数量 */
  947. set redMoney(value: number) {
  948. this._redMoney = value;
  949. gData.gameData.init_coin = true;
  950. //gData.gameData.init_red_point = true;
  951. gData.gameData.init_wallet_redMoney = true;
  952. }
  953. get redMoney(): number {
  954. return this._redMoney;
  955. }
  956. _signInDay = 0;
  957. /** 累计签到次数 客户端理解 上次签到天数 */
  958. set signInDay(value: number) {
  959. if (this._signInDay === value) return;
  960. this._signInDay = value;
  961. gData.sign.init_data = true;
  962. }
  963. get signInDay(): number {
  964. return this._signInDay;
  965. }
  966. /** 转盘次数 */
  967. turntableTimes = 0;
  968. /** 版本号 */
  969. versioncfg = 0;
  970. /** 福袋数据 */
  971. userTuCaoInfo = 0;
  972. /** 能免费领红包 1 表示是新人第一次产出红包币,不用看视频*/
  973. isFirstRedMoney = 0;
  974. //农场等级
  975. gradeLevel = 6;
  976. //农场等级奖励数据
  977. farmGradeData: any = {};
  978. //农场经验
  979. private farmExp = 0;
  980. set farmExpValue(value: number) {
  981. this.farmExp = value;
  982. gData.gameData.init_expLevel = true;
  983. }
  984. get farmExpValue(): number {
  985. return this.farmExp;
  986. }
  987. //提现新手数据
  988. userNoviceWeFareInfo: any = {};
  989. //提现记录数据
  990. redMoneyCashPayRecordList = null;
  991. //任务红;
  992. userFarmTaskInfo = null;
  993. getRedMoneyCashOutTimesByIndex(index: number): number {
  994. if (this.redMoneyCashPayRecordList) {
  995. for (let i = 0; i != this.redMoneyCashPayRecordList.length; ++i) {
  996. if (index == this.redMoneyCashPayRecordList[i].index) {
  997. return this.redMoneyCashPayRecordList[i].freuency;
  998. }
  999. }
  1000. }
  1001. return 0;
  1002. }
  1003. /** ABTest分组id */
  1004. groupCode = 0;
  1005. }
  1006. /**
  1007. * 奖励状态
  1008. */
  1009. export enum RewardState {
  1010. /** 已领取 */
  1011. none = 1,
  1012. /** 未解锁 */
  1013. lock = 2,
  1014. /** 可领取 */
  1015. unlock = 3
  1016. }
  1017. /**
  1018. * 奖励类型
  1019. */
  1020. export enum RewardType {
  1021. /** 红包币 */
  1022. redBag = 1,
  1023. /** 毛币 */
  1024. rmb = 2,
  1025. /** 金猪币 */
  1026. pigRmb = 3,
  1027. }
  1028. /**
  1029. * 音频路径
  1030. */
  1031. export enum AUDIO_TYPE {
  1032. /**主界面背景音乐*/
  1033. bgm = 'bgm',
  1034. /**打开存钱罐界面播放一次*/
  1035. pigBank = 'pigBank',
  1036. /**关卡玩法背景音乐*/
  1037. missionBg = 'missionBg',
  1038. /**红包币领取界面关闭音效*/
  1039. rewardClose = 'rewardClose',
  1040. /**红包币领取界面开启音效*/
  1041. rewardOpen = 'rewardOpen',
  1042. /**红包界面打开音效*/
  1043. reward = 'reward',
  1044. /**提现到账界面打开播放一次*/
  1045. receiptNotice = 'receiptNotice',
  1046. /**通用按钮点击音效 */
  1047. button = 'button',
  1048. /**转盘转动音效*/
  1049. turnableplay = 'turnableplay',
  1050. /**转盘转动音效*/
  1051. turnplateDrawEnd = 'turnplateDrawEnd',
  1052. /**主页背景音乐 */
  1053. music_startBg = "music_startBg",
  1054. /**游戏背景音乐 */
  1055. music_gameBg = "music_gameBg",
  1056. /**按钮点击 */
  1057. ef_button_click = "ef_button_click",
  1058. /**红包打开 */
  1059. ef_redPacket_open = "ef_redPacket_open",
  1060. /**红包来了音效 */
  1061. ef_redPacket_come = "ef_redPacket_come",
  1062. /**消除4个 */
  1063. ef_bonus4 = "ef_bonus4",
  1064. /**消除5个 */
  1065. ef_bonus5 = "ef_bonus5",
  1066. /**消除6个 */
  1067. ef_bonus6 = "ef_bonus6",
  1068. /**消除7个 */
  1069. ef_bonus7 = "ef_bonus7",
  1070. /**消除8个 */
  1071. ef_bonus8 = "ef_bonus8",
  1072. /**普通消除音效 */
  1073. ef_eliminate = "ef_eliminate",
  1074. /**bouns消除音效 */
  1075. ef_eliminate_bonus = "ef_eliminate_bonus",
  1076. /**胜利音效 */
  1077. ef_win = "ef_win",
  1078. /**锤子 */
  1079. ef_change = "ef_change",
  1080. /**刷新 */
  1081. ef_refresh = "ef_refresh",
  1082. /**飞翔 */
  1083. ef_fly = "ef_fly",
  1084. /**关闭按钮音效*/
  1085. closeButton = "closeButton",
  1086. }
  1087. /** ECPM */
  1088. type ADShowCfg = {
  1089. average_ecpm: number,
  1090. insert_probability: number,
  1091. is_show_banner: number,
  1092. is_show_inter: number,
  1093. }
  1094. type PlayerInfoType = {
  1095. /** 自定义不需要校验的数据 */
  1096. gameUserData: object,
  1097. /** 今日是否有签到 */
  1098. isSignInToday: number,
  1099. /** 存钱罐存款 */
  1100. piggyBank: number,
  1101. /** 存钱罐能否提现 */
  1102. isWithdrawable: boolean,
  1103. /** 存钱罐每日提现次数 */
  1104. piggyBankCashTimes: number,
  1105. /** 累计存钱罐每日提现次数 */
  1106. totalPiggyBankCashTimes: number,
  1107. /** 提现进度 */
  1108. cashIndex: number,
  1109. /** 上次登录时间 */
  1110. lastTime: number,
  1111. /** 登录天数 */
  1112. loginDays: number,
  1113. newPlayer: Boolean,
  1114. /** 红包币数量 */
  1115. redMoney: number,
  1116. /** 累计签到次数 客户端理解 上次签到天数 */
  1117. signInDay: number,
  1118. /** 转盘次数 */
  1119. turntableTimes: number,
  1120. /** 版本号 */
  1121. versioncfg: string,
  1122. /** 福袋数据 */
  1123. userTuCaoInfo: object,
  1124. }
  1125. /**事件类型 */
  1126. export enum EVENT_TYPE {
  1127. BACK_WxAuth = "BACK_WxAuth",
  1128. UPDATE_CashNum = "UPDATE_CashNum",
  1129. }
  1130. /** 数据事件Id */
  1131. export enum DataEventId {
  1132. /** 点击 */
  1133. guide = "guide",
  1134. /** 按钮点击 */
  1135. button_click = "button_click",
  1136. /** 看视频 */
  1137. video_init = "video_init",
  1138. /** 点击视频 */
  1139. video_click = "video_click",
  1140. /** 看视频完成 */
  1141. video_end = "video_end",
  1142. /** 成功拉取全屏视频 */
  1143. interstitial2_init = "interstitial2_init",
  1144. /** 全屏视频点击 */
  1145. interstitial2_click = "interstitial2_click",
  1146. /** 全屏视频完成 */
  1147. interstitial2_end = "interstitial2_end",
  1148. /** 插屏广告内点击 */
  1149. interstitial1_click = "interstitial1_click",
  1150. /** banner点击 */
  1151. banner_click = "banner_click",
  1152. /** 开屏点击 */
  1153. splash_click = "splash_click",
  1154. /** 福袋功能 */
  1155. fudaiFunction = "fudaiFunction",
  1156. /** 互推功能 */
  1157. hutuiFunction = "hutuiFunction",
  1158. /** 激励视频ecpm */
  1159. ad_videoEcpm = 'ad_video',
  1160. /** 开屏ecpm */
  1161. ad_openEcpm = 'ad_open',
  1162. /** 提现 */
  1163. Sundry = 'Sundry'
  1164. }
  1165. /** 视频广告类型 */
  1166. export enum VideoAdType {
  1167. video_init_1 = '农场加等级经验',
  1168. video_init_2 = '提现-加进度',
  1169. video_init_3 = '提现-加现金',
  1170. video_init_4 = '签到',
  1171. video_init_5 = '抽奖',
  1172. video_init_6 = '图鉴领奖',
  1173. video_init_7 = '消灭害虫',
  1174. video_init_8 = '恢复健康',
  1175. video_init_9 = '恢复供电',
  1176. video_init_10 = '山羊红包',
  1177. video_init_11 = '拓建',
  1178. video_init_12 = '收获',
  1179. video_init_13 = '飘浮红包',
  1180. video_init_14 = '全体加速',
  1181. video_init_15 = '福利加进度',
  1182. video_init_16 = '生产加次数',
  1183. video_init_17 = '点击生产按钮',
  1184. video_init_18 = '离开游戏领红包',
  1185. video_init_19 = '定时弹出红包',
  1186. }
  1187. export enum InterFullAdType {
  1188. interstitial2_init_1 = '点击红包的关闭按钮',
  1189. interstitial2_init_2 = '普通收获',
  1190. interstitial2_init_3 = '点击鸟和狗'
  1191. }
  1192. export enum InterAdType {
  1193. interstitial1_click_1 = '恭喜发财红包弹出后',
  1194. interstitial1_click_2 = '恭喜获得弹窗弹出后',
  1195. interstitial1_click_3 = '生虫/生病/停电弹出后'
  1196. }
  1197. export enum BannerAdType {
  1198. banner_click_1 = '恭喜获得弹窗弹出后',
  1199. banner_click_2 = '任务红包',
  1200. banner_click_3 = '恭喜发财红包',
  1201. banner_click_4 = '图鉴',
  1202. banner_click_5 = '全体加速',
  1203. banner_click_6 = '收获弹窗',
  1204. banner_click_7 = '拓建弹窗',
  1205. banner_click_8 = '三个恢复弹窗',
  1206. banner_click_9 = '抽奖'
  1207. }
  1208. export enum ExpAddType {
  1209. EAT_video = 1,
  1210. EAT_harvest = 2,
  1211. }
  1212. export enum FarmState {
  1213. Lock,
  1214. CanUnlock,
  1215. Empty,
  1216. Growing,
  1217. Ripe,
  1218. Sick
  1219. }
  1220. export enum PastureState {
  1221. Lock,
  1222. Empty,
  1223. Growing,
  1224. Ripe,
  1225. Sick
  1226. }
  1227. export enum ProductType {
  1228. nzw = '农作物',
  1229. dw = '动物',
  1230. bmhc = '爆米花厂',
  1231. gdp = '糕点铺',
  1232. ztc = '制糖厂',
  1233. lrc = '炼乳厂',
  1234. gfmg = '功夫面馆',
  1235. kcd = '快餐店'
  1236. }
  1237. /** 动物状态 */
  1238. export enum AnimalState {
  1239. Hanger,
  1240. Eat,
  1241. Wait
  1242. }
  1243. export enum FactroyState {
  1244. Lock,
  1245. Empty,
  1246. Producting,
  1247. Ripe,
  1248. Sick
  1249. }