Example #1
0
        /// <summary>
        /// On click, we detect which skill is under the mouse location
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseClick(MouseEventArgs e)
        {
            base.OnMouseClick(e);

            // Computes the offsets caused by scrollers
            int ofsLeft = -AutoScrollPosition.X;
            int ofsTop  = -AutoScrollPosition.Y;

            // Checks every cell
            Skill skill         = null;
            var   mouseLocation = e.Location;

            mouseLocation.Offset(ofsLeft, ofsTop);
            foreach (var cell in m_rootCell.AllCells.Where(x => x.Rectangle.Contains(mouseLocation)))
            {
                skill = cell.Skill;
            }

            // Fires the event when skill not null
            if (skill == null)
            {
                return;
            }

            if (SkillClicked != null)
            {
                SkillClickedEventArgs se = new SkillClickedEventArgs(skill, e.Button, mouseLocation);
                SkillClicked(this, se);
            }
        }
Example #2
0
 /// <summary>
 /// Whenever the user right-click the skill tree on the left, we display the context menu.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void skillTreeDisplay_SkillClicked(object sender, SkillClickedEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         bool isPlanned = false;
         isPlanned |= PlanHelper.UpdatesRegularPlanToMenu(miPlanTo0, m_plan, e.Skill, 0);
         isPlanned |= PlanHelper.UpdatesRegularPlanToMenu(miPlanTo1, m_plan, e.Skill, 1);
         isPlanned |= PlanHelper.UpdatesRegularPlanToMenu(miPlanTo2, m_plan, e.Skill, 2);
         isPlanned |= PlanHelper.UpdatesRegularPlanToMenu(miPlanTo3, m_plan, e.Skill, 3);
         isPlanned |= PlanHelper.UpdatesRegularPlanToMenu(miPlanTo4, m_plan, e.Skill, 4);
         isPlanned |= PlanHelper.UpdatesRegularPlanToMenu(miPlanTo5, m_plan, e.Skill, 5);
         cmsSkillContext.Show(skillTreeDisplay, e.Location);
     }
     else
     {
         this.SelectedSkill = e.Skill;
     }
 }
Example #3
0
        /// <summary>
        /// Whenever the user right-click the skill tree on the left, we display the context menu.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void skillTreeDisplay_SkillClicked(object sender, SkillClickedEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                if (m_plan == null)
                {
                    return;
                }

                for (int i = 0; i <= 5; i++)
                {
                    m_plan.UpdatesRegularPlanToMenu(cmsSkillContext.Items[i], e.Skill, i);
                }

                Cursor = Cursors.Default;
                cmsSkillContext.Show(skillTreeDisplay, e.Location);
                return;
            }

            SelectedSkill = e.Skill;
            skillSelectControl.SelectedSkill = e.Skill;
            SetPlanEditorSkillSelectorSelectedSkill(e.Skill);
        }