//Get Chat public int GetChat(int friendId = -1, int playerId = 0, string token = "") { if (friendId == -1) //Get Public Chat { string defaultNotFound = "{\"chat\":[]}"; API api = new API("chat/chat.ray", "RGetChatPublic", "", -1); StartCoroutine(Congest.ReadTempFile(this, api, defaultNotFound)); return(api.seed); } else if (friendId == 0) //Get Private Chat List { if (ParseToken(playerId, token)) { TokenParam param = new TokenParam(); param.player_id = apiPlayerId; param.token = apiToken; string paramJson = JsonUtility.ToJson(param); API api = new API("getchat.php", "RGetChatList", paramJson, 1); param = null; paramJson = ""; StartCoroutine(Congest.SendPOST(this, api)); return(api.seed); } } else //Get Private Chat { string fromto = (apiPlayerId < friendId ? Mathf.FloorToInt(apiPlayerId / 1000).ToString() : Mathf.FloorToInt(friendId / 1000).ToString()) + "/" + (apiPlayerId < friendId ? apiPlayerId.ToString() : friendId.ToString()) + "/" + (apiPlayerId > friendId ? apiPlayerId.ToString() : friendId.ToString()); string defaultNotFound = "{\"chat\":[]}"; API api = new API("chat/" + fromto + "/chat.ray", "RGetChatPrivate", "", -1); StartCoroutine(Congest.ReadTempFile(this, api, defaultNotFound)); return(api.seed); } return(0); }
private int GetAnnouncementSession() { string defaultNotFound = "0"; API api = new API("announcementindex.ray", "StartAnnouncementSessionResponse", "", -1); StartCoroutine(Congest.ReadTempFile(this, api, defaultNotFound)); return(api.seed); }
private int StartAnnouncementSessionResponse(ResponseParam response) { if (response.post_data.Length > 0) { try { int index = int.Parse(response.post_data); if (index > announcementSession) { announcementSession = index; PlayerPrefs.SetInt("announcementSession", announcementSession); string defaultNotFound = "{\"announcement\":[]}"; API api = new API("announcement.ray", "UpdateAnnouncementSession", "", -1); StartCoroutine(Congest.ReadTempFile(this, api, defaultNotFound)); return(api.seed); } } catch (Exception e) { Debug.Log(e.Message); } } return(0); }
private int StartChatSessionResponse(ResponseParam response) { if (response.post_data.Length > 0) { try { long index = long.Parse(response.post_data); if (index > chatSession) { chatSession = index; PlayerPrefs.SetInt((chatSessionUrl.Length == 1 ? "publicChatSession" : "privateChatSession"), (int)chatSession); string defaultNotFound = "{\"chat\":[]}"; API api = new API("chat" + chatSessionUrl + "chat.ray", "UpdateChatSessionResponse", "", -1); StartCoroutine(Congest.ReadTempFile(this, api, defaultNotFound)); return(api.seed); } } catch (Exception e) { Debug.Log(e.Message); } } return(0); }