Beispiel #1
0
        public void AddProduct(Product product, GameObject obj)
        {
            if (_addedProductIds.Contains(product.id()))
            {
                return;
            }

            laodingPanel.SetActive(false);

            Debug.Log(Utils.GetHatShape(product));

            _addedProductIds.Add(product.id());
            GameObject objs       = obj;
            HatGallery hatGallery = objs.GetComponent <ScrollGallery>().hatGallery;
            Transform  trans      = objs.GetComponent <ScrollGallery>().content.transform;

            var instance = Instantiate(hatGallery);

            instance.transform.SetParent(trans, false);

            instance.SetCurrentProduct(product, _lineItems.Count);

            instance.Load();

            instance.OnClick.AddListener(delegate { OnProduct(product, instance); });

            _lineItems.Add(instance);

            galleryAR(product);
        }
Beispiel #2
0
 private void OnProduct(Product product, HatGallery hatGallery)
 {
     hatData.SethatName(hatGallery.GetNameHat());
     hatData.SethatImage(hatGallery.GetImageHat().sprite);
     OnShowProduct.Invoke(product);
 }