| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599 |
- 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 isTouchScreen: boolean = false;
- public configs: any = {};
- public adShowConfig: ADShowCfg;
- /** 功能开启 */
- public funOpenData: string[] = [];
- public playerProp: PlayerProp = null;
- /** 标志位:刷新主界面货币 */
- public init_coin: boolean = false;
- public addHb: number = 0;
- public updatePiggyBankValue: boolean = false;
- /** 标志位:刷新主界面头像 */
- public init_head: boolean = false;
- public init_add: boolean = false;
- /** 标志位:刷新主界面红点 */
- public init_red_point: boolean = true;
- //标志位,刷新提现界面的红包币
- public init_wallet_redMoney = false;
- /** 属性存储字典 */
- 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;
- /** 剩余可种植次数 */
- public leftTimes: number = -1;
- /** 最大可种植次数 */
- public maxTimes: number = -1;
- /** 恢复种植次数间隔 */
- public ProductionRecovery: number = 15;
- public init_leftTimes: boolean = false;
- /** 可生产商品配置 */
- public nextCanProduct = null;
- /** 按钮生产选中的农田、牧场或工厂 */
- public nextMake = null;
- /** 类型标识 */
- private nextType = 0;
- /** 刷新生产按钮信息 */
- public init_makeInfo = false;
- /** 正在生产 */
- public isProducting = false;
- /** 标志位 刷新任务描述 */
- public init_task = false;
- public init_expLevel = false;
- //标志位任务跟新
- public init_redBagTask = false;
- //标志位 生产奖励的任务ui刷新
- public init_productTask = false;
- public init_speedup = false;
- 标志位
- public init_hideRedBag = false;
- public shareUrl = '';
- public shareTitle = '';
- public shareDes = '';
- public shareImgUrl = '';
- /** 生虫/生病/停电最多个数 */
- public RawInsectArr = [];
- /** 生虫/生病/停电当前个数 */
- public RawInsectCurArr = [0, 0, 0];
- //弹出微信登陆UI位置类型
- public authUIType = 0;
- /**
- * 初始化游戏数据:网络配置信息,用户信息
- * @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);
- gData.adData.initEcpmData();
- // data = {};
- // response = await mk.http.sendData('noviceWeFare/getNoviceWeFareInfo', data);
- // if (response.errcode != 0) {
- // return;
- // }
- // this.playerProp.userTuCaoInfo = response.data.userWelFareTaskInfo;
- // mk.console.logSingle("welFare/getUserWelFareTaskInfo", response.data);
- gData.guideData.init();
- gData.guideWeakData.init();
- gData.moduleData.forEach(element => {
- element.init();
- });
- this.dataFinish = true;
- }
- private initConfigs(data) {
- // console.log('config ', data);
- this.configs = data;
- this.funOpenData = this.configs.ServerConfig.Functionswitch.split(",");
- //从服务器解析配置
- this.setProductMapFromJson();
- gData.loginData.popIdentifySwitch = this.configs.ServerConfig.popIdentifySwitch == '1';
- gData.gameData.shareUrl = this.configs.ServerConfig.shareUrl;
- gData.gameData.shareTitle = this.configs.ServerConfig.shareTitle;
- gData.gameData.shareDes = this.configs.ServerConfig.shareDes;
- gData.gameData.shareImgUrl = this.configs.ServerConfig.shareImgUrl;
- gData.gameData.RawInsectArr = this.configs.ServerConfig.RawInsect.split(',');
- }
- /**
- * 初始化玩家数据
- */
- private initPlayerProp(res_data) {
- this.playerProp = new PlayerProp();
- this.playerProp.cashIndex = res_data.cashIndex;
- this.playerProp.gameUserData = res_data.gameUserData;
- this.playerProp.isSignInToday = res_data.isSignInToday;
- this.playerProp.isWithdrawable = res_data.isWithdrawable;
- this.playerProp.lastTime = res_data.lastTime;
- this.playerProp.loginDays = res_data.loginDays;
- this.playerProp.newPlayer = res_data.newPlayer;
- this.playerProp.initPiggyBank(res_data.piggyBank);
- this.playerProp.piggyBankCashTimes = res_data.piggyBankCashTimes;
- this.playerProp.redMoney = res_data.redMoney == null ? 0 : res_data.redMoney;
- this.playerProp.signInDay = res_data.signInDay;
- this.playerProp.totalPiggyBankCashTimes = res_data.totalPiggyBankCashTimes;
- this.playerProp.turntableTimes = res_data.turntableTimes;
- this.playerProp.versioncfg = res_data.versioncfg;
- this.playerProp.isFirstRedMoney = res_data.isFirstRedMoney;
- gData.adData.watchNumToday = res_data.dayVideoTimesForRedMoney == null ? 0 : res_data.dayVideoTimesForRedMoney;
- this.playerProp.gradeLevel = res_data.farmLevel
- this.playerProp.userTuCaoInfo = res_data.userWelFareTaskInfo;
- this.playerProp.farmExpValue = res_data.userExp;
- this.playerProp.farmGradeData = res_data.userFarmGrageRewardInfo;
- this.playerProp.userNoviceWeFareInfo = res_data.userNoviceWeFareInfo;
- this.playerProp.redMoneyCashPayRecordList = res_data.redMoneyCashPayRecordList;
- mk.console.logSingle('userNoviceWeFareInfo==>', res_data.userNoviceWeFareInfo);
- //mk.console.logSingle('redMoneyCashPayRecordList==>', res_data.redMoneyCashPayRecordList);
- this.playerProp.userFarmTaskInfo = res_data.userFarmTaskInfo;
- this.playerProp.speedUpLeftTimes = res_data.speedUpLeftTimes;
- this.playerProp.completeFarmTaskTimes = res_data.completeFarmTaskTimes;
- mk.console.logSingle('initPlayerProp=>', res_data.userFarmTaskInfo);
-
- mk.data.setTAUserID(gData.loginData.uin);
- mk.data.setTAEventUser(0, 'logindays_total', this.playerProp.loginDays);
- if (this.playerProp.completeFarmTaskTimes == 0) {
- mk.data.setTAEventUser(0, 'Cumulative_task', gData.gameData.playerProp.completeFarmTaskTimes);
- }
- if (gData.loginData.isFirstIn) {
- gData.loginData.isFirstIn = false;
- mk.data.setTAEventRegister();
- mk.data.sendDataEvent('ABTest', `触发${this.playerProp.groupCode}方案`);
- //注册时版本号
- mk.data.setTAEventUserStr(0, 'regtime_app_id', gData.appData.appVersion);
- //星云uid
- mk.data.setTAEventUserStr(0, 'xy_uid', gData.loginData.uin);
- mk.data.setTAEventUser(0, 'farm_lv', gData.gameData.playerProp.gradeLevel);
- }
- //当前版本号
- mk.data.setTAEventUserStr(0, 'now_app_id', gData.appData.appVersion);
- //渠道号
- mk.data.setTAEventUserStr(0, 'channel_id', gData.appData.umengChannel);
- // //test
- // this.playerProp.completeFarmTaskTimes = 3;
- }
- /**
- * 保存单个数据
- */
- 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();
- this.initProductTimes();
- this.initLeftTimes();
- this.initFarmMapGetRewardData();
- this.initCashOutTimes();
- // let isNewTask = this.getProp(GameProp.redBagTaskRefresh);
- // if (isNewTask != undefined) {
- // this.init_redBagTask = isNewTask;
- // }
- }
- private initLeftTimes() {
- let lefttimes = this.getProp(GameProp.leftTimes);
- if (lefttimes == undefined) {
- this.leftTimes = parseInt(this.configs.ServerConfig.FreeProduction);
- this.setProp(GameProp.leftTimes, this.leftTimes);
- }
- else {
- this.leftTimes = lefttimes;
- }
- this.maxTimes = parseInt(this.configs.ServerConfig.ProductionMax);
- this.ProductionRecovery = parseInt(this.configs.ServerConfig.ProductionRecovery);
- // //test
- // this.leftTimes = 1;
- // this.maxTimes = 20;
- // this.ProductionRecovery = 1;
- }
- /** 增加减少生产次数
- * @param add 增减变量
- */
- public changeLeftTimes(add, isIgnoreMaxTimes = false) {
- gData.gameData.leftTimes += add;
- if (add > 0 && !isIgnoreMaxTimes) {
- gData.gameData.leftTimes = (gData.gameData.leftTimes > gData.gameData.maxTimes ? gData.gameData.maxTimes : gData.gameData.leftTimes);
- }
- if (gData.gameData.leftTimes < 0) {
- gData.gameData.leftTimes = 0;
- }
- gData.gameData.setProp(GameProp.leftTimes, gData.gameData.leftTimes);
- gData.gameData.init_leftTimes = true;
- }
- //图鉴领取数据
- private _farmMapRewardData = [];
- public getFarmMapRewardState(index) {
- if (index.i < this._farmMapRewardData.length) {
- if (index.j < this._farmMapRewardData[index.i].length) {
- return this._farmMapRewardData[index.i][index.j];
- }
- }
- return 1;
- }
- public setFarmMapRewardState(index, state) {
- if (index.i < this._farmMapRewardData.length) {
- if (index.j < this._farmMapRewardData[index.i].length) {
- this._farmMapRewardData[index.i][index.j] = state;
- this.setProp(GameProp.farmMapGetRewardData, this._farmMapRewardData);
- }
- }
- }
- private initFarmMapGetRewardData() {
- this._farmMapRewardData = this.getProp(GameProp.farmMapGetRewardData);
- if (!this._farmMapRewardData) {
- this._farmMapRewardData = [];
- }
- let needSync = false;
- let index = 0;
- this._productTypeMap.forEach((value, key) => {
- if (this._farmMapRewardData.length <= index) {
- let len = value.length;
- let arr = [];
- for (let i = 0; i != len; ++i) {
- arr.push(0);
- }
- this._farmMapRewardData.push(arr);
- needSync = true;
- console.log("-----add 数组数据")
- } else {
- let data = this._farmMapRewardData[index];
- let len = value.length;
- for (let i = 0; i != len; ++i) {
- if (i >= data.length) {
- data.push(0);
- needSync = true;
- console.log("-----add 单个数据")
- }
- }
- }
- ++index;
- });
- if (needSync) {
- this.setProp(GameProp.farmMapGetRewardData, this._farmMapRewardData);
- }
- }
- //提现次数
- public _cashOutTimes = 0;
- public initCashOutTimes()
- {
- let v= this.getProp(GameProp.cashOutTimes);
- if(v)
- {
- this._cashOutTimes = v;
- }else{
- this._cashOutTimes = 0;
- }
- console.log(`initCashOutTimes====>${this._cashOutTimes }`);
- }
- public addCashOutTimes()
- {
- this._cashOutTimes += 1;
- this.setProp(GameProp.cashOutTimes, this._cashOutTimes);
- console.log(`addCashOutTimes====>${this._cashOutTimes }`);
- }
- /** 是否是新用户 */
- public isNewPlayer(): boolean {
- let v = this.getProp(GameProp.newPlayer);
- return v == 0;
- }
- //*********** ================= 农场数据 ================== */
- /** 农田数据 服务器数据 */
- 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);
- }
- /** 随机获取可生产产品 */
- getRandomFactoryConfig(configID) {
- let tab = gData.gameData.getTabByConfigID(configID);
- let arr = this.getProductArrByType(tab);
- let max = this.getMaxProduct(tab);
- let canArr = [];
- let len = arr.length;
- for (var i = 0; i < len; i++) {
- if (arr[i].picture <= max) {
- canArr.push(arr[i].picture);
- if (arr[i].picture == max) {
- break;
- }
- }
- }
- let index = Util.rnd(0, canArr.length - 1);
- let id = canArr[index];
- return this.getProductMap(id);
- }
- /** 自动生产选中下一个 */
- setNextProduct(sel = true) {
- if (this.nextMake) {
- return;
- }
- let next = gData.farmSystem.selectNextFarm(sel);
- if (!next) {
- let next1 = gData.pastureSystem.nextPasture();
- if (!next1) {
- let next2 = gData.factorySystem.nextFactory();
- if (!next2) {
- this.nextType = 0;
- }
- else {
- this.nextType = 3;
- }
- }
- else {
- this.nextType = 2;
- }
- }
- else {
- this.nextType = 1;
- }
- this.init_makeInfo = true;
- }
- hasFirstCheck = false;
- firstCheckNext() {
- if (!this.hasFirstCheck && gData.farmSystem.farms.length >= 18
- && gData.pastureSystem.pastureIcons.length >= 3 && gData.factorySystem.factoryIcons.length >= 6) {
- this.hasFirstCheck = true;
- Util.objSortByKey(gData.farmSystem.farms, 'sortID');
- Util.objSortByKey(gData.pastureSystem.pastureIcons, 'sortID');
- Util.objSortByKey(gData.factorySystem.factoryIcons, 'sortID');
- gData.gameData.setNextProduct(false);
- }
- }
- async makeProduct() {
- let flyRed = true;
- switch (this.nextType) {
- case 0:
- mk.tip.pop('农场已满,无法继续生产');
- //弹出收获、生虫、加速
- if (!this.checkCanHarvest()) {
- if (!this.checkCanClearSick()) {
- this.checkCanSpeedUp(true);
- }
- }
- flyRed = false;
- break;
- case 1:
- flyRed = await gData.farmSystem.btnMake();
- gData.adData.checkPopRed();
- break;
- case 2:
- flyRed = await gData.pastureSystem.btnMake();
- gData.adData.checkPopRed();
- break;
- case 3:
- flyRed = await gData.factorySystem.btnMake();
- gData.adData.checkPopRed();
- break;
- }
- return flyRed;
- }
- public async updateNewTaskProgress(isNeedRefresh = false) {
- // if (gData.gameData.init_redBagTask) {
- // return;
- // }
- if (this.playerProp.userFarmTaskInfo) {
- let com = this.playerProp.userFarmTaskInfo.completeCount;
- let count = this.playerProp.userFarmTaskInfo.taskCount;
- if (com >= count) {
- mk.tip.pop('任务红包进度已满,快去提现');
- return false;
- }
- }
- let data = {};
- let response = await mk.http.sendData('farmTask/updateUserFarmTaskInfo', data);
- mk.console.logSingle('refrehTask=>', response);
- if (response.errcode != 0) {
- return false;
- }
- mk.console.logSingle('updateNewTaskProgress=>', response.data.userFarmTaskInfo);
- gData.gameData.init_task = true;
- this.playerProp.userFarmTaskInfo = response.data.userFarmTaskInfo;
- if (this.playerProp.userFarmTaskInfo.completeCount >= this.playerProp.userFarmTaskInfo.taskCount) {
- mk.ui.closeAllUI();
- mk.guide.open(4);
- }
- // if (isNeedRefresh) {
- // gData.gameData.init_task = true;
- // }
- return true;
- }
- 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.freshSendToServer(1);
- }
- }
- 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;
- let unluckNum = parseInt(gData.gameData.configs.ServerConfig.unluckNum);
- for (var i = 0; i < 18; i++) {
- if (i < unluckNum) {
- data = { id: id, state: FarmState.Empty, productID: 0, growSpan: 0 };
- }
- else if (i == unluckNum) {
- 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(10003);
- //更新到服务器
- this.setProp(GameProp.farmData, this._farmData);
- }
- else {
- let sickTimes = 0;
- for (var i = 0; i < len; i++) {
- this._farmDataMap.set(this._farmData[i].id, this._farmData[i]);
- if (this._farmData[i].state == FarmState.Sick) {
- sickTimes++;
- }
- }
- this.RawInsectCurArr[0] = sickTimes;
- }
- this.setMaxProduct(10003, true);
- }
- /** 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();
- private initProductTimes() {
- this._productMakeTimesData = this.getProp(GameProp.productMakeTimes);
- if (!this._productMakeTimesData) {
- this._productMakeTimesData = [];
- }
- let len = this._productMakeTimesData.length;
- for (var i = 0; i < len; i++) {
- this._productMakeTimesMap.set(this._productMakeTimesData[i].id, this._productMakeTimesData[i].times);
- this.setMaxProduct(this._productMakeTimesData[i].id);
- }
- }
- 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 (id == this.getMaxProduct(curConfig.tab)) {
- if (nextConfig) {
- gData.plantData.init_itemIndex = nextID;
- }
- }
- if (nextConfig) {
- if (nextConfig.tab == curConfig.tab && nextID > this.getMaxProduct(curConfig.tab)) {
- if (nextConfig.unlock == 1 && nextConfig.value <= times) {
- this._productMakeTimesMap.set(nextID, 0);
- let data = { 'id': nextID, 'times': 0 };
- this._productMakeTimesData.push(data);
- this.setMaxProduct(nextID);
- let nConfig = this.getProductMap(nextID + 1);
- if (nConfig) {
- gData.plantData.init_lock = nextID + 1;
- }
- }
- }
- }
- 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.freshSendToServer(2);
- }
- }
- 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++) {
- if (this.playerProp.completeFarmTaskTimes < arr[i].value) {
- data = { id: id, state: PastureState.Lock, productID: arr[i].picture, growSpan: 0 };
- }
- else {
- 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 {
- let sickTimes = 0;
- for (var i = 0; i < len; i++) {
- this._pastureDataMap.set(this._pastureData[i].id, this._pastureData[i]);
- if (this._pastureData[i].state == PastureState.Sick) {
- sickTimes++;
- }
- }
- this.RawInsectCurArr[1] = sickTimes;
- }
- }
- //------------- 工厂数据-----------
- /** 工厂数据 服务器数据 */
- 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.freshSendToServer(3);
- }
- }
- 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 < 6) {
- let id = 30004;
- let data = null;
- let tab = null;
- for (var i = 0; i < 6; i++) {
- tab = this.getTabByConfigID(id);
- let arr = this.getProductArrByType(tab);
- if (this.playerProp.completeFarmTaskTimes < arr[0].value) {
- data = { id: id, state: FactroyState.Lock, productID: 0, growSpan: 0 };
- }
- else {
- data = { id: id, state: FactroyState.Empty, productID: 0, growSpan: 0 };
- //更新最大可购买商品
- this.setMaxProduct(arr[0].picture, true);
- }
- this._factoryData.push(data);
- this._factoryDataMap.set(id, data);
- id++;
- }
- //更新到服务器
- this.setProp(GameProp.factoryData, this._factoryData);
- }
- else {
- let sickTimes = 0;
- let id = 30004;
- let tab = null;
- for (var i = 0; i < len; i++) {
- tab = this.getTabByConfigID(id);
- let arr = this.getProductArrByType(tab);
- this._factoryDataMap.set(this._factoryData[i].id, this._factoryData[i]);
- if (this._factoryData[i].state == FactroyState.Sick) {
- sickTimes++;
- }
- if (this.playerProp.completeFarmTaskTimes >= arr[0].value) {
- //更新最大可购买商品
- this.setMaxProduct(arr[0].picture, true);
- }
- id++;
- }
- this.RawInsectCurArr[2] = sickTimes;
- }
- }
- /** 通过工厂建筑物ID获取标签 */
- getTabByConfigID(configID: number): ProductType {
- let tab = ProductType.bmhc;
- switch (configID) {
- case 30004:
- tab = ProductType.bmhc;
- break;
- case 30005:
- tab = ProductType.gdp;
- break;
- case 30006:
- tab = ProductType.ztc;
- break;
- case 30007:
- tab = ProductType.lrc;
- break;
- case 30008:
- tab = ProductType.gfmg;
- break;
- case 30009:
- tab = ProductType.kcd;
- break;
- }
- return tab;
- }
- /** 通过标签获取工厂建筑物ID */
- getConfigIDByTab(tab: ProductType): number {
- let configID = 0;
- switch (tab) {
- case ProductType.bmhc:
- configID = 30004;
- break;
- case ProductType.gdp:
- configID = 30005;
- break;
- case ProductType.ztc:
- configID = 30006;
- break;
- case ProductType.lrc:
- configID = 30007;
- break;
- case ProductType.gfmg:
- configID = 30008;
- break;
- case ProductType.kcd:
- configID = 30009;
- break;
- }
- return configID;
- }
- /** 发送数据到服务器 */
- freshSendToServer(type) {
- switch (type) {
- case 1:
- this.setProp(GameProp.farmData, this._farmData);
- break;
- case 2:
- this.setProp(GameProp.pastureData, this._pastureData);
- break;
- case 3:
- this.setProp(GameProp.factoryData, this._factoryData);
- break;
- }
- }
- /** 最大可种植/生产商品数组 */
- 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;
- }
- /** 设置最大可生产商品
- * @param id 产品id
- * @param unlock 是否是解锁增加
- */
- public setMaxProduct(id, unlock = false) {
- let config = this.getProductMap(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 == config.tab) {
- if (data.productID < id) {
- data.productID = id;
- }
- has = true;
- break;
- }
- }
- if (!has && unlock) {
- data = { tab: config.tab, productID: id };
- this._maxProduct.push(data);
- }
- gData.farmMapData.isStateChange = true;
- }
- /** 农场升级时解锁工厂,检查最大可种植/生产商品 */
- public checkTaskFinishUnLock() {
- for (var key in ProductType) {
- let tab = ProductType[key];
- let configArr = this.getProductArrByType(tab);
- let len = configArr.length;
- let data = null;
- let needUpdate = false;
- switch (tab) {
- case ProductType.nzw:
- break;
- case ProductType.dw:
- let id = 30001;
- needUpdate = false;
- let maxId = 0;
- for (var i = 0; i < len; i++) {
- data = this.getPastureDataMap(id);
- if (this.playerProp.completeFarmTaskTimes >= configArr[i].value) {
- if (data.state == PastureState.Lock) {
- data = { id: id, state: PastureState.Empty, productID: configArr[i].picture, growSpan: 0 };
- this.setPastureDataMap(id, data, false);
- needUpdate = true;
- }
- maxId = configArr[i].picture;
- }
- id++;
- }
- if (maxId != 0) {
- //更新最大可购买商品
- this.setMaxProduct(maxId, true);
- }
- //更新到服务器
- if (needUpdate) {
- this.setProp(GameProp.pastureData, this._pastureData);
- this.setNextProduct();
- }
- break;
- default:
- //工厂解锁根据第一个商品
- needUpdate = false;
- let configID = this.getConfigIDByTab(tab);
- data = this.getFactoryDataMap(configID);
- if (this.playerProp.completeFarmTaskTimes >= configArr[0].value) {
- if (data.state == FactroyState.Lock) {
- data = { id: id, state: FactroyState.Empty, productID: 0, growSpan: 0 };
- this.setFactoryDataMap(configID, data, false);
- needUpdate = true;
- }
- //更新最大可购买商品
- this.setMaxProduct(configArr[0].picture, true);
- }
- if (needUpdate) {
- this.setProp(GameProp.factoryData, this._factoryData);
- this.setNextProduct();
- }
- break;
- }
- }
- }
- checkCanSpeedUp(pop = false) {
- let can = false;
- can = gData.farmSystem.canSpeedUp();
- if (!can) {
- can = gData.pastureSystem.canSpeedUp();
- if (!can) {
- can = gData.factorySystem.canSpeedUp();
- }
- }
- if (can && pop) {
- mk.ui.openPanel('module/speedUpUI/speedUp');
- }
- return can;
- }
- setHarvest() {
- gData.farmSystem.setHarvest();
- gData.pastureSystem.setHarvest();
- gData.factorySystem.setHarvest();
- }
- checkCanHarvest() {
- let can = false;
- can = gData.farmSystem.canHarvest();
- if (!can) {
- can = gData.pastureSystem.canHarvest();
- if (!can) {
- can = gData.factorySystem.canHarvest();
- }
- }
- return can;
- }
- checkCanClearSick() {
- let can = false;
- can = gData.farmSystem.canClearSick();
- if (!can) {
- can = gData.pastureSystem.canClearSick();
- if (!can) {
- can = gData.factorySystem.canClearSick();
- }
- }
- return can;
- }
- doPointToXYLogic() {
- let value = mk.storage.getStorage('cash_out');
- if (!value) {
- mk.storage.setStorage('cash_out', 1);
- mk.data.sendXYEvent('cash_1', `第一次提现`);
- } else {
- if (value == 1) {
- mk.storage.setStorage('cash_out', 2);
- mk.data.sendXYEvent('cash_2', `第二次提现`);
- } else if (value == 2) {
- mk.storage.setStorage('cash_out', 3);
- mk.data.sendXYEvent('cash_3', `第三次提现`);
- }
- }
- }
- }
- /**
- * 所有模块的非校验数据
- */
- export enum GameProp {
- /** -------------------- 通用玩家数据 ------------------------- */
- /** 是否新手 0新手 1老手 */
- newPlayer = 1,
- /** 当前新手引导步骤 */
- guideID = 2,
- /** 需要自动弹界面 每次登录都弹 除首次 表示今日是否要自动开 1自动开 2不自动开 其他不处理*/
- isAutoOpenPanel = 3,
- /** 关闭常规提现时需要自动开存钱罐 每天一次 表示今日有没有开过 */
- isOpenBankOnCloseCash = 4,
- //看视频次数
- videoTimes = 5,
- //提现次数
- cashTimes = 6,
- /** ------------------ 游戏核心数据 --------------------------- */
- /** 农田数据 */
- farmData = 11,
- /** 产品生产次数 */
- productMakeTimes = 12,
- /** 养殖场数据 */
- pastureData = 14,
- /** 工厂数据 */
- factoryData = 15,
- /** 剩余可种植次数 */
- leftTimes = 16,
- /**
- 图鉴领取数据*/
- farmMapGetRewardData = 17,
- //红包任务tag
- redBagTaskRefresh = 18,
- /** ------------------ 转盘数据 ------------------------------ */
- turnable_leftTimes = 20,
- //提现次数
- cashOutTimes = 21,
-
- }
- /**
- * 玩家数据
- */
- 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.playerProp.isWithdrawable && value > 0) return;// 存钱罐可提现状态,不能增加存钱罐金额
- this._piggyBank = value;
- gData.gameData.init_coin = 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.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;
- gData.gameData.init_wallet_redMoney = true;
- mk.event.emit('refreshCoin');
- mk.data.setTAEventUser(0, 'current_redmoney_stock', this._redMoney);
- }
- 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;
- /** 能免费领红包 1 表示是新人第一次产出红包币,不用看视频*/
- isFirstRedMoney = 0;
- //农场等级
- gradeLevel = 1;
- //农场等级奖励数据
- farmGradeData: any = {};
- //农场等级名字
- farmGradeName: number = 1;
- //农场经验
- private farmExp = 0;
- set farmExpValue(value: number) {
- this.farmExp = value;
- gData.gameData.init_expLevel = true;
- }
- get farmExpValue(): number {
- return this.farmExp;
- }
- //提现新手数据
- userNoviceWeFareInfo: any = {};
- //提现记录数据
- redMoneyCashPayRecordList = null;
- //任务红;
- userFarmTaskInfo = null;
- getRedMoneyCashOutTimesByIndex(index: number): number {
- if (this.redMoneyCashPayRecordList) {
- for (let i = 0; i != this.redMoneyCashPayRecordList.length; ++i) {
- if (index === this.redMoneyCashPayRecordList[i].index) {
- return this.redMoneyCashPayRecordList[i].frequency;
- }
- }
- }
- return 0;
- }
- /** ABTest分组id */
- groupCode = 0;
- //加速剩余次数
- speedUpLeftTimes = 0;
- /** 农场任务完成次数 */
- completeFarmTaskTimes = 0;
- }
- /**
- * 奖励状态
- */
- export enum RewardState {
- /** 已领取 */
- none = 1,
- /** 未解锁 */
- lock = 2,
- /** 可领取 */
- unlock = 3
- }
- /**
- * 奖励类型
- */
- export enum RewardType {
- /** 红包币 */
- redBag = 1,
- /** 毛币 */
- rmb = 2,
- /** 金猪币 */
- pigRmb = 3,
- /** 生产次数 */
- productTimes = 4,
- }
- /**
- * 音频路径
- */
- 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",
- //红包界面打开
- congratulations = 'congratulations',
- //红包飞音效
- redmoney = 'redmoney'
- }
- /** ECPM */
- type ADShowCfg = {
- average_ecpm: number,
- insert_probability: number,
- is_show_banner: number,
- is_show_inter: number,
- }
- /**事件类型 */
- export enum EVENT_TYPE {
- BACK_WxAuth = "BACK_WxAuth",
- UPDATE_CashNum = "UPDATE_CashNum",
- }
- /** 数据事件Id */
- export enum DataEventId {
- /** 点击 */
- guide = "guide",
- /** 点击跳过 */
- guideSkip = "guideSkip",
- /** 按钮点击 */
- button_click = "button_click",
- /** 看视频 */
- video_init = "video_init",
- /** 看视频完成 */
- video_end = "video_end",
- /** 成功拉取全屏视频 */
- interstitial2_init = "interstitial2_init",
- /** 广告点击 */
- Ad_click = "Ad_click",
- /** 全屏视频完成 */
- interstitial2_end = "interstitial2_end",
- /** 福袋功能 */
- fudaiFunction = "fudaiFunction",
- /** 互推功能 */
- hutuiFunction = "hutuiFunction",
- /** 激励视频ecpm */
- ad_videoEcpm = 'ad_video',
- /** 开屏ecpm */
- ad_openEcpm = 'ad_open',
- /** 提现 */
- Sundry = 'Sundry',
- /** 加载 */
- loading = 'loading'
- }
- /** 视频广告类型 */
- export enum VideoAdType {
- video_init_1 = '农场加等级经验',
- video_init_2 = '提现-加进度',
- video_init_3 = '提现-加现金',
- video_init_4 = '签到',
- video_init_5 = '抽奖',
- video_init_6 = '图鉴领奖',
- video_init_7 = '消灭害虫',
- video_init_8 = '恢复健康',
- video_init_9 = '恢复供电',
- video_init_10 = '山羊红包',
- video_init_11 = '拓建',
- video_init_12 = '收获',
- video_init_13 = '飘浮红包',
- video_init_14 = '全体加速',
- video_init_15 = '福利加进度',
- video_init_16 = '生产加次数',
- video_init_17 = '点击生产按钮',
- video_init_18 = '离开游戏领红包',
- video_init_19 = '定时弹出红包',
- video_init_20 = '插队',
- }
- export enum InterFullAdType {
- interstitial2_init_1 = '点击红包的关闭按钮',
- interstitial2_init_2 = '普通收获',
- interstitial2_init_3 = '点击鸟和狗'
- }
- export enum InterAdType {
- interstitial1_click_1 = '恭喜发财红包弹出后',
- interstitial1_click_2 = '恭喜获得弹窗弹出后',
- interstitial1_click_3 = '生虫/生病/停电弹出后'
- }
- export enum BannerAdType {
- banner_click_1 = '恭喜获得弹窗弹出后',
- banner_click_2 = '任务红包',
- banner_click_3 = '恭喜发财红包',
- banner_click_4 = '图鉴',
- banner_click_5 = '全体加速',
- banner_click_6 = '收获弹窗',
- banner_click_7 = '拓建弹窗',
- banner_click_8 = '三个恢复弹窗',
- banner_click_9 = '抽奖'
- }
- export enum ExpAddType {
- EAT_video = 1,
- EAT_harvest = 2,
- EAT_others = 3,
- }
- 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
- }
|