public void ClickAndSelectSkill(SkillType skill) { Debug.Log($"Clicked skill {skill}"); SkillClicked?.Invoke(skill); SelectSkill(skill); }
private void OnSlotPointerUp(SpellbookSlot slot) { if (slot.Slot.Skill.IsEmpty() || !this.isEnabled) { return; } SkillClicked?.Invoke(slot.Slot.Skill); }
/// <summary> /// On mouse down, we detect which skill is under the mouse location. /// </summary> /// <param name="e"></param> protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); if (e.Button == MouseButtons.Right) { Cursor = Cursors.Default; } Skill skill; Point mouseLocation = GetMouseLocation(e, out skill); // Fires the event when skill not null if (skill == null) { return; } SkillClicked?.ThreadSafeInvoke(this, new SkillClickedEventArgs(skill, e.Button, mouseLocation)); }
/// <summary> /// We run this when a skill is clicked. /// Ideally this would select the skill and start figuring out available targets. /// </summary> /// <remarks> /// Does a UI button have this event defined the same way as a sprite with a collider does? /// </remarks> protected virtual void OnMouseDown() { //SkillClicked?.Invoke(this, new EventArgs()); // Wah... we need .NET 4.0 for this awesome feature. if (SkillClicked != null) SkillClicked.Invoke(this, new EventArgs()); }