public void AddToTradeList(Player player, Field field) { if (player.NetworkPlayer == PhotonNetwork.LocalPlayer && myListings.Find(listing => listing.tradeField == field) == null) { TradeListing listing = myPool.TakeObject().GetComponent <TradeListing>(); listing.Init(this, myPool, field); myListings.Add(listing); } if (player.NetworkPlayer != PhotonNetwork.LocalPlayer && theirListings.Find(listing => listing.tradeField == field) == null) { TradeListing listing = theirPool.TakeObject().GetComponent <TradeListing>(); listing.Init(this, theirPool, field); theirListings.Add(listing); } }
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; }