GameData.ts 23 KB

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