Пример #1
0
        public void Add(Product product)
        {
            ProductItemView productView = CreateProductView(product);

            productView.transform.parent = _grid.transform;

            _grid.repositionNow = true;
            _grid.Reposition();
        }
Пример #2
0
        private ProductItemView CreateProductView(Product product)
        {
            GameObject source = (GameObject)Resources.Load("UI/ProductItem", typeof(GameObject));
            GameObject go     = Instantiate(source, _grid.transform);

            go.transform.localPosition    = Vector3.zero;
            go.transform.localEulerAngles = Vector3.zero;
            go.transform.localScale       = Vector3.one;
            ProductItemView productView = go.GetComponent <ProductItemView>();

            productView.Init(product);
            return(productView);
        }