Exemple #1
0
 public ShopThingData(ShopThingData prod)
 {
     if (prod == null)
     {
         return;
     }
     name              = prod.name;
     thingImage        = prod.thingImage;
     thingLabelImage   = prod.thingLabelImage;
     thingCount        = prod.thingCount;
     thingPrice        = prod.thingPrice;
     thingPriceText    = prod.thingPriceText;
     thingCountText    = prod.thingCountText;
     thingCountOldText = prod.thingCountOldText;
     kProductID        = prod.kProductID;
     clickEvent        = prod.clickEvent;
 }
Exemple #2
0
        public void SetData(ShopThingData shopThing)
        {
            if (thingImage)
            {
                thingImage.sprite = shopThing.thingImage;
                thingImage.SetNativeSize();
            }
            if (thingTextCount)
            {
                thingTextCount.text = shopThing.thingCountText;
            }
            if (thingTextCountOld)
            {
                thingTextCountOld.text = shopThing.thingCountOldText;
            }
            if (thingTextPrice)
            {
                thingTextPrice.text = shopThing.thingPriceText;
            }

            if (thingLabelImage)
            {
                if (shopThing.thingLabelImage)
                {
                    thingLabelImage.sprite = shopThing.thingLabelImage;
                    thingLabelImage.SetNativeSize();
                }
                else
                {
                    thingLabelImage.gameObject.SetActive(false);
                }
            }
            if (thingBuyButton)
            {
                thingBuyButton.onClick.RemoveAllListeners();
                thingBuyButton.onClick = shopThing.clickEvent;
            }
            if (thingName)
            {
                thingName.text = shopThing.name;
            }
        }
Exemple #3
0
        public static ShopThingHelper CreateShopThingsHelper(GameObject prefab, RectTransform parent, ShopThingData shopThingData)
        {
            if (!prefab)
            {
                return(null);
            }

            prefab.GetComponent <ShopThingHelper>().SetImages(shopThingData.thingImage, shopThingData.thingLabelImage); // fix 2019 unity

            GameObject shopThing = Instantiate(prefab);

            shopThing.transform.localScale = parent.transform.lossyScale;
            shopThing.transform.SetParent(parent.transform);
            ShopThingHelper sC = shopThing.GetComponent <ShopThingHelper>();

            sC.SetData(shopThingData);
            return(sC);
        }
Exemple #4
0
        public static ShopThingHelper CreateShopThingsHelper(GameObject prefab, RectTransform parent, ShopThingData shopThingData)
        {
            if (!prefab)
            {
                return(null);
            }
            GameObject shopThing = UnityEngine.Object.Instantiate(prefab);

            shopThing.transform.localScale = parent.transform.lossyScale;
            shopThing.transform.SetParent(parent.transform);
            ShopThingHelper sC = shopThing.GetComponent <ShopThingHelper>();

            sC.SetData(shopThingData);
            return(sC);
        }