GameData.ts 44 KB

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