void TemplateDragBegin(AbilityUITemplate template, AbilityTemplate unit, PointerEventData pointerData) { if (OnTemplateDragBegin != null) { OnTemplateDragBegin(template, unit, pointerData); } }
void TemplateClicked(AbilityUITemplate template, AbilityTemplate data) { if (OnClick != null) { OnClick(template, data); } }
void OnListElementClicked(AbilityUITemplate template, AbilityTemplate data) { if (Core.Player.Inventory.Contains(data)) { } else { Core.UI.Buy.Show(data); } }
void ListTemplateDrag(AbilityUITemplate template, AbilityTemplate unit, PointerEventData pointerData) { if (Instance == null) { } else { if (Instance.Template == template.Template) { SetTemplatePosition(pointerData); } } }
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; } }
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); }
void ListTemplateDragEnd(AbilityUITemplate template, AbilityTemplate unit, PointerEventData pointerData) { if (Instance == null) { } else { Destroy(Instance.gameObject); Instance = null; Selection.Context.Apply(); if (OnDragEnd != null) { OnDragEnd(); } } }
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 { } }