const { ccclass, property } = cc._decorator; @ccclass export default class GameConst extends cc.Component { //游戏开关------------------------------------------------------------------ /**是否显示广告 (上线前记得打开)*/ public static ifShowAd: boolean = true; /**是否连接服务器(上线前记得打开) */ public static ifConnectService: boolean = true; /**是否推送日志 (上线前记得打开) */ public static ifSendEvent: boolean = true; /**是否显示日志 (上线前记得关闭) */ public static ifShowLog: boolean = true; //基础数据------------------------------------------------------------------ /**当前的appid */ public static appid: string = "wx28356dc7c541ea76"; /**微信开放平台的appid */ public static app_wx_appid: string = "wx28356dc7c541ea76"; /**小游戏appid */ public static miniGame_wx_appid: string = ""; /**微信的code */ public static wxCode: string = ""; /**服务器地址 * @static 正式地址 https://xx-test.duiweize.com * @static 测试地址 https://xx-test.duiweize.com * @static 服务器测试地址 http://172.16.13.93:8952 "http://172.16.13.36:8952"; http://172.16.13.135:8952 172.16.15.85:8952 */ public static url_service: string = " https://xx.duiweize.com"; public static url_sharePic: string = ""; /**资源文件夹 */ public static res_dirArr = ["game/otherGame/config"]; public static url_resOss: string = ""; //其他数据-------------------------------------------------------------- /**是否登陆结束 */ public static ifLoginFinished: boolean = false; /**是否是新玩家 */ public static isNew: boolean = true; /**是否授权 */ public static isAuth: boolean = false; /**本地加密key值 */ public static localEncryptKey: string = "mzmNr2s358irB3WQC3AmGaWMFkMx2HQs"; /**随机Key值 */ public static randomKey: string = "abcdefghijklopqrstuvwxyzabcdefgh"; /**随机Key值(新) */ public static randomKey_new: string = ""; /**玩家的uin Id */ public static uin: string = ""; /**玩家临时的uin Id */ public static tmp_uin: string = ""; /**玩家的session key */ public static session_key: string = ""; /**玩家的login_ticket */ public static login_ticket: string = ""; //OSS配置数据---------------------------------------------------------------- /**关卡配置 */ public static config_level: any = null; public static configCount: number = 100; /** 当前关卡配置 100关后开始随机 */ public static curLevelCfg: any = null; /**方块的icon index */ public static iconIndex: number = 6; public static maxIconIndex: number = 2; //缓存数据----------------------------------------------------------------- //游戏数据------------------------------------------------------------------ /**纵列 */ public static col_num: number = 8; /**横列 */ public static row_num: number = 8; /**加载配置 */ public static loadConfig(): Promise { return new Promise((resolve, reject) => { GameConst.res_dirArr.forEach(element => { cc.resources.loadDir(element, function (completedCount, totalCount, item) { // Loading.curloadedNum++; }, () => { GameConst.config_level = (cc.resources.get(`game/otherGame/config/level`) as cc.JsonAsset).json; resolve(null); }); }); }) // GameConst.clockInConfig = cc.loader.getRes("config/clockInConfig.json").json; // LogUtil.log("GameConst.clockInConfig", GameConst.clockInConfig); } /**解析配置 */ public static getConfig() { } /**获取appid */ public static getAppid() { if (cc.sys.platform == cc.sys.WECHAT_GAME) { GameConst.appid = GameConst.miniGame_wx_appid; } else { if (cc.sys.os == cc.sys.OS_ANDROID) { GameConst.appid = GameConst.app_wx_appid; } else if (cc.sys.os == cc.sys.OS_IOS) { } } } //安卓设备数据------------------------------------------------------------------ /** 投放渠道 1 巨量 2 快手 3 广点通 */ public static advertisingChannel = 1; /**NADROID id */ public static android_id = ""; /**idfa */ public static idfa = ""; /**imei */ public static imei = ""; /**mac */ public static mac = ""; /**oaid */ public static oaid = ""; /**umid */ public static umid = ""; /** 友盟渠道 */ public static umengChannel = 'ttaxx_juliang'; /** 设备型号 */ public static deviceType = 'Android'; /** 安卓版本号 */ public static androidVersion = ''; /** app版本号 */ public static appVersion = ''; /** 投放渠道号 */ public static tf_channel = 'juliang'; /** 设备信息字段 */ public static deviceInfo = null /**更新设备信息(根据AS) */ public static updateDeviceInfo(info: any) { let arr = info.split('#') GameConst.android_id = arr[0] GameConst.idfa = arr[1] GameConst.imei = arr[2] GameConst.mac = arr[3] GameConst.oaid = arr[4] GameConst.umid = arr[5] GameConst.tf_channel = arr[6] GameConst.appVersion = arr[7] /** 友盟渠道 */ GameConst.umengChannel = arr[8] /** 设备型号 */ GameConst.deviceType = arr[9] /** 安卓版本号 */ GameConst.androidVersion = arr[10] mk.console.log(`updateDeviceInf: android_id=${GameConst.android_id}; idf=${GameConst.idfa}; imei=${GameConst.imei};mac=${GameConst.mac};oaid=${GameConst.oaid}; umid=${GameConst.umid};tf_channel=${this.tf_channel};appVersion=${this.appVersion};umengChannel=${this.umengChannel}; deviceType=${this.deviceType};androidVersion=${this.androidVersion}`); GameConst.deviceInfo = { "android_id": GameConst.android_id, "idfa": GameConst.idfa, "imei": GameConst.imei, "mac": GameConst.mac, "oaid": GameConst.oaid, "umid": GameConst.umid } // HttpMgr.Inst.updateGameVersion(GameConst.appVersion); // HttpMgr.Inst.updateDeviceInfo(GameConst.deviceInfo) } }