コード例 #1
0
 void TemplateDragBegin(AbilityUITemplate template, AbilityTemplate unit, PointerEventData pointerData)
 {
     if (OnTemplateDragBegin != null)
     {
         OnTemplateDragBegin(template, unit, pointerData);
     }
 }
コード例 #2
0
 void TemplateClicked(AbilityUITemplate template, AbilityTemplate data)
 {
     if (OnClick != null)
     {
         OnClick(template, data);
     }
 }
コード例 #3
0
 void OnListElementClicked(AbilityUITemplate template, AbilityTemplate data)
 {
     if (Core.Player.Inventory.Contains(data))
     {
     }
     else
     {
         Core.UI.Buy.Show(data);
     }
 }
コード例 #4
0
 void ListTemplateDrag(AbilityUITemplate template, AbilityTemplate unit, PointerEventData pointerData)
 {
     if (Instance == null)
     {
     }
     else
     {
         if (Instance.Template == template.Template)
         {
             SetTemplatePosition(pointerData);
         }
     }
 }
コード例 #5
0
        public override void Init()
        {
            base.Init();

            Templates = new AbilityUITemplate[List.Count];

            for (int i = 0; i < List.Count; i++)
            {
                Templates[i] = CreateTemplate(List[i]);

                Templates[i].OnClick        += TemplateClicked;
                Templates[i].DragBeginEvent += TemplateDragBegin;
                Templates[i].DragEvent      += TemplateDrag;
                Templates[i].DragEndEvent   += TemplateDragEnd;
            }
        }
コード例 #6
0
        AbilityUITemplate CreateTemplate(AbilityUITemplate source)
        {
            var instance = Instantiate(template, RectTransform);

            instance.name = source.Template.name + " Drag Template";

            var script = instance.GetComponent <AbilityUITemplate>();

            script.Init();
            script.Set(source.Template);

            script.LayoutElement.ignoreLayout = true;
            script.CanvasGroup.blocksRaycasts = false;
            script.CanvasGroup.alpha          = 0.6f;

            script.RectTransform.sizeDelta = source.RectTransform.sizeDelta * 0.8f;

            return(script);
        }
コード例 #7
0
        void ListTemplateDragEnd(AbilityUITemplate template, AbilityTemplate unit, PointerEventData pointerData)
        {
            if (Instance == null)
            {
            }
            else
            {
                Destroy(Instance.gameObject);

                Instance = null;

                Selection.Context.Apply();

                if (OnDragEnd != null)
                {
                    OnDragEnd();
                }
            }
        }
コード例 #8
0
        void ListTemplateDragBegin(AbilityUITemplate UITemplate, AbilityTemplate template, PointerEventData pointerData)
        {
            if (Instance == null)
            {
                if (Player.Inventory.Contains(template.CatalogItem))
                {
                    Selection.Context.Start(UITemplate.Template);

                    Instance = CreateTemplate(UITemplate);

                    SetTemplatePosition(pointerData);

                    if (OnDragBegin != null)
                    {
                        OnDragBegin();
                    }
                }
            }
            else
            {
            }
        }