| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012 |
- import Util from "../../before/util/Util";
- import FunBtns from "../game/FunBtns";
- import Game from "../game/Game";
- /**
- * @description 游戏核心玩法数据
- * @author 邹勇
- */
- export class GameData {
- public dataFinish: boolean = false;
- public savePropFinish: boolean = false;
- public savePropsFinish: boolean = false;
- public getPropsFnish: boolean = false;
- public configs: any = {};
- public adShowConfig: ADShowCfg;
- /** 功能开启 */
- public funOpenData: string[] = [];
- public gameData: PlayerProp = null;
- /** 标志位:刷新主界面货币 */
- public init_coin: boolean = false;
- public updatePiggyBankValue: boolean = false;
- /** 标志位:刷新主界面头像 */
- public init_head: boolean = false;
- /** 标志位:刷新主界面红点 */
- public init_red_point: boolean = true;
- /** 属性存储字典 */
- public props: Map<number, any> = new Map<number, any>();
- public pools = [
- { url: "game/prefab/tips", num: 20 },
- { url: "game/prefab/coin", num: 20 }
- ];
- /** 主页样式脚本 */
- public gameStyle: Game = null;
- /** 入口按钮 */
- public funBtns: FunBtns = null;
- /**
- * 初始化游戏数据:网络配置信息,用户信息
- * @returns
- */
- public async init() {
- let data: any = { "versionCode": gData.appData.version };
- let response = await mk.http.sendData('getAllConfigInfo', data);
- if (response.errcode != 0) {
- if (response.errcode == -10003 || response.errcode == -20003) {
- //清除缓存
- gData.loginData.reload();
- }
- return;
- }
- mk.console.logSingle("getAllConfigInfo", response.data);
- this.initConfigs(response.data);
- //初始化topon
- mk.ad.init();
- data = {};
- response = await mk.http.sendData('getInfoCrypt', data);
- if (response.errcode != 0) {
- return;
- }
- mk.console.logSingle("getInfoCrypt", response.data);
- this.initPlayerProp(response.data)
- this.initProps(response.data.gameUserData);
- data = {};
- response = await mk.http.sendData('user/adShowConfig', data);
- if (response.errcode != 0) {
- return;
- }
- this.adShowConfig = response.data;
- mk.console.logSingle("user/adShowConfig", response.data);
- data = {};
- response = await mk.http.sendData('welFare/getUserWelFareTaskInfo', data);
- if (response.errcode != 0) {
- return;
- }
- this.gameData.userTuCaoInfo = response.data.userWelFareTaskInfo;
- mk.console.logSingle("welFare/getUserWelFareTaskInfo", response.data);
- gData.guideData.init();
- gData.guideWeakData.init();
- gData.moduleData.forEach(element => {
- element.init();
- });
- gData.adData.setFullInterShowStr();
- this.dataFinish = true;
- }
- private initConfigs(data) {
- // console.log('config ', data);
- this.configs = data;
- this.funOpenData = this.configs.ServerConfig.Functionswitch.split(",");
- //从服务器解析配置
- // this.setProductMapFromJson();
- }
- /**
- * 初始化玩家数据
- */
- private initPlayerProp(res_data) {
- this.gameData = new PlayerProp();
- this.gameData.cashIndex = res_data.cashIndex;
- this.gameData.gameUserData = res_data.gameUserData;
- this.gameData.isSignInToday = res_data.isSignInToday;
- this.gameData.isWithdrawable = res_data.isWithdrawable;
- this.gameData.lastTime = res_data.lastTime;
- this.gameData.loginDays = res_data.loginDays;
- this.gameData.newPlayer = res_data.newPlayer;
- this.gameData.initPiggyBank(res_data.piggyBank);
- this.gameData.piggyBankCashTimes = res_data.piggyBankCashTimes;
- this.gameData.redMoney = res_data.redMoney == null ? 0 : res_data.redMoney;
- this.gameData.signInDay = res_data.signInDay;
- this.gameData.totalPiggyBankCashTimes = res_data.totalPiggyBankCashTimes;
- this.gameData.turntableTimes = res_data.turntableTimes;
- this.gameData.userTuCaoInfo = res_data.userTuCaoInfo;
- this.gameData.versioncfg = res_data.versioncfg;
- this.gameData.isFirstRedMoney = res_data.isFirstRedMoney;
- gData.adData.watchNumToday = res_data.dayVideoTimesForRedMoney == null ? 0 : res_data.dayVideoTimesForRedMoney;
- }
- /**
- * 保存单个数据
- */
- public async setProp(key: GameProp, value: any) {
- let data = {
- key: key + '',
- value: value
- };
- this.props.set(key, value);
- await mk.http.sendData('savePlayerProp', data);
- this.savePropFinish = true;
- }
- /**
- * 保存多个数据
- */
- public async setProps(arr: { key: GameProp, value: any }[]) {
- let needProp = {};
- for (let i = 0; i < arr.length; i++) {
- needProp[arr[i].key + ''] = arr[i].value;
- }
- let data = {
- needProp: needProp
- };
- for (let i = 0; i < arr.length; i++) {
- this.props.set(arr[i].key, arr[i].value);
- }
- await mk.http.sendData('saveAllPlayerProp', data);
- this.savePropsFinish = true;
- }
- /** 获取属性 */
- public getProp(key: GameProp): any {
- if (this.props == null) {
- return 0;
- }
- let value = this.props.get(key);
- return value;
- }
- /**
- * 向服务器请求所有属性后更新
- */
- public async getAllProps() {
- let response = await mk.http.sendData('getAllPlayerProp', {});
- if (response.errcode != 0) {
- return;
- }
- this.initProps(response.data);
- this.getPropsFnish = true;
- }
- private initProps(data) {
- if (data == null) {
- return;
- }
- for (let key in data) {
- this.props.set(parseInt(key), data[key]);
- }
- this.setFramDataMapByServer();
- this.setPastureDataMapByServer();
- this.setFactoryDataMapByServer();
- }
- /**
- * 第二天需要重置的数据
- */
- public resetProps() {
- let arr = [];
- arr.push({ key: GameProp.sign_can, value: 1 });
- arr.push({ key: GameProp.isAutoOpenPanel, value: 1 });
- arr.push({ key: GameProp.isOpenBankOnCloseCash, value: 0 });
- this.setProps(arr);
- }
- /** 是否是新用户 */
- public isNewPlayer(): boolean {
- let v = this.getProp(GameProp.newPlayer);
- return v == 0;
- }
- //*********** ================= 农场数据 ================== */
- // public needReloadData = false;
- // private _productingListMap: Map<number, Array<{ productID: number, ripeDate: number }>> = new Map();
- // /**建筑生产队列列表 */
- // public getProductingList(id: number): Array<{ productID: number, ripeDate: number }> {
- // if (!this._productingListMap.has(id)) {
- // this._productingListMap.set(id, []);
- // }
- // return this._productingListMap.get(id);
- // }
- // /**已激活的建筑列表 */
- // private buildDataMap: Map<number, number> = new Map();
- // public hasBuildData(id: number): boolean {
- // return this.buildDataMap.has(id);
- // }
- // public getBuildData(id: number): number {
- // return this.buildDataMap.get(id);
- // }
- // public setBuildData(id: number, userBuildID: number): void {
- // this.buildDataMap.set(id, userBuildID);
- // }
- // // /**设置建筑数据(生产队列,流水线数量,激活情况等) */
- // // public async setGameData(data: any) {
- // // this._productingListMap = new Map();
- // // this._unlockMap = new Map();
- // // this.buildDataMap = new Map();
- // // let product = ConfigData.configMap.get("product");
- // // for (let i = 0; i < data.length; i++) {
- // // const build = data[i];
- // // if (!this.buildDataMap.has(build.buildID)) {
- // // this.buildDataMap.set(build.buildID, build.userBuildID);
- // // this.setUnlock(build.buildID, build.addValue + 1);
- // // }
- // // if (build.productID != 0) {
- // // let result = product[build.productID];
- // // this.getProductingList(build.buildID).push({ productID: build.productID, ripeDate: build.plantTime * 1000 + result["time"] * 1000 });
- // // }
- // // }
- // // }
- // /**是否有任务可领取 */
- // public taskReceive = false;
- // /**是否有3日活动任务可领取 */
- // public threeDayTaskReceive = 0;
- // /**3日活动还需要邀请人数 */
- // public needChildCount: number = 0;
- // /**3日活动激活后结束时间 */
- // public threedayTaskTime: number = 0
- // /**种植奖励数据 */
- // public productPrize = null;
- // // /**排行榜数据*/
- // // public rankData: RankData;
- // // /**排行榜积分数据*/
- // // public rankScore: number = 0;
- // // /**是否刷新排行榜活动倒计时*/
- // // public isRefreshRankTime: boolean;
- // // /**是否可以领取排行榜奖励*/
- // // public isCanGetRankReward: boolean;
- /** 农田数据 服务器数据 */
- private _farmData = [];
- /** 农田字典 本地数据,方便操作*/
- private _farmDataMap: Map<number, any> = new Map();
- //刷新农田
- public needFreshArr = [];
- getRandomPlantConfig() {
- let id = Util.rnd(10001, this.getMaxProduct(ProductType.nzw));
- return this.getProductMap(id);
- }
- public setFarmDataMap(id, data, sendToServer = true) {
- this._farmDataMap.set(id, data);
- let len = this._farmData.length;
- for (var i = 0; i < len; i++) {
- if (this._farmData[i].id == id) {
- this._farmData[i].state = data.state;
- this._farmData[i].productID = data.productID;
- this._farmData[i].growSpan = data.growSpan;
- break;
- }
- }
- this.needFreshArr.push(id);
- //更新到服务器
- if (sendToServer) {
- this.setProp(GameProp.farmData, this._farmData);
- }
- }
- public getFarmDataMap(id) {
- return this._farmDataMap.get(id);
- }
- /** 服务器数据设置到本地 */
- public setFramDataMapByServer() {
- this._farmData = this.getProp(GameProp.farmData);
- if (!this._farmData) {
- this._farmData = [];
- }
- let len = this._farmData.length;
- //新玩家初始化农田数据
- if (len < 18) {
- let id = 31000;
- let data = null;
- for (var i = 0; i < 18; i++) {
- if (i < 3) {
- data = { id: id, state: FarmState.Empty, productID: 0, growSpan: 0 };
- }
- else if (i == 3) {
- data = { id: id, state: FarmState.CanUnlock, productID: 0, growSpan: 0 };
- }
- else {
- data = { id: id, state: FarmState.Lock, productID: 0, growSpan: 0 };
- }
- this._farmData.push(data);
- this._farmDataMap.set(id, data);
- id++;
- }
- //第一次初始数据
- this.setMaxProduct(ProductType.nzw, 10003);
- //更新到服务器
- this.setProp(GameProp.farmData, this._farmData);
- }
- else {
- for (var i = 0; i < len; i++) {
- this._farmDataMap.set(this._farmData[i].id, this._farmData[i]);
- }
- }
- }
- /** puduct配置数据 <picture, config> */
- private _productMap: Map<number, any> = new Map();
- /** puduct类型配置数据 <tab, 类型数组> */
- private _productTypeMap: Map<string, any> = new Map();
- /** 设置puduct配置数据 */
- public setProductMapFromJson() {
- // let productJson = this.configs.product;
- //先用本地数据
- let productJson = gData.configData.configMap.get('product');
- let len = productJson.length;
- let product = null;
- let tab = '';
- let arr = [];
- for (var i = 0; i < len; i++) {
- product = productJson[i];
- this._productMap.set(product.picture, product);
- if (tab != product.tab) {
- arr = [];
- this._productTypeMap.set(product.tab, arr);
- tab = product.tab;
- }
- arr.push(product);
- }
- }
- /** 根据id获取单个数据 */
- public getProductMap(id) {
- return this._productMap.get(id);
- }
- /** 根据tab获取数组 */
- public getProductArrByType(type: ProductType) {
- return this._productTypeMap.get(type);
- }
- /** 产品生产/种植次数 服务器数据 */
- private _productMakeTimesData = [];
- /** 产品生产/种植次数 */
- private _productMakeTimesMap: Map<number, number> = new Map();
- addProductMakeTimesById(id: number) {
- let times = this._productMakeTimesMap.get(id);
- if (!times) {
- times = 0;
- }
- times++;
- this._productMakeTimesMap.set(id, times);
- //更新到服务器
- let has = false;
- let len = this._productMakeTimesData.length;
- for (var i = 0; i < len; i++) {
- if (this._productMakeTimesData[i].id == id) {
- this._productMakeTimesData[i].times = times;
- has = true;
- break;
- }
- }
- if (!has) {
- let data = { 'id': id, 'times': times };
- this._productMakeTimesData.push(data);
- }
- //设置可种植/生产最大id
- let nextID = id + 1;
- let curConfig = this.getProductMap(id);
- let nextConfig = this.getProductMap(nextID);
- if (nextConfig) {
- if (nextConfig.tab == curConfig.tab && nextID > this.getMaxProduct(curConfig.tab)) {
- if (nextConfig.unlock == 1 && nextConfig.value <= times) {
- this.setMaxProduct(curConfig.tab, nextID);
- }
- }
- }
- this.setProp(GameProp.productMakeTimes, this._productMakeTimesData);
- }
- getProductMakeTimesById(id: number) {
- let times = this._productMakeTimesMap.get(id);
- if (!times) {
- times = 0
- }
- return times;
- }
- //------------- 养殖场数据-----------
- /** 养殖场数据 服务器数据 */
- private _pastureData = [];
- /** 养殖场字典 本地数据,方便操作*/
- private _pastureDataMap: Map<number, any> = new Map();
- public setPastureDataMap(id, data, sendToServer = true) {
- this._pastureDataMap.set(id, data);
- let len = this._pastureData.length;
- for (var i = 0; i < len; i++) {
- if (this._pastureData[i].id == id) {
- this._pastureData[i].state = data.state;
- this._pastureData[i].productID = data.productID;
- this._pastureData[i].growSpan = data.growSpan;
- break;
- }
- }
- this.needFreshArr.push(id);
- //更新到服务器
- if (sendToServer) {
- this.setProp(GameProp.pastureData, this._pastureData);
- }
- }
- public getPastureDataMap(id) {
- return this._pastureDataMap.get(id);
- }
- /** 服务器数据设置到本地 */
- public setPastureDataMapByServer() {
- this._pastureData = this.getProp(GameProp.pastureData);
- if (!this._pastureData) {
- this._pastureData = [];
- }
- let len = this._pastureData.length;
- //新玩家初始化农田数据
- if (len < 3) {
- let arr = this.getProductArrByType(ProductType.dw);
- let len1 = arr.length;
- let id = 30001;
- let data = null;
- for (var i = 0; i < len1; i++) {
- // data = { id: id, state: PastureState.Lock, productID: arr[i].picture, growSpan: 0 };
- //test
- data = { id: id, state: PastureState.Empty, productID: arr[i].picture, growSpan: 0 };
- this._pastureData.push(data);
- this._pastureDataMap.set(id, data);
- id++;
- }
- //更新到服务器
- this.setProp(GameProp.pastureData, this._pastureData);
- }
- else {
- for (var i = 0; i < len; i++) {
- this._pastureDataMap.set(this._pastureData[i].id, this._pastureData[i]);
- }
- }
- }
- //------------- 工厂数据-----------
- /** 工厂数据 服务器数据 */
- private _factoryData = [];
- /** 工厂字典 本地数据,方便操作*/
- private _factoryDataMap: Map<number, any> = new Map();
- public setFactoryDataMap(id, data, sendToServer = true) {
- this._factoryDataMap.set(id, data);
- let len = this._factoryData.length;
- for (var i = 0; i < len; i++) {
- if (this._factoryData[i].id == id) {
- this._factoryData[i].state = data.state;
- this._factoryData[i].productID = data.productID;
- this._factoryData[i].growSpan = data.growSpan;
- break;
- }
- }
- this.needFreshArr.push(id);
- //更新到服务器
- if (sendToServer) {
- this.setProp(GameProp.factoryData, this._factoryData);
- }
- }
- public getFactoryDataMap(id) {
- return this._factoryDataMap.get(id);
- }
- /** 服务器数据设置到本地 */
- public setFactoryDataMapByServer() {
- this._factoryData = this.getProp(GameProp.factoryData);
- if (!this._factoryData) {
- this._factoryData = [];
- }
- let len = this._factoryData.length;
- //新玩家初始化农田数据
- if (len < 3) {
- let id = 30004;
- let data = null;
- for (var i = 0; i < 6; i++) {
- // data = { id: id, state: FactroyState.Lock, productID: 0, growSpan: 0 };
- //test
- data = { id: id, state: FactroyState.Empty, productID: 0, growSpan: 0 };
- this._factoryData.push(data);
- this._factoryDataMap.set(id, data);
- id++;
- }
- //更新到服务器
- this.setProp(GameProp.factoryData, this._factoryData);
- }
- else {
- for (var i = 0; i < len; i++) {
- this._factoryDataMap.set(this._factoryData[i].id, this._factoryData[i]);
- }
- }
- }
- /** 最大可种植/生产商品数组 */
- private _maxProduct = [];
- public getMaxProduct(tab) {
- if (this._maxProduct) {
- let len = this._maxProduct.length;
- let data = null;
- for (var i = 0; i < len; i++) {
- data = this._maxProduct[i];
- if (data.tab == tab) {
- return data.productID;
- }
- }
- }
- return null;
- }
- public setMaxProduct(tab, id) {
- if (!this._maxProduct) {
- this._maxProduct = [];
- }
- let len = this._maxProduct.length;
- let data = null;
- let has = false;
- for (var i = 0; i < len; i++) {
- data = this._maxProduct[i];
- if (data.tab == tab) {
- data.productID = id;
- has = true;
- break;
- }
- }
- if (!has) {
- data = { tab: tab, productID: id };
- this._maxProduct.push(data);
- }
- this.setProp(GameProp.maxProduct, this._maxProduct);
- }
- /** 农场升级时检查最大可种植/生产商品 */
- public checkMaxProduct() {
- for (var key in ProductType) {
- let tab = ProductType[key]
- let curmax = this.getMaxProduct(tab);
- if (!curmax) {
- let configArr = this.getProductArrByType(tab);
- if (gData.gameData.gameData.gradeLevel >= configArr[0].value && this.getMaxProduct(tab) <= configArr[0].value) {
- this.setMaxProduct(tab, configArr[0].picture);
- }
- }
- }
- }
- }
- /**
- * 所有模块的非校验数据
- */
- export enum GameProp {
- /** -------------------- 通用玩家数据 ------------------------- */
- /** 是否新手 0新手 1老手 */
- newPlayer = 1,
- /** 当前新手引导步骤 */
- guideID = 2,
- /** 需要自动弹界面 每次登录都弹 除首次 表示今日是否要自动开 1自动开 2不自动开 其他不处理*/
- isAutoOpenPanel = 3,
- /** 关闭常规提现时需要自动开存钱罐 每天一次 表示今日有没有开过 */
- isOpenBankOnCloseCash = 4,
- //看视频次数
- videoTimes = 5,
- //提现次数
- cashTimes = 6,
- /** ------------------ 游戏核心数据 --------------------------- */
- /** 农场等级 */
- levelNum = 10,
- /** 农田数据 */
- farmData = 11,
- /** 产品生产次数 */
- productMakeTimes = 12,
- /** 可生产最大产品字典 */
- maxProduct = 13,
- /** 养殖场数据 */
- pastureData = 14,
- /** 工厂数据 */
- factoryData = 15,
- /** ------------------ 转盘数据 ------------------------------ */
- turnable_leftTimes = 20,
- /** ------------------ 存钱罐数据 ----------------------------- */
- /** ------------------ 签到数据 ----------------------------- */
- /** 上次签到进度 */
- sign_last_bar = 120,
- /** 当前能否签到 */
- sign_can = 121,
- /** ------------------ 红包提现 ----------------------------- */
- /** 提现进度 */
- redBag_cash_bar = 220,
- }
- /**
- * 玩家数据
- */
- class PlayerProp {
- /** 自定义不需要校验的数据 */
- gameUserData = 0;
- _isSignInToday = 0;
- /**
- * 今日是否有签到
- * - 0 未签到,表示可以签到
- * - 1 有签到,表示不可签到
- */
- set isSignInToday(value: number) {
- this._isSignInToday = value;
- gData.sign.init_data = true;
- gData.gameData.init_red_point = true;
- }
- get isSignInToday(): number {
- return this._isSignInToday;
- }
- private _piggyBank: number = 0;
- /** 存钱罐存款 */
- set piggyBank(value: number) {
- if (this._piggyBank === value) return;
- if (gData.gameData.gameData.isWithdrawable && value > 0) return;// 存钱罐可提现状态,不能增加存钱罐金额
- this._piggyBank = value;
- gData.gameData.init_coin = true;
- gData.pigbank.init_data = true;
- gData.gameData.init_red_point = true;
- }
- get piggyBank(): number {
- return this._piggyBank;
- }
- /** 初始化 */
- initPiggyBank(v) {
- this._piggyBank = v;
- }
- _isWithdrawable = 0;
- /**
- * 存钱罐能否提现
- * - 0 不能提现
- * - 1 能提现
- */
- set isWithdrawable(value: number) {
- if (this._isWithdrawable != value) {
- this._isWithdrawable = value;
- gData.pigbank.init_data = true;
- gData.gameData.init_red_point = true;
- }
- }
- get isWithdrawable(): number {
- return this._isWithdrawable;
- }
- /** 存钱罐每日提现次数 */
- piggyBankCashTimes = 0;
- /** 累计存钱罐每日提现次数 */
- totalPiggyBankCashTimes = 0;
- /** 提现进度 */
- cashIndex = 0;
- /** 上次登录时间 */
- lastTime = 0;
- /** 登录天数 */
- loginDays = 0;
- newPlayer = 0;
- private _redMoney: number = 0;
- /** 红包币数量 */
- set redMoney(value: number) {
- this._redMoney = value;
- gData.gameData.init_coin = true;
- gData.gameData.init_red_point = true;
- }
- get redMoney(): number {
- return this._redMoney;
- }
- _signInDay = 0;
- /** 累计签到次数 客户端理解 上次签到天数 */
- set signInDay(value: number) {
- if (this._signInDay === value) return;
- this._signInDay = value;
- gData.sign.init_data = true;
- }
- get signInDay(): number {
- return this._signInDay;
- }
- /** 转盘次数 */
- turntableTimes = 0;
- /** 版本号 */
- versioncfg = 0;
- /** 福袋数据 */
- userTuCaoInfo = 0;
- /** 关卡数 */
- levelNum = 0;
- /** 锤子道具数目 */
- hammerPropNum = 0;
- /** 重设道具数目 */
- resetPropNum = 0;
- /** 变色道具数目 */
- changePropNum = 0;
- /** 能免费领红包 1 表示是新人第一次产出红包币,不用看视频*/
- isFirstRedMoney = 0;
- //玩家等级
- gradeLevel = 6;
- }
- /**
- * 奖励状态
- */
- export enum RewardState {
- /** 已领取 */
- none = 1,
- /** 未解锁 */
- lock = 2,
- /** 可领取 */
- unlock = 3
- }
- /**
- * 奖励类型
- */
- export enum RewardType {
- /** 红包币 */
- redBag = 1,
- /** 毛币 */
- rmb = 2,
- /** 金猪币 */
- pigRmb = 3,
- }
- /**
- * 音频路径
- */
- export enum AUDIO_TYPE {
- /**主界面背景音乐*/
- bgm = 'bgm',
- /**打开存钱罐界面播放一次*/
- pigBank = 'pigBank',
- /**关卡玩法背景音乐*/
- missionBg = 'missionBg',
- /**红包币领取界面关闭音效*/
- rewardClose = 'rewardClose',
- /**红包币领取界面开启音效*/
- rewardOpen = 'rewardOpen',
- /**红包界面打开音效*/
- reward = 'reward',
- /**提现到账界面打开播放一次*/
- receiptNotice = 'receiptNotice',
- /**通用按钮点击音效 */
- button = 'button',
- /**转盘转动音效*/
- turnableplay = 'turnableplay',
- /**转盘转动音效*/
- turnplateDrawEnd = 'turnplateDrawEnd',
- /**主页背景音乐 */
- music_startBg = "music_startBg",
- /**游戏背景音乐 */
- music_gameBg = "music_gameBg",
- /**按钮点击 */
- ef_button_click = "ef_button_click",
- /**红包打开 */
- ef_redPacket_open = "ef_redPacket_open",
- /**红包来了音效 */
- ef_redPacket_come = "ef_redPacket_come",
- /**消除4个 */
- ef_bonus4 = "ef_bonus4",
- /**消除5个 */
- ef_bonus5 = "ef_bonus5",
- /**消除6个 */
- ef_bonus6 = "ef_bonus6",
- /**消除7个 */
- ef_bonus7 = "ef_bonus7",
- /**消除8个 */
- ef_bonus8 = "ef_bonus8",
- /**普通消除音效 */
- ef_eliminate = "ef_eliminate",
- /**bouns消除音效 */
- ef_eliminate_bonus = "ef_eliminate_bonus",
- /**胜利音效 */
- ef_win = "ef_win",
- /**锤子 */
- ef_change = "ef_change",
- /**刷新 */
- ef_refresh = "ef_refresh",
- /**飞翔 */
- ef_fly = "ef_fly",
- /**关闭按钮音效*/
- closeButton = "closeButton",
- }
- /** ECPM */
- type ADShowCfg = {
- average_ecpm: number,
- insert_probability: number,
- is_show_banner: number,
- is_show_inter: number,
- }
- type PlayerInfoType = {
- /** 自定义不需要校验的数据 */
- gameUserData: object,
- /** 今日是否有签到 */
- isSignInToday: number,
- /** 存钱罐存款 */
- piggyBank: number,
- /** 存钱罐能否提现 */
- isWithdrawable: boolean,
- /** 存钱罐每日提现次数 */
- piggyBankCashTimes: number,
- /** 累计存钱罐每日提现次数 */
- totalPiggyBankCashTimes: number,
- /** 提现进度 */
- cashIndex: number,
- /** 上次登录时间 */
- lastTime: number,
- /** 登录天数 */
- loginDays: number,
- newPlayer: Boolean,
- /** 红包币数量 */
- redMoney: number,
- /** 累计签到次数 客户端理解 上次签到天数 */
- signInDay: number,
- /** 转盘次数 */
- turntableTimes: number,
- /** 版本号 */
- versioncfg: string,
- /** 福袋数据 */
- userTuCaoInfo: object,
- }
- /**事件类型 */
- export enum EVENT_TYPE {
- BACK_WxAuth = "BACK_WxAuth",
- UPDATE_CashNum = "UPDATE_CashNum",
- }
- /** 数据事件Id */
- export enum DataEventId {
- /** 点击 */
- guide = "guide",
- /** 按钮点击 */
- button_click = "button_click",
- /** 看视频 */
- video_init = "video_init",
- /** 看视频完成 */
- video_end = "video_end",
- /** 福袋功能 */
- fudaiFunction = "fudaiFunction",
- /** 互推功能 */
- hutuiFunction = "hutuiFunction",
- /** 关卡 */
- level = "level",
- /** 常规提现-红包币提现 */
- commonWithDrawal = "commonWithDrawl",
- /** 存钱罐提现 */
- jarWithDrawal = "jarWithDrawal",
- /** 签到提现 */
- signWithDrawal = "signWithDrawal",
- }
- /** 视频广告类型 */
- export enum VideoAdType {
- Null = "",
- /** 关卡积分红包 */
- LevelScoreRedBag = "关卡积分红包",
- /** 主界面气泡红包 */
- StartQiPaoRedBag = "主界面气泡红包",
- /** 关卡气泡红包 */
- LevelQiPaoRedBag = "关卡气泡红包",
- /** 转盘 */
- Turntable = "转盘视频",
- /** 福袋视频" */
- Fudai = "福袋视频",
- /** 签到视频 */
- Sign = "签到视频",
- //钱包提现新手视频
- CashOutNoviceWelfare = "钱包提现新手视频",
- //钱包提现加现金视频
- CashOutAddCash = "钱包提现加现金视频"
- }
- export enum FarmState {
- Lock,
- CanUnlock,
- Empty,
- Growing,
- Ripe,
- Sick
- }
- export enum PastureState {
- Lock,
- Empty,
- Growing,
- Ripe,
- Sick
- }
- export enum ProductType {
- nzw = '农作物',
- dw = '动物',
- bmhc = '爆米花厂',
- gdp = '糕点铺',
- ztc = '制糖厂',
- lrc = '炼乳厂',
- gfmg = '功夫面馆',
- kcd = '快餐店'
- }
- /** 动物状态 */
- export enum AnimalState {
- Hanger,
- Eat,
- Wait
- }
- export enum FactroyState {
- Lock,
- Empty,
- Producting,
- Ripe,
- Sick
- }
|