GameData.ts 44 KB

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