import AppConfig from "./AppConfig"; import { LogUtils } from "../Util/LogUtils"; import { FMListener, callFM_custom } from "../Interface/FMInterface"; export class AppSwitchData { public version_custom: string = ""; public banner_custom: number = 0; public wudian_custom: number = 0; public debuginfo_custom: number = 0;//debug info 金手指 public isNetWorkGame_custom: number = 1;//是否联网游戏 1开启 private wudianAvailableTime_custom: object = { "0": 0, "1": 0, "2": 0, "3": 0, "4": 0, "5": 0, "6": 0, "7": 0, "8": 0, "9": 0, "10": 0, "11": 0, "12": 0, "13": 0, "14": 0, "15": 0, "16": 0, "17": 0, "18": 0, "19": 0, "20": 0, "21": 0, "22": 0, "23": 0 } private homePageExportTimeControl_custom: object = { "0": 0, "1": 0, "2": 0, "3": 0, "4": 0, "5": 0, "6": 0, "7": 0, "8": 0, "9": 0, "10": 0, "11": 0, "12": 0, "13": 0, "14": 0, "15": 0, "16": 0, "17": 0, "18": 0, "19": 0, "20": 0, "21": 0, "22": 0, "23": 0 } /** * 得到当前时间开关是否打开 * * @readonly * @type {boolean} * @memberof AppSwitchData */ public get wudianTimeAvaliable_custom(): boolean { return this.wudianAvailableTime_custom[new Date().getHours()] == 1; } public get homePageExportIsOpen_custom(): boolean { return Number(this.homePageExportTimeControl_custom["" + new Date().getHours()]) == 1; } public mailiang_custom: number = 1; public readonly mailianglist_custom: Array = new Array(); public readonly mailiangSceneList_custom: Array = new Array(); public readonly wxWuDianBanners_custom: Array = new Array(); public readonly recreateBannerIDList_custom: Array = new Array(); public bannerRecreateTime_custom: number = 5; public kuangdianjiange_custom: number = 0; public btnMoveTimer_custom: number = 1; public bannerMoveTimer_custom: number = 0.5; public bannerFreshTimer_custom: number = 200; public bannerCreateFailNum_custom: number = 3; public bannerTodayBannerMax_custom: number = 10; public adSwitch_custom: number = 1; public readonly wudianSceneList_custom: Array = new Array(); public continueBtnDelayTime_custom: number = 2;//Exprot2ViewTemplate 中继续按钮延迟显示的时间 public bannerShowTime_custom: number = 30; public fakeBtn_custom: number = 0; public popAd_custom: number = 0;//是否启用 Exprot3ViewTemplate, public continueBanner_custom: number = 0;//Exprot2ViewTemplate 是否开启Banner显示 public continueBannerShowTime_custom: number = 2;//Exprot2ViewTemplate 中Banner延迟显示的时间 public continueBannerHideTime_custom: number = 2;//Exprot2ViewTemplate 中Banner显示后延迟关闭的时间 public readonly oppocfg_custom = new OPPOCfg(); public readonly qqcfg_custom = new QQCfg(); public readonly ttcfg_custom = new TTCfg(); public readonly vivocfg_custom = new VVcfg(); public readonly wxcfg_custom = new WXCfg(); public readonly tt2cfg_custom = new TT2Cfg(); public readonly cocosWxcfg_custom = new cocosWxcfg(); public readonly bdcfg_custom = new BDCfg(); public readonly quickgamecfg_custom = new Quickgamecfg(); } export class Quickgamecfg { autoExport: number = 0; // 自动导出开关 1开 0 关 bigExportColor: string = '416e8d'; //大导出页背景色设置,仅cocos可用 bigExportColor_g: string = '416e8d'; //大导出页背景色渐变部分设置,仅cocos可用 bigExportBannerType: number = 100; //100 大导出页闪现banner点击后计时概率(0~100) bigExportShowBannerTime: number = 1; //大导出页计时开始后多长时间显示banner bigExportHideBannerTime: number = 2; //大导出页banner显示后,多长时间隐藏 hotplayBannerType: number = 100; //好友热玩页面闪现banner点击后计时概率(0~100) hotplayShowBannerTime: number = 1; //好友热玩页面计时开始后多长时间显示banner hotplayHideBannerTime: number = 2; //好友热玩页面banner显示后,多长时间隐藏 recommendBannerType: number = 100; //推荐弹窗页面位移误点点击后计时概率(0~100) recommendShowBannerTime: number = 1; //推荐弹窗页面计时开始后多长时间显示banner recommendButMoveTime: number = 0.2; //推荐弹窗页面,banner显示之后多久按钮位移到正常位置 endBannerType: number = 100; //结算页面位移误点点击后计时概率(0~100) endShowBannerTime: number = 1; //结算页面计时开始后多长时间显示banner endButMoveTime: number = 0.2; // 0.2 结算页面,banner显示之后多久按钮位移到正常位 crazyShowBanner: number[] = [3, 10]; // 3,10 狂点页面,点击多少下时显示banner, 为一个区间,随机,banner显示后,重新随机计算下一次banner显示,均为-1的时候,为关闭banner显示 playButVideo: number = 0; // 开始按钮是否播放视频; crazyBannerHideTime: number = 0; //狂点按钮消失时间 } export class WXCfg { kuangdian_custom: number = 1; //狂点是否开启 kuangdianBanner_custom: number = 0;//狂点banner是否开启 kuangdianLevelSpcacing_custom: number = 0;//狂点间隔 ForceSkip_custom: number = 0; // 大导出页强导开关 SlideSkip_custom: number = 0; // 滑动导出强导开关 tc_ForceSkip_custom: number = 0; //首页弹窗是否强导 tc_SlideSkip_custom: number = 0; //首页弹窗是否滑动强导 phb_ForceSkip_custom: number = 0; //排行榜是否强导 phb_SlideSkip_custom: number = 0; //排行榜是否滑动强导 tc_continueBanner_custom: number = 0;//首页弹窗闪现banner MainPop_custom: number = 0; //首页弹窗是否开启 hyrw_ForceSkip_custom: number = 0; //好友热玩是否开启强导 hyrw_SlideSkip_custom: number = 0; //好友热玩是否开启滑动强导 hyrw_continueBanner_custom: number = 0; //好友热玩闪现banner handShow_custom: number = 1; //手指是否显示 firstOpen_custom: number = 0; //首次进入游戏强拉视频 startVideo_custom: number = 0; //开始游戏强拉视频 mainBackBtn_custom: number = 1; //首页返回按钮是否开启 mainMoreBtn_custom: number = 1; //首页更多按钮是否开启 mainItemBtn_custom: number = 1; //首页菜单按钮是否开启 mainExportShow_custom: number = 0; //首页导出是否屏蔽 isJumpHotPlay_custom: number = 0; //是否跳转好友热玩 moreGameShowLevel_custom: number = 0;//第几关开始弹出更多好玩 setUserScan_custom: number = 0; //设置用户屏蔽 } export class OPPOCfg { public yuansheng_custom: number = 100; public yuanshengSwitch_custom: number = 1; public addToDesktop_custom: number = 0; public oppoversions_custom: string = ""; public btnShowTimer_custom: number = 0; public indexAdSwitch_custom: number = 0; public endAdSwitch_custom: number = 0; public yuansheng2_custom: number = 100; public yuanshengSwitch2_custom: number = 1; } export class QQCfg { public kuangdianBanner_custom: number = 0; public kuangdianBox_custom: number = 0; public box_custom: number = 0; public weiyi_custom: number = 0; public qqversions_custom: string = ""; } export class TTCfg { public moreGameSwitch_custom: number = 0; public kuangdianBanner_custom: number = 0; public luping_custom: number = 0; public ttversions_custom: string = ""; public videoGetPowerNum: number = 3; //普通体力视频获取点数 public powerRecoverTime: number = 300; //体力恢复时间(s) public fisrtPower: number = 3; //玩家第一次进入游戏的体力值 public maxPower: number = 3; //体力值上限 public videoFirstGetPowerNum: number = 2; //无限体力第一次视频获取点数 public videoSecondGetPowerNum: number = 3; //无限体力第二次视频获取点数 public videoWxtlPowerNum: number = 2; // public videoUnlockDayNum: number = 2; // } export class TT2Cfg { public startSwitch_custom: number = 0; public signInSwitch_custom: number = 0; public getSwitch_custom: number = 0; public useSwitch_custom: number = 0; public reliveSwitch_custom: number = 0; public screenCapSwitch_custom: number = 0; public boxSwitch_custom: number = 0; } export class VVcfg { yuanshengSwitch_custom: number = 1; yuansheng_custom: number = 100; yuanshengSwitch2_custom: number = 1; yuansheng2_custom: number = 100; chapingSwitch_custom: number = 1; chaping_custom: number = 100; addToDesktop_custom: number = 1; vivoversions_custom: string = ""; btnShowTimer_custom: number = 1; } export class BDCfg { version_custom: string = ""; signInSwitch_custom: number = 0; taskVideo_custom: number = 1; btnDelayTime_custom: number = 0; } //cocos weixin 控制开关 export class cocosWxcfg { //轮播 loopAd = { rollWayLeftUp_custom: 0, rollWaitNum_custom: 1, rollWaitTime_custom: 1, roolSpeed_custom: 3, bgColor_custom: "62d5ff" }; skinTrial = { videoIcon_custom: 0, wudian_custom: 0, timeClick_custom: 0, butMoveTime_custom: 0, bannerShowTime_custom: 0, bannerHideTime_custom: 0, butDelayShowTime_custom: 0, rollWayLeftUp_custom: 1, rollWaitNum_custom: 1, rollWaitTime_custom: 1, roolSpeed_custom: 3 }; revival = { videoIcon_custom: 0, wudian_custom: 0, timeClick_custom: 0, butMoveTime_custom: 0, bannerShowTime_custom: 0, bannerHideTime_custom: 0, butDelayShowTime_custom: 0, rollWayLeftUp_custom: 1, rollWaitNum_custom: 1, rollWaitTime_custom: 1, roolSpeed_custom: 3 }; moreGoodGame = { bgColor_custom: "3485fb", maskColor_custom: "", mouseEventIsUp_custom: 0, cancelIntercept_custom: 1, wudian_custom: 0, timeClick_custom: 0, butMoveTime_custom: 0, bannerShowTime_custom: 0, bannerHideTime_custom: 0, butDelayShowTime_custom: 0, rollWayLeftUp_custom: 1, rollWaitNum_custom: 1, rollWaitTime_custom: 1, roolSpeed_custom: 3 }; bigLoopAd = { bgColor_custom: "3485fb", maskColor_custom: "", wudian_custom: 0, timeClick_custom: 0, butMoveTime_custom: 0, bannerShowTime_custom: 0, bannerHideTime_custom: 0, butDelayShowTime_custom: 0, rollWayLeftUp_custom: 1, rollWaitNum_custom: 1, rollWaitTime_custom: 1, roolSpeed_custom: 3 }; settlePage = { bgColor_custom: "3485fb", maskColor_custom: "", wudian_custom: 0, timeClick_custom: 0, butMoveTime_custom: 0, bannerShowTime_custom: 0, bannerHideTime_custom: 0, butDelayShowTime_custom: 0, rollWayLeftUp_custom: 1, rollWaitNum_custom: 1, rollWaitTime_custom: 1, roolSpeed_custom: 3 }; moreGoodGame2 = { bgColor_custom: "3485fb", maskColor_custom: "", butDelayShowTime_custom: 0, rollWayLeftUp_custom: 1, rollWaitNum_custom: 1, rollWaitTime_custom: 1, roolSpeed_custom: 3 }; } export default class AppSwitchConfig { protected static _instance_custom: AppSwitchConfig = new AppSwitchConfig(); protected readonly _data_custom: Array = new Array(); public static getInstance_custom(): AppSwitchConfig { return AppSwitchConfig._instance_custom } public loadLocalJson(json,finish) { this._data_custom.length = 0; if (json) { for (var i = 0; i < json.length; ++i) { var row = json[i]; var rowData: AppSwitchData = new AppSwitchData(); rowData.version_custom = String(row["version"]); rowData.banner_custom = Number(row["banner"]); rowData.wudian_custom = Number(row["wudian"]); rowData.debuginfo_custom = Number(row["debuginfo"]); rowData.isNetWorkGame_custom = Number(row["netWorkgame"]);//是否网络登录游戏,数据存本地 (rowData as any).wudianAvailableTime_custom = Object(row["wudianTime"]); (rowData as any).homePageExportTimeControl_custom = Object(row["homePageExportTimeControl"]); // rowData.mailiang_custom = Number(row["mailiang"]); // var mailianglist = row["mailianglist"]; // if (null != mailianglist) { // for (var j = 0; j < mailianglist.length; ++j) { // var flag = Number(mailianglist[j]); // rowData.mailianglist_custom.push(flag); // } // } // var mailiangScenelist = row["mailiangScenelist"]; // if (null != mailiangScenelist) { // for (var j = 0; j < mailiangScenelist.length; ++j) { // var sceneValue = Number(mailiangScenelist[j]); // rowData.mailiangSceneList_custom.push(sceneValue); // } // } var wxwudianbanners = row["wxwudianbanners"]; if (null != wxwudianbanners) { for (var j = 0; j < wxwudianbanners.length; ++j) { let bannerid = String(wxwudianbanners[j]); rowData.wxWuDianBanners_custom.push(bannerid); } } var recreateBannerIDList = row["recreateBannerIDList"]; if (null != recreateBannerIDList) { for (var j = 0; j < recreateBannerIDList.length; ++j) { let bannerid = String(recreateBannerIDList[j]); rowData.recreateBannerIDList_custom.push(bannerid); } } rowData.bannerRecreateTime_custom = null != row["bannerRecreateTime"] ? Number(row["bannerRecreateTime"]) : rowData.bannerRecreateTime_custom; rowData.kuangdianjiange_custom = null != row["kuangdianjiange"] ? Number(row["kuangdianjiange"]) : rowData.kuangdianjiange_custom; rowData.btnMoveTimer_custom = Number(row["btnMoveTimer"]); rowData.bannerMoveTimer_custom = Number(row["bannerMoveTimer"]); rowData.bannerCreateFailNum_custom = Number(row["createFailNum"]); rowData.bannerFreshTimer_custom = Number(row["bannerFreshTimer"]); rowData.bannerTodayBannerMax_custom = Number(row["todayBannerMax"]); rowData.adSwitch_custom = Number(row["adSwitch"]); var wudianSceneList = row["wudianSceneList"]; if (null != wudianSceneList) { for (var j = 0; j < wudianSceneList.length; ++j) { var wudianSceneValue = Number(wudianSceneList[j]); rowData.wudianSceneList_custom.push(wudianSceneValue); } } rowData.continueBtnDelayTime_custom = Number(row["continueBtnDelayTime"]); rowData.bannerShowTime_custom = Number(row["bannerShowTime"]); rowData.fakeBtn_custom = null != row["fakeBtn"] ? Number(row["fakeBtn"]) : rowData.fakeBtn_custom; rowData.popAd_custom = null != row["popAd"] ? Number(row["popAd"]) : rowData.popAd_custom; rowData.continueBanner_custom = null != row["continueBanner"] ? Number(row["continueBanner"]) : rowData.continueBanner_custom; rowData.continueBannerShowTime_custom = null != row["continueBannerShowTime"] ? Number(row["continueBannerShowTime"]) : rowData.continueBannerShowTime_custom; rowData.continueBannerHideTime_custom = null != row["continueBannerHideTime"] ? Number(row["continueBannerHideTime"]) : rowData.continueBannerHideTime_custom; if (null != row["oppocfg"]) { let cfg = row["oppocfg"]; rowData.oppocfg_custom.yuansheng_custom = Number(cfg["yuansheng"]); rowData.oppocfg_custom.yuanshengSwitch_custom = Number(cfg["yuanshengSwitch"]); rowData.oppocfg_custom.addToDesktop_custom = Number(cfg["addToDesktop"]); rowData.oppocfg_custom.oppoversions_custom = String(cfg["oppoversions"]); rowData.oppocfg_custom.btnShowTimer_custom = Number(cfg["btnShowTimer"]); rowData.oppocfg_custom.indexAdSwitch_custom = Number(cfg["indexAdSwitch"]); rowData.oppocfg_custom.endAdSwitch_custom = Number(cfg["endAdSwitch"]); rowData.oppocfg_custom.yuansheng2_custom = null != cfg["yuansheng2"] ? Number(cfg["yuansheng2"]) : rowData.oppocfg_custom.yuansheng2_custom; rowData.oppocfg_custom.yuanshengSwitch2_custom = null != cfg["yuanshengSwitch2"] ? Number(cfg["yuanshengSwitch2"]) : rowData.oppocfg_custom.yuanshengSwitch2_custom; } if (null != row["qqcfg"]) { let cfg = row["qqcfg"]; rowData.qqcfg_custom.kuangdianBanner_custom = Number(cfg["kuangdianBanner"]); rowData.qqcfg_custom.kuangdianBox_custom = Number(cfg["kuangdianBox"]); rowData.qqcfg_custom.box_custom = Number(cfg["box"]); rowData.qqcfg_custom.weiyi_custom = Number(cfg["weiyi"]); rowData.qqcfg_custom.qqversions_custom = String(cfg["qqversions"]); } if (null != row["ttcfg"]) { let cfg = row["ttcfg"]; rowData.ttcfg_custom.moreGameSwitch_custom = Number(cfg["moreGameSwitch"]); rowData.ttcfg_custom.kuangdianBanner_custom = Number(cfg["kuangdianBanner"]); rowData.ttcfg_custom.luping_custom = Number(cfg["luping"]); rowData.ttcfg_custom.ttversions_custom = String(cfg["ttversions"]); rowData.ttcfg_custom.videoGetPowerNum = Number(cfg["videoGetPowerNum"]); rowData.ttcfg_custom.powerRecoverTime = Number(cfg["powerRecoverTime"]); rowData.ttcfg_custom.fisrtPower = Number(cfg["fisrtPower"]); rowData.ttcfg_custom.maxPower = Number(cfg["maxPower"]); rowData.ttcfg_custom.videoFirstGetPowerNum = Number(cfg["videoFirstGetPowerNum"]); rowData.ttcfg_custom.videoSecondGetPowerNum = Number(cfg["videoSecondGetPowerNum"]); rowData.ttcfg_custom.videoWxtlPowerNum = Number(cfg["videoWxtlPowerNum"]); } if (null != row["tt2cfg"]) { let cfg = row["tt2cfg"]; rowData.tt2cfg_custom.startSwitch_custom = Number(cfg["startSwitch"]); rowData.tt2cfg_custom.signInSwitch_custom = Number(cfg["signInSwitch"]); rowData.tt2cfg_custom.getSwitch_custom = Number(cfg["getSwitch"]); rowData.tt2cfg_custom.useSwitch_custom = Number(cfg["useSwitch"]); rowData.tt2cfg_custom.reliveSwitch_custom = Number(cfg["reliveSwitch"]); rowData.tt2cfg_custom.screenCapSwitch_custom = Number(cfg["screenCapSwitch"]); rowData.tt2cfg_custom.boxSwitch_custom = Number(cfg["boxSwitch"]); } if (null != row["vivocfg"]) { let cfg = row["vivocfg"]; rowData.vivocfg_custom.yuanshengSwitch_custom = Number(cfg["yuanshengSwitch"]); rowData.vivocfg_custom.yuansheng_custom = Number(cfg["yuansheng"]); rowData.vivocfg_custom.yuanshengSwitch2_custom = Number(cfg["yuanshengSwitch2"]); rowData.vivocfg_custom.yuansheng2_custom = Number(cfg["yuansheng2"]); rowData.vivocfg_custom.chapingSwitch_custom = Number(cfg["chapingSwitch"]); rowData.vivocfg_custom.chaping_custom = Number(cfg["chaping"]); rowData.vivocfg_custom.addToDesktop_custom = Number(cfg["addToDesktop"]); rowData.vivocfg_custom.vivoversions_custom = String(cfg["vivoversions"]); rowData.vivocfg_custom.btnShowTimer_custom = Number(cfg["btnShowTimer"]); } if (null != row["wxcfg"]) { let cfg = row["wxcfg"]; rowData.wxcfg_custom.kuangdian_custom = Number(cfg["kuangdian"]); rowData.wxcfg_custom.kuangdianBanner_custom = Number(cfg["kuangdianBanner"]); rowData.wxcfg_custom.kuangdianLevelSpcacing_custom = Number(cfg["kuangdianLevelSpcacing"]); rowData.wxcfg_custom.ForceSkip_custom = Number(cfg["ForceSkip"]); rowData.wxcfg_custom.SlideSkip_custom = Number(cfg["SlideSkip"]); rowData.wxcfg_custom.tc_ForceSkip_custom = Number(cfg["tc_ForceSkip"]); rowData.wxcfg_custom.tc_SlideSkip_custom = Number(cfg["tc_SlideSkip"]); rowData.wxcfg_custom.phb_ForceSkip_custom = Number(cfg["phb_ForceSkip"]); rowData.wxcfg_custom.phb_SlideSkip_custom = Number(cfg["phb_SlideSkip"]); rowData.wxcfg_custom.tc_continueBanner_custom = Number(cfg["tc_continueBanner"]); rowData.wxcfg_custom.MainPop_custom = Number(cfg["MainPop"]); rowData.wxcfg_custom.hyrw_ForceSkip_custom = Number(cfg["hyrw_ForceSkip"]); rowData.wxcfg_custom.hyrw_SlideSkip_custom = Number(cfg["hyrw_SlideSkip"]); rowData.wxcfg_custom.hyrw_continueBanner_custom = Number(cfg["hyrw_continueBanner"]); rowData.wxcfg_custom.handShow_custom = Number(cfg["handShow"]); rowData.wxcfg_custom.firstOpen_custom = Number(cfg["firstOpen"]); rowData.wxcfg_custom.startVideo_custom = Number(cfg["startVideo"]); rowData.wxcfg_custom.mainBackBtn_custom = Number(cfg["mainBackBtn"]); rowData.wxcfg_custom.mainMoreBtn_custom = Number(cfg["mainMoreBtn"]); rowData.wxcfg_custom.mainItemBtn_custom = Number(cfg["mainItemBtn"]); rowData.wxcfg_custom.mainExportShow_custom = Number(cfg["mainExportShow"]); rowData.wxcfg_custom.isJumpHotPlay_custom = Number(cfg["isJumpHotPlay"]); rowData.wxcfg_custom.moreGameShowLevel_custom = Number(cfg["moreGameShowLevel"]); rowData.wxcfg_custom.setUserScan_custom = Number(cfg["setUserScan"]); } if (null != row["bdcfg"]) { let cfg = row["bdcfg"]; rowData.bdcfg_custom.btnDelayTime_custom = Number(cfg["btnDelayTime"]); rowData.bdcfg_custom.signInSwitch_custom = Number(cfg["signInSwitch"]); rowData.bdcfg_custom.taskVideo_custom = Number(cfg["taskVideo"]); rowData.bdcfg_custom.version_custom = String(cfg["version"]) } if (null != row["cocosWxConfig"]) { let cfg = row["cocosWxConfig"]; let loopAd = cfg["loopAd"]; let skinTrial = cfg["skinTrial"]; let revival = cfg["revival"]; let moreGoodGame = cfg["moreGoodGame"]; let bigLoopAd = cfg["bigLoopAd"]; let settlePage = cfg["settlePage"]; let moreGoodGame2 = cfg["moreGoodGame2"]; for (const key in rowData.cocosWxcfg_custom.loopAd) { if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.loopAd, key)) { if (key == "bgColor") { rowData.cocosWxcfg_custom.loopAd[key] = loopAd[key] != null ? String(loopAd[key]) : rowData.cocosWxcfg_custom.loopAd[key]; } else { rowData.cocosWxcfg_custom.loopAd[key] = loopAd[key] != null ? Number(loopAd[key]) : rowData.cocosWxcfg_custom.loopAd[key]; } } } for (const key in rowData.cocosWxcfg_custom.skinTrial) { if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.skinTrial, key)) { rowData.cocosWxcfg_custom.skinTrial[key] = skinTrial[key] != null ? Number(skinTrial[key]) : rowData.cocosWxcfg_custom.skinTrial[key]; } } for (const key in rowData.cocosWxcfg_custom.revival) { if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.revival, key)) { rowData.cocosWxcfg_custom.revival[key] = revival[key] != null ? Number(revival[key]) : rowData.cocosWxcfg_custom.revival[key]; } } for (const key in rowData.cocosWxcfg_custom.moreGoodGame) { if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.moreGoodGame, key)) { if (key == "bgColor" || key == "maskColor") { rowData.cocosWxcfg_custom.moreGoodGame[key] = moreGoodGame[key] != null ? String(moreGoodGame[key]) : rowData.cocosWxcfg_custom.moreGoodGame[key]; } else { rowData.cocosWxcfg_custom.moreGoodGame[key] = moreGoodGame[key] != null ? Number(moreGoodGame[key]) : rowData.cocosWxcfg_custom.moreGoodGame[key]; } } } for (const key in rowData.cocosWxcfg_custom.bigLoopAd) { if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.bigLoopAd, key)) { if (key == "bgColor" || key == "maskColor") { rowData.cocosWxcfg_custom.bigLoopAd[key] = bigLoopAd[key] != null ? String(bigLoopAd[key]) : rowData.cocosWxcfg_custom.bigLoopAd[key]; } else { rowData.cocosWxcfg_custom.bigLoopAd[key] = bigLoopAd[key] != null ? Number(bigLoopAd[key]) : rowData.cocosWxcfg_custom.bigLoopAd[key]; } } } for (const key in rowData.cocosWxcfg_custom.settlePage) { if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.settlePage, key)) { if (key == "bgColor" || key == "maskColor") { rowData.cocosWxcfg_custom.settlePage[key] = settlePage[key] != null ? String(settlePage[key]) : rowData.cocosWxcfg_custom.settlePage[key]; } else { rowData.cocosWxcfg_custom.settlePage[key] = settlePage[key] != null ? Number(settlePage[key]) : rowData.cocosWxcfg_custom.settlePage[key]; } } } for (const key in rowData.cocosWxcfg_custom.moreGoodGame2) { if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.moreGoodGame2, key)) { if (key == "bgColor" || key == "maskColor") { rowData.cocosWxcfg_custom.moreGoodGame2[key] = moreGoodGame2[key] != null ? String(moreGoodGame2[key]) : rowData.cocosWxcfg_custom.moreGoodGame2[key]; } else { rowData.cocosWxcfg_custom.moreGoodGame2[key] = moreGoodGame2[key] != null ? Number(moreGoodGame2[key]) : rowData.cocosWxcfg_custom.moreGoodGame2[key]; } } } } if (null != row['quickgamecfg']) { let cfg = row["quickgamecfg"]; rowData.quickgamecfg_custom.autoExport = Number(cfg["autoExport"]); rowData.quickgamecfg_custom.bigExportColor = cfg["bigExportColor"]; rowData.quickgamecfg_custom.bigExportColor_g = cfg["bigExportColor_g"]; rowData.quickgamecfg_custom.bigExportBannerType = Number(cfg["bigExportBannerType"]); rowData.quickgamecfg_custom.bigExportShowBannerTime = Number(cfg["bigExportShowBannerTime"]); rowData.quickgamecfg_custom.bigExportHideBannerTime = Number(cfg["bigExportHideBannerTime"]); rowData.quickgamecfg_custom.hotplayBannerType = Number(cfg["hotplayBannerType"]); rowData.quickgamecfg_custom.hotplayShowBannerTime = Number(cfg["hotplayShowBannerTime"]); rowData.quickgamecfg_custom.hotplayHideBannerTime = Number(cfg["hotplayHideBannerTime"]); rowData.quickgamecfg_custom.recommendBannerType = Number(cfg["recommendBannerType"]); rowData.quickgamecfg_custom.recommendShowBannerTime = Number(cfg["recommendShowBannerTime"]); rowData.quickgamecfg_custom.recommendButMoveTime = Number(cfg["recommendButMoveTime"]); rowData.quickgamecfg_custom.endBannerType = Number(cfg["endBannerType"]); rowData.quickgamecfg_custom.endShowBannerTime = Number(cfg["endShowBannerTime"]); rowData.quickgamecfg_custom.endButMoveTime = Number(cfg["endButMoveTime"]); rowData.quickgamecfg_custom.playButVideo = cfg["playButVideo"] == null ? 0 : Number(cfg["playButVideo"]); rowData.quickgamecfg_custom.crazyBannerHideTime = cfg["crazyBannerHideTime"] == null ? 0 : Number(cfg["crazyBannerHideTime"]); //切出去则不考虑 let crazyShowString = cfg['crazyShowBanner']; if (crazyShowString) { let tmp = crazyShowString.split(','); rowData.quickgamecfg_custom.crazyShowBanner[0] = Number(tmp[0]); rowData.quickgamecfg_custom.crazyShowBanner[1] = Number(tmp[1]); } } this._data_custom.push(rowData); } } if (finish) { finish() } } public loadUrlConfig_custom(finish: FMListener, errorListener: FMListener) { if (AppConfig.ResServer_custom == "") { LogUtils.warn_custom("没有找到合适的AppswitchConfig 路径"); this._data_custom.push(new AppSwitchData()); if (finish) { callFM_custom(finish) } return; } let url = AppConfig.ResServer_custom + "/json/appswitch.json?" + (new Date().getTime()) //使用 url 加载远程资源 cc.assetManager.loadRemote(url, (err, textAsset: cc.JsonAsset) => { //移除缓存 if (cc.assetManager.cacheManager) { cc.assetManager.cacheManager.removeCache(url); } if (err) { LogUtils.error_custom(err); this._data_custom.push(new AppSwitchData()); if (errorListener) { callFM_custom(errorListener) } return } this._data_custom.length = 0; let json = textAsset.json; LogUtils.log_custom("下载 appswitch.json>>>"); LogUtils.log_custom(textAsset); //json[0].banner = 0 if (json) { for (var i = 0; i < json.length; ++i) { var row = json[i]; var rowData: AppSwitchData = new AppSwitchData(); rowData.version_custom = String(row["version"]); rowData.banner_custom = Number(row["banner"]); rowData.wudian_custom = Number(row["wudian"]); rowData.debuginfo_custom = Number(row["debuginfo"]); rowData.isNetWorkGame_custom = Number(row["netWorkgame"]);//是否网络登录游戏,数据存本地 (rowData as any).wudianAvailableTime_custom = Object(row["wudianTime"]); (rowData as any).homePageExportTimeControl_custom = Object(row["homePageExportTimeControl"]); // rowData.mailiang_custom = Number(row["mailiang"]); // var mailianglist = row["mailianglist"]; // if (null != mailianglist) { // for (var j = 0; j < mailianglist.length; ++j) { // var flag = Number(mailianglist[j]); // rowData.mailianglist_custom.push(flag); // } // } // var mailiangScenelist = row["mailiangScenelist"]; // if (null != mailiangScenelist) { // for (var j = 0; j < mailiangScenelist.length; ++j) { // var sceneValue = Number(mailiangScenelist[j]); // rowData.mailiangSceneList_custom.push(sceneValue); // } // } var wxwudianbanners = row["wxwudianbanners"]; if (null != wxwudianbanners) { for (var j = 0; j < wxwudianbanners.length; ++j) { let bannerid = String(wxwudianbanners[j]); rowData.wxWuDianBanners_custom.push(bannerid); } } var recreateBannerIDList = row["recreateBannerIDList"]; if (null != recreateBannerIDList) { for (var j = 0; j < recreateBannerIDList.length; ++j) { let bannerid = String(recreateBannerIDList[j]); rowData.recreateBannerIDList_custom.push(bannerid); } } rowData.bannerRecreateTime_custom = null != row["bannerRecreateTime"] ? Number(row["bannerRecreateTime"]) : rowData.bannerRecreateTime_custom; rowData.kuangdianjiange_custom = null != row["kuangdianjiange"] ? Number(row["kuangdianjiange"]) : rowData.kuangdianjiange_custom; rowData.btnMoveTimer_custom = Number(row["btnMoveTimer"]); rowData.bannerMoveTimer_custom = Number(row["bannerMoveTimer"]); rowData.bannerCreateFailNum_custom = Number(row["createFailNum"]); rowData.bannerFreshTimer_custom = Number(row["bannerFreshTimer"]); rowData.bannerTodayBannerMax_custom = Number(row["todayBannerMax"]); rowData.adSwitch_custom = Number(row["adSwitch"]); var wudianSceneList = row["wudianSceneList"]; if (null != wudianSceneList) { for (var j = 0; j < wudianSceneList.length; ++j) { var wudianSceneValue = Number(wudianSceneList[j]); rowData.wudianSceneList_custom.push(wudianSceneValue); } } rowData.continueBtnDelayTime_custom = Number(row["continueBtnDelayTime"]); rowData.bannerShowTime_custom = Number(row["bannerShowTime"]); rowData.fakeBtn_custom = null != row["fakeBtn"] ? Number(row["fakeBtn"]) : rowData.fakeBtn_custom; rowData.popAd_custom = null != row["popAd"] ? Number(row["popAd"]) : rowData.popAd_custom; rowData.continueBanner_custom = null != row["continueBanner"] ? Number(row["continueBanner"]) : rowData.continueBanner_custom; rowData.continueBannerShowTime_custom = null != row["continueBannerShowTime"] ? Number(row["continueBannerShowTime"]) : rowData.continueBannerShowTime_custom; rowData.continueBannerHideTime_custom = null != row["continueBannerHideTime"] ? Number(row["continueBannerHideTime"]) : rowData.continueBannerHideTime_custom; if (null != row["oppocfg"]) { let cfg = row["oppocfg"]; rowData.oppocfg_custom.yuansheng_custom = Number(cfg["yuansheng"]); rowData.oppocfg_custom.yuanshengSwitch_custom = Number(cfg["yuanshengSwitch"]); rowData.oppocfg_custom.addToDesktop_custom = Number(cfg["addToDesktop"]); rowData.oppocfg_custom.oppoversions_custom = String(cfg["oppoversions"]); rowData.oppocfg_custom.btnShowTimer_custom = Number(cfg["btnShowTimer"]); rowData.oppocfg_custom.indexAdSwitch_custom = Number(cfg["indexAdSwitch"]); rowData.oppocfg_custom.endAdSwitch_custom = Number(cfg["endAdSwitch"]); rowData.oppocfg_custom.yuansheng2_custom = null != cfg["yuansheng2"] ? Number(cfg["yuansheng2"]) : rowData.oppocfg_custom.yuansheng2_custom; rowData.oppocfg_custom.yuanshengSwitch2_custom = null != cfg["yuanshengSwitch2"] ? Number(cfg["yuanshengSwitch2"]) : rowData.oppocfg_custom.yuanshengSwitch2_custom; } if (null != row["qqcfg"]) { let cfg = row["qqcfg"]; rowData.qqcfg_custom.kuangdianBanner_custom = Number(cfg["kuangdianBanner"]); rowData.qqcfg_custom.kuangdianBox_custom = Number(cfg["kuangdianBox"]); rowData.qqcfg_custom.box_custom = Number(cfg["box"]); rowData.qqcfg_custom.weiyi_custom = Number(cfg["weiyi"]); rowData.qqcfg_custom.qqversions_custom = String(cfg["qqversions"]); } if (null != row["ttcfg"]) { let cfg = row["ttcfg"]; rowData.ttcfg_custom.moreGameSwitch_custom = Number(cfg["moreGameSwitch"]); rowData.ttcfg_custom.kuangdianBanner_custom = Number(cfg["kuangdianBanner"]); rowData.ttcfg_custom.luping_custom = Number(cfg["luping"]); rowData.ttcfg_custom.ttversions_custom = String(cfg["ttversions"]); rowData.ttcfg_custom.videoGetPowerNum = Number(cfg["videoGetPowerNum"]); rowData.ttcfg_custom.powerRecoverTime = Number(cfg["powerRecoverTime"]); rowData.ttcfg_custom.fisrtPower = Number(cfg["fisrtPower"]); rowData.ttcfg_custom.maxPower = Number(cfg["maxPower"]); rowData.ttcfg_custom.videoFirstGetPowerNum = Number(cfg["videoFirstGetPowerNum"]); rowData.ttcfg_custom.videoSecondGetPowerNum = Number(cfg["videoSecondGetPowerNum"]); rowData.ttcfg_custom.videoWxtlPowerNum = Number(cfg["videoWxtlPowerNum"]); rowData.ttcfg_custom.videoUnlockDayNum = Number(cfg["videoUnlockDayNum"]); } if (null != row["tt2cfg"]) { let cfg = row["tt2cfg"]; rowData.tt2cfg_custom.startSwitch_custom = Number(cfg["startSwitch"]); rowData.tt2cfg_custom.signInSwitch_custom = Number(cfg["signInSwitch"]); rowData.tt2cfg_custom.getSwitch_custom = Number(cfg["getSwitch"]); rowData.tt2cfg_custom.useSwitch_custom = Number(cfg["useSwitch"]); rowData.tt2cfg_custom.reliveSwitch_custom = Number(cfg["reliveSwitch"]); rowData.tt2cfg_custom.screenCapSwitch_custom = Number(cfg["screenCapSwitch"]); rowData.tt2cfg_custom.boxSwitch_custom = Number(cfg["boxSwitch"]); } if (null != row["vivocfg"]) { let cfg = row["vivocfg"]; rowData.vivocfg_custom.yuanshengSwitch_custom = Number(cfg["yuanshengSwitch"]); rowData.vivocfg_custom.yuansheng_custom = Number(cfg["yuansheng"]); rowData.vivocfg_custom.yuanshengSwitch2_custom = Number(cfg["yuanshengSwitch2"]); rowData.vivocfg_custom.yuansheng2_custom = Number(cfg["yuansheng2"]); rowData.vivocfg_custom.chapingSwitch_custom = Number(cfg["chapingSwitch"]); rowData.vivocfg_custom.chaping_custom = Number(cfg["chaping"]); rowData.vivocfg_custom.addToDesktop_custom = Number(cfg["addToDesktop"]); rowData.vivocfg_custom.vivoversions_custom = String(cfg["vivoversions"]); rowData.vivocfg_custom.btnShowTimer_custom = Number(cfg["btnShowTimer"]); } if (null != row["wxcfg"]) { let cfg = row["wxcfg"]; rowData.wxcfg_custom.kuangdian_custom = Number(cfg["kuangdian"]); rowData.wxcfg_custom.kuangdianBanner_custom = Number(cfg["kuangdianBanner"]); rowData.wxcfg_custom.kuangdianLevelSpcacing_custom = Number(cfg["kuangdianLevelSpcacing"]); rowData.wxcfg_custom.ForceSkip_custom = Number(cfg["ForceSkip"]); rowData.wxcfg_custom.SlideSkip_custom = Number(cfg["SlideSkip"]); rowData.wxcfg_custom.tc_ForceSkip_custom = Number(cfg["tc_ForceSkip"]); rowData.wxcfg_custom.tc_SlideSkip_custom = Number(cfg["tc_SlideSkip"]); rowData.wxcfg_custom.phb_ForceSkip_custom = Number(cfg["phb_ForceSkip"]); rowData.wxcfg_custom.phb_SlideSkip_custom = Number(cfg["phb_SlideSkip"]); rowData.wxcfg_custom.tc_continueBanner_custom = Number(cfg["tc_continueBanner"]); rowData.wxcfg_custom.MainPop_custom = Number(cfg["MainPop"]); rowData.wxcfg_custom.hyrw_ForceSkip_custom = Number(cfg["hyrw_ForceSkip"]); rowData.wxcfg_custom.hyrw_SlideSkip_custom = Number(cfg["hyrw_SlideSkip"]); rowData.wxcfg_custom.hyrw_continueBanner_custom = Number(cfg["hyrw_continueBanner"]); rowData.wxcfg_custom.handShow_custom = Number(cfg["handShow"]); rowData.wxcfg_custom.firstOpen_custom = Number(cfg["firstOpen"]); rowData.wxcfg_custom.startVideo_custom = Number(cfg["startVideo"]); rowData.wxcfg_custom.mainBackBtn_custom = Number(cfg["mainBackBtn"]); rowData.wxcfg_custom.mainMoreBtn_custom = Number(cfg["mainMoreBtn"]); rowData.wxcfg_custom.mainItemBtn_custom = Number(cfg["mainItemBtn"]); rowData.wxcfg_custom.mainExportShow_custom = Number(cfg["mainExportShow"]); rowData.wxcfg_custom.isJumpHotPlay_custom = Number(cfg["isJumpHotPlay"]); rowData.wxcfg_custom.moreGameShowLevel_custom = Number(cfg["moreGameShowLevel"]); rowData.wxcfg_custom.setUserScan_custom = Number(cfg["setUserScan"]); } if (null != row["bdcfg"]) { let cfg = row["bdcfg"]; rowData.bdcfg_custom.btnDelayTime_custom = Number(cfg["btnDelayTime"]); rowData.bdcfg_custom.signInSwitch_custom = Number(cfg["signInSwitch"]); rowData.bdcfg_custom.taskVideo_custom = Number(cfg["taskVideo"]); rowData.bdcfg_custom.version_custom = String(cfg["version"]) } if (null != row["cocosWxConfig"]) { let cfg = row["cocosWxConfig"]; let loopAd = cfg["loopAd"]; let skinTrial = cfg["skinTrial"]; let revival = cfg["revival"]; let moreGoodGame = cfg["moreGoodGame"]; let bigLoopAd = cfg["bigLoopAd"]; let settlePage = cfg["settlePage"]; let moreGoodGame2 = cfg["moreGoodGame2"]; for (const key in rowData.cocosWxcfg_custom.loopAd) { if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.loopAd, key)) { if (key == "bgColor") { rowData.cocosWxcfg_custom.loopAd[key] = loopAd[key] != null ? String(loopAd[key]) : rowData.cocosWxcfg_custom.loopAd[key]; } else { rowData.cocosWxcfg_custom.loopAd[key] = loopAd[key] != null ? Number(loopAd[key]) : rowData.cocosWxcfg_custom.loopAd[key]; } } } for (const key in rowData.cocosWxcfg_custom.skinTrial) { if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.skinTrial, key)) { rowData.cocosWxcfg_custom.skinTrial[key] = skinTrial[key] != null ? Number(skinTrial[key]) : rowData.cocosWxcfg_custom.skinTrial[key]; } } for (const key in rowData.cocosWxcfg_custom.revival) { if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.revival, key)) { rowData.cocosWxcfg_custom.revival[key] = revival[key] != null ? Number(revival[key]) : rowData.cocosWxcfg_custom.revival[key]; } } for (const key in rowData.cocosWxcfg_custom.moreGoodGame) { if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.moreGoodGame, key)) { if (key == "bgColor" || key == "maskColor") { rowData.cocosWxcfg_custom.moreGoodGame[key] = moreGoodGame[key] != null ? String(moreGoodGame[key]) : rowData.cocosWxcfg_custom.moreGoodGame[key]; } else { rowData.cocosWxcfg_custom.moreGoodGame[key] = moreGoodGame[key] != null ? Number(moreGoodGame[key]) : rowData.cocosWxcfg_custom.moreGoodGame[key]; } } } for (const key in rowData.cocosWxcfg_custom.bigLoopAd) { if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.bigLoopAd, key)) { if (key == "bgColor" || key == "maskColor") { rowData.cocosWxcfg_custom.bigLoopAd[key] = bigLoopAd[key] != null ? String(bigLoopAd[key]) : rowData.cocosWxcfg_custom.bigLoopAd[key]; } else { rowData.cocosWxcfg_custom.bigLoopAd[key] = bigLoopAd[key] != null ? Number(bigLoopAd[key]) : rowData.cocosWxcfg_custom.bigLoopAd[key]; } } } for (const key in rowData.cocosWxcfg_custom.settlePage) { if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.settlePage, key)) { if (key == "bgColor" || key == "maskColor") { rowData.cocosWxcfg_custom.settlePage[key] = settlePage[key] != null ? String(settlePage[key]) : rowData.cocosWxcfg_custom.settlePage[key]; } else { rowData.cocosWxcfg_custom.settlePage[key] = settlePage[key] != null ? Number(settlePage[key]) : rowData.cocosWxcfg_custom.settlePage[key]; } } } for (const key in rowData.cocosWxcfg_custom.moreGoodGame2) { if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.moreGoodGame2, key)) { if (key == "bgColor" || key == "maskColor") { rowData.cocosWxcfg_custom.moreGoodGame2[key] = moreGoodGame2[key] != null ? String(moreGoodGame2[key]) : rowData.cocosWxcfg_custom.moreGoodGame2[key]; } else { rowData.cocosWxcfg_custom.moreGoodGame2[key] = moreGoodGame2[key] != null ? Number(moreGoodGame2[key]) : rowData.cocosWxcfg_custom.moreGoodGame2[key]; } } } } if (null != row['quickgamecfg']) { let cfg = row["quickgamecfg"]; rowData.quickgamecfg_custom.autoExport = Number(cfg["autoExport"]); rowData.quickgamecfg_custom.bigExportColor = cfg["bigExportColor"]; rowData.quickgamecfg_custom.bigExportColor_g = cfg["bigExportColor_g"]; rowData.quickgamecfg_custom.bigExportBannerType = Number(cfg["bigExportBannerType"]); rowData.quickgamecfg_custom.bigExportShowBannerTime = Number(cfg["bigExportShowBannerTime"]); rowData.quickgamecfg_custom.bigExportHideBannerTime = Number(cfg["bigExportHideBannerTime"]); rowData.quickgamecfg_custom.hotplayBannerType = Number(cfg["hotplayBannerType"]); rowData.quickgamecfg_custom.hotplayShowBannerTime = Number(cfg["hotplayShowBannerTime"]); rowData.quickgamecfg_custom.hotplayHideBannerTime = Number(cfg["hotplayHideBannerTime"]); rowData.quickgamecfg_custom.recommendBannerType = Number(cfg["recommendBannerType"]); rowData.quickgamecfg_custom.recommendShowBannerTime = Number(cfg["recommendShowBannerTime"]); rowData.quickgamecfg_custom.recommendButMoveTime = Number(cfg["recommendButMoveTime"]); rowData.quickgamecfg_custom.endBannerType = Number(cfg["endBannerType"]); rowData.quickgamecfg_custom.endShowBannerTime = Number(cfg["endShowBannerTime"]); rowData.quickgamecfg_custom.endButMoveTime = Number(cfg["endButMoveTime"]); rowData.quickgamecfg_custom.playButVideo = cfg["playButVideo"] == null ? 0 : Number(cfg["playButVideo"]); rowData.quickgamecfg_custom.crazyBannerHideTime = cfg["crazyBannerHideTime"] == null ? 0 : Number(cfg["crazyBannerHideTime"]); //切出去则不考虑 let crazyShowString = cfg['crazyShowBanner']; if (crazyShowString) { let tmp = crazyShowString.split(','); rowData.quickgamecfg_custom.crazyShowBanner[0] = Number(tmp[0]); rowData.quickgamecfg_custom.crazyShowBanner[1] = Number(tmp[1]); } } this._data_custom.push(rowData); } } else { this._data_custom.push(new AppSwitchData()); } if (finish) { callFM_custom(finish) } }) } public getAppSwitchData_custom(): AppSwitchData { return this._data_custom[0]; } }