GameData.ts 44 KB

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