GameData.ts 44 KB

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