예제 #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;
        }
예제 #2
0
        public static void DestroyInstance()
        {
            if (instance == null)
            {
                return;
            }

            UI_Pool.Instance.RemoveImage(instance.SelectionImage);
            Destroy(instance);
            instance = null;
        }
예제 #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();
        }
예제 #4
0
 private void OnPointerEnter(BaseEventData eventData)
 {
     OnMouseEnter.Invoke();
     UI_Selection.CreateInstance(RectTransform, 24);
 }
예제 #5
0
 private void OnPointerExit(BaseEventData eventData)
 {
     OnMouseExit.Invoke();
     UI_Selection.DestroyInstance();
 }
예제 #6
0
 private void OnMouseExit()
 {
     UI_Selection.DestroyInstance();
 }
예제 #7
0
 private void OnMouseEnter()
 {
     UI_Selection.CreateInstance(RectTransform, 32);
 }
예제 #8
0
 private void OnPointerExit_Yes(BaseEventData eventData)
 {
     UI_Selection.DestroyInstance();
 }
예제 #9
0
 private void OnPointerEnter_Yes(BaseEventData eventData)
 {
     UI_Selection.CreateInstance(yes, 24.0f);
 }
예제 #10
0
 private void OnPointerClick_No(BaseEventData eventData)
 {
     UI_Selection.DestroyInstance();
     UI_Shop.Instance.CloseTradeMenu();
 }