GameData.ts 45 KB

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