GameData.ts 26 KB

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