public void OnPartyLeaveFunction() { var Button = GameManager.Instance.GetComponent <Tutorial> (); selectedFlatParty = null; Button.AllButtons [0].transform.parent.gameObject.SetActive(true); Button.AllButtons [6].gameObject.GetComponent <Image> ().enabled = true; Button.AllButtons [6].gameObject.SetActive(true); GameGUIControle(true); FlatPartyHostingControler.Instance.ScreenCanMove = false; ScreenAndPopupCall.Instance.CloseScreen(); HostPartyManager.Instance.AttendingParty = false; CheckPartyStatus(); if (GameObject.Find("FlatPartyPublicArea")) { Destroy(GameObject.Find("FlatPartyRoom")); } ScreenManager.Instance.RunningParty.transform.FindChild("Name").GetChild(0).GetComponent <Text> ().text = ""; ScreenManager.Instance.RunningParty.transform.FindChild("Members").GetChild(0).GetComponent <Text> ().text = ""; MultiplayerManager.Instance.LeavRoomForFlatParty(); MultiplayerManager.Instance.MoveOutOfPublicArea(); // MultiplayerManager.Instance._flatParty = false; var tut = GameManager.Instance.GetComponent <Tutorial> (); tut.DecreaseHostPartyTutorial(); }
public void CloseFlatPartyFromList() { var Button = GameManager.Instance.GetComponent <Tutorial> (); selectedFlatParty = null; Button.AllButtons [0].transform.parent.gameObject.SetActive(true); Button.AllButtons [6].gameObject.GetComponent <Image> ().enabled = true; Button.AllButtons [6].gameObject.SetActive(true); GameGUIControle(true); FlatPartyHostingControler.Instance.ScreenCanMove = false; ScreenAndPopupCall.Instance.CloseScreen(); HostPartyManager.Instance.AttendingParty = false; CheckPartyStatus(); MultiplayerManager.Instance.DisconnectNetworkForFlatParty(); }
public IEnumerator IEGetMyParty() { ScreenAndPopupCall.Instance.LoadingScreen(); 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(ViewMyFlatPartyLink, 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("Party data has followed")) { JSONNode data = _jsnode ["data"]; var FlatPartys = new List <HostParty> (); int partyId = 0; int.TryParse(data ["party_id"], out partyId); int playerId = 0; int.TryParse(data ["player_id"], out playerId); string Partyname = data ["party_name"]; string Partydescription = data ["party_desc"]; int max_no_of_guests = 0; int.TryParse(data ["max_no_of_guests"], out max_no_of_guests); //TODO; int partyType = 0; bool pTpye; int.TryParse(data ["party_type"], out partyType); if (partyType == 1) { pTpye = false; } else { pTpye = true; } DateTime TimeEnd = Convert.ToDateTime(data ["party_end_time"]); DateTime partyCreatedTime = Convert.ToDateTime(data ["party_created_time"]); int no_of_present_member = 0; int.TryParse(data ["no_of_present_member"], out no_of_present_member); int rooms; int.TryParse(data ["no_of_rooms"], out rooms); var AllDecorList = new List <FlatPartyHostingControler.GameItemPropties> (); var AllRoomList = new List <FlatPartyHostingControler.GameItemPropties> (); FlatPartyHostingControler.GameItemPropties Decoritem; FlatPartyHostingControler.GameItemPropties RoomItem; JSONNode Decordata = data ["items"]; for (int j = 0; j < Decordata.Count; j++) { int ChekcItemId = 0; int.TryParse(Decordata [j] ["item_id"], out ChekcItemId); if (ChekcItemId == 0) { int itemId = 0; int.TryParse(Decordata [j] ["item_id"], out itemId); string ItemTyp = ""; ItemTyp = Decordata [j] ["item_type"].ToString().Trim('"'); string properties = ""; properties = Decordata [j] ["properties"].ToString().Trim('"'); RoomItem = new FlatPartyHostingControler.GameItemPropties(itemId, ItemTyp, properties); AllRoomList.Add(RoomItem); } else { int itemId = 0; int.TryParse(Decordata [j] ["item_id"], out itemId); string ItemTyp = ""; ItemTyp = Decordata [j] ["item_type"].ToString().Trim('"'); string properties = ""; properties = Decordata [j] ["properties"].ToString().Trim('"'); Decoritem = new FlatPartyHostingControler.GameItemPropties(itemId, ItemTyp, properties); AllDecorList.Add(Decoritem); } } HostParty hosparty = new HostParty(playerId, partyId, Partyname, Partydescription, max_no_of_guests, pTpye, TimeEnd, no_of_present_member, rooms, AllDecorList, AllRoomList, partyCreatedTime); FlatPartys.Add(hosparty); _myFlatParty = FlatPartys; CreateMyFlatPartyList(_myFlatParty, MyFlatPartyContainer); } else if (_jsnode ["status"].ToString().Contains("400") || _jsnode ["description"].ToString().Contains("No party has found")) { AllFlatPartyParent.SetActive(false); MyFlatPartyParent.SetActive(true); AllFlatParty.Clear(); _myFlatParty.Clear(); CreateMyFlatPartyList(_myFlatParty, MyFlatPartyContainer); CreateButton.SetActive(true); } } ScreenAndPopupCall.Instance.LoadingScreenClose(); }