public void Activate() { if (GameManager.IsScreenResolutionGreaterOrEqualThanFHD) { Resize(); } if (renderTexture != null) { Debug.Log("Render texture not null!!", Debug.LogType.Warning); } else { renderTexture = new RenderTexture((int)itemRenderer.rectTransform.sizeDelta.x, (int)itemRenderer.rectTransform.sizeDelta.y, 16, RenderTextureFormat.ARGBHalf); } var product = TradeMenu.Mid.ItemProduct; costText.text = UI_Shop.Instance.TradeType == TradeType.Buy ? product.PriceBuyString : product.PriceSellString; itemRenderer.texture = renderTexture; itemPreview = Item_Preview.InstantiateItemPrefab(product.Product, Vector2.zero); itemPreview.enabled = true; UI_ItemRenderer.ResetCameraPositionAndRotation(product.Product, itemPreview.transform); UI_ItemRenderer.SetTexture(renderTexture); UpdateAsync(); }
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(); } }
public Item_Preview InstantiateItemPreview(Vector2 positionOffeset) { if (ItemPreview != null) { Debug.Log("ItemPreview is not null !!"); return(ItemPreview); } // =============================================================================================== // Instantiate item prefab and set its position. // =============================================================================================== ItemPreview = Item_Preview.InstantiateItemPrefab(ItemIcon.Item, positionOffeset); return(ItemPreview); }