public IEnumerator IDeletSocietyParty(int partyId) { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); ///ToDO jsonElement ["data_type"] = "delete"; jsonElement ["player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); jsonElement ["society_id"] = SocietyManager.Instance.SelectedSociety.Id.ToString(); jsonElement ["party_id"] = partyId.ToString(); postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(GetSocietyPartyLink, encoding.GetBytes(jsonElement.ToString()), postHeader); print("jsonDtat is ==>> " + jsonElement.ToString()); yield return(www); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); print("_jsnode ==>> " + _jsnode.ToString()); //TODO if (_jsnode ["status"].ToString().Contains("200") || _jsnode ["description"].ToString().Contains("Society party has deleted successfully")) { print("Society Party Deleted"); } } }
IEnumerator UpdateStatusOfParentalControl(int _status) { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); jsonElement ["player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); jsonElement ["status"] = _status.ToString(); postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(parentalControlUpdateOrChangeStatus, encoding.GetBytes(jsonElement.ToString()), postHeader); print("jsonDtat is ==>> " + jsonElement.ToString()); yield return(www); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); print("jsonDtat is ==>> " + _jsnode.ToString()); if (_jsnode ["status"].ToString().Contains("200") && _jsnode ["description"].ToString().Contains("Player parental control status has updated")) { if (_status == 2) { WarningText.text = "Parental control successfully Disabled!"; activateParentel = false; StatusForButton.text = "Enable"; ButtonText.text = StatusForButton.text; ShowPopUpMessage("Parental Control Disabled"); // disableParentalControl.SetActive (true); PanelControlerLogin(); // enableParentalControl.SetActive(false); // BackToPanelControler (); PlayerPrefs.SetString("activateParentel", activateParentel.ToString()); } else if (_status == 1) { WarningText.text = "Parental control successfully Enabled!"; activateParentel = true; StatusForButton.text = "Disable"; ButtonText.text = StatusForButton.text; ShowPopUpMessage("Parental Control Enabled"); // disableParentalControl.SetActive (true); PanelControlerLogin(); // enableParentalControl.SetActive(false); // BackToPanelControler (); PlayerPrefs.SetString("activateParentel", activateParentel.ToString()); } ClearInputFeild(); } else { ClearInputFeild(); WarningText.gameObject.SetActive(true); WarningText.text = _jsnode ["description"].ToString().Trim('"'); } } }
public IEnumerator IeGetSocietyAchievements(int society_id) { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); jsonElement ["data_type"] = "get_achievement"; jsonElement ["player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); jsonElement ["society_id"] = society_id.ToString(); postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(SocietyLink, encoding.GetBytes(jsonElement.ToString()), postHeader); print("jsonDtat is ==>> " + jsonElement.ToString()); yield return(www); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); print("_jsnode ==>> " + _jsnode.ToString()); if (_jsnode ["status"].ToString().Contains("200")) { JSONNode data = _jsnode ["data"]; int.TryParse(data ["role_id"].ToString().Trim('"'), out myRole); } } }
public IEnumerator IeGetMyRole(Society society) { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); ScreenAndPopupCall.Instance.LoadingScreen(); // "data_type" : "get_role", jsonElement ["data_type"] = "get_role"; jsonElement ["player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); jsonElement ["society_id"] = society.Id.ToString(); postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(SocietyLink, encoding.GetBytes(jsonElement.ToString()), postHeader); print("jsonDtat is ==>> " + jsonElement.ToString()); yield return(www); ScreenAndPopupCall.Instance.LoadingScreenClose(); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); print("_jsnode ==>> " + _jsnode.ToString()); // "description": "Player`s role is following.", if (_jsnode ["description"].ToString().Contains("Player`s role is following") || _jsnode ["status"].ToString().Contains("200")) { JSONNode data = _jsnode ["data"]; int.TryParse(data ["role_id"].ToString().Trim('"'), out myRole); var societyDescriptionController = ScreenManager.Instance.Admin_MemberDiscriptionPanel.GetComponent <SocietyDescriptionController> (); societyDescriptionController.OpenSocietyDiscription(myRole, society); // switch(myRole) // { // case 0: // // break; // case 1: // break; // case 2: // break; // case 3: // break; // default: // break; // } } else if (_jsnode ["description"].ToString().Contains("This player is not found in this society") || _jsnode ["status"].ToString().Contains("400")) { myRole = 3; var societyDescriptionController = ScreenManager.Instance.Admin_MemberDiscriptionPanel.GetComponent <SocietyDescriptionController> (); societyDescriptionController.OpenSocietyDiscription(myRole, society); } } }
public IEnumerator ParentleRegister(string _email, string _password) { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); jsonElement ["player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); jsonElement ["player_email"] = PlayerPrefs.GetString("UserEmail"); jsonElement ["parental_email_id"] = _email; jsonElement ["parental_password"] = _password; postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(parentleActivateLink, encoding.GetBytes(jsonElement.ToString()), postHeader); print("jsonDtat is ==>> " + jsonElement.ToString()); yield return(www); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); print("_jsnode ==>> " + _jsnode.ToString()); if (_jsnode ["status"].ToString().Contains("200") && _jsnode ["description"].ToString().Contains("Player`s parental control has saved successfully")) { activateParentel = true; PlayerPrefs.SetString("activateParentel", activateParentel.ToString()); WarningText.text = WarningText.text = _jsnode ["description"].ToString().Trim('"'); PlayerPrefs.SetString("ParentelEmail", _userEmail); ClearInputFeild(); if (SceneManager.GetActiveScene().name == "GamePlay") { StatusForButton.text = "Disable"; ButtonText.text = StatusForButton.text; // disableParentalControl.SetActive (true); enableParentalControl.SetActive(false); PanelControlerLogin(); ShowPopUpMessage("Parental Control Enabled"); } if (SceneManager.GetActiveScene().name == "00_LoginScene") { CharacterCustomizationAtStart.Instance.CameraEnebleDesable(false); CharacterCustomizationAtStart.Instance.ShowConfirmationPopUpParentelScreen(false); } } else { ClearInputFeild(); WarningText.gameObject.SetActive(true); WarningText.text = _jsnode ["description"].ToString().Trim('"'); } } }
public IEnumerator IeUpdateParty(int updateTime) { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); jsonElement ["player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); jsonElement ["party_name"] = HostPartyManager.Instance.selectedFlatParty.Name; jsonElement ["party_desc"] = HostPartyManager.Instance.selectedFlatParty.Description; jsonElement ["max_no_of_guests"] = HostPartyManager.Instance.selectedFlatParty.TotleMember.ToString(); // string eTime = ExtensionMethods.GetTimeStringFromFloat (PartyTime); // DateTime EndTime = Convert.ToDateTime (eTime); // var PEndTime = HostPartyManager.Instance.selectedFlatParty.PartyEndTime.AddSeconds (updateTime); // DateTime EndTime = PEndTime; DateTime EndTime = HostPartyManager.Instance.selectedFlatParty.PartyEndTime.AddSeconds(updateTime); print(EndTime); jsonElement ["party_end_time"] = EndTime.ToString(); if (HostPartyManager.Instance.selectedFlatParty.PartyType) { jsonElement ["party_type"] = "2"; } else { jsonElement ["party_type"] = "1"; } jsonElement ["no_of_present_member"] = "1"; postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(HostPartyLink, encoding.GetBytes(jsonElement.ToString()), postHeader); print("jsonDtat is ==>> " + jsonElement.ToString()); yield return(www); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); print("_jsnode ==>> " + _jsnode.ToString()); if (isPaid) { if (_jsnode ["status"].ToString().Contains("200") && _jsnode ["description"].ToString().Contains("Your flat party has been updated successfully")) { TimeExtended = true; UpdateMyRunningParty(updateTime); } } } }
public IEnumerator IGetAllPlayers(int society_id) { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); jsonElement ["data_type"] = "get_member"; jsonElement ["player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); jsonElement ["society_id"] = society_id.ToString(); postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(SocietyLink, encoding.GetBytes(jsonElement.ToString()), postHeader); print("jsonDtat is ==>> " + jsonElement.ToString()); yield return(www); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); print("_jsnode ==>> " + _jsnode.ToString()); if (_jsnode ["status"].ToString().Contains("400") || _jsnode ["status"].ToString().Contains("200")) { JSONNode data = _jsnode ["data"]; _allMembers.Clear(); int _id = 0; int _role = 0; int _society_id = 0; int _level = 0; string _name = ""; for (int i = 0; i < data.Count; i++) { int.TryParse(data [i] ["player_id"].ToString().Trim('"'), out _id); int.TryParse(data [i] ["role_id"].ToString().Trim('"'), out _role); int.TryParse(data [i] ["society_id"].ToString().Trim('"'), out _society_id); int.TryParse(data [i] ["level_number"].ToString().Trim('"'), out _level); _name = data [i] ["player_name"].ToString().Trim('"'); var newMember = new SocietyMembers(_id, _name, _role, _society_id, _level); _allMembers.Add(newMember); } _totalPlayers.text = _allMembers.Count.ToString() + "/50"; } } else { print(www.error.ToString()); } }
public IEnumerator IeJoinSociety(int playerId, int society_Id, int invitationid, GameObject go = null) { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); jsonElement ["data_type"] = "join"; jsonElement ["player_id"] = playerId.ToString(); jsonElement ["society_id"] = society_Id.ToString(); jsonElement ["level_number"] = "1"; postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(SocietyLink, encoding.GetBytes(jsonElement.ToString()), postHeader); print("jsonDtat is ==>> " + jsonElement.ToString()); yield return(www); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); print("_jsnode ==>> " + _jsnode.ToString()); if (_jsnode ["description"].ToString().Contains("Your have joined society successfully.") || _jsnode ["status"].ToString().Contains("200")) { ShowPopUp("Member added successfully.", null); if (go != null) { NotificationManager.Instance.DeleteInvitation(invitationid, go); } NotificationManager.Instance.SendNotificationToUser(playerId, string.Format("Your request to join the \"{0}\" society is accepted", SelectedSociety.Name)); yield return(true); } else if (_jsnode ["description"].ToString().Contains("This player id has already join any society") && _jsnode ["status"].ToString().Contains("400")) { ShowPopUp("Already a member of a society.", null); yield return(false); // if (go != null) // NotificationManager.Instance.DeleteInvitation (invitationid, go); } else if (_jsnode ["description"].ToString().Contains("Members limit has not crossed")) { ShowPopUp("Society has reached maximum limit of members", null); yield return(false); } } }
public IEnumerator IeDeletePlayer(int player_id) { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); jsonElement ["data_type"] = "delete_member"; jsonElement ["player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); jsonElement ["delete_player_id"] = player_id.ToString(); jsonElement ["society_id"] = SelectedSociety.Id.ToString(); postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(SocietyLink, encoding.GetBytes(jsonElement.ToString()), postHeader); print("jsonDtat is ==>> " + jsonElement.ToString()); yield return(www); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); print("_jsnode ==>> " + _jsnode.ToString()); if (_jsnode ["status"].ToString().Contains("200")) { print("success"); if (!_reported) { ShowPopUp("Player has been removed from society", () => { StartCoroutine(IeGetMyRole(SelectedSociety)); if (player_id == PlayerPrefs.GetInt("PlayerId")) { } else { SocietyDescriptionController.Instance.SocietyMemberList(true); } }); } else { ShowPopUp("Your report has been sent to the Admin he will take action shortly", () => StartCoroutine(IeGetMyRole(SelectedSociety))); _reported = false; } NotificationManager.Instance.SendNotificationToUser(player_id, string.Format("You have been removed out of \"{0}\" society", SelectedSociety.Name)); } } }
IEnumerator GetPlayerSocietyName(int thisPlayerId) { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); jsonElement ["data_type"] = "search"; jsonElement ["search_type"] = "mine"; jsonElement ["keyword"] = ""; jsonElement ["player_id"] = thisPlayerId.ToString(); postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(GetCurruntSocietyName, encoding.GetBytes(jsonElement.ToString()), postHeader); print("jsonDtat is ==>> " + jsonElement.ToString()); yield return(www); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); print("_jsnode ==>> " + _jsnode.ToString()); if (_jsnode ["status"].ToString().Contains("200") && _jsnode ["description"].ToString().Contains("Societies are following according your search")) { var playerData = _jsnode ["data"]; if (thisPlayerId == PlayerPrefs.GetInt("PlayerId")) { CurruntSocietyName.text = playerData [0] ["society_name"].ToString().Trim('\"'); } else { FriendProfileManager.Instance.CurruntSociety.text = playerData [0] ["society_name"].ToString().Trim('\"'); } } else if (_jsnode ["status"].ToString().Contains("400") && _jsnode ["description"].ToString().Contains("Your society list has empty")) { if (thisPlayerId == PlayerPrefs.GetInt("PlayerId")) { CurruntSocietyName.text = " - "; } else { FriendProfileManager.Instance.CurruntSociety.text = " - "; } } } }
public IEnumerator IeGetOtherBlockUserProfile() { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); jsonElement ["player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(GetBlockUserProfileOther, encoding.GetBytes(jsonElement.ToString()), postHeader); print("jsonDtat is ==>> " + jsonElement.ToString()); yield return(www); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); print("_jsnode ==>> " + _jsnode.ToString()); if (_jsnode ["status"].ToString().Contains("200") && _jsnode ["description"].ToString().Contains("Blocked players list has followed")) { /// Fatch Blocke List var JsonData = _jsnode ["data"]; BlockeList temList = null; for (int i = 0; i < JsonData.Count; i++) { // GameObject Go = GameObject.Instantiate (BlockUseePrefeb, Vector3.zero, Quaternion.identity) as GameObject; int playerId = 0; int.TryParse(JsonData [i] ["id"], out playerId); // Go.GetComponent<AddFriendUi> ().thisData.Id = playerId; // Go.GetComponent<AddFriendUi> ().thisData.Username = JsonData [i] ["name"]; // Go.GetComponent<AddFriendUi> ().thisData.Type = FriendData.FriendType.BlockedBy; // Go.transform.parent = BlockListContainer.transform; // temList = new BlockeList(playerId, JsonData [i] ["name"].ToString().Trim('\"')); BlockedByList.Add(temList); } // ScreenAndPopupCall.Instance.MyProfileBlockListPopup (); // if (BlockListContainer.transform.childCount == 0) // ScreenManager.Instance.MyProfileBlockList.transform.GetChild (1).transform.GetChild (3).gameObject.SetActive (true); // else // ScreenManager.Instance.MyProfileBlockList.transform.GetChild (1).transform.GetChild (3).gameObject.SetActive (false); // BlockListContainer.transform.parent.parent.parent.GetChild (2).GetComponent<Text> ().text = "BLOCKED BY USER LIST"; } } }
IEnumerator IDeleteNotification() { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); jsonElement ["data_type"] = "delete"; jsonElement ["player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(NotificationUrl, encoding.GetBytes(jsonElement.ToString()), postHeader); // print ("jsonDtat is ==>> " + jsonElement.ToString ()); yield return(www); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); // print ("_jsnode ==>> " + _jsnode.ToString ()); if (_jsnode ["status"].ToString().Contains("200")) { // print ("Success"); CreateNotifications(new List <Notifications> ()); yield return(true); } } }
public IEnumerator ISendNotificationtoUser(int playerId, string message) { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); jsonElement ["data_type"] = "save"; jsonElement ["sender_player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); jsonElement ["reciever_player_id"] = playerId.ToString(); jsonElement ["message"] = message; postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(NotificationUrl, encoding.GetBytes(jsonElement.ToString()), postHeader); // print ("jsonDtat is ==>> " + jsonElement.ToString ()); yield return(www); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); print("_jsnode ==>> " + _jsnode.ToString()); if (_jsnode ["status"].ToString().Contains("200")) { // print ("Success"); IndicationManager.Instance.SendIndicationToUsers(new int[] { playerId }, "Notification"); yield return(true); } } }
// public void DeleteFlatParty () // { // StartCoroutine (IDeleteAllFlatParty ()); // // } // // public IEnumerator IDeleteAllFlatParty () // { // ScreenAndPopupCall.Instance.LoadingScreen (); // var encoding = new System.Text.UTF8Encoding (); // // Dictionary<string,string> postHeader = new Dictionary<string,string> (); // var jsonElement = new Simple_JSON.JSONClass (); // // // // pageNo.ToString (); // jsonElement ["player_id"] = PlayerPrefs.GetInt ("PlayerId").ToString (); // jsonElement ["flat_party_id"] = PlayerPrefs.GetInt ("flat_party_id").ToString (); // // postHeader.Add ("Content-Type", "application/json"); // postHeader.Add ("Content-Length", jsonElement.Count.ToString ()); // // WWW www = new WWW (DeleteFlatPartyLink, encoding.GetBytes (jsonElement.ToString ()), postHeader); // // print ("jsonDtat is ==>> " + jsonElement.ToString ()); // yield return www; // // if (www.error == null) { // JSONNode _jsnode = Simple_JSON.JSON.Parse (www.text); // print ("_jsnode ==>> " + _jsnode.ToString ()); // if (_jsnode ["status"].ToString ().Contains ("200") || _jsnode ["description"].ToString ().Contains ("Flat party has removed successfully")) { // // print ("flat party deleted from flatparty hosting controler"); // // } // } // ScreenAndPopupCall.Instance.LoadingScreenClose (); // } public IEnumerator IDeleteSelectedFlatParty(int flatNo) { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); // pageNo.ToString (); jsonElement ["player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); jsonElement ["flat_party_id"] = flatNo.ToString(); postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(DeleteFlatPartyLink, encoding.GetBytes(jsonElement.ToString()), postHeader); // print ("jsonDtat is ==>> " + jsonElement.ToString ()); yield return(www); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); // print ("_jsnode ==>> " + _jsnode.ToString ()); if (_jsnode ["status"].ToString().Contains("200") || _jsnode ["description"].ToString().Contains("Flat party has removed successfully")) { // print ("flat party deleted from host party manager list"); } } }
IEnumerator IGetAllDecorInSocietyRoom(int societyId) { PlacedDecorInRoom.Clear(); var link = "http://pinekix.ignivastaging.com/decors/getDecorSocietyData"; var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); jsonElement ["player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); jsonElement ["society_id"] = societyId.ToString(); postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(link, encoding.GetBytes(jsonElement.ToString()), postHeader); yield return(www); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); print("_jsnode ==>> " + _jsnode.ToString()); //TODO if (_jsnode["status"].ToString().Contains("200") || _jsnode["description"].ToString().Contains("Data is following.")) { // "data": [ // { // "id": "12", // "player_id": "101", // "society_id": "56", // "item_id": "39", // "position": "", // "rotation": "" // } // ] var data = _jsnode["data"]; for (int i = 0; i < data.Count; i++) { var item = data[i]; var sd = new SocietyDecor(); int id = 0; int.TryParse(item["item_id"], out id); string posString = item["position"].Value; int rotation = 0; int.TryParse(item["rotation"], out rotation); sd.Id = id; sd.Position = Decor3DView.DeserializeVector3Array(posString); sd.Rotation = rotation; // sd.Prefab = FindDecorWithId(id); PlacedDecorInRoom.Add(sd); } CreatePlacedDecor(); } } }
public IEnumerator BlockPlayer(int BlockplayerId) { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); jsonElement ["blocked_by_player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); jsonElement ["blocked_to_player_id"] = BlockplayerId.ToString(); postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(BlockPlayerLink, encoding.GetBytes(jsonElement.ToString()), postHeader); print("jsonDtat is ==>> " + jsonElement.ToString()); yield return(www); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); print("_jsnode ==>> " + _jsnode.ToString()); if (_jsnode ["status"].ToString().Contains("200") && _jsnode ["description"].ToString().Contains("Player has blocked successfully.")) { ScreenManager.Instance.ClosePopup(); BlockButton.SetActive(false); UnblockButton.SetActive(true); AddFriendButton.SetActive(false); ShowPopUpErrorMsg("Player has blocked successfully."); } else if (_jsnode ["status"].ToString().Contains("200") && _jsnode ["description"].ToString().Contains("You have already block this player.")) { ScreenManager.Instance.ClosePopup(); BlockButton.SetActive(false); UnblockButton.SetActive(true); AddFriendButton.SetActive(false); ShowPopUpErrorMsg("You have already block this player."); } else { ScreenManager.Instance.ClosePopup(); ShowPopUpErrorMsg("Somthing went wrong!!!"); } } }
public IEnumerator ParentleLogIn(string _email, string _password) { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); jsonElement ["player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); jsonElement ["parental_email_id"] = _email; jsonElement ["parental_password"] = _password; postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(parentleLogInLink, encoding.GetBytes(jsonElement.ToString()), postHeader); print("jsonDtat is ==>> " + jsonElement.ToString()); yield return(www); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); print("_jsnode of Login or enable Parental -->> ==>> " + _jsnode.ToString()); if (_jsnode ["status"].ToString().Contains("200") && _jsnode ["description"].ToString().Contains("Player parental control details are following")) { if (_jsnode ["data"] ["parental_status"].ToString().Contains("1")) { StartCoroutine(UpdateStatusOfParentalControl(2)); } else if (_jsnode ["data"] ["parental_status"].ToString().Contains("2")) { StartCoroutine(UpdateStatusOfParentalControl(1)); } // ShowPopUpMessage ("Parental Enabled"); } else { ClearInputFeild(); WarningText.gameObject.SetActive(true); WarningText.text = _jsnode ["description"].ToString().Trim('"'); } } }
IEnumerator IeReportSociety(int society_Id, string message) { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); jsonElement ["data_type"] = "save_report"; jsonElement ["player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); jsonElement ["society_id"] = society_Id.ToString(); jsonElement ["message"] = message; postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(SocietyLink, encoding.GetBytes(jsonElement.ToString()), postHeader); print("jsonDtat is ==>> " + jsonElement.ToString()); yield return(www); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); print("_jsnode ==>> " + _jsnode.ToString()); if (_jsnode ["description"].ToString().Contains("successfully") || _jsnode ["status"].ToString().Contains("200")) { _reported = true; if (myRole == 3) { ScreenManager.Instance.ClosePopup(); ShowPopUp("Your report has been sent to the Admin he will take action shortly", null); } else if (myRole < 3) { yield return(IeDeletePlayer(PlayerPrefs.GetInt("PlayerId"))); } } else if (_jsnode ["status"].ToString().Contains("400")) { ShowPopUp("You already reported this society.", null); } } }
public IEnumerator IeUpdateRole(int role, int player_id, int level) { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); jsonElement ["data_type"] = "update"; jsonElement ["role_id"] = role.ToString(); jsonElement ["player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); jsonElement ["updated_player_id"] = player_id.ToString(); jsonElement ["society_id"] = SelectedSociety.Id.ToString(); jsonElement ["level_number"] = level.ToString(); postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(SocietyLink, encoding.GetBytes(jsonElement.ToString()), postHeader); print("jsonDtat is ==>> " + jsonElement.ToString()); yield return(www); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); print("_jsnode ==>> " + _jsnode.ToString()); if (_jsnode ["status"].ToString().Contains("200")) { print("success"); yield return(true); } else { yield return(false); } SocietyManager.Instance.StartCoroutine(SocietyManager.Instance.IeGetMyRole(SocietyManager.Instance.SelectedSociety)); SocietyDescriptionController.Instance.SocietyMemberList(true); } else { yield return(false); } }
public IEnumerator IeSwapPresident(string id) { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); ScreenAndPopupCall.Instance.LoadingScreen(); // "data_type" : "get_role", jsonElement ["data_type"] = "update_president_role"; jsonElement ["player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); jsonElement ["society_id"] = SelectedSociety.Id.ToString(); jsonElement ["president_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); jsonElement ["commity_member_id"] = id; postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(SocietyLink, encoding.GetBytes(jsonElement.ToString()), postHeader); print("jsonDtat is ==>> " + jsonElement.ToString()); yield return(www); ScreenAndPopupCall.Instance.LoadingScreenClose(); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); print("_jsnode ==>> " + _jsnode.ToString()); // "description": "Player`s role is following.", if (_jsnode ["description"].ToString().Contains("Player`s role is following") || _jsnode ["status"].ToString().Contains("200")) { yield return(true); } else if (_jsnode ["description"].ToString().Contains("This player is not found in this society") || _jsnode ["status"].ToString().Contains("400")) { yield return(false); } } else { yield return(false); } }
IEnumerator SendFreindrequestToUser(GameObject Go, string friendName, int FriendId) { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); jsonElement ["sender_player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); jsonElement ["receiver_player_id"] = FriendId.ToString(); string json = PlayerPrefs.GetString("UserName") + "_" + friendName + "_" + " Hey! Add me as your friend"; // json ["SenderUserName"] = PlayerPrefs.GetString ("UserName"); // json ["RealMessage"] = "Hey! Add me as your friend "; jsonElement ["message"] = json.ToString(); jsonElement ["data_type"] = "send_friend_request"; postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(FriendActionUrl, encoding.GetBytes(jsonElement.ToString()), postHeader); // print ("jsonDtat is ==>> " + jsonElement.ToString ()); yield return(www); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); // print ("www.text ==>> " + www.text); // print ("_jsnode ==>> " + _jsnode.ToString ()); if (_jsnode ["description"].ToString().Contains("success") || _jsnode ["status"].ToString().Contains("200")) { // print (_jsnode ["description"]); ScreenManager.Instance.ClosePopup(); if (Go) { Go.GetComponent <AddFriendUi> ().AddButton.interactable = false; Go.GetComponent <AddFriendUi> ().AddButton.GetComponentInChildren <Text> ().text = "Pending"; } PushScript.Instance.SendPushToUser(friendName, "You have recieved a new friend request from " + PlayerPrefs.GetString("UserName")); IndicationManager.Instance.SendIndicationToUsers(new int[] { FriendId }, "Request"); FriendProfileManager.Instance.PendingRequest.SetActive(true); FriendProfileManager.Instance.AddFriendButton.SetActive(false); ShowPopUp("Friend request has been sent successfully."); } else if (_jsnode ["description"].ToString().Contains("already send") || _jsnode ["status"].ToString().Contains("400")) { FriendProfileManager.Instance.PendingRequest.SetActive(false); FriendProfileManager.Instance.AddFriendButton.SetActive(true); ShowPopUp("The player has already sent a friend request to you."); } } }
IEnumerator IGetNotifications() { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); jsonElement ["data_type"] = "view"; jsonElement ["player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); WWW www = new WWW(NotificationUrl, encoding.GetBytes(jsonElement.ToString()), postHeader); // print ("jsonDtat is ==>> " + jsonElement.ToString ()); yield return(www); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); // print ("_jsnode ==>> " + _jsnode.ToString ()); List <Notifications> Notifications = new List <Notifications> (); if (_jsnode ["status"].ToString().Contains("200") || _jsnode ["description"].ToString().Contains("Invitations are following")) { var data = _jsnode ["data"]; // {"status":"200","description":"Messages are following.","data":[{"sender_id":"119","reciever_id":"111","message":"1asdasdasdsad"}]} for (int i = 0; i < data.Count; i++) { int friendId = 0; int.TryParse(data [i] ["sender_id"], out friendId); string message = data [i] ["message"]; string Title = ""; if (message.Contains("society")) { Title = "Society"; } else { Title = "Notification"; } Notifications Notif = new Notifications(message, Title); Notifications.Add(Notif); } } else if (_jsnode ["status"].ToString().Contains("400")) { } CreateNotifications(Notifications); } }
public IEnumerator KickOutPlayer(int Id) { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); int thisPlayerId = this.transform.parent.parent.GetComponent <PlayerNetworkForFlatParty> ().PlayerDataForFlatParty.player_id; jsonElement ["player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); jsonElement ["party_id"] = HostPartyManager.Instance.selectedFlatParty.Id.ToString(); jsonElement ["party_type"] = "1"; jsonElement ["kicked_out_player_id"] = thisPlayerId.ToString(); postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(KickOutPlayerData, encoding.GetBytes(jsonElement.ToString()), postHeader); print("jsonDtat is ==>> " + jsonElement.ToString()); yield return(www); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); print("_jsnode ==>> " + _jsnode.ToString()); if (_jsnode ["status"].ToString().Contains("200") && _jsnode ["description"].ToString().Contains("Player has kicked out successfully")) { PhotonNetwork.CloseConnection(PhotonPlayer.Find(Id)); this.transform.parent.gameObject.transform.localScale = Vector3.zero; this.transform.parent.parent.GetComponent <RemoveThisPlayer> ().ObjState = false; ScreenManager.Instance.ClosePopup(); } if (_jsnode ["status"].ToString().Contains("200") && _jsnode ["description"].ToString().Contains("This party has not available")) { this.transform.parent.gameObject.transform.localScale = Vector3.zero; this.transform.parent.parent.GetComponent <RemoveThisPlayer> ().ObjState = false; ScreenManager.Instance.ClosePopup(); } } }
IEnumerator ISendIndicationToUsers(int[] UserIds, string Indication, string message) { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); // { // "data_type": "save", // "players": [{"id" : 10}, { "id" : 11}], // "message":"hkjsflkasd alksndflaksd alsjkdaksd asd", // "message_type":"test" // } jsonElement ["data_type"] = "save"; var jsonarray = new Simple_JSON.JSONArray(); foreach (int id in UserIds) { var jsonItem = new Simple_JSON.JSONClass(); jsonItem ["id"] = id.ToString(); jsonarray.Add(jsonItem); } jsonElement ["players"] = jsonarray; jsonElement ["message"] = message; jsonElement ["message_type"] = Indication; postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(PinekixUrls.IndicationUrl, encoding.GetBytes(jsonElement.ToString()), postHeader); // print ("jsonDtat is ==>> " + jsonElement.ToString ()); yield return(www); if (www.error == null) { Simple_JSON.JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); if (_jsnode ["description"].ToString().Contains("Data has following") || _jsnode ["status"].ToString().Contains("200")) { } else { } } else { } }
public IEnumerator ReportThisPlayer(int playerId, string reportMsg) { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); jsonElement ["player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); jsonElement ["reported_player_id"] = playerId.ToString(); jsonElement ["message"] = reportMsg; postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(ReportLink, encoding.GetBytes(jsonElement.ToString()), postHeader); print("jsonDtat is ==>> " + jsonElement.ToString()); yield return(www); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); print("_jsnode ==>> " + _jsnode.ToString()); if (_jsnode ["status"].ToString().Contains("200") && _jsnode ["description"].ToString().Contains("Your report has saved successfully")) { ScreenManager.Instance.ClosePopup(); ShowPopUpErrorMsg("Your have reported successfully to " + seletedPlayerData.Username + "."); } else if (_jsnode ["status"].ToString().Contains("400") && _jsnode ["description"].ToString().Contains("You have already reported this player.")) { ShowPopUpErrorMsg("You have reported already to " + seletedPlayerData.Username + "."); } else { ShowPopUpErrorMsg("Somthing went wrong!!! Please try again."); } } }
IEnumerator GetUpdatedAchievements() { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); jsonElement ["player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(LinkToGetUpdatedAchievements, encoding.GetBytes(jsonElement.ToString()), postHeader); // print ("jsonDtat is ==>> " + jsonElement.ToString ()); yield return(www); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); // print ("_jsnode ==>> " + _jsnode.ToString ()); if (_jsnode ["status"].ToString().Contains("200") && _jsnode ["description"].ToString().Contains("Achievements count are following.")) { // AchievementData data = new AchievementData ("Ankush", 1, 1, 1, 1); var data = _jsnode ["data"] [0]; int.TryParse(data ["flatmate_recruit"], out flatmateRecruited); int.TryParse(data ["complete_university_class"], out completeUniversityClasses); int.TryParse(data ["real_player_level"], out realPlayerLevel); int.TryParse(data ["flat_upgrades"], out flatsUpgrade); int.TryParse(data ["furniture_acquisition"], out furnitureAcquisition); int.TryParse(data ["clothing_acquisition"], out clothesAcquisition); int.TryParse(data ["enter_university_events"], out enterUniversityEvents); int.TryParse(data ["win_university_events"], out winUniversityEvents); int.TryParse(data ["vote_for_friends"], out voteForFriends); int.TryParse(data ["complete_quests"], out completeQuests); int.TryParse(data ["visit_multiplayer_area"], out visitMultiplayerAreas); int.TryParse(data ["host_flat_parties"], out hostFlatParties); int.TryParse(data ["attend_society_parties"], out attendSocietyParties); int.TryParse(data ["placement_rank_catwalk"], out placementRank_CatwalkEvent); int.TryParse(data ["placement_rank_society"], out placementRank_SocietyEvent); // CheckAchievementsToUpdate ("flatmateRecruited"); } else { } } }
public IEnumerator IDeleteIndication(int IndicationId) { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); jsonElement ["data_type"] = "delete"; jsonElement ["player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); jsonElement ["indication_id"] = IndicationId.ToString(); postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(PinekixUrls.IndicationUrl, encoding.GetBytes(jsonElement.ToString()), postHeader); // print ("jsonDtat is ==>> " + jsonElement.ToString ()); yield return(www); // {"status":"200","description":"Data has following.", // "data":[ // {"player_id":"10","message":"hkjsflkasd alksndflaksd alsjkdaksd asd","message_type":"test"}, // {"player_id":"10","message":"hkjsflkasd alksndflaksd alsjkdaksd asd","message_type":"test"} // ] // } if (www.error == null) { Simple_JSON.JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); if (_jsnode ["description"].ToString().Contains("Data has following") || _jsnode ["status"].ToString().Contains("200")) { } else { } } else { } }
public IEnumerator MyBlockUserList(bool show) { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); jsonElement ["player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(GetMyBlockUserProfile, encoding.GetBytes(jsonElement.ToString()), postHeader); print("jsonDtat is ==>> " + jsonElement.ToString()); yield return(www); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); print("_jsnode ==>> " + _jsnode.ToString()); if (_jsnode ["status"].ToString().Contains("200") && _jsnode ["description"].ToString().Contains("Blocked players list has followed.")) { /// Fatch Blocke List var JsonData = _jsnode ["data"]; BlockeList temList = null; for (int i = 0; i < JsonData.Count; i++) { GameObject Go = GameObject.Instantiate(BlockUserPrefeb, Vector3.zero, Quaternion.identity) as GameObject; int playerId = 0; int.TryParse(JsonData [i] ["id"], out playerId); Go.GetComponent <AddFriendUi> ().thisData.Id = playerId; Go.GetComponent <AddFriendUi> ().thisData.Username = JsonData [i] ["name"]; Go.GetComponent <AddFriendUi> ().thisData.Type = FriendData.FriendType.Blocked; //ToDo: if (show) { ShowBlockList = true; Go.GetComponent <AddFriendUi> ().AddButton.onClick.RemoveAllListeners(); Go.GetComponent <AddFriendUi> ().AddButton.onClick.AddListener(() => FriendProfileManager.Instance.ActiveBackButtonForUserProfile()); } else { ShowBlockList = false; } Go.transform.parent = BlockListContainer.transform; // add into block List temList = new BlockeList(playerId, JsonData [i] ["name"].ToString().Trim('\"')); MyBlockList.Add(temList); } if (show) { ScreenAndPopupCall.Instance.MyProfileBlockListPopup(); } if (BlockListContainer.transform.childCount == 0) { ScreenManager.Instance.MyProfileBlockList.transform.GetChild(1).transform.GetChild(3).gameObject.SetActive(true); } else { ScreenManager.Instance.MyProfileBlockList.transform.GetChild(1).transform.GetChild(3).gameObject.SetActive(false); } BlockListContainer.transform.parent.parent.parent.GetChild(2).GetComponent <Text> ().text = "BLOCKED LIST"; } else if (_jsnode ["status"].ToString().Contains("200") && _jsnode ["description"].ToString().Contains("No data has found.")) { if (show) { ShowPopUpErrorMsg(" You have not blocked anyone yet."); } } } }
IEnumerator UpdateStatusOfRequest(string friendName, int FriendId, int status, GameObject Go = null) { var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); jsonElement ["sender_player_id"] = FriendId.ToString(); jsonElement ["receiver_player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); jsonElement ["message"] = friendName + "_" + PlayerPrefs.GetString("UserName") + "_" + " Hey! Add me as your friend "; jsonElement ["status"] = status.ToString(); jsonElement ["data_type"] = "accept_or_reject_FR"; // { // "sender_player_id": 206, // "receiver_player_id":100, // "message": "Friend Request accepted" // "status": 1, // "data_type": "accept_or_reject_FR" // } postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(FriendActionUrl, encoding.GetBytes(jsonElement.ToString()), postHeader); // print ("jsonDtat is ==>> " + jsonElement.ToString ()); yield return(www); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); // print ("www.text ==>> " + www.text); // print ("_jsnode ==>> " + _jsnode.ToString ()); if (_jsnode ["description"].ToString().Contains("success") || _jsnode ["status"].ToString().Contains("200")) { var temp = new List <FriendData> (); foreach (var rqusts in NewRequests) { if (rqusts.Id != FriendId) { temp.Add(rqusts); } NewRequests = temp; } if (Go) { Destroy(Go); } // ShowPopUp (_jsnode ["description"]); if (status == 1) { FriendProfileManager.Instance.UnblockButton.SetActive(false); FriendProfileManager.Instance.BlockButton.SetActive(true); FriendProfileManager.Instance.AddFriendButton.SetActive(false); FriendProfileManager.Instance.Accept.SetActive(false); FriendProfileManager.Instance.Decline.SetActive(false); FriendProfileManager.Instance.PendingRequest.SetActive(false); } else if (status == 2) { FriendProfileManager.Instance.UnblockButton.SetActive(false); FriendProfileManager.Instance.BlockButton.SetActive(true); FriendProfileManager.Instance.AddFriendButton.SetActive(true); FriendProfileManager.Instance.Accept.SetActive(false); FriendProfileManager.Instance.Decline.SetActive(false); FriendProfileManager.Instance.PendingRequest.SetActive(false); } } // else if (_jsnode ["description"].ToString ().Contains ("You have not recieved friend request from this user") || _jsnode ["status"].ToString ().Contains ("400")) // ShowPopUp (_jsnode ["description"]); ScreenManager.Instance.ClosePopup(); yield return(StartCoroutine(GetAllFriendsList(false))); yield return(StartCoroutine(GetAllFriendRequests(false))); } }
IEnumerator GetAllFriendRequests(bool OpneScreen) { NewRequests.Clear(); var encoding = new System.Text.UTF8Encoding(); Dictionary <string, string> postHeader = new Dictionary <string, string> (); var jsonElement = new Simple_JSON.JSONClass(); jsonElement ["receiver_player_id"] = PlayerPrefs.GetInt("PlayerId").ToString(); jsonElement ["data_type"] = "get_recieved_friend_request"; postHeader.Add("Content-Type", "application/json"); postHeader.Add("Content-Length", jsonElement.Count.ToString()); WWW www = new WWW(FriendActionUrl, encoding.GetBytes(jsonElement.ToString()), postHeader); // print ("jsonDtat is ==>> " + jsonElement.ToString ()); yield return(www); if (www.error == null) { JSONNode _jsnode = Simple_JSON.JSON.Parse(www.text); // print ("www.text ==>> " + www.text); // print ("_jsnode ==>> " + _jsnode.ToString ()); if (_jsnode ["description"].ToString().Contains("success") || _jsnode ["status"].ToString().Contains("200")) { JSONNode data = _jsnode ["data"]; for (int i = 0; i < data.Count; i++) { FriendData friend = new FriendData(); var senderid = int.Parse(data [i] ["sender_player_id"]); var receiverid = int.Parse(data [i] ["receiver_player_id"]); string jsonString = data [i] ["message"].ToString(); var Values = jsonString.Split('_'); if (senderid == PlayerPrefs.GetInt("PlayerId")) { friend.Id = receiverid; friend.Username = Values [1].ToString().Trim('"').Trim('\\').Trim('\"'); } else { friend.Id = senderid; friend.Username = Values [0].ToString().Trim('"').Trim('\\').Trim('\"'); } friend.Message = Values [2].ToString().Trim('"').Trim('\\').Trim('\"'); friend.Status = int.Parse(data [i] ["status"]); friend.Type = FriendData.FriendType.Request; NewRequests.Add(friend); } } if (OpneScreen) { CreateAllRequestForUi(); IndicationManager.Instance.IncrementIndicationForRequest(4); } } }