Exemplo n.º 1
0
        public static void CreateInstance(RectTransform parent, float maxExpand)
        {
            Image img = null;

            if (instance == null)
            {
                img = UI_Pool.Instance.GetImage(parent, (int)parent.sizeDelta.x, (int)parent.sizeDelta.y, nameof(UI_Selection));

                var selection = img.gameObject.AddComponent <UI_Selection>();
                selection.maxExpand      = maxExpand;
                selection.selectionImage = img;

                instance = selection;
            }
            else
            {
                img = instance.SelectionImage;

                img.rectTransform.SetParent(parent);
                img.rectTransform.sizeDelta = parent.sizeDelta;
                img.name = nameof(UI_Selection);

                instance.maxExpand        = maxExpand;
                instance.defaultSizeDelta = parent.sizeDelta;
                instance.selectionImage   = img;
            }

            img.rectTransform.localPosition = Vector3.zero;
            img.sprite        = GlobalAssetsReference.InventoryItemOnPointerOver_Sprite;
            img.type          = Image.Type.Sliced;
            img.raycastTarget = false;
        }
Exemplo n.º 2
0
        public static void DestroyInstance()
        {
            if (instance == null)
            {
                return;
            }

            UI_Pool.Instance.RemoveImage(instance.SelectionImage);
            Destroy(instance);
            instance = null;
        }
Exemplo n.º 3
0
        private void OnPointerClick_Yes(BaseEventData eventData)
        {
            if (UI_Shop.Instance.TradeType == TradeType.Buy)
            {
                TradeMenu.Mid.ItemProduct.Purchase();
            }
            else
            {
                TradeMenu.Mid.ItemProduct.Sell();
            }


            UI_Selection.DestroyInstance();
            UI_Shop.Instance.CloseTradeMenu();
        }
Exemplo n.º 4
0
 private void OnPointerEnter(BaseEventData eventData)
 {
     OnMouseEnter.Invoke();
     UI_Selection.CreateInstance(RectTransform, 24);
 }
Exemplo n.º 5
0
 private void OnPointerExit(BaseEventData eventData)
 {
     OnMouseExit.Invoke();
     UI_Selection.DestroyInstance();
 }
Exemplo n.º 6
0
 private void OnMouseExit()
 {
     UI_Selection.DestroyInstance();
 }
Exemplo n.º 7
0
 private void OnMouseEnter()
 {
     UI_Selection.CreateInstance(RectTransform, 32);
 }
Exemplo n.º 8
0
 private void OnPointerExit_Yes(BaseEventData eventData)
 {
     UI_Selection.DestroyInstance();
 }
Exemplo n.º 9
0
 private void OnPointerEnter_Yes(BaseEventData eventData)
 {
     UI_Selection.CreateInstance(yes, 24.0f);
 }
Exemplo n.º 10
0
 private void OnPointerClick_No(BaseEventData eventData)
 {
     UI_Selection.DestroyInstance();
     UI_Shop.Instance.CloseTradeMenu();
 }