/// <summary> /// 反馈信息接口 /// </summary> /// <param name="data">用户反馈的数据</param> public void PostFeedback(int type, string msg, System.Action <bool> callback = null) { GlobalConfig globalConfig = GlobalConfig.GetInstance(); GlobalConfig.LoginInfoStruct loginInfo = globalConfig.LoginInfo; IBridge bridge = DBOSManager.getOSBridge(); string url = GlobalConfig.GetInstance().CSURLV + "Feedback"; url += "?account=" + loginInfo.AccName; url += "&game_mark=" + globalConfig.GameMark; url += "&ticket=" + WWW.EscapeURL(loginInfo.Ticket); url += "&device_mark=dm" + globalConfig.DeviceMark; url += "&provider=" + globalConfig.SDKName; url += "&server_id=" + loginInfo.ServerInfo.ServerId; url += "&role_id=" + loginInfo.RId; url += "&role_name=" + WWW.EscapeURL(LocalPlayerManager.Instance.LocalActorAttribute.Name, System.Text.Encoding.UTF8); url += "&lv=" + LocalPlayerManager.Instance.LocalActorAttribute.Level; url += "&type=" + type; url += "&title=" + WWW.EscapeURL(xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_18"), System.Text.Encoding.UTF8); url += "&msg=" + WWW.EscapeURL(msg, System.Text.Encoding.UTF8); //url = System.Uri.EscapeUriString(url); mPostFeedbackCallback = callback; MainGame.HttpRequest.GET(url, OnFeedback, null); }
public override void Update() { float now = Time.time; if (Game.GetInstance().IsSwitchingScene || !SceneHelp.Instance.IsPlayingInstance) { mFPS = 0; mFrameCount = 0; mLastTime = now; return; } mFrameCount++; if (now >= mLastTime + FPSUpdateWaitTime) { float fps = mFrameCount / (now - mLastTime); mFPS = (int)fps; mFrameCount = 0; mLastTime = now; // TestinExternalLog var logContent = string.Format(mLogFmt, mLogCount, mFPS); DBOSManager.getOSBridge().log2OSCmd("TestinExternalLog", logContent); mLogCount += 1; OnFPSUpdate(); } }
/// <summary> /// 账号登陆日志记录(已经选服登陆请求) /// </summary> /// <param name="serverId">Server identifier.</param> /// <param name="serverType">Server type.</param> public void PostAccountLoginLogS(int serverId, EServerState serverType) { GlobalConfig globalConfig = GlobalConfig.GetInstance(); GlobalConfig.LoginInfoStruct loginInfo = globalConfig.LoginInfo; IBridge bridge = DBOSManager.getOSBridge(); string url = GlobalConfig.GetInstance().LogURLV + "AccountLoginLogS?account=" + loginInfo.AccName; url += "&server_id=" + serverId; url += "&server_type=" + (int)serverType; url += "&show_marked=" + globalConfig.ServerType; url += "&provider=" + globalConfig.SDKName; url += "&device_mark=" + globalConfig.DeviceMark; url += "&os=" + globalConfig.PlatformName; url += "&os_ver=" + bridge.getOSVersion(); url += "&mobile=" + bridge.getPhoneModel(); url += "&net=" + bridge.getNetType(); url += "&imei=" + bridge.getPhoneIMEI(); url += "&mac=" + bridge.getPhoneMAC(); url += "&imsi=" + bridge.getPhoneIMSI(); url += "&game_mark=" + globalConfig.GameMark; url += "&sub_chn=" + globalConfig.SubChannel; MainGame.HttpRequest.GET(url, null, null); }
/// <summary> /// 根据传入的IPV4地址获取模拟的IPV6地址 /// </summary> /// <param name="serverIp"></param> /// <param name="newServerIp"></param> /// <param name="ipType"></param> void GetIPType(String serverIp, out String newServerIp, out AddressFamily ipType) { ipType = AddressFamily.InterNetwork; newServerIp = serverIp; try { string mIPv6 = DBOSManager.getOSBridge().getIPv6(serverIp); if (!string.IsNullOrEmpty(mIPv6)) { string[] tmpStr = System.Text.RegularExpressions.Regex.Split(mIPv6, "&&"); if (tmpStr != null && tmpStr.Length >= 2) { string ipTypeStr = tmpStr[1]; if (ipTypeStr == "ipv6") { newServerIp = tmpStr[0]; ipType = AddressFamily.InterNetworkV6; } } } } catch (Exception e) { GameDebug.LogError("GetIPv6 error:" + e); } }
//获取更新信息 public string getUpdateCheckUrl() { IBridge bridge = DBOSManager.getOSBridge(); string url = string.Format("{0}UpdateCheck?platform={1}&app_v={2}&mobile={3}&lib_v=0.0.0&game_mark={4}&cpu=armeabi-v7a&api_ver=1.0&device_mark={5}&imei={6}&res_v=0&res_v=0", GlobalConfig.GetInstance().CSURLV, "ios_" + bridge.getSDKName(), bridge.getAppVersion(), bridge.getPhoneModel(), GlobalConfig.Instance.GameMark, GlobalConfig.Instance.DeviceMark, bridge.GetPhoneIDFA()); return(url); }
void Start() { mTime = 0; mBatterySlider = GetComponent <Slider>(); if (mBatterySlider != null) { mBatterySlider.value = DBOSManager.getOSBridge().getBattery(); } }
// 点击开始,进入游戏 public void OnEnterGame() { if (mSelectIndex < 0) { ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_90")); return; } // 保存本地玩家ID UnitID uid = new UnitID(); uid.type = (byte)EUnitType.UNITTYPE_PLAYER; uid.obj_idx = (uint)mData [mSelectIndex].uuid; Game.GetInstance().LocalPlayerID = uid; Game.GetInstance().LocalPlayerTypeID = ActorHelper.RoleIdToTypeId(mData [mSelectIndex].rid); Game.GetInstance().LocalPlayerName = System.Text.Encoding.UTF8.GetString(mData [mSelectIndex].name); // 保存选择的角色索引 GlobalSettings.GetInstance().LastActorIndex = mSelectIndex; GlobalSettings.GetInstance().Save(); // Enter Game C2SEnterGame c2sEnterGame = new C2SEnterGame(); c2sEnterGame.uuid = mData[mSelectIndex].uuid; NetClient.GetBaseClient().SendData <C2SEnterGame>(NetMsg.MSG_ENTER_GAME, c2sEnterGame); GlobalConfig.GetInstance().LoginInfo.Name = System.Text.Encoding.UTF8.GetString(mData[mSelectIndex].name); GlobalConfig.GetInstance().LoginInfo.RId = mData [mSelectIndex].uuid.ToString(); GlobalConfig.GetInstance().LoginInfo.Job = mData [mSelectIndex].rid.ToString(); GlobalConfig.GetInstance().LoginInfo.Level = mData[mSelectIndex].level.ToString(); ControlServerLogHelper.GetInstance().PostRoleInfo(); // 注册FCM DBOSManager.getOSBridge().registerFCM(); DBOSManager.getOSBridge().registerPush(); // 为确保进入场景的角色等级判断正确,这里要赋值给LocalPlayerManager LocalPlayerManager.Instance.LocalActorAttribute.Level = mData[mSelectIndex].level; Game.Instance.IsCreateRoleEnter = false; xc.ui.ugui.UIManager.Instance.ShowWaitScreen(true); // 点击选角按钮 ControlServerLogHelper.Instance.PostPlayerFollowRecord(PlayerFollowRecordSceneId.ClickSelectActorButton); ControlServerLogHelper.Instance.PostCloudLadderEventAction(CloudLadderMarkEnum.select_role); }
void Update() { if (null != mBatterySlider) { if (mTime >= mBatteryCD) { mTime = 0; if (mBatterySlider != null) { mBatterySlider.value = DBOSManager.getOSBridge().getBattery(); } } mTime += Time.deltaTime; } }
// 获取更新信息,加密版 public string getUpdateCheckUrlEx() { IBridge bridge = DBOSManager.getOSBridge(); var fmt = "platform={0}&app_v={1}&mobile={2}&lib_v=0.0.0&game_mark={3}&cpu=armeabi-v7a&api_ver=1.0&device_mark={4}&imei={5}&res_v=0&res_v=0"; string sign = string.Format(fmt, "ios_" + bridge.getSDKName(), bridge.getAppVersion(), bridge.getPhoneModel(), GlobalConfig.Instance.GameMark, GlobalConfig.Instance.DeviceMark, bridge.GetPhoneIDFA()); Debug.Log(string.Format("controlServer_oriSign_ZYGXCheck2 = {0}", sign)); sign = WWW.EscapeURL(Utils.AES.Encode(sign, Const.CS_URL_KEY, Const.CS_URL_IV)); string url = string.Format("{0}ZYGXCheck2?sign={1}", GlobalConfig.GetInstance().CSURLVEX, sign); return(url); }
/// <summary> /// 获取最近登录服务器列表 /// </summary> public void GetLatelyLoginServerInfo(GetLatelyLoginServerListFinishedDelegate finishCallback) { GlobalConfig globalConfig = GlobalConfig.GetInstance(); GlobalConfig.LoginInfoStruct loginInfo = globalConfig.LoginInfo; IBridge bridge = DBOSManager.getOSBridge(); string url = globalConfig.CSURLV + "GetLatelyLoginServerInfo?show_marked=" + globalConfig.ServerType + "&game_mark=" + GlobalConfig.Instance.GameMark + "&account=" + globalConfig.LoginInfo.AccName + "&device_mark=" + globalConfig.DeviceMark; MainGame.HttpRequest.GET(url, OnGetLatelyLoginServerInfoFinished, null); mGetLatelyLoginServerListFinishedCallback = finishCallback; }
/// <summary> /// 获取全部大区列表 /// </summary> public void GetAllRegion(GetAllRegionFinishedDelegate finishCallback) { GlobalConfig globalConfig = GlobalConfig.GetInstance(); GlobalConfig.LoginInfoStruct loginInfo = globalConfig.LoginInfo; IBridge bridge = DBOSManager.getOSBridge(); string url = globalConfig.CSURLV + "GetAllRegion?show_marked=" + globalConfig.ServerType + "&account=" + loginInfo.AccName + "&game_mark=" + GlobalConfig.Instance.GameMark + "&device_mark=" + globalConfig.DeviceMark + "&ticket=" + WWW.EscapeURL(loginInfo.Ticket); MainGame.HttpRequest.GET(url, OnGetAllRegionFinished, null); mGetAllRegionFinishedCallback = finishCallback; }
/// <summary> /// 获取服务器信息 /// </summary> public void GetServerData(GetServerDataFinishedDelegate finishCallback) { GlobalConfig globalConfig = GlobalConfig.GetInstance(); GlobalConfig.LoginInfoStruct loginInfo = globalConfig.LoginInfo; IBridge bridge = DBOSManager.getOSBridge(); string url = globalConfig.CSURLV + "GetServerData?account=" + loginInfo.AccName + "&show_marked=" + globalConfig.ServerType + "&game_mark=" + globalConfig.GameMark + "&imei=" + bridge.getPhoneIMEI() + "&device_mark=" + globalConfig.DeviceMark; MainGame.HttpRequest.GET(url, OnGetServerDataFinished, null); mGetServerDataFinishedCallback = finishCallback; }
static int _m_getOSBridge_xlua_st_(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); try { { IBridge __cl_gen_ret = DBOSManager.getOSBridge( ); translator.Push(L, __cl_gen_ret); return(1); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } }
/// <summary> /// 重新进入当前的场景(切换画质的时候使用) /// </summary> public static void ReenterScene() { // TestinExternalLog var logContent = string.Format(mLogFmt, 3 - QualitySetting.GraphicLevel); DBOSManager.getOSBridge().log2OSCmd("TestinExternalLog", logContent); // 如果当前场景名字和需要再次进入的场景名字不一样,才进行跳场景的操作 var cur_scene_name = SceneHelp.Instance.CurSceneName; var db_map = DBManager.Instance.GetDB <DBMap>(); if (db_map == null) { return; } var map_info = SceneHelp.Instance.MapInfo; if (map_info == null) { GameDebug.LogError("MapInfo is null"); return; } m_isReEnterScene = true; ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_SETTING_QUALITY_CHANGED, null); var scen_name = map_info.SceneLevelName; if (scen_name != cur_scene_name) { if (CheckCanSwitch(InstanceManager.Instance.InstanceType, InstanceManager.Instance.InstanceSubType, false)) { JumpToScene(SceneHelp.Instance.CurSceneID); } else { GameDebug.Log("can not renter scene"); } } m_isReEnterScene = false; }
/// <summary> /// 礼包兑换码接口 /// </summary> /// <param name="code">Code.</param> public void PostGetPack(string code, System.Action <bool> callback = null) { GlobalConfig globalConfig = GlobalConfig.GetInstance(); GlobalConfig.LoginInfoStruct loginInfo = globalConfig.LoginInfo; IBridge bridge = DBOSManager.getOSBridge(); string url = GlobalConfig.GetInstance().CSURLV + "GetPack"; url += "?game_mark=" + globalConfig.GameMark; url += "&code=" + code; url += "&server_id=" + loginInfo.ServerInfo.ServerId; url += "&provider=" + globalConfig.SDKName; url += "&account=" + loginInfo.AccName; url += "&role_id=" + loginInfo.RId; url += "&ticket=" + WWW.EscapeURL(loginInfo.Ticket); mPostGetPackFinishedCallback = callback; MainGame.HttpRequest.GET(url, OnGetPackFinished, null); }
public PayDroductInfo getProductInfo(float rmb_low) { IBridge brideg = DBOSManager.getOSBridge(); var channel = brideg.getSDKName(); #if UNITY_ANDROID if (Const.Region == RegionType.KOREA) { if (Application.identifier == GameConst.APK_NAME_KOREA_ONESTORE) { channel = "eagle_468"; } else { channel = "google_eagle_468"; } } else if (Const.Region == RegionType.HKTW) { channel = "eagle_427"; } #endif string key = string.Format("{0}_{1}", rmb_low, channel); if (mPayItemInfos.ContainsKey(key)) { return(mPayItemInfos[key]); } else { if (Const.Region == RegionType.CHINA) { key = string.Format("{0}_{1}", rmb_low, "undefined"); return(mPayItemInfos[key]); } else { return(null); } } }
//void OnLevelup(CEventBaseArgs args) //{ // PostRoleInfo(); //} /// <summary> /// 客户端启动日志采集 /// </summary> public void PostStartClientLog() { GlobalConfig globalConfig = GlobalConfig.GetInstance(); GlobalConfig.LoginInfoStruct loginInfo = globalConfig.LoginInfo; IBridge bridge = DBOSManager.getOSBridge(); string url = GlobalConfig.GetInstance().LogURLV + "StartClientLog?provider=" + globalConfig.SDKName; url += "&device_mark=" + globalConfig.DeviceMark; url += "&os=" + globalConfig.PlatformName; url += "&os_ver=" + bridge.getOSVersion(); url += "&mobile=" + bridge.getPhoneModel(); url += "&net=" + bridge.getNetType(); url += "&imei=" + bridge.getPhoneIMEI(); url += "&mac=" + bridge.getPhoneMAC(); url += "&imsi=" + bridge.getPhoneIMSI(); url += "&use_time=" + ((int)Time.time).ToString(); url += "&game_mark=" + globalConfig.GameMark; MainGame.HttpRequest.GET(url, null, null); }
/// <summary> /// 获取推荐服务器列表 /// </summary> public void GetAllRecommServer(GetAllRecommServerFinishedDelegate finishCallback) { GlobalConfig globalConfig = GlobalConfig.GetInstance(); GlobalConfig.LoginInfoStruct loginInfo = globalConfig.LoginInfo; IBridge bridge = DBOSManager.getOSBridge(); string url = globalConfig.CSURLV + "GetAllRecommServer?account=" + globalConfig.LoginInfo.AccName + "&show_marked=" + globalConfig.ServerType + "&game_mark=" + GlobalConfig.Instance.GameMark + "&imei=" + bridge.getPhoneIMEI() + "&device_mark=" + globalConfig.DeviceMark; if (Const.Region == RegionType.SEASIA) { url += "&lang=" + Const.LanguageName(); } MainGame.HttpRequest.GET(url, OnGetAllRecommServerFinished, null); mGetAllRecommServerFinishedCallback = finishCallback; }
// 请求更新信息 // 第三个res_v是之前的补丁(res3),第四个res_v是新的散文件0.unity3d的版本(res4) // 这里将res_v=0是为了获取当前最新版本的下载地址(版本号一致时服务器不返回下载信息的) public string getUpdatePatchUrl() { IBridge bridge = DBOSManager.getOSBridge(); int localVersion = 0; if (xpatch.XPatchConfig.IsBinPatchPlatform()) { localVersion = xpatch.XPatchManager.Instance.LocalVersion; } var fmt = "platform={0}&app_v={1}&mobile={2}&lib_v=0.0.0&game_mark={3}&cpu=armeabi-v7a&api_ver=1.0&device_mark={4}&imei={5}&res_v=0&res_v=0&res_v={6}&res_v={7}&server_id={8}"; string sign = string.Format(fmt, "ios_" + bridge.getSDKName(), bridge.getAppVersion(), bridge.getPhoneModel(), GlobalConfig.Instance.GameMark, GlobalConfig.Instance.DeviceMark, bridge.GetPhoneIDFA(), localVersion, 0, GrayServerManager.Instance.GetLoginServer()); Debug.Log(string.Format("controlServer_oriSign_ZYGXCheck2 = {0}", sign)); sign = WWW.EscapeURL(Utils.AES.Encode(sign, Const.CS_URL_KEY, Const.CS_URL_IV)); string url = string.Format("{0}ZYGXCheck2?sign={1}", GlobalConfig.GetInstance().CSURLVEX, sign); return(url); }
public void RegistPushService(string token) { GameDebug.Log(string.Format("PushManager:RegistPushService token = {0}", token)); if (string.IsNullOrEmpty(token)) { return; } if (token.Length > 16) // 欢老板说,大于16位就是token,不然就是错误码 { GlobalConfig globalConfig = GlobalConfig.GetInstance(); DBOSManager.getOSBridge().registerPush(globalConfig.LoginInfo.AccName); globalConfig.XgDeviceId = token; // 接收到信鸽sdk的设备id之后,发一次RoleInfo给控制服 ControlServerLogHelper.Instance.PostRoleInfo(); } else { GameDebug.LogError("RegistPushService error, msg: " + token); } }
public void Pay(DBPay.PayItemInfo pay_info) { if (pay_info == null) { return; } var server_id = 0; var server_name = "0"; var server_info = GlobalConfig.Instance.LoginInfo.ServerInfo; if (server_info == null) { Debug.LogError("OnClickPayButton: server_info is null"); } else { server_id = server_info.ServerId; server_name = server_info.Name; } #if UNITY_IPHONE var pay_request_info = new Dictionary <string, string>(); //IPHONE 从ProductInfo.json里面读取商品数据 ProductInfoManager.ProductInfo info = ProductInfoManager.GetInstance().GetProductInfo(pay_info.RmbLow); if (info == null) { //ProductInfo.json 不存在则 读取 C充值商品id.xlsx var db_pay_product = DBManager.Instance.GetDB <DBPayProduct>(); DBPayProduct.PayDroductInfo product_info = db_pay_product.getProductInfo(pay_info.RmbLow); pay_request_info.Add("productID", product_info.ProductId); pay_request_info.Add("productName", product_info.ProductName); pay_request_info.Add("productDesc", product_info.ProductDesc); } else { //ProductInfo.json 存在则 读取 ProductInfo.json pay_request_info.Add("productID", info.productId); pay_request_info.Add("productName", info.productName); pay_request_info.Add("productDesc", info.productDesc); } #else var db_pay_product = DBManager.Instance.GetDB <DBPayProduct>(); DBPayProduct.PayDroductInfo product_info = db_pay_product.getProductInfo(pay_info.RmbLow); var pay_request_info = new Dictionary <string, string>(); pay_request_info.Add("productID", product_info.ProductId); pay_request_info.Add("productName", product_info.ProductName); pay_request_info.Add("productDesc", product_info.ProductDesc); #endif pay_request_info.Add("passport", GlobalConfig.Instance.LoginInfo.AccName); pay_request_info.Add("serverID", server_id.ToString()); pay_request_info.Add("roleId", GlobalConfig.Instance.LoginInfo.RId.ToString()); pay_request_info.Add("price", pay_info.RmbLow.ToString()); if (Const.Region == RegionType.HKTW || Const.Region == RegionType.SEASIA) { pay_request_info.Add("currency", GameConstHelper.GetString("GAME_PAYMENT_CURRENCY_USD")); } else if (Const.Region == RegionType.KOREA) { pay_request_info.Add("currency", GameConstHelper.GetString("GAME_PAYMENT_CURRENCY_KR")); } else { pay_request_info.Add("currency", GameConstHelper.GetString("GAME_PAYMENT_CURRENCY")); } pay_request_info.Add("serverName", server_name); pay_request_info.Add("roleName", GlobalConfig.Instance.LoginInfo.Name); pay_request_info.Add("roleLevel", GlobalConfig.Instance.LoginInfo.Level.ToString()); pay_request_info.Add("vip", VipHelper.GetVipValidLevel().ToString()); //角色VIP等级 pay_request_info.Add("coinNum", LocalPlayerManager.Instance.GetMoneyByConst(GameConst.MONEY_DIAMOND).ToString()); //当前玩家身上拥有的金锭数量 if (DBOSManager.getOSBridge().getAppID() == 529) // 卓梦 { pay_request_info.Add("currencyNum", LocalPlayerManager.Instance.GetMoneyByConst(GameConst.MONEY_DIAMOND).ToString()); //当前玩家身上拥有的金锭数量 } #if UNITY_IPHONE pay_request_info.Add("gameMark", GlobalConfig.Instance.GameMark); //角色VIP等级 #endif //使用sdk接口发送充值请求 string pay_requeset_str = MiniJSON.JsonEncode(new Hashtable(pay_request_info)); DBOSManager.getDBOSManager().getBridge().pay(pay_requeset_str); Debug.Log(string.Format("OnClickPayButton pay_rmb: {0}", pay_info.RmbLow)); }
public static void CreatePkgAccPhoneInfos(List <PkgAccPhoneInfo> infos) { IBridge bridge = DBOSManager.getOSBridge(); GlobalConfig globalConfig = GlobalConfig.GetInstance(); infos.Clear(); // 手机平台 PkgAccPhoneInfo info = new PkgAccPhoneInfo(); info.key = Encoding.UTF8.GetBytes("platform"); info.val = Encoding.UTF8.GetBytes(globalConfig.PlatformName); GameDebug.Log("platform: " + globalConfig.PlatformName); infos.Add(info); // 系统版本 info = new PkgAccPhoneInfo(); info.key = Encoding.UTF8.GetBytes("sys_ver"); info.val = Encoding.UTF8.GetBytes(SystemInfo.operatingSystem); GameDebug.Log("system: " + SystemInfo.operatingSystem); infos.Add(info); // 手机型号 info = new PkgAccPhoneInfo(); info.key = Encoding.UTF8.GetBytes("model"); info.val = Encoding.UTF8.GetBytes(SystemInfo.deviceModel); GameDebug.Log("model: " + SystemInfo.deviceModel); infos.Add(info); // 芯片型号参数 info = new PkgAccPhoneInfo(); info.key = Encoding.UTF8.GetBytes("chip"); //CPU核数#CPU主频#CPU名称#GPU名称 string chip_info = string.Format("{0}#{1}#{2}#{3}", SystemInfo.processorCount, SystemInfo.processorFrequency, SystemInfo.processorType, SystemInfo.graphicsDeviceName); info.val = Encoding.UTF8.GetBytes(chip_info); GameDebug.Log("chip_info: " + chip_info); infos.Add(info); // imei info = new PkgAccPhoneInfo(); info.key = Encoding.UTF8.GetBytes("imei"); info.val = Encoding.UTF8.GetBytes(bridge.getPhoneIMEI()); GameDebug.Log("imei: " + bridge.getPhoneIMEI()); infos.Add(info); // imsi info = new PkgAccPhoneInfo(); info.key = Encoding.UTF8.GetBytes("imsi"); info.val = Encoding.UTF8.GetBytes(bridge.getPhoneIMSI()); GameDebug.Log("imsi: " + bridge.getPhoneIMSI()); infos.Add(info); // mac info = new PkgAccPhoneInfo(); info.key = Encoding.UTF8.GetBytes("mac"); info.val = Encoding.UTF8.GetBytes(bridge.getPhoneMAC()); GameDebug.Log("mac: " + bridge.getPhoneMAC()); infos.Add(info); // 画质选择 info = new PkgAccPhoneInfo(); info.key = Encoding.UTF8.GetBytes("grahics"); info.val = Encoding.UTF8.GetBytes(QualitySetting.GraphicLevel.ToString()); GameDebug.Log("grahics: " + QualitySetting.GraphicLevel); infos.Add(info); // 召唤物开关 info = new PkgAccPhoneInfo(); info.key = Encoding.UTF8.GetBytes("summon"); var summon_str_val = (GlobalSettings.Instance.SummonMonsterVisible ? 1 : 0).ToString(); info.val = Encoding.UTF8.GetBytes(summon_str_val); GameDebug.Log("summon: " + summon_str_val); infos.Add(info); // 同屏人数 info = new PkgAccPhoneInfo(); info.key = Encoding.UTF8.GetBytes("player"); info.val = Encoding.UTF8.GetBytes(GlobalSettings.Instance.MaxPlayerCount.ToString()); GameDebug.Log("player: " + GlobalSettings.Instance.MaxPlayerCount); infos.Add(info); // 联网方式 info = new PkgAccPhoneInfo(); info.key = Encoding.UTF8.GetBytes("net"); var net_str_val = ((uint)Application.internetReachability).ToString(); info.val = Encoding.UTF8.GetBytes(net_str_val); GameDebug.Log("net: " + net_str_val); infos.Add(info); // 分辨率 info = new PkgAccPhoneInfo(); info.key = Encoding.UTF8.GetBytes("screen"); var screnn_str_val = string.Format("{0}*{1}", Screen.width, Screen.height); info.val = Encoding.UTF8.GetBytes(screnn_str_val); GameDebug.Log("screen: " + screnn_str_val); infos.Add(info); // DeviceMark info = new PkgAccPhoneInfo(); info.key = Encoding.UTF8.GetBytes("device_mark"); info.val = Encoding.UTF8.GetBytes(globalConfig.DeviceMark); GameDebug.Log("device_mark: " + globalConfig.DeviceMark); infos.Add(info); // appid info = new PkgAccPhoneInfo(); info.key = Encoding.UTF8.GetBytes("appid"); info.val = Encoding.UTF8.GetBytes(globalConfig.AppId.ToString()); GameDebug.Log("appid: " + globalConfig.AppId); infos.Add(info); if (globalConfig.LoginInfo.ServerInfo != null) { // 控制服务器的id info = new PkgAccPhoneInfo(); info.key = Encoding.UTF8.GetBytes("control_id"); info.val = Encoding.UTF8.GetBytes(globalConfig.LoginInfo.ServerInfo.ServerId.ToString()); GameDebug.Log("control_id: " + globalConfig.LoginInfo.ServerInfo.ServerId); infos.Add(info); // 服务器名字 info = new PkgAccPhoneInfo(); info.key = Encoding.UTF8.GetBytes("server_name"); info.val = Encoding.UTF8.GetBytes(globalConfig.LoginInfo.ServerInfo.Name); GameDebug.Log("server_name: " + globalConfig.LoginInfo.ServerInfo.Name); infos.Add(info); } // did info = new PkgAccPhoneInfo(); info.key = Encoding.UTF8.GetBytes("did"); info.val = Encoding.UTF8.GetBytes(bridge.getSDKDeviceID()); GameDebug.Log("did: " + bridge.getSDKDeviceID()); infos.Add(info); // idfa info = new PkgAccPhoneInfo(); info.key = Encoding.UTF8.GetBytes("idfa"); info.val = Encoding.UTF8.GetBytes(bridge.GetPhoneIDFA()); GameDebug.Log("idfa: " + bridge.GetPhoneIDFA()); infos.Add(info); // lua扩展 object[] param = { }; System.Type[] return_type = { typeof(string) }; object[] objs = LuaScriptMgr.Instance.CallLuaFunction_return(LuaScriptMgr.Instance.Lua.Global, "GetExtendPhoneInfo", param, return_type); if (objs != null && objs.Length > 0) { if (objs[0] != null) { string ret = (string)objs[0]; System.Object retObject = MiniJSON.JsonDecode(ret); if (retObject != null) { Hashtable hashtable = retObject as Hashtable; if (hashtable != null) { foreach (DictionaryEntry kv in hashtable) { info = new PkgAccPhoneInfo(); info.key = Encoding.UTF8.GetBytes(kv.Key.ToString()); info.val = Encoding.UTF8.GetBytes(kv.Value.ToString()); GameDebug.Log(kv.Key.ToString() + ": " + kv.Value.ToString()); infos.Add(info); } } } } } if (Const.Region == RegionType.SEASIA) { //当前选中语言 info = new PkgAccPhoneInfo(); info.key = Encoding.UTF8.GetBytes("language"); info.val = Encoding.UTF8.GetBytes(TranslateManager.GetInstance().ConvertToServerLang(Const.Language).ToString()); GameDebug.Log("language: " + TranslateManager.GetInstance().ConvertToServerLang(Const.Language).ToString()); infos.Add(info); } // os_ext 韩国版用来标识是one_store还是google_play,还是app_store if (Const.Region == RegionType.KOREA) { info = new PkgAccPhoneInfo(); info.key = Encoding.UTF8.GetBytes("os_ext"); info.val = Encoding.UTF8.GetBytes(Application.identifier); GameDebug.Log("os_ext: " + Application.identifier); infos.Add(info); } }
/// <summary> /// 进行更新检查 /// </summary> /// <returns></returns> public IEnumerator StartLogingCheck() { // 读取游戏常量表的配置 bool isSupportGrayServer = false; #if UNITY_IPHONE if (GameConstHelper.GetUint("GAME_SYS_IS_SUPPORT_GRAY_SERVER_IOS") > 0) { isSupportGrayServer = true; } #else if (GameConstHelper.GetUint("GAME_SYS_IS_SUPPORT_GRAY_SERVER") > 0) { isSupportGrayServer = true; } #endif // 检查当前包是否支持灰度服的更新检查 if (!GrayServerManager.Instance.IsSupportGrayServer() || !isSupportGrayServer) { OnEnterGame(); yield break; } // 上次登录的服务器ID与当前服务器ID相同时,不需要检查灰度服更新 var lastServerId = GrayServerManager.Instance.GetLoginServer(); var curServerId = 0; if (GlobalConfig.Instance.LoginInfo != null && GlobalConfig.Instance.LoginInfo.ServerInfo != null) { curServerId = GlobalConfig.Instance.LoginInfo.ServerInfo.SId; } if (lastServerId == curServerId) { OnEnterGame(); yield break; } // 记录最新的服务器ID GrayServerManager.Instance.RecordLoginServer(curServerId); #if UNITY_EDITOR // editor下使用android的资源来测试 var server_url = @"http://s01.huiwaninfo.net:8087/XControl/v2/servlet/UpdateCheck?game_mark=zl_cehua&platform=android&appv=2.0.0&libv=0.0.0&imei=359786050902015&device_mark=&cpu=Intel&extend=&api_ver=1.0&res_v=1&res_v=1"; #else var server_url = DBOSManager.getOSBridge().getUpdateCheckUrl(); #endif // 获取最新资源版本 GrayServerManager.Instance.SetUpdateURL(server_url); yield return(MainGame.HeartBehavior.StartCoroutine(GrayServerManager.Instance.CheckUpdate(curServerId))); var updateInfo = GrayServerManager.Instance.UpdateInfo; bool needUpdate = false; if (updateInfo != null) { // 判断是否有更新 var versionInfo = VersionInfoManager.Instance.LocalVersionInfo; if (versionInfo != null) { foreach (var info in versionInfo) { var local_version = info.Value; var server_version = 0; if (updateInfo.TryGetValue(info.Key, out server_version)) { if (local_version < server_version) { needUpdate = true; break; } } } } } if (mCheckCoroutine != null) { MainGame.HeartBehavior.StopCoroutine(mCheckCoroutine); mCheckCoroutine = null; } // 有更新时需要重新启动游戏 if (needUpdate) { ui.UIWidgetHelp.GetInstance().ShowNoticeDlg("检测到游戏资源有更新,请重启游戏进行更新操作。", (x) => { DBOSManager.getOSBridge().reboot(); }); } else { OnEnterGame(); } }
/// <summary> /// 玩家登录轨迹 /// </summary> public void PostPlayerFollowRecord(PlayerFollowRecordSceneId sceneId, string desc = "", bool isEnterGame = true) { if (sceneId == PlayerFollowRecordSceneId.EnterFirstScene) { // TestinExternalLog DBOSManager.getOSBridge().log2OSCmd("TestinExternalLog", mLogContent); // TestinExternalLog var logContent = string.Format(mLogFmt, 3 - QualitySetting.GraphicLevel); DBOSManager.getOSBridge().log2OSCmd("TestinExternalLog", logContent); // 云梯第一次进入场景 ControlServerLogHelper.Instance.PostCloudLadderEventAction(CloudLadderMarkEnum.enter_game); } FieldInfo fi = sceneId.GetType().GetField(sceneId.ToString()); DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false); string scene = (attributes.Length > 0) ? attributes[0].Description : sceneId.ToString(); LanguageType languageType = Const.Language; fi = languageType.GetType().GetField(languageType.ToString()); attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false); string language = (attributes.Length > 0) ? attributes[0].Description : languageType.ToString(); //GameDebug.LogError("PostPlayerFollowRecord scene: " + scene); GlobalConfig globalConfig = GlobalConfig.GetInstance(); GlobalConfig.LoginInfoStruct loginInfo = globalConfig.LoginInfo; IBridge bridge = DBOSManager.getOSBridge(); string url = globalConfig.CommonURL + "playerFollowRecord"; url += "?gameMark=" + globalConfig.GameMark; if (string.IsNullOrEmpty(loginInfo.AccName) == true) { url += "&account=none"; } else { url += "&account=" + loginInfo.AccName; } if (loginInfo.ServerInfo != null) { url += "&server_id=" + loginInfo.ServerInfo.ServerId; } url += "&role_id=" + loginInfo.RId; url += "&role_name=" + WWW.EscapeURL(loginInfo.Name); url += "&level=" + loginInfo.Level; if (isEnterGame == true) { url += "&vip=" + VipHelper.GetVipValidLevel(); } else { url += "&vip=0"; } url += "&provider=" + globalConfig.SDKName; url += "&scene=" + WWW.EscapeURL(scene); url += "&msg=" + WWW.EscapeURL(desc); url += "&position=0"; url += "&os=" + globalConfig.PlatformName; url += "&osVer=" + bridge.getOSVersion(); url += "&brand=" + WWW.EscapeURL(bridge.getBrand()); url += "&model=" + WWW.EscapeURL(bridge.getPhoneModel()); url += "&job=" + loginInfo.Job; url += "&net=" + bridge.getNetType(); if (isEnterGame == true) { if (Game.Instance.ServerTime > 0) { url += "&time=" + Game.Instance.ServerTime; } else { url += "&time=" + System.Convert.ToUInt32(xc.Maths.Util.ConvertDateTimeToTimestamp(System.DateTime.Now));; } } else { url += "&time=0"; } url += "&device_mark=" + globalConfig.DeviceMark; url += "&start_time=" + globalConfig.StartTimeStamp; #if UNITY_IPHONE url += "&imei=" + bridge.GetPhoneIDFA(); #else url += "&imei=" + bridge.getPhoneIMEI(); #endif url += "&mac=" + bridge.getPhoneMAC(); url += "&imsi=" + bridge.getPhoneIMSI(); url += "&app_version=" + bridge.getAppVersion(); url += "&chn_id=" + bridge.getSdkID(); url += "&carrier=" + WWW.EscapeURL(bridge.getOperator()); url += "&jbk=" + bridge.isRoot(); url += "&did=" + bridge.getSDKDeviceID(); url += "&tz=" + WWW.EscapeURL(bridge.getTimeZone()); url += "&lang=" + language; url += "&width=" + bridge.getWindowWidth(); url += "&height=" + bridge.getWindowHeigh(); url += "&apil=" + bridge.getAPILevel(); url += "&idfa=" + bridge.GetPhoneIDFA(); url += "&idfv=" + bridge.getPhoneIDFV(); url += "&ip=" + WWW.EscapeURL(bridge.getLocalIpAddress()); url += "&wifi=" + WWW.EscapeURL(bridge.getWfName()); url += "&factory=" + WWW.EscapeURL(bridge.getManufacturer()); url += "&game_version=" + VersionInfoManager.Instance.GameVersion; url += "&appId=" + bridge.getAppID(); url += "&sdkv=" + bridge.getSDKVersionName(); HttpRequest.Instance.GET(url, null, null); GameDebug.Log("PostPlayerFollowRecord: " + scene); }
//-------------------------------------------------------- // 虚函数 //-------------------------------------------------------- protected override void InitUI() { mIsDestroy = false; base.InitUI(); m_LoadingIcon = FindChild <Transform>("LoadingIcon").gameObject; m_LoadingIcon.SetActive(false); //m_SDKAccountButton = FindChild("SDKAccountButton").GetComponent<Button>(); m_ChooseServerButton = FindChild("ChooseServerButton").GetComponent <Button>(); m_LoginButton = FindChild("LoginButton").GetComponent <Button>(); m_ServerStateImage = FindChild <Image>("ServerStateImage"); m_ServerNameText = FindChild <Text>("ServerNameText"); //m_SDKAccountButton.onClick.AddListener( OnClickSDKAccountButton); m_ChooseServerButton.onClick.AddListener(OnClickChooseServerButton); m_LoginButton.onClick.AddListener(OnClickLoginButton); mBtnAnnouncement = FindChild <Transform>("AnnouncementButton").gameObject.GetComponent <Button>(); mBtnAnnouncement.onClick.AddListener(onShowLoginNotice); mUserButton = FindChild <Transform>("UserButton").gameObject.GetComponent <Button>(); bool isShowUserCenterButton = true; string isShowUserCenterButtonStr = GameConstHelper.GetString("GAME_SYS_SHOW_SDK_USER_CENTER"); if (Const.Region != RegionType.CHINA) { isShowUserCenterButtonStr = GameConstHelper.GetString("GAME_SYS_SHOW_SDK_USER_CENTER_OVERSEA"); } if (isShowUserCenterButtonStr == "" || isShowUserCenterButtonStr == "0") { isShowUserCenterButton = false; } mUserButton.gameObject.SetActive(isShowUserCenterButton); mUserButton.onClick.AddListener(OnClickUserButton); mLogo = FindChild <Image>("Logo"); #if UNITY_ANDROID var app_id = DBOSManager.getOSBridge().getAppID(); var item = DBAndroidMajia.Instance.GetData((uint)app_id); if (item != null) { mLogo.gameObject.SetActive(item.ShowLogo); mUserButton.gameObject.SetActive(item.ShowUserCenter); } #endif mCustomLogoRawImage = FindChild <RawImage>("CustomLogoRawImage"); GameObject ageIdentification = FindChild("AgeIdentification"); if (ageIdentification != null) { // 只有韩国版 onestore 渠道需要显示年龄分级图标 var ret = Const.Region == RegionType.KOREA && Application.identifier == GameConst.APK_NAME_KOREA_ONESTORE; ageIdentification.gameObject.SetActive(ret); } //IOS #if UNITY_IPHONE mLogo.gameObject.SetActive(true); mCustomLogoRawImage.gameObject.SetActive(false); LoadMaJiaImage majiaImage = mLogo.gameObject.AddComponent <LoadMaJiaImage>(); var logoName = "logo.png"; majiaImage.mPath = ResNameMapping.Instance.GetMappingName(logoName); //majiaImage.SetCallBack(LoadImgSuccess); GameObject go = FindChild("Bg"); LoadMaJiaImage majiaBg = go.AddComponent <LoadMaJiaImage>(); var picName = "QuickLogin.jpg"; majiaBg.mPath = ResNameMapping.Instance.GetMappingName(picName); #endif mKVPanel = FindChild("KVPanel"); if (mKVPanel != null) { //if (AuditManager.Instance.AuditAndIOS() && SDKHelper.GetSwitchModel()) // mKVPanel.SetActive(false); #if UNITY_IPHONE mKVPanel.SetActive(SDKHelper.GetAuditInfo("is_show_login_kv")); #endif #if UNITY_ANDROID item = DBAndroidMajia.Instance.GetData((uint)app_id); if (item != null) { mKVPanel.gameObject.SetActive(item.ShowKv); } #endif } mVersionInfoText = FindChild <Text>("VersionInfoText"); mBgParent = FindChild("BgParent"); if (Const.Region != RegionType.CHINA) { // 隐藏健康提示 var login_panel_trans = FindChild <Transform>("LoginPanel"); if (login_panel_trans != null) { var health_text = login_panel_trans.Find("Text"); if (health_text != null) { health_text.gameObject.SetActive(false); } } } // 注册网络消息 // 注册客户端消息 ClientEventMgr.GetInstance().SubscribeClientEvent((int)ClientEvent.CE_SDK_INITED, OnInitCallback); ClientEventMgr.GetInstance().SubscribeClientEvent((int)ClientEvent.CE_SELECT_SERVER, OnSelectServerChange); ClientEventMgr.GetInstance().SubscribeClientEvent((int)ClientEvent.CE_START_GET_SERVER_INFOS, OnStartGetServerInfos); }
/// <summary> /// 响应注册的网络消息 /// </summary> /// <param name="protocol"></param> /// <param name="data"></param> void HandleCreateRole(ushort protocol, byte[] data) { if (protocol != NetMsg.MSG_CREATE_ROLE) { return; } var create_role = S2CPackBase.DeserializePack <S2CCreateRole>(data); if (create_role.result != 1) // 创建不成功 { string content = ""; DBErrorCode db_error_code = (DBErrorCode)DBManager.GetInstance().GetDB(typeof(DBErrorCode).Name); DBErrorCode.ErrorInfo errorInfo = db_error_code.GetErrorInfo(create_role.result); if (errorInfo == null) { content = xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_35"); } else { content = errorInfo.mDesc; } GameDebug.LogError(string.Format("服务端报错: {0}", content)); UINotice.GetInstance().ShowMessage(content); UIManager.Instance.ShowWaitScreen(false); return; } // 保存本地玩家ID UnitID uid = new UnitID(); uid.type = (byte)EUnitType.UNITTYPE_PLAYER; uid.obj_idx = (uint)create_role.uuid; Game.GetInstance().LocalPlayerID = uid; Game.GetInstance().LocalPlayerTypeID = ActorHelper.RoleIdToTypeId(mVocationId); Game.GetInstance().LocalPlayerName = mNameInputField.text; // 保存角色职业信息 GlobalConfig.GetInstance().LoginInfo.RId = create_role.uuid.ToString(); GlobalConfig.GetInstance().LoginInfo.Job = mVocationId.ToString(); GlobalConfig.GetInstance().LoginInfo.Level = "0"; GlobalConfig.GetInstance().LoginInfo.CreateRoleTime = create_role.now.ToString(); // 通知服务端 var enter_game = new C2SEnterGame(); enter_game.uuid = create_role.uuid; NetClient.GetBaseClient().SendData <C2SEnterGame>(NetMsg.MSG_ENTER_GAME, enter_game); // 通知控制服 ControlServerLogHelper.GetInstance().PostRoleInfo(); // 通知sdk,sendRoleInfo2SDK要求等级最小为1,需要特殊处理 GlobalConfig.GetInstance().LoginInfo.Level = "1"; SDKControler.getSDKControler().sendRoleInfo2SDK((int)SDKControler.RoleEvent.CREATE_ROLE); // 创角埋点数据上报 if (xc.Const.Region == xc.RegionType.KOREA) { xc.BuriedPointHelper.ReportTapjoyEvnet("account generate"); } // 注册FCM DBOSManager.getOSBridge().registerFCM(); // 注册推送服务 DBOSManager.getOSBridge().registerPush(); }
protected override void ResetUI() { base.ResetUI(); var parmas = ShowParam; if (parmas != null && parmas.Length > 0) { var get_last_server = Convert.ToBoolean(parmas[0]); if (get_last_server) { StartGetServerInfos(); } } // 显示版本信息 UIManager.Instance.ShowWindow("UIVersionWindow"); GlobalConfig globalConfig = GlobalConfig.GetInstance(); if (Game.Instance.ManualCancelReconnect) { StartGetServerInfos(); } else { if (string.IsNullOrEmpty(globalConfig.LoginInfo.AccName) == true) { if (globalConfig.IsEnterSDK) { // 初始化sdk if (AuditManager.Instance.AuditAndIOS() == false) { mInDelayTime = true; DestroyInitSDKTimer(); mInitSDKTimer = new Utils.Timer(2000, false, 1000, OnDelayInitSDK); } else { OnDelayInitSDK(0); } } else { mInDelayTime = false; GameDebug.LogError("UIQucikWindow must be in sdk"); } } } // 根据sdkname来选择配置信息 SDKConfig sdkConfig = SDKHelper.GetSDKConfig(); if (sdkConfig != null) { // logo Sprite sprite = LoadSprite(sdkConfig.LogoName); if (sprite != null) { mLogo.sprite = sprite; } #if UNITY_IPHONE //mCustoLogoTexture = Resources.Load("logo") as Texture; ////从resource里面读出,如果存在,则优先显示 //if (mCustoLogoTexture != null) //{ // if (mCustomLogoRawImage != null) // { // mCustomLogoRawImage.texture = mCustoLogoTexture; // mCustomLogoRawImage.gameObject.SetActive(true); // mCustomLogoRawImage.SetNativeSize(); // } // if (mLogo != null) // { // mLogo.gameObject.SetActive(false); // } //} //else //{ // if (mLogo != null) // mLogo.gameObject.SetActive(true); // if (mCustomLogoRawImage != null) // mCustomLogoRawImage.gameObject.SetActive(false); //} #endif // 版号信息 if (Const.Region == RegionType.CHINA) { mVersionInfoText.text = sdkConfig.VersionInfo; if (mVersionInfoText != null) { mVersionInfoText.gameObject.SetActive(AuditManager.Instance.AuditAndIOS() == false); } } else { if (mVersionInfoText != null) { mVersionInfoText.gameObject.SetActive(false); } } if (mBtnAnnouncement != null) { mBtnAnnouncement.gameObject.SetActive(AuditManager.Instance.AuditAndIOS() == false); } } #if UNITY_ANDROID // 安卓平台从assets文件夹查找是否存在"login_logo.png"图片,存在则优先显示 string logoFileName = "login_logo.png"; byte[] logoImageData = DBOSManager.getDBOSManager().getBridge().loadExternalFileData(logoFileName); if (logoImageData != null) { TextureFormat textureFormat = TextureFormat.RGBA4444; Texture2D newTexture2D = new Texture2D((int)mLogo.preferredWidth, (int)mLogo.preferredHeight, textureFormat, false); newTexture2D.LoadImage(logoImageData); mCustomLogoRawImage.texture = newTexture2D; mCustomLogoRawImage.gameObject.SetActive(true); mCustomLogoRawImage.SetNativeSize(); mLogo.gameObject.SetActive(false); } else { GameDebug.LogError("Error, Can not load logo image: " + logoFileName); } // 安卓平台从assets文件夹查找是否存在"version_info"文件,存在则优先显示为版号信息 string versionInfoFileName = "version_info"; byte[] versionInfoFileData = DBOSManager.getDBOSManager().getBridge().loadExternalFileData(versionInfoFileName); if (versionInfoFileData != null) { mVersionInfoText.text = System.Text.Encoding.UTF8.GetString(versionInfoFileData); } RawImage bgImage = FindChild <RawImage>("Bg"); GameObject effect = FindChild("Effect"); // 安卓平台从assets文件夹查找是否存在"login_bg.jpg"图片,存在则优先显示 string imageFileName = "login_bg.jpg"; byte[] imageData = DBOSManager.getDBOSManager().getBridge().loadExternalFileData(imageFileName); if (imageData != null) { TextureFormat textureFormat = TextureFormat.DXT1; int width = Screen.currentResolution.width; int height = Screen.currentResolution.height; Texture2D newTexture2D = new Texture2D(width, height, textureFormat, false); newTexture2D.LoadImage(imageData); bgImage.texture = newTexture2D; effect.SetActive(false); var app_id = DBOSManager.getOSBridge().getAppID(); var item = DBAndroidMajia.Instance.GetData((uint)app_id); if (item != null) { effect.gameObject.SetActive(item.ShowEffect); } } else { //GameDebug.LogError("Error, Can not load loading bg image: " + imageFileName); effect.SetActive(true); } #endif mLogo.SetNativeSize(); if (Const.Region == RegionType.KOREA) { BuriedPointHelper.ReportAppsflyerEvnet("af_server"); } }
public void OnNetConnect(NetType netType) { Debug.Log("Connect server successed!"); // 设置连接状态 mConnected = true; ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_NET_MAIN_CONNECTED, null); if (ChangeRoleManager.Instance.IsChangeRole)// 更换角色发送C2SAccRoleChangeLogin协议 { var acc_role_change_login = new C2SAccRoleChangeLogin(); acc_role_change_login.token = GlobalConfig.Instance.Token; acc_role_change_login.uuid = ChangeRoleManager.Instance.PreUuid; NetClient.GetBaseClient().SendData <C2SAccRoleChangeLogin>(NetMsg.MSG_ACC_ROLE_CHANGE_LOGIN, acc_role_change_login); return; } if (NetReconnect.Instance.IsReconnect)// 在断线重连状态下,不需要发送C2SEasyLogin协议 { var session_login = new C2SAccSessionLogin(); session_login.token = GlobalConfig.Instance.Token; session_login.uuid = Game.Instance.LocalPlayerID.obj_idx; NetClient.GetBaseClient().SendData <C2SAccSessionLogin>(NetMsg.MSG_ACC_SESSION_LOGIN, session_login); return; } // 游戏帐号为空则直接返回 if (string.IsNullOrEmpty(Game.GetInstance().Account)) { GameDebug.LogError("Game account is null"); return; } IBridge bridge = DBOSManager.getDBOSManager().getBridge(); // 发送C2SEasyLogin协议 C2SEasyLogin easy_login = new C2SEasyLogin(); easy_login.username = System.Text.Encoding.UTF8.GetBytes(Game.GetInstance().Account); if (string.IsNullOrEmpty(GlobalConfig.GetInstance().LoginInfo.Ticket)) { easy_login.password = System.Text.Encoding.UTF8.GetBytes("ticket"); } else { easy_login.password = System.Text.Encoding.UTF8.GetBytes(GlobalConfig.GetInstance().LoginInfo.Ticket); } easy_login.channel = System.Text.Encoding.UTF8.GetBytes(GlobalConfig.GetInstance().SDKName); easy_login.server_id = (uint)GlobalConfig.GetInstance().LoginInfo.ServerInfo.SId; easy_login.sub_channel = System.Text.Encoding.UTF8.GetBytes(GlobalConfig.GetInstance().SubChannel); easy_login.sdk_user_id = System.Text.Encoding.UTF8.GetBytes(DBOSManager.getOSBridge().getSdkUserID()); easy_login.roll_sever = GlobalConfig.GetInstance().LoginInfo.RollServer; easy_login.ext_channel = System.Text.Encoding.UTF8.GetBytes(bridge.getExtChannel()); easy_login.main_channel = System.Text.Encoding.UTF8.GetBytes(bridge.getCurrChannel()); NetClient.GetBaseClient().SendData <C2SEasyLogin>(NetMsg.MSG_EASY_LOGIN, easy_login); #if !UNITY_IPHONE // 选择服务器的时候通知sdk SDKControler.getSDKControler().sendRoleInfo2SDK((int)SDKControler.RoleEvent.SELECT_SERVER); #endif }
protected IEnumerator LoadScene() { string asset_path = SceneHelp.Instance.CurSceneResPath; string level_name = SceneHelp.Instance.CurSceneName; int patch_id; if (!xpatch.XPatchManager.Instance.IsAssetDownloaded(asset_path, out patch_id)) { // 由于loading界面层级太高,无法用正常界面来显示,所以在Loading界面内嵌了一个简单的messageBox var message_box = xc.ui.ugui.UIManager.Instance.LoadingWindow.MessageBox; yield return(xc.MainGame.GetGlobalMono().StartCoroutine( message_box.ShowRoutine(DBConstText.GetText("SCENE_NEED_DOWNLOAD"), xc.TextHelper.BtnConfirm, xc.TextHelper.BtnCancel))); if (message_box.Result == MessageBoxUI.EResult.Cancel) { Application.Quit(); yield break; } var patch_mgr = xpatch.XPatchManager.Instance; var need_download_patch_list = new List <xpatch.DL_PatchContext>(); for (var i = 1; i <= patch_id; ++i) { if (!patch_mgr.IsPatchDownloaded(i)) { var patch = patch_mgr.GetExtendPatchProgress(i); if (patch.PatchContext != null) { need_download_patch_list.Add(patch.PatchContext); } } } var progress = patch_mgr.CreatePatchProcess(); yield return(xc.MainGame.GetGlobalMono().StartCoroutine(patch_mgr.CollectPatchContextByList(progress, need_download_patch_list))); // 磁盘空间检查 var free_space_in_mb = DBOSManager.getOSBridge().getStorageFreeSize(); var total_bytes_to_download = progress.TotalBytesToDownload; var total_bytes_to_download_in_mb = total_bytes_to_download / 1024.0f / 1024.0f; // 计算需要的磁盘空间(预留多点空间,是下载需求大1.5倍,最多不多于50Mb) var need_space_in_mb = total_bytes_to_download_in_mb * 1.5; if (need_space_in_mb - total_bytes_to_download_in_mb > 50) { need_space_in_mb = total_bytes_to_download_in_mb + 50; } if (free_space_in_mb < need_space_in_mb) { yield return(xc.MainGame.GetGlobalMono().StartCoroutine( message_box.ShowRoutine(DBConstText.GetText("SCENE_DISK_NOTENOUGH"), xc.TextHelper.BtnConfirm))); Application.Quit(); } // 移动数据网络 var cur_network_state = Application.internetReachability; if (cur_network_state == NetworkReachability.ReachableViaCarrierDataNetwork) { if (total_bytes_to_download_in_mb > 10) { // wait messagebox 提示下载 yield return(xc.MainGame.GetGlobalMono().StartCoroutine( message_box.ShowRoutine(string.Format(DBConstText.GetText("SCENE_PATCH_DOWNLOAD"), total_bytes_to_download_in_mb), xc.TextHelper.BtnConfirm, xc.TextHelper.BtnCancel))); if (message_box.Result == MessageBoxUI.EResult.Cancel) { Application.Quit(); yield break; } } } // 不限速 patch_mgr.LimitBytesPerSec = 0; mIsInPatch = true; progress.Start(); while (!progress.IsFinish) { if (patch_mgr.FatalError) { yield return(xc.MainGame.GetGlobalMono().StartCoroutine( message_box.ShowRoutine(DBConstText.GetText("SCENE_DOWNLOAD_FAIL"), xc.TextHelper.BtnConfirm, xc.TextHelper.BtnCancel))); if (message_box.Result == MessageBoxUI.EResult.Cancel) { Application.Quit(); yield break; } patch_mgr.Resume(); } var download_speed_str = patch_mgr.DownloadSpeedStr; string progress_tips; if (total_bytes_to_download_in_mb < 1) { var total_bytes_to_download_in_kb = total_bytes_to_download / 1024.0f; var bytes_download_in_kb = progress.BytesDownloaded / 1024.0f; progress_tips = string.Format(DBConstText.GetText("SCENE_DOWNLOAD_NOTICE"), bytes_download_in_kb, total_bytes_to_download_in_kb, download_speed_str); } else { var bytes_download_in_mb = progress.BytesDownloaded / 1024.0f / 1024.0f; progress_tips = string.Format(DBConstText.GetText("SCENE_DOWNLOAD_NOTICE2"), bytes_download_in_mb, total_bytes_to_download_in_mb, download_speed_str); } xc.ui.ugui.UIManager.GetInstance().SetLoadingTip(progress_tips); xc.ui.ugui.UIManager.GetInstance().UpdateLoadingBar(progress.Value); yield return(null); } mIsInPatch = false; // 去掉更新的进度 //SetRandomTip(); xc.ui.ugui.UIManager.GetInstance().UpdateLoadingBar(0); } ResourceLoader.Instance.sceneLoadAsyncOp = null; QuadTreeSceneManager.Instance.StartLoadPercentage = 0.2f + UnityEngine.Random.Range(-0.1f, 0.1f); xc.MainGame.GetGlobalMono().StartCoroutine(ResourceLoader.Instance.load_scene(asset_path, level_name, null)); xc.MainGame.GetGlobalMono().StartCoroutine(Game.WaitForSceneLoadAsyncOp()); }
public void GotoCSLogin(string msg) { mIsLogining = true; Hashtable hashtable = MiniJSON.JsonDecode(msg) as Hashtable; if (hashtable != null) { if (hashtable.Count <= 2) { if (mLoginCallback != null) { endLogin((int)SDK_STATU_CODE.LOGIN_CANCEL, xc.TextHelper.SDKLoginCancel); } return; } GlobalConfig globalConfig = GlobalConfig.GetInstance(); string loginAction = hashtable["_LoginAction_"] as string; string data = ""; foreach (DictionaryEntry de in hashtable) { string key = de.Key.ToString(); string value = de.Value.ToString(); if (!key.Equals("_LoginAction_")) { value = WWW.EscapeURL(value, System.Text.Encoding.UTF8); data = data + key + "=" + value + "&"; } } IBridge bridge = DBOSManager.getOSBridge(); string url = ""; // AppID超过350使用新接口 if (GlobalConfig.Instance.AppId > 350) { url = globalConfig.LoginURL + "eagleV4/" + loginAction + "?" + data + "game_mark=" + GlobalConfig.Instance.GameMark + "&net=" + bridge.getNetType() + "&provider=" + GlobalConfig.Instance.Channel; // os_ext 韩国版用来标识是one_store还是google_play,还是app_store if (Const.Region == RegionType.KOREA) { url += "&os_ext=" + Application.identifier; url += "&sdkUserId=" + bridge.getSdkUserID(); } } else { url = globalConfig.LoginURL + loginAction + "?" + data + "game_mark=" + GlobalConfig.Instance.GameMark + "&net=" + bridge.getNetType() + "&provider=" + GlobalConfig.Instance.Channel; if (Const.Region == RegionType.KOREA) { url += "&os_ext=" + Application.identifier; url += "&sdkUserId=" + bridge.getSdkUserID(); } } #if UNITY_IPHONE url = globalConfig.LoginURL + loginAction + "?" + data + "game_mark=" + GlobalConfig.Instance.GameMark + "&net=" + bridge.getNetType(); if (Const.Region == RegionType.KOREA) { url += "&os_ext=" + Application.identifier; url += "&sdkUserId=" + bridge.getSdkUserID(); } //ios 在xcode 已经传了 #endif #if UNITY_IPHONE url = url + "&device_mark=" + globalConfig.DeviceMark; Debug.Log("SDKControler.GotoCSLogin" + url); #endif // 加上二级渠道 url = url + "&sub_chn=" + globalConfig.SubChannel; // 扩展参数 Hashtable extendParams = new Hashtable(); extendParams.Add("did", WWW.EscapeURL(bridge.getSDKDeviceID())); extendParams.Add("idfa", WWW.EscapeURL(bridge.GetPhoneIDFA())); extendParams.Add("extc", bridge.getExtChannel()); //三级渠道 var extend = MiniJSON.JsonEncode(extendParams); url = url + "&extend=" + extend; MainGame.HttpRequest.GET(url, OnCSLoginFinished, null); } else { if (mLoginCallback != null) { mLoginCallback((int)SDK_STATU_CODE.LOGIN_MSG_FAIL, xc.TextHelper.SDKLoginCancel); } return; } }