public static HttpPackageReturn <T> Create(WWW www, JsonHttp host) { if (www == null) { return(null); } if (!string.IsNullOrEmpty(www.error)) { return(null); } HttpPackageReturn <T> recv; #if GX_JSONNET try { // TODO: 服务器下发的json有个bug,空的数组不会用“[]”而是“{}”,而Json.Net是强类型的,这里统一替换为null以应对空数组和空对象的情况 recv = Json.Deserialize <HttpPackageReturn <T> >(Json.Proxy is JsonNetProxy ? www.text.Replace("{}", "null") : www.text); } #else try { recv = Common.Json.Deserialize <HttpPackageReturn <T> >(www.text); } #endif catch { return(null); } if (recv == null) { return(null); } //if (recv.errno != Pmd.HttpReturnCode.HttpReturnCode_Null && recv.errno != Pmd.HttpReturnCode.HttpReturnCode_SignError) // return null; return(recv); }
public static HttpPackageReturn <T> Create(WWW www, JsonHttp host) { if (www == null) { return(null); } if (!string.IsNullOrEmpty(www.error)) { return(null); } HttpPackageReturn <T> recv; try { recv = Json.Deserialize <HttpPackageReturn <T> >(www.text); } catch { return(null); } if (recv == null) { return(null); } if (recv.errno != Pmd.HttpReturnCode.HttpReturnCode_Null && recv.errno != HttpReturnCode.HttpReturnCode_SignError) { return(null); } return(recv); }
/// <summary> /// 由弱联网转强联网链接 /// </summary> /// <param name="http"></param> /// <param name="success"></param> /// <param name="error"></param> public static void CreateAsync(JsonHttp http, Action <JsonSocket, UserLoginReturnOkLoginUserPmd_S> success, Action <string, UserLoginReturnFailLoginUserPmd_S> error = null) { ulong accountid = 0; if (http.UID.TryParse(out accountid) == false) { var msg = string.Format("[WS ERROR] Parse HTTP.UID error: {0}", http.UID); if (error == null) { Debug.LogError(msg); } else { error(msg, null); } return; } http.SendAsync(new WebSocketForwardUserPmd_C() { accountid = accountid }, (WebSocketForwardUserPmd_S recv) => { var websocket = new JsonSocket(recv.jsongatewayurl); websocket.Dispatcher.StaticRegister(); new WebSocketCreateProxy().Register(websocket, success, error); // websocket登陆消息 var cmd = new UserLoginTokenLoginUserPmd_C() { gameid = http.GameID, zoneid = http.ZoneID, accountid = recv.accountid, logintempid = recv.logintempid, timestamp = DateTime.Now.ToUnixTime(), compress = http.Compress.ToString(), encrypt = null, encryptkey = null, }; cmd.tokenmd5 = MD5.ComputeHashString(cmd.accountid.ToString() + cmd.logintempid.ToString() + cmd.timestamp.ToString() + recv.tokenid.ToString()); websocket.Send(cmd); }, error == null ? null : new Action <string>(s => error(s, null))); }
public LoginStepSelectZone(Engine.Utility.StateMachine <LoginDataManager> machine, GX.Net.JsonHttp http) : base(machine, http) { m_nStateID = (int)LoginSteps.LGS_SelectZone; }
public LoginStepFetchASFilterData(Engine.Utility.StateMachine <LoginDataManager> machine, GX.Net.JsonHttp http) : base(machine, http) { m_nStateID = (int)LoginSteps.LGS_FetchASFilterData; }
public LoginStepGameServer(Engine.Utility.StateMachine <LoginDataManager> machine, GX.Net.JsonHttp http) : base(machine, http) { m_nStateID = (int)LoginSteps.LGS_GameServer; }
public LoginStepPlatform(Engine.Utility.StateMachine <LoginDataManager> machine, GX.Net.JsonHttp http) : base(machine, http) { m_nStateID = (int)LoginSteps.LGS_Platform; }
public LoginStateBase(Engine.Utility.StateMachine <LoginDataManager> machine, GX.Net.JsonHttp http) { m_Statemachine = machine; m_http = http; }