GameData.ts 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808
  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. public configs: any = {};
  14. public adShowConfig: ADShowCfg;
  15. /** 功能开启 */
  16. public funOpenData: string[] = [];
  17. public gameData: PlayerProp = null;
  18. /** 标志位:刷新主界面货币 */
  19. public init_coin: boolean = false;
  20. public updatePiggyBankValue: boolean = false;
  21. /** 标志位:刷新主界面头像 */
  22. public init_head: boolean = false;
  23. /** 标志位:刷新主界面红点 */
  24. public init_red_point: boolean = true;
  25. /** 属性存储字典 */
  26. public props: Map<number, any> = new Map<number, any>();
  27. public pools = [
  28. { url: "game/prefab/tips", num: 20 },
  29. { url: "game/prefab/coin", num: 20 }
  30. ];
  31. /** 主页样式脚本 */
  32. public gameStyle: Game = null;
  33. /** 入口按钮 */
  34. public funBtns: FunBtns = null;
  35. /**
  36. * 初始化游戏数据:网络配置信息,用户信息
  37. * @returns
  38. */
  39. public async init() {
  40. let data: any = { "versionCode": gData.appData.version };
  41. let response = await mk.http.sendData('getAllConfigInfo', data);
  42. if (response.errcode != 0) {
  43. if (response.errcode == -10003 || response.errcode == -20003) {
  44. //清除缓存
  45. gData.loginData.reload();
  46. }
  47. return;
  48. }
  49. mk.console.logSingle("getAllConfigInfo", response.data);
  50. this.initConfigs(response.data);
  51. //初始化topon
  52. mk.ad.init();
  53. data = {};
  54. response = await mk.http.sendData('getInfoCrypt', data);
  55. if (response.errcode != 0) {
  56. return;
  57. }
  58. mk.console.logSingle("getInfoCrypt", response.data);
  59. this.initPlayerProp(response.data)
  60. this.initProps(response.data.gameUserData);
  61. data = {};
  62. response = await mk.http.sendData('user/adShowConfig', data);
  63. if (response.errcode != 0) {
  64. return;
  65. }
  66. this.adShowConfig = response.data;
  67. mk.console.logSingle("user/adShowConfig", response.data);
  68. data = {};
  69. response = await mk.http.sendData('welFare/getUserWelFareTaskInfo', data);
  70. if (response.errcode != 0) {
  71. return;
  72. }
  73. this.gameData.userTuCaoInfo = response.data.userWelFareTaskInfo;
  74. mk.console.logSingle("welFare/getUserWelFareTaskInfo", response.data);
  75. gData.guideData.init();
  76. gData.guideWeakData.init();
  77. gData.moduleData.forEach(element => {
  78. element.init();
  79. });
  80. gData.adData.setFullInterShowStr();
  81. this.dataFinish = true;
  82. }
  83. private initConfigs(data) {
  84. // console.log('config ', data);
  85. this.configs = data;
  86. this.funOpenData = this.configs.ServerConfig.Functionswitch.split(",");
  87. // this.setProductMapFromJson();
  88. gData.configData.loadConfig();
  89. }
  90. /**
  91. * 初始化玩家数据
  92. */
  93. private initPlayerProp(res_data) {
  94. this.gameData = new PlayerProp();
  95. this.gameData.cashIndex = res_data.cashIndex;
  96. this.gameData.gameUserData = res_data.gameUserData;
  97. this.gameData.isSignInToday = res_data.isSignInToday;
  98. this.gameData.isWithdrawable = res_data.isWithdrawable;
  99. this.gameData.lastTime = res_data.lastTime;
  100. this.gameData.loginDays = res_data.loginDays;
  101. this.gameData.newPlayer = res_data.newPlayer;
  102. this.gameData.initPiggyBank(res_data.piggyBank);
  103. this.gameData.piggyBankCashTimes = res_data.piggyBankCashTimes;
  104. this.gameData.redMoney = res_data.redMoney == null ? 0 : res_data.redMoney;
  105. this.gameData.signInDay = res_data.signInDay;
  106. this.gameData.totalPiggyBankCashTimes = res_data.totalPiggyBankCashTimes;
  107. this.gameData.turntableTimes = res_data.turntableTimes;
  108. this.gameData.userTuCaoInfo = res_data.userTuCaoInfo;
  109. this.gameData.versioncfg = res_data.versioncfg;
  110. this.gameData.isFirstRedMoney = res_data.isFirstRedMoney;
  111. gData.adData.watchNumToday = res_data.dayVideoTimesForRedMoney == null ? 0 : res_data.dayVideoTimesForRedMoney;
  112. this.setFramDataMapByServer();
  113. }
  114. /**
  115. * 保存单个数据
  116. */
  117. public async setProp(key: GameProp, value: any) {
  118. let data = {
  119. key: key + '',
  120. value: value
  121. };
  122. this.props.set(key, value);
  123. await mk.http.sendData('savePlayerProp', data);
  124. this.savePropFinish = true;
  125. }
  126. /**
  127. * 保存多个数据
  128. */
  129. public async setProps(arr: { key: GameProp, value: any }[]) {
  130. let needProp = {};
  131. for (let i = 0; i < arr.length; i++) {
  132. needProp[arr[i].key + ''] = arr[i].value;
  133. }
  134. let data = {
  135. needProp: needProp
  136. };
  137. for (let i = 0; i < arr.length; i++) {
  138. this.props.set(arr[i].key, arr[i].value);
  139. }
  140. await mk.http.sendData('saveAllPlayerProp', data);
  141. this.savePropsFinish = true;
  142. }
  143. /** 获取属性 */
  144. public getProp(key: GameProp): number {
  145. if (this.props == null) {
  146. return 0;
  147. }
  148. let value = this.props.get(key);
  149. return value;
  150. }
  151. /**
  152. * 向服务器请求所有属性后更新
  153. */
  154. public async getAllProps() {
  155. let response = await mk.http.sendData('getAllPlayerProp', {});
  156. if (response.errcode != 0) {
  157. return;
  158. }
  159. this.initProps(response.data);
  160. this.getPropsFnish = true;
  161. }
  162. private initProps(data) {
  163. if (data == null) {
  164. return;
  165. }
  166. for (let key in data) {
  167. this.props.set(parseInt(key), data[key]);
  168. }
  169. }
  170. /**
  171. * 第二天需要重置的数据
  172. */
  173. public resetProps() {
  174. let arr = [];
  175. arr.push({ key: GameProp.sign_can, value: 1 });
  176. arr.push({ key: GameProp.isAutoOpenPanel, value: 1 });
  177. arr.push({ key: GameProp.isOpenBankOnCloseCash, value: 0 });
  178. this.setProps(arr);
  179. }
  180. /** 是否是新用户 */
  181. public isNewPlayer(): boolean {
  182. let v = this.getProp(GameProp.newPlayer);
  183. return v == 0;
  184. }
  185. //*********** ================= 农场数据 ================== */
  186. // public needReloadData = false;
  187. // private _productingListMap: Map<number, Array<{ productID: number, ripeDate: number }>> = new Map();
  188. // /**建筑生产队列列表 */
  189. // public getProductingList(id: number): Array<{ productID: number, ripeDate: number }> {
  190. // if (!this._productingListMap.has(id)) {
  191. // this._productingListMap.set(id, []);
  192. // }
  193. // return this._productingListMap.get(id);
  194. // }
  195. // /**已激活的建筑列表 */
  196. // private buildDataMap: Map<number, number> = new Map();
  197. // public hasBuildData(id: number): boolean {
  198. // return this.buildDataMap.has(id);
  199. // }
  200. // public getBuildData(id: number): number {
  201. // return this.buildDataMap.get(id);
  202. // }
  203. // public setBuildData(id: number, userBuildID: number): void {
  204. // this.buildDataMap.set(id, userBuildID);
  205. // }
  206. // // /**设置建筑数据(生产队列,流水线数量,激活情况等) */
  207. // // public async setGameData(data: any) {
  208. // // this._productingListMap = new Map();
  209. // // this._unlockMap = new Map();
  210. // // this.buildDataMap = new Map();
  211. // // let product = ConfigData.configMap.get("product");
  212. // // for (let i = 0; i < data.length; i++) {
  213. // // const build = data[i];
  214. // // if (!this.buildDataMap.has(build.buildID)) {
  215. // // this.buildDataMap.set(build.buildID, build.userBuildID);
  216. // // this.setUnlock(build.buildID, build.addValue + 1);
  217. // // }
  218. // // if (build.productID != 0) {
  219. // // let result = product[build.productID];
  220. // // this.getProductingList(build.buildID).push({ productID: build.productID, ripeDate: build.plantTime * 1000 + result["time"] * 1000 });
  221. // // }
  222. // // }
  223. // // }
  224. // /**是否有任务可领取 */
  225. // public taskReceive = false;
  226. // /**是否有3日活动任务可领取 */
  227. // public threeDayTaskReceive = 0;
  228. // /**3日活动还需要邀请人数 */
  229. // public needChildCount: number = 0;
  230. // /**3日活动激活后结束时间 */
  231. // public threedayTaskTime: number = 0
  232. // /**种植奖励数据 */
  233. // public productPrize = null;
  234. // // /**排行榜数据*/
  235. // // public rankData: RankData;
  236. // // /**排行榜积分数据*/
  237. // // public rankScore: number = 0;
  238. // // /**是否刷新排行榜活动倒计时*/
  239. // // public isRefreshRankTime: boolean;
  240. // // /**是否可以领取排行榜奖励*/
  241. // // public isCanGetRankReward: boolean;
  242. /** 农田数据 服务器数据 */
  243. private _farmData = [];
  244. /** 农田字典 本地数据,方便操作*/
  245. private _farmDataMap: Map<number, any> = new Map();
  246. //刷新农田
  247. public needFreshArr = [];
  248. /** 最大可种植植物ID */
  249. private _maxCanPlantID = 10003;
  250. /** 设置最大可种植id 用于判断随机种植植物*/
  251. setMaxPlantID(id) {
  252. this._maxCanPlantID = id;
  253. this.setProp(GameProp.maxCanPlantID, this._maxCanPlantID);
  254. }
  255. getMaxPlantID() {
  256. return this._maxCanPlantID;
  257. }
  258. getRandomPlantConfig() {
  259. let id = Util.rnd(10001, this._maxCanPlantID);
  260. return this.getProductMap(id);
  261. }
  262. public setFarmDataMap(id, data, sendToServer = true) {
  263. this._farmDataMap.set(id, data);
  264. let len = this._farmData.length;
  265. for (var i = 0; i < len; i++) {
  266. if (this._farmData[i].id == id) {
  267. this._farmData[i].state = data.state;
  268. this._farmData[i].productID = data.productID;
  269. this._farmData[i].growSpan = data.growSpan;
  270. break;
  271. }
  272. }
  273. this.needFreshArr.push(id);
  274. //更新到服务器
  275. if (sendToServer) {
  276. this.setProp(GameProp.farmData, this._farmData);
  277. }
  278. }
  279. public getFarmDataMap(id) {
  280. return this._farmDataMap.get(id);
  281. }
  282. /** 服务器数据设置到本地 */
  283. public setFramDataMapByServer() {
  284. let len = this._farmData.length;
  285. //新玩家初始化农田数据
  286. if (len <= 18) {
  287. let id = 31000;
  288. let data = null;
  289. for (var i = 0; i < 18; i++) {
  290. if (i < 3) {
  291. data = { id: id, state: FarmState.Empty, productID: 0, growSpan: 0 };
  292. }
  293. else if (i == 3) {
  294. data = { id: id, state: FarmState.CanUnlock, productID: 0, growSpan: 0 };
  295. }
  296. else {
  297. data = { id: id, state: FarmState.Lock, productID: 0, growSpan: 0 };
  298. }
  299. this._farmData.push(data);
  300. this._farmDataMap.set(id, data);
  301. id++;
  302. }
  303. //第一次初始数据
  304. this.setMaxPlantID(this._maxCanPlantID);
  305. //更新到服务器
  306. this.setProp(GameProp.farmData, this._farmData);
  307. }
  308. else {
  309. for (var i = 0; i < len; i++) {
  310. this._farmDataMap.set(this._farmData[i].id, this._farmData[i]);
  311. }
  312. }
  313. }
  314. /** puduct配置数据 <picture, config> */
  315. private _productMap: Map<number, any> = new Map();
  316. /** puduct类型配置数据 <tab, 类型数组> */
  317. private _productTypeMap: Map<string, any> = new Map();
  318. /** 设置puduct配置数据 */
  319. public setProductMapFromJson() {
  320. // let productJson = this.configs.product;
  321. //先用本地数据
  322. let productJson = gData.configData.configMap.get('product');
  323. let len = productJson.length;
  324. let product = null;
  325. for (var i = 0; i < len; i++) {
  326. product = productJson[i];
  327. this._productMap.set(product['picture'], product);
  328. let arr = [];
  329. if (this.getProductArrByType(product['tab'])) {
  330. arr = this.getProductArrByType(product['tab']);
  331. }
  332. else {
  333. this._productTypeMap.set(product['tab'], arr);
  334. }
  335. arr.push(product);
  336. }
  337. }
  338. /** 根据id获取单个数据 */
  339. public getProductMap(id) {
  340. return this._productMap.get(id);
  341. }
  342. /** 根据tab获取数组 */
  343. public getProductArrByType(type: ProductType) {
  344. return this._productTypeMap.get(type);
  345. }
  346. /** 产品生产/种植次数 服务器数据 */
  347. private _productMakeTimesData = [];
  348. /** 产品生产/种植次数 */
  349. private _productMakeTimesMap: Map<number, number> = new Map();
  350. addProductMakeTimesById(id: number) {
  351. let times = this._productMakeTimesMap.get(id);
  352. if (!times) {
  353. times = 0;
  354. }
  355. times++;
  356. this._productMakeTimesMap.set(id, times);
  357. //更新到服务器
  358. let has = false;
  359. let len = this._productMakeTimesData.length;
  360. for (var i = 0; i < len; i++) {
  361. if (this._productMakeTimesData[i].id == id) {
  362. this._productMakeTimesData[i].times = times;
  363. has = true;
  364. break;
  365. }
  366. }
  367. if (!has) {
  368. let data = { 'id': id, 'times': times };
  369. this._productMakeTimesData.push(data);
  370. }
  371. //设置可种植植物最大id
  372. let nextID = id + 1;
  373. let nextConfig = this.getProductMap(nextID);
  374. if (nextConfig) {
  375. if (nextConfig.tab == '农作物' && nextID > this.getMaxPlantID()) {
  376. if (nextConfig.unlock == 1 && nextConfig.value <= times) {
  377. this.setMaxPlantID(nextID);
  378. }
  379. }
  380. }
  381. this.setProp(GameProp.productMakeTimes, this._productMakeTimesData);
  382. }
  383. getProductMakeTimesById(id: number) {
  384. let times = this._productMakeTimesMap.get(id);
  385. if (!times) {
  386. times = 0
  387. }
  388. return times;
  389. }
  390. }
  391. /**
  392. * 所有模块的非校验数据
  393. */
  394. export enum GameProp {
  395. /** -------------------- 通用玩家数据 ------------------------- */
  396. /** 是否新手 0新手 1老手 */
  397. newPlayer = 1,
  398. /** 当前新手引导步骤 */
  399. guideID = 2,
  400. /** 需要自动弹界面 每次登录都弹 除首次 表示今日是否要自动开 1自动开 2不自动开 其他不处理*/
  401. isAutoOpenPanel = 3,
  402. /** 关闭常规提现时需要自动开存钱罐 每天一次 表示今日有没有开过 */
  403. isOpenBankOnCloseCash = 4,
  404. //看视频次数
  405. videoTimes = 5,
  406. //提现次数
  407. cashTimes = 6,
  408. /** ------------------ 游戏核心数据 --------------------------- */
  409. /** 农场等级 */
  410. levelNum = 10,
  411. /** 农田数据 */
  412. farmData = 11,
  413. /** 产品生产次数 */
  414. productMakeTimes = 12,
  415. /** 最大可种植id */
  416. maxCanPlantID = 13,
  417. /** ------------------ 转盘数据 ------------------------------ */
  418. turnable_leftTimes = 20,
  419. /** ------------------ 存钱罐数据 ----------------------------- */
  420. /** ------------------ 签到数据 ----------------------------- */
  421. /** 上次签到进度 */
  422. sign_last_bar = 120,
  423. /** 当前能否签到 */
  424. sign_can = 121,
  425. /** ------------------ 红包提现 ----------------------------- */
  426. /** 提现进度 */
  427. redBag_cash_bar = 220,
  428. }
  429. /**
  430. * 玩家数据
  431. */
  432. class PlayerProp {
  433. /** 自定义不需要校验的数据 */
  434. gameUserData = 0;
  435. _isSignInToday = 0;
  436. /**
  437. * 今日是否有签到
  438. * - 0 未签到,表示可以签到
  439. * - 1 有签到,表示不可签到
  440. */
  441. set isSignInToday(value: number) {
  442. this._isSignInToday = value;
  443. gData.sign.init_data = true;
  444. gData.gameData.init_red_point = true;
  445. }
  446. get isSignInToday(): number {
  447. return this._isSignInToday;
  448. }
  449. private _piggyBank: number = 0;
  450. /** 存钱罐存款 */
  451. set piggyBank(value: number) {
  452. if (this._piggyBank === value) return;
  453. if (gData.gameData.gameData.isWithdrawable && value > 0) return;// 存钱罐可提现状态,不能增加存钱罐金额
  454. this._piggyBank = value;
  455. gData.gameData.init_coin = true;
  456. gData.pigbank.init_data = true;
  457. gData.gameData.init_red_point = true;
  458. }
  459. get piggyBank(): number {
  460. return this._piggyBank;
  461. }
  462. /** 初始化 */
  463. initPiggyBank(v) {
  464. this._piggyBank = v;
  465. }
  466. _isWithdrawable = 0;
  467. /**
  468. * 存钱罐能否提现
  469. * - 0 不能提现
  470. * - 1 能提现
  471. */
  472. set isWithdrawable(value: number) {
  473. if (this._isWithdrawable != value) {
  474. this._isWithdrawable = value;
  475. gData.pigbank.init_data = true;
  476. gData.gameData.init_red_point = true;
  477. }
  478. }
  479. get isWithdrawable(): number {
  480. return this._isWithdrawable;
  481. }
  482. /** 存钱罐每日提现次数 */
  483. piggyBankCashTimes = 0;
  484. /** 累计存钱罐每日提现次数 */
  485. totalPiggyBankCashTimes = 0;
  486. /** 提现进度 */
  487. cashIndex = 0;
  488. /** 上次登录时间 */
  489. lastTime = 0;
  490. /** 登录天数 */
  491. loginDays = 0;
  492. newPlayer = 0;
  493. private _redMoney: number = 0;
  494. /** 红包币数量 */
  495. set redMoney(value: number) {
  496. this._redMoney = value;
  497. gData.gameData.init_coin = true;
  498. gData.gameData.init_red_point = true;
  499. }
  500. get redMoney(): number {
  501. return this._redMoney;
  502. }
  503. _signInDay = 0;
  504. /** 累计签到次数 客户端理解 上次签到天数 */
  505. set signInDay(value: number) {
  506. if (this._signInDay === value) return;
  507. this._signInDay = value;
  508. gData.sign.init_data = true;
  509. }
  510. get signInDay(): number {
  511. return this._signInDay;
  512. }
  513. /** 转盘次数 */
  514. turntableTimes = 0;
  515. /** 版本号 */
  516. versioncfg = 0;
  517. /** 福袋数据 */
  518. userTuCaoInfo = 0;
  519. /** 关卡数 */
  520. levelNum = 0;
  521. /** 锤子道具数目 */
  522. hammerPropNum = 0;
  523. /** 重设道具数目 */
  524. resetPropNum = 0;
  525. /** 变色道具数目 */
  526. changePropNum = 0;
  527. /** 能免费领红包 1 表示是新人第一次产出红包币,不用看视频*/
  528. isFirstRedMoney = 0;
  529. //玩家等级
  530. gradeLevel = 1;
  531. }
  532. /**
  533. * 奖励状态
  534. */
  535. export enum RewardState {
  536. /** 已领取 */
  537. none = 1,
  538. /** 未解锁 */
  539. lock = 2,
  540. /** 可领取 */
  541. unlock = 3
  542. }
  543. /**
  544. * 奖励类型
  545. */
  546. export enum RewardType {
  547. /** 红包币 */
  548. redBag = 1,
  549. /** 毛币 */
  550. rmb = 2,
  551. /** 金猪币 */
  552. pigRmb = 3,
  553. }
  554. /**
  555. * 音频路径
  556. */
  557. export enum AUDIO_TYPE {
  558. /**主界面背景音乐*/
  559. bgm = 'bgm',
  560. /**打开存钱罐界面播放一次*/
  561. pigBank = 'pigBank',
  562. /**关卡玩法背景音乐*/
  563. missionBg = 'missionBg',
  564. /**红包币领取界面关闭音效*/
  565. rewardClose = 'rewardClose',
  566. /**红包币领取界面开启音效*/
  567. rewardOpen = 'rewardOpen',
  568. /**红包界面打开音效*/
  569. reward = 'reward',
  570. /**提现到账界面打开播放一次*/
  571. receiptNotice = 'receiptNotice',
  572. /**通用按钮点击音效 */
  573. button = 'button',
  574. /**转盘转动音效*/
  575. turnableplay = 'turnableplay',
  576. /**转盘转动音效*/
  577. turnplateDrawEnd = 'turnplateDrawEnd',
  578. /**主页背景音乐 */
  579. music_startBg = "music_startBg",
  580. /**游戏背景音乐 */
  581. music_gameBg = "music_gameBg",
  582. /**按钮点击 */
  583. ef_button_click = "ef_button_click",
  584. /**红包打开 */
  585. ef_redPacket_open = "ef_redPacket_open",
  586. /**红包来了音效 */
  587. ef_redPacket_come = "ef_redPacket_come",
  588. /**消除4个 */
  589. ef_bonus4 = "ef_bonus4",
  590. /**消除5个 */
  591. ef_bonus5 = "ef_bonus5",
  592. /**消除6个 */
  593. ef_bonus6 = "ef_bonus6",
  594. /**消除7个 */
  595. ef_bonus7 = "ef_bonus7",
  596. /**消除8个 */
  597. ef_bonus8 = "ef_bonus8",
  598. /**普通消除音效 */
  599. ef_eliminate = "ef_eliminate",
  600. /**bouns消除音效 */
  601. ef_eliminate_bonus = "ef_eliminate_bonus",
  602. /**胜利音效 */
  603. ef_win = "ef_win",
  604. /**锤子 */
  605. ef_change = "ef_change",
  606. /**刷新 */
  607. ef_refresh = "ef_refresh",
  608. /**飞翔 */
  609. ef_fly = "ef_fly",
  610. /**关闭按钮音效*/
  611. closeButton = "closeButton",
  612. }
  613. /** ECPM */
  614. type ADShowCfg = {
  615. average_ecpm: number,
  616. insert_probability: number,
  617. is_show_banner: number,
  618. is_show_inter: number,
  619. }
  620. type PlayerInfoType = {
  621. /** 自定义不需要校验的数据 */
  622. gameUserData: object,
  623. /** 今日是否有签到 */
  624. isSignInToday: number,
  625. /** 存钱罐存款 */
  626. piggyBank: number,
  627. /** 存钱罐能否提现 */
  628. isWithdrawable: boolean,
  629. /** 存钱罐每日提现次数 */
  630. piggyBankCashTimes: number,
  631. /** 累计存钱罐每日提现次数 */
  632. totalPiggyBankCashTimes: number,
  633. /** 提现进度 */
  634. cashIndex: number,
  635. /** 上次登录时间 */
  636. lastTime: number,
  637. /** 登录天数 */
  638. loginDays: number,
  639. newPlayer: Boolean,
  640. /** 红包币数量 */
  641. redMoney: number,
  642. /** 累计签到次数 客户端理解 上次签到天数 */
  643. signInDay: number,
  644. /** 转盘次数 */
  645. turntableTimes: number,
  646. /** 版本号 */
  647. versioncfg: string,
  648. /** 福袋数据 */
  649. userTuCaoInfo: object,
  650. }
  651. /**事件类型 */
  652. export enum EVENT_TYPE {
  653. BACK_WxAuth = "BACK_WxAuth",
  654. UPDATE_CashNum = "UPDATE_CashNum",
  655. }
  656. /** 数据事件Id */
  657. export enum DataEventId {
  658. /** 点击 */
  659. guide = "guide",
  660. /** 按钮点击 */
  661. button_click = "button_click",
  662. /** 看视频 */
  663. video_init = "video_init",
  664. /** 看视频完成 */
  665. video_end = "video_end",
  666. /** 福袋功能 */
  667. fudaiFunction = "fudaiFunction",
  668. /** 互推功能 */
  669. hutuiFunction = "hutuiFunction",
  670. /** 关卡 */
  671. level = "level",
  672. /** 常规提现-红包币提现 */
  673. commonWithDrawal = "commonWithDrawl",
  674. /** 存钱罐提现 */
  675. jarWithDrawal = "jarWithDrawal",
  676. /** 签到提现 */
  677. signWithDrawal = "signWithDrawal",
  678. }
  679. /** 视频广告类型 */
  680. export enum VideoAdType {
  681. Null = "",
  682. /** 关卡积分红包 */
  683. LevelScoreRedBag = "关卡积分红包",
  684. /** 主界面气泡红包 */
  685. StartQiPaoRedBag = "主界面气泡红包",
  686. /** 关卡气泡红包 */
  687. LevelQiPaoRedBag = "关卡气泡红包",
  688. /** 转盘 */
  689. Turntable = "转盘视频",
  690. /** 福袋视频" */
  691. Fudai = "福袋视频",
  692. /** 签到视频 */
  693. Sign = "签到视频",
  694. //钱包提现新手视频
  695. CashOutNoviceWelfare = "钱包提现新手视频",
  696. //钱包提现加现金视频
  697. CashOutAddCash = "钱包提现加现金视频"
  698. }
  699. export enum FarmState {
  700. Lock,
  701. CanUnlock,
  702. Empty,
  703. Growing,
  704. Ripe,
  705. Sick
  706. }
  707. export enum ProductType {
  708. nzw = '农作物',
  709. dw = '动物',
  710. bmhc = '爆米花厂',
  711. gdp = '糕点铺',
  712. ztc = '制糖厂',
  713. gfmg = '功夫面馆',
  714. kcd = '快餐店'
  715. }