GameData.ts 45 KB

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