private void OnWebAccountLogOn(HttpCallBackArgs args) { if (args.HasError) { ShowOrHideErrorTip(true, args.Value); Log.Error(args.Value); } else { LitJson.JsonData data = LitJson.JsonMapper.ToObject(args.Value); bool hasError = (bool)data["HasError"]; if (hasError) { ShowOrHideErrorTip(true, "您输入的帐号不存在"); } else { LitJson.JsonData config = LitJson.JsonMapper.ToObject(data["Value"].ToString()); GameEntry.Data.UserData.AccountId = int.Parse(config["Id"].ToString()); //GameEntry.Data.SystemData.Ip = config["Ip"].ToString(); //GameEntry.Data.SystemData.Port = int.Parse(config["Port"].ToString()); //todo 正式使用需要服务器返回 这里直接使用目标机 GameEntry.Data.SystemData.Ip = GameEntry.Http.RealWebAccountUrl.Replace("http://", ""); GameEntry.Data.SystemData.Ip = GameEntry.Data.SystemData.Ip.Replace(":8080", ""); GameEntry.Data.SystemData.Port = 1038; Debug.Log(GameEntry.Data.UserData.AccountId); Close(); GameEntry.UI.OpenUIForm(UIFormId.LogIn); } } }
/// <summary> /// 帐号服务器访问回调 /// </summary> /// <param name="args"></param> private void OnWebAccountInit(HttpCallBackArgs args) { if (!args.HasError) { LitJson.JsonData data = LitJson.JsonMapper.ToObject(args.Value); bool hasError = (bool)data["HasError"]; if (!hasError) { LitJson.JsonData config = LitJson.JsonMapper.ToObject(data["Value"].ToString()); GameEntry.Data.SystemData.CurrAccountServerTime = long.Parse(config["ServerTime"].ToString()); //GameEntry.Data.SystemData.SourceUrl = config["SourceUrl"].ToString(); Debug.Log("暂时直接使用目标地址CDN,正式使用使用上面的回调"); { GameEntry.Data.SystemData.SourceUrl = GameEntry.Http.RealWebAccountUrl.Replace(":8080", ":8081/"); } GameEntry.Data.SystemData.RechargeUrl = config["RechargeUrl"].ToString(); GameEntry.Data.SystemData.TDAppId = config["TDAppId"].ToString(); GameEntry.Data.SystemData.IsOpenTD = int.Parse(config["IsOpenTD"].ToString()) == 1; GameEntry.Data.SystemData.VersionLength = int.Parse(config["VersionLength"].ToString()); GameEntry.Data.SystemData.VersionHashCode = int.Parse(config["VersionHashCode"].ToString()); GameEntry.Data.SystemData.VersionZipLength = int.Parse(config["VersionZipLength"].ToString()); GameEntry.Data.SystemData.VersionZipHashCode = int.Parse(config["VersionZipHashCode"].ToString()); Log.Info("ServerTime==" + GameEntry.Data.SystemData.CurrAccountServerTime); Log.Info("SourceUrl==" + GameEntry.Data.SystemData.SourceUrl); ChangeState(GameEntry.Resource.EditorResourceMode ? typeof(ProcedurePreload) : typeof(ProcedureCheckVersion)); } else { string msg = data["ErrorMsg"].ToString(); Log.Error(msg); Debug.LogError("无法连接到网络请重试!"); //todo } } }