public void Init(MarketPlaceScreen marketPlaceWidget, int id, ToggleGroup group)
 {
     this.screen  = marketPlaceWidget;
     img.sprite   = DataManager.ResourcePrefabs.GetResourceSprite(id);
     toggle.group = group;
     toggle.onValueChanged.AddListener((bool b) => marketPlaceWidget.UpdateFilter(id));
     toggle.isOn = (id == 0);
 }
Ejemplo n.º 2
0
        public void Init(MarketPlaceScreen marketWidget, TradeOffer offer) {
            this.marketWidget = marketWidget;
            this.offer = offer;

            title.text = "Buy from " + offer.player.Name;
            img.sprite = DataManager.ResourcePrefabs.GetResourceSprite(offer.productId);
            cost.text = offer.player.resourcesCostForTrade[offer.productId].ToString();

            myOffer = new TradeOffer(offer.player, offer.productId, 1, offer.player.resourcesCostForTrade[offer.productId]);
            buyButton.onClick.AddListener(() => marketWidget.BuyTradeOffer(myOffer));
            amountInputField.text = 1.ToString();
        }
        public void Init(MarketPlaceScreen marketPlaceScreen, TradeOffer offer)
        {
            this.offer = offer;

            playerFromTxt.text = offer.player.Name;
            GameResourcesData resource = DataManager.ResourcesData.dataArray[offer.productId];

            productOffer.Init(DataManager.ResourcePrefabs.GetResourceSprite(resource.ID), offer.amount);
            offerCost.text = offer.totalValue.ToString();

            buyBtn.onClick.AddListener(() => marketPlaceScreen.OpenBuyScreen(this, offer));
        }