Exemple #1
0
    public void Setup(Community buyer, CommodityGroup currentOffer)
    {
        OnOffer.Clear();

        foreach (var i in InitializedObjects)
        {
            Destroy(i);
        }

        foreach (var rin in buyer.Inventory)
        {
            var res = (KeyValuePair <Commodity, int>)rin;

            var r   = res.Key;
            int max = res.Value - currentOffer.GetResourceAmount(r);

            if (max <= 0)
            {
                continue;
            }

            var o = Instantiate(OfferPrefab, OfferPrefab.transform.parent);

            o.Max = max;
            o.ResourceNameText.text = r.name;
            o.ResourceImage.sprite  = r.Sprite;

            o.gameObject.SetActive(true);

            o.AmountInputField.onValueChanged.AddListener(v => UpdateResourceInOffer(v, r));


            InitializedObjects.Add(o.gameObject);
        }

        Holder.SetActive(true);
    }
Exemple #2
0
 private void Clear()
 {
     CurrentOffer.Clear();
     AddOns.Clear();
 }