Esempio n. 1
0
        private void OnSelectedItemChanged(Item_Product itemProduct)
        {
            if (itemProduct == null)
            {
                Destroy(itemPreview);
                itemPreview = null;

                itemRenderer.enabled = false;
                itemName.text        = null;
                itemDesription.text  = null;

                Effect.Deactivate();
            }

            else
            {
                itemPreview          = Item_Preview.InstantiateItemPrefab(itemProduct.Product, Vector2.zero);
                itemPreview.enabled  = true;
                itemRenderer.enabled = true;
                itemName.text        = itemProduct.Product.ItemName;
                itemDesription.text  = itemProduct.Product.ItemDescription;
                Effect.Activate(itemProduct);

                UI_ItemRenderer.ResetCameraPositionAndRotation(itemProduct.Product, itemPreview.transform);
                UI_ItemRenderer.SetTexture(renderTexture);
                UI_ItemRenderer.Render();

                UpdateAsync();
            }
        }
Esempio n. 2
0
        private async void UpdateAsync()
        {
            while (renderTexture != null)
            {
                await AsyncManager.WaitForFrame(1);

                UI_ItemRenderer.Render();
            }
        }
Esempio n. 3
0
        private async void UpdateAsync()
        {
            var instanceID = itemPreview.GetInstanceID();

            while (itemPreview != null && instanceID == itemPreview.GetInstanceID())
            {
                await AsyncManager.WaitForFrame(1);

                if (itemPreview != null)
                {
                    UI_ItemRenderer.ResetCameraPositionAndRotation(itemPreview.ItemBase, itemPreview.transform);
                    UI_ItemRenderer.SetTexture(renderTexture);
                    UI_ItemRenderer.Render();
                }
            }
        }
Esempio n. 4
0
        private async void RenderCameraForTheFirstTime()
        {
            await AsyncManager.WaitForFrame(2);

            foreach (var t in itemIconsList)
            {
                UI_ItemRenderer.SetPosition(t.ItemRenderer.ItemPreview.transform.position - new Vector3(0, 0, 1));
                UI_ItemRenderer.SetTexture(t.ItemRenderer.RawImage.texture as RenderTexture);
                UI_ItemRenderer.ResetCameraPositionAndRotation(t.Item, t.ItemRenderer.ItemPreview.transform);

                t.ItemRenderer.ItemPreview.ResetRotation();
                t.ItemRenderer.ItemPreview.UpdateMaterial();
                UI_ItemRenderer.Render();

                t.ItemRenderer.gameObject.SetActive(true);
            }
        }
Esempio n. 5
0
        private async void InstantiateItem()
        {
            var products       = Buy.Left.Shop.Products;
            var position       = new Vector3(RectTransform.position.x, RectTransform.position.y + (RectTransform.sizeDelta.y * 0.5f));
            var spacingPerItem = 10.0f;

            position.y -= itemPrefab.RectTransform.sizeDelta.y * 0.5f;

            items = new UI_Shop_Left_Buy_ItemChild[maxVisibleItem];
            for (int i = startIndex; i < startIndex + maxVisibleItem; i++)
            {
                if (i > products.Count - 1)
                {
                    break;
                }

                var product = Instantiate(itemPrefab, RectTransform);
                product.Initialize(products.ElementAt(i), this, position);
                items[i - startIndex] = product;

                position.y -= itemPrefab.RectTransform.sizeDelta.y + spacingPerItem;
            }

            await AsyncManager.WaitForFrame(1);

            int index = startIndex;

            foreach (var item in items)
            {
                if (index > products.Count - 1)
                {
                    break;
                }

                UI_ItemRenderer.ResetCameraPositionAndRotation(products.ElementAt(index).Product, item.ItemPreview.transform);
                UI_ItemRenderer.SetTexture(item.ItemRenderer.texture as RenderTexture);
                UI_ItemRenderer.Render();

                index++;
            }

            UI_ItemRenderer.SetTexture(null);
        }
Esempio n. 6
0
 private void RenderCamera()
 {
     UI_ItemRenderer.SetTexture(RawImage.texture as RenderTexture);
     UI_ItemRenderer.Render();
 }