|
@@ -73,18 +73,11 @@ public class NetworkManager
|
|
|
|
|
|
ChatManager.GetInstance ().Clear ();
|
|
|
|
|
|
- URLRequestData data = new URLRequestData(true);
|
|
|
- data.Add("id", id);
|
|
|
- data.Add("device", device);
|
|
|
- data.Add("from", "ios");
|
|
|
- data.Add ("port", Config.USER_PORT);
|
|
|
-
|
|
|
- URLRequest.CreateURLRequest (GetURL (URL.Login), data, (JsonData json) => {
|
|
|
|
|
|
- int resCode = (int)json["c"];
|
|
|
- if(resCode == 0)
|
|
|
+ UserRequest.Login (id, device, "ios", Config.USER_PORT).ResultEvent.AddListener((bool success, JsonData data) => {
|
|
|
+ if(success)
|
|
|
{
|
|
|
- JsonData info = json["d"];
|
|
|
+ JsonData info = data;
|
|
|
UserData userData = Session.GetInstance().myUserData;
|
|
|
userData.id = JsonUtil.ToInt(info["i"]);
|
|
|
if(info["n"] != null)
|
|
@@ -121,6 +114,9 @@ public class NetworkManager
|
|
|
|
|
|
ChatMsg.InitDateTime(info["ts"].ToString());
|
|
|
|
|
|
+ Config.SERVER_ADDRESS = info["sfs_ip"].ToString();
|
|
|
+ Config.SERVER_PORT = JsonUtil.ToInt(info["sfs_port"]);
|
|
|
+
|
|
|
if(callBack != null)
|
|
|
callBack();
|
|
|
}
|
|
@@ -128,8 +124,7 @@ public class NetworkManager
|
|
|
{
|
|
|
AlertPanel alertPanel = AlertPanel.Show(null, Language.GetStr("MenuPage", "internetFailed"), 4, OnLoginAlertClose);
|
|
|
}
|
|
|
-
|
|
|
- }, URLRequest.Method.POST);
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
|