// Replace the clicked location with a MultiSkillSelect button and reset all data of both the Skill being removed and linked skills (e.g. description, level, etc.)
        private void UnassignSkillButton_Click(object sender, EventArgs e)
        {
            // Get the tree control that the clicked button exists in
            TreeTableLayoutPanel treeControl = (this.Parent as SkillSelectPanel).treeControl;

            // Get the current control that will be unassigned
            Control btnSkill = treeControl.GetControlFromPosition(this.tlpXPos, this.tlpYPos);

            //Incase there's a skill at this position already, subtract the level of the skill from the build before we remove it
            if (btnSkill is SkillButton)
            {
                // Ensure we can actually unassign this skill before doing so (ie. there aren't linked skills that require it to be leveled)
                if ((btnSkill as SkillButton).CanDeLevel())
                {
                    //Create a new MultiSkillSelect button to hold the selectable skills and change it on the tree
                    (this.Parent as SkillSelectPanel).ChangeSelectedSkill(btnSkill, new MultiSkillSelectButton(this.tlpXPos, this.tlpYPos, treeControl.tree.name, (btnSkill as SkillButton).skill.max_rank));
                }
            }
            else
            {
                // No selected Skill exists at this location, so do nothing but
                //   hide the SkillSelectPanel since the user chose not to select a skill
                this.Parent.Hide();
            }
        }
Exemplo n.º 2
0
        //TODO public Tree tree <-- would it be helpful to have?

        public SkillButton(Skill inSkill, TreeTableLayoutPanel parentControl, SkillTooltipPanel skillTooltip, MainForm inForm)
        {
            InitializeComponent();

            //Set the Skill
            skill = inSkill;

            this.Parent             = parentControl;
            this.form               = inForm;
            this.lblSkillLevel.Text = this.skill.level.ToString();
            this.skillTooltipPanel  = skillTooltip;

            //Set the .Name property based on the Skill's Name
            this.Name = skill.id.ToString();

            //Specify defaults for this custom control
            this.pnlSkillButton.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom);
            this.pnlSkillButton.Dock   = DockStyle.Fill;

            //Background Image
            ResourceManagerImageSkill = new ResourceManager("ChroniCalc.ResourceImageSkill", Assembly.GetExecutingAssembly());

            if (!((Image)ResourceManagerImageSkill.GetObject(MainForm.GetSkillButtonIconFilename(parentControl.tree.name, inSkill.id)) is null))
            {
                this.pbSkillIcon.BackgroundImage = (Image)ResourceManagerImageSkill.GetObject(MainForm.GetSkillButtonIconFilename(parentControl.tree.name, inSkill.id));
            }
Exemplo n.º 3
0
        private bool CanSelectSkill(TreeTableLayoutPanel treeControl, Skill selectedSkill)
        {
            bool result = true;

            // Check the selected Skill has not already been selected in any of the other 3 General Rows at the same X position
            if (treeControl.Controls.OfType <SkillButton>().Where(s => s.skill.id == selectedSkill.id && s.skill.x == selectedSkill.x && s.skill.y >= 2 && s.skill.y <= 4).Count() > 0)
            {
                return(false);
            }

            // If this is a Shared Class-specific Skill (ie. Thorns, found in the first column of the Berserker's Class-specific Rows; or Ultimate Affinity, found in the last column of the Berserker's Class-specific Rows), check the selected Skill has not already been selected in any of the other 3 Class-specific Rows (Row numbers 1, 2, 6, 7)
            if ((treeControl.Controls.OfType <SkillButton>().Where(s => s.skill.id == selectedSkill.id && s.skill.x == selectedSkill.x && s.skill.y >= 0 && s.skill.y <= 1).Count() > 0) ||
                (treeControl.Controls.OfType <SkillButton>().Where(s => s.skill.id == selectedSkill.id && s.skill.x == selectedSkill.x && s.skill.y >= 5 && s.skill.y <= 6).Count() > 0))
            {
                return(false);
            }

            return(result);
        }
Exemplo n.º 4
0
        public SkillTooltipPanel(Skill inSkill, TreeTableLayoutPanel tlpTree, MainForm inForm)
        {
            InitializeComponent();

            this.form  = inForm;
            this.skill = inSkill;
            this.treeTableLayoutPanel = tlpTree;
            this.element = new Element(this.skill.element);

            //Specify defaults for this custom control
            this.lblPointsRequired.Text    = GetPointsRequiredText();
            this.lblPointsRequired.Visible = GetPointsRequiredVisibility();

            //Adjust the width of the Tooltip based on if the lblPointsRequired text is running off the right edge, otherwise use the min width defined
            this.Width       = ((this.lblPointsRequired.Width + this.lblPointsRequired.Left) > DEFAULT_WIDTH) ? (this.lblPointsRequired.Width + this.lblPointsRequired.Left) : DEFAULT_WIDTH;
            pnlTooltip.Width = this.Width;

            //Max width and height of labels (to enable word-wrapping)
            lblDescription.MaximumSize = new Size(lblDescription.Parent.Width - (lblDescription.Left * 2), this.lblDescription.Font.Height * 7);

            this.Parent  = form.Controls.Find("pnlTrees", true).First();
            this.Visible = false;

            //Fill out the controls on this custom SkillTooltipPanel

            this.lblElement.Text      = this.skill.element;
            this.lblElement.ForeColor = this.element.color;

            this.lblName.Text = this.skill.name;
            UpdateRankText(skill.level);
            this.lblTypeAndFamily.Text = this.skill.type + ((skill.family != "None" && !string.IsNullOrEmpty(skill.family)) ? (", " + skill.family) : "");

            //Background Image
            ResourceManagerImageSkill = new ResourceManager("ChroniCalc.ResourceImageSkill", Assembly.GetExecutingAssembly());

            if (!((Image)ResourceManagerImageSkill.GetObject(MainForm.GetSkillButtonIconFilename(tlpTree.tree.name, inSkill.id)) is null))
            {
                this.pbIcon.BackgroundImage = (Image)ResourceManagerImageSkill.GetObject(MainForm.GetSkillButtonIconFilename(tlpTree.tree.name, inSkill.id));
            }
Exemplo n.º 5
0
        public SkillSelectPanel(TreeTableLayoutPanel tlpTree)
        {
            InitializeComponent();
            WireMouseLeaveEventToAllChildren(this);

            this.treeControl = tlpTree;

            //Specify defaults for this custom control

            //Size
            this.Height = 36;
            //this.Width = AssignedAtRuntime;

            //Background Image
            ResourceManagerImageUI = new ResourceManager("ChroniCalc.ResourceImageUI", Assembly.GetExecutingAssembly());
            this.BackgroundImage   = (Image)ResourceManagerImageUI.GetObject("spr_menu_button_thin_0");

            //Image Layout
            this.BackgroundImageLayout = ImageLayout.Stretch;

            //Visbility
            this.Visible = false;
        }
Exemplo n.º 6
0
        private void SkillSelectButton_Click(object sender, EventArgs e)
        {
            bool canSelectSkill = true;

            //START Debug Info
            //string debugMessage;

            //debugMessage = "Skill: " + this.skill.name + "\n" +
            //                "XPos: " + this.skill.x + "\n" +
            //                "YPos:" + this.skill.y;
            //;
            //MessageBox.Show(debugMessage);
            //END Debug Info

            // Get the tree control that the clicked button exists in
            TreeTableLayoutPanel treeControl = (this.Parent as SkillSelectPanel).treeControl;

            // Get the current control that will be replaced with the newly-selected one
            Control btnSkill = treeControl.GetControlFromPosition(this.skill.x, this.skill.y);

            // Since the Mastery Tree has 3 shared General Rows with the same Skills, check that the chosen skill isn't already assigned in a different General Row
            if (treeControl.tree.name == "Mastery")
            {
                canSelectSkill = CanSelectSkill(treeControl, this.skill);
            }

            // See if we've discovered that we cannot select this Skill
            if (!canSelectSkill)
            {
                // Explain to the user that they cannot select this Skill because it's already been selected in a different General Row
                MessageBox.Show("Skill '" + this.skill.name + "' has already been selected.", "Skill Selection Error");

                // Hide the SkillSelectPanel
                this.Parent.Hide();

                // Get out of this method, we don't need to do anything else here
                return;
            }

            // Incase there's a skill at this position already, subtract the level of the skill from the build before we remove it
            if (canSelectSkill && btnSkill is SkillButton)
            {
                // Get the skill that was previously selected at this location
                SkillButton btnPreviousSkill = (btnSkill as SkillButton);

                // Create a new button to hold the selected Skill and change it on the tree
                (this.Parent as SkillSelectPanel).ChangeSelectedSkill(btnPreviousSkill, new SkillButton(this.skill, treeControl, this.skillTooltipPanel, form));
            }
            else if (canSelectSkill && btnSkill is MultiSkillSelectButton)
            {
                // No skill has yet been selected at this position
                MultiSkillSelectButton btnMultiSkillSelect = (btnSkill as MultiSkillSelectButton);

                // Create a new button to hold the selected Skill and change it on the tree
                (this.Parent as SkillSelectPanel).ChangeSelectedSkill(btnMultiSkillSelect, new SkillButton(this.skill, treeControl, this.skillTooltipPanel, form));
            }
            else if (!(btnSkill is SkillButton) && !(btnSkill is MultiSkillSelectButton))
            {
                // Display error for unknown control type found (ie. user clicked an unknown control type on the Tree to bring up the skill select panel and click a SkillSelectButton
                Alerts.DisplayError("SkillSelectButton_Click: Unknown control type found.  The control type of '" + btnSkill.GetType().ToString() + "' is not being accounted for or has a click event on it that needs to be removed.");
                return;
            }
        }