public void Init() { foreach (string playerName in gc.session.playerOrder) { Player _player = GameplayController.instance.session.FindPlayer(playerName); IngamePlayerListing listing = basePool.TakeObject().GetComponent <IngamePlayerListing>(); listing.Init(_player, UIPanels); playerListings.Add(listing); } }
public void Init() { //Ustawianie przycisku rozpoczęcia gry na nieaktywny dla graczy, którzy nie są masterem startGameButton.SetActive(PhotonNetwork.LocalPlayer.IsMasterClient); //Wyłączanie możliwości rozpoczęcia gry bez spełnienia wymagań co do ilości i gotowości graczy if (PhotonNetwork.IsMasterClient) { startGameButton.GetComponent <Button>().interactable = false; } //ładowanie graczy foreach (Photon.Realtime.Player player in PhotonNetwork.PlayerList) { basePool.TakeObject().gameObject.GetComponent <PlayerListing>().Init(mainMenuController, player, basePool); } //animacja konca ladowania mainMenuController.loadingScreen.EndLoading(); }
private void FillReceiver(Player sender, List <Field> myBuildings, float myMoney, List <Field> theirBuildings, float theirMoney) { mainTitle.text = lC.GetWord("OFFER_FROM") + " " + sender.GetName(); theirTitle.text = lC.GetWord("IN_EXCHANGE_FOR_BUILDINGS_OF") + " " + sender.GetName(); myTitle.text = lC.GetWord("MY_ITEMS"); this.myMoney.text = myMoney.ToString(); this.theirMoney.text = theirMoney.ToString(); myListings.ForEach((listing) => { listing.DeInit(); }); myListings.Clear(); theirListings.ForEach((listing) => { listing.DeInit(); }); theirListings.Clear(); myBuildings?.ForEach((building) => { TradeListing t = myPool.TakeObject().GetComponent <TradeListing>(); t.Init(this, myPool, building, true); myListings.Add(t); }); theirBuildings?.ForEach((building) => { TradeListing t = theirPool.TakeObject().GetComponent <TradeListing>(); t.Init(this, theirPool, building, true); theirListings.Add(t); }); this.myMoney.interactable = false; this.theirMoney.interactable = false; closeButton.SetActive(false); addMyBuildingsButton.SetActive(false); addTheirBuildingsButton.SetActive(false); sendButton.SetActive(false); acceptDeclineGroup.SetActive(true); acceptDeclineGroup.GetComponentsInChildren <Button>()[0].interactable = true; acceptDeclineGroup.GetComponentsInChildren <Button>()[1].interactable = true; }
public void ListItems() { for (int i = 0; i < FileManager.GetSavesName().Count; i++) { string saveName = FileManager.GetSavesName()[i]; GameSave save = new GameSave(); FileManager.LoadGame(ref save, saveName); if (!save.IsCompatible()) { continue; } basePool.TakeObject().GetComponent <SaveListing>().Init(saveName, basePool, mainMenuController); } }
/// <summary> /// Rozmieszczanie przycisków w zależności od ich ilości /// </summary> private void InitButons() { QuestionPopup popup = source as QuestionPopup; foreach (Tuple <string, Popup.PopupAction> button in popup.buttons) { GameObject gameObject = buttonPool.TakeObject(); gameObject.GetComponentInChildren <TextMeshProUGUI>().text = button.Item1; gameObject.GetComponent <Button>().onClick.AddListener(delegate { button.Item2?.Invoke(source); }); showedButtons.Add(gameObject); } }
public override void OnRoomListUpdate(List <RoomInfo> roomList) { foreach (RoomInfo roomInfo in roomList) { if (roomListings.FirstOrDefault(x => x.roomInfo.Equals(roomInfo)) == null) { if (!roomInfo.RemovedFromList && roomInfo.PlayerCount != roomInfo.MaxPlayers) { RoomListing rL = basePool.TakeObject().GetComponent <RoomListing>(); rL.Init(roomInfo, this, basePool, mainMenuController); roomListings.Add(rL); } } } roomListings.RemoveAll(x => x.roomInfo.RemovedFromList); roomListings.RemoveAll(x => x.roomInfo.PlayerCount == x.roomInfo.MaxPlayers); roomListings.ForEach((roomListing) => { roomListing.Refresh(); }); }
private void FillContent(Player player, bool trading) { nickNameText.text = player.GetName(); moneyText.text = player.Money.ToString(); nickNameText.color = moneyText.color = player.MainColor; foreach (int placeId in player.GetOwnedPlaces()) { Field field = gc.board.GetField(placeId); BuildingListing listing = buildingsPool.TakeObject().GetComponent <BuildingListing>(); listing.Init(field, UIPanels, trading); buildingListings.Add(listing); } if (player.NetworkPlayer == PhotonNetwork.LocalPlayer) { title.text = lC.GetWord("YOUR_BUILDINGS"); } else { title.text = lC.GetWord("PLAYERS_BUILDINGS") == "Budynki gracza" ? lC.GetWord("PLAYERS_BUILDINGS") + " " + player.GetName() : player.GetName() + lC.GetWord("PLAYERS_BUILDINGS"); } }