コード例 #1
0
        private void SkillUpDownValueChanged(object sender, EventArgs e)
        {
            NumericUpDownWithBlank control;
            string        controlName;
            List <string> SkillNames;

            CharacterSkillClass.Skills Skill;
            SkillNames = Enum.GetNames(typeof(CharacterSkillClass.Skills)).ToList();
            control    = (NumericUpDownWithBlank)sender;
            int tomeBonus;
            int minLevel = 0;

            if (AllowChange == true)
            {
                bool SkillFound = false;
                controlName = control.Name;
                //determine the ability changed
                Skill = CharacterSkillClass.Skills.Balance;
                for (int i = 0; i < SkillNames.Count; ++i)
                {
                    if (controlName.Contains(SkillNames[i]))
                    {
                        Skill      = (CharacterSkillClass.Skills)i;
                        SkillFound = true;
                        if (SkillFound)
                        {
                            break;
                        }
                    }
                }
                if (!SkillFound)
                {
                    return;
                }
                //determine the level of the tome
                tomeBonus = (int)control.Value;
                Guid SkillID  = SkillModel.GetIdFromName(Skill.ToString().Replace("_", " "));
                int  SkillMax = TomeModel.GetMaxBonus(SkillID);
                if (tomeBonus != 0)
                {
                    minLevel = TomeModel.GetMinLevel(SkillID, tomeBonus);
                }
                if (control.Blank == true)
                {
                    CharacterManagerClass.CharacterManager.CharacterSkill.SetPriorLifeTomeBonus(Skill, tomeBonus, 0);
                }
                else
                {
                    CharacterManagerClass.CharacterManager.CharacterSkill.SetPriorLifeTomeBonus(Skill, tomeBonus, minLevel);
                }
                for (int i = tomeBonus + 1; i < SkillMax + 1; ++i)
                {
                    CharacterManagerClass.CharacterManager.CharacterSkill.SetPriorLifeTomeBonus(Skill, i, 0);
                }
                //inform other screens
                UIManagerClass.UIManager.ScreenMessenger.NotifyChange(UIManagerClass.ChildScreen.PastLifeEditScreen, ScreenMessengerClass.ChangeList.SkillChange);
            }
        }
コード例 #2
0
        private void AddNewRequirementRecord()
        {
            RequirementModel reqModel;
            string           tableName;
            string           applyToName;

            reqModel    = new RequirementModel();
            tableName   = comboCategory.SelectedItem.ToString();
            applyToName = comboApplyTo.SelectedItem.ToString();

            reqModel.TableNamesId = TableNamesModel.GetIdFromTableName(tableName);
            if (tableName == "Ability")
            {
                reqModel.ApplytoId = AbilityModel.GetIdFromName(applyToName);
            }
            else if (tableName == "Alignments")
            {
                reqModel.ApplytoId = AlignmentModel.GetIdFromName(applyToName);
            }
            else if (tableName == "Attribute")
            {
                reqModel.ApplytoId = AttributeModel.GetIdFromName(applyToName);
            }
            else if (tableName == "Class")
            {
                reqModel.ApplytoId = ClassModel.GetIdFromName(applyToName);
            }
            else if (tableName == "Enhancement")
            {
                reqModel.ApplytoId = GetEnhancementId();
            }
            else if (tableName == "EnhancementSlot")
            {
                reqModel.ApplytoId = GetSlotId();
            }
            else if (tableName == "Feat")
            {
                reqModel.ApplytoId = FeatModel.GetIdFromName(applyToName);
            }
            else if (tableName == "Race")
            {
                reqModel.ApplytoId = RaceModel.GetIdFromName(applyToName);
            }
            else if (tableName == "Skill")
            {
                reqModel.ApplytoId = SkillModel.GetIdFromName(applyToName);
            }
            else
            {
                Debug.WriteLine("Error: CategoryName isn't listed :: RequirementDialogClass: AddNewRequirement");
            }

            reqModel.Save();
            SelectedRequirementId = reqModel.Id;
        }
コード例 #3
0
        private Guid GetApplyToId()
        {
            Guid   applyToId;
            string tableName;

            applyToId = Guid.Empty;
            tableName = comboCategory.SelectedItem.ToString();

            if (tableName == "Ability")
            {
                applyToId = AbilityModel.GetIdFromName(comboApplyTo.SelectedItem.ToString());
            }
            if (tableName == "Alignments")
            {
                applyToId = AlignmentModel.GetIdFromName(comboApplyTo.SelectedItem.ToString());
            }
            if (tableName == "Attribute")
            {
                applyToId = AttributeModel.GetIdFromName(comboApplyTo.SelectedItem.ToString());
            }
            if (tableName == "Character")
            {
                applyToId = Guid.Empty;
            }
            if (tableName == "Class")
            {
                applyToId = ClassModel.GetIdFromName(comboApplyTo.SelectedItem.ToString());
            }
            if (tableName == "Enhancement")
            {
                applyToId = GetEnhancementId();
            }
            if (tableName == "EnhancementSlot")
            {
                applyToId = GetSlotId();
            }
            if (tableName == "Feat")
            {
                applyToId = FeatModel.GetIdFromName(comboApplyTo.SelectedItem.ToString());
            }
            if (tableName == "Race")
            {
                applyToId = RaceModel.GetIdFromName(comboApplyTo.SelectedItem.ToString());
            }
            if (tableName == "Skill")
            {
                applyToId = SkillModel.GetIdFromName(comboApplyTo.SelectedItem.ToString());
            }

            return(applyToId);
        }
コード例 #4
0
        private void OnModifierListBoxSelectedValueChanged(object sender, System.EventArgs e)
        {
            string modifiedName;

            modifiedName = ModifierListBox.Items[ModifierListBox.SelectedIndex].ToString();
            if (TomeTypeAbilityRadioButton.Checked == true)
            {
                Model.ModifiedID = AbilityModel.GetIdFromName(modifiedName);
            }
            else
            {
                Model.ModifiedID = SkillModel.GetIdFromName(modifiedName);
            }
            SetTomeLongName();
            DataHasChanged = true;
        }
コード例 #5
0
        private Guid GetApplyToId()
        {
            Guid   applyToId;
            string tableName;

            applyToId = Guid.Empty;
            tableName = comboCategory.SelectedItem.ToString();


            if (tableName == "Ability")
            {
                applyToId = AbilityModel.GetIdFromName(comboModifier.SelectedItem.ToString());
            }
            else if (tableName == "Attribute")
            {
                applyToId = AttributeModel.GetIdFromName(comboModifier.SelectedItem.ToString());
            }
            else if (tableName == "Feat")
            {
                applyToId = FeatModel.GetIdFromName(comboModifier.SelectedItem.ToString());
            }
            else if (tableName == "Save")
            {
                applyToId = SaveModel.GetIdFromName(comboModifier.SelectedItem.ToString());
            }
            else if (tableName == "Skill")
            {
                applyToId = SkillModel.GetIdFromName(comboModifier.SelectedItem.ToString());
            }
            else if (tableName == "Spell")
            {
                applyToId = SpellModel.GetIdFromName(comboModifier.SelectedItem.ToString());
            }
            else
            {
                //We should never reach this, if so, we need to add a category of fix one.
                Debug.WriteLine("Error: no category exists for the selected. ModifierDialogClass::GetApplyToId()");
                return(applyToId);
            }

            return(applyToId);
        }
コード例 #6
0
        private void AddNewRequirementRecord()
        {
            RequirementModel model;
            string           categoryName;
            string           applyToName;
            string           treeName;
            Guid             treeId;
            Guid             slotId;
            Guid             enhancementId;

            treeName     = "";
            model        = new RequirementModel();
            categoryName = CategoryComboBox.SelectedItem.ToString();
            applyToName  = ApplyToComboBox.SelectedItem.ToString();
            if (categoryName == "Enhancement" || categoryName == "EnhancementSlot")
            {
                treeName = TreeComboBox.SelectedItem.ToString();
            }

            model.Initialize(Guid.Empty);
            model.TableNamesId = TableNamesModel.GetIdFromTableName(categoryName);
            if (categoryName == "Ability")
            {
                model.ApplytoId = AbilityModel.GetIdFromName(applyToName);
            }
            if (categoryName == "Attribute")
            {
                model.ApplytoId = AttributeModel.GetIdFromName(applyToName);
            }
            if (categoryName == "Class")
            {
                model.ApplytoId = ClassModel.GetIdFromName(applyToName);
            }
            if (categoryName == "Enhancement")
            {
                treeId          = EnhancementTreeModel.GetIdFromTreeName(treeName);
                slotId          = EnhancementSlotModel.GetIdFromTreeIdandSlotIndex(treeId, GetSlotIndex(SlotComboBox.SelectedItem.ToString()));
                enhancementId   = EnhancementModel.GetIdFromSlotIdandDisplayOrder(slotId, GetDisplayOrder(ApplyToComboBox.SelectedItem.ToString()));
                model.ApplytoId = enhancementId;
            }
            if (categoryName == "EnhancementSlot")
            {
                treeId          = EnhancementTreeModel.GetIdFromTreeName(treeName);
                slotId          = EnhancementSlotModel.GetIdFromTreeIdandSlotIndex(treeId, GetSlotIndex(ApplyToComboBox.SelectedItem.ToString()));
                model.ApplytoId = slotId;
            }
            if (categoryName == "Feat")
            {
                model.ApplytoId = FeatModel.GetIdFromName(applyToName);
            }
            if (categoryName == "Race")
            {
                model.ApplytoId = RaceModel.GetIdFromName(applyToName);
            }
            if (categoryName == "Skill")
            {
                model.ApplytoId = SkillModel.GetIdFromName(applyToName);
            }

            model.Name = NameTextBox.Text;
            model.Save();
            NewRequirementId = model.Id;
        }
コード例 #7
0
        public PastLifeEditScreen()
        {
            InitializeComponent();
            NumClasses  = ClassModel.GetNumClasses();
            NumSkills   = SkillModel.GetNumSkills();
            NumIconic   = RaceModel.GetNumIconic();
            AllowChange = false;
            int           xpos        = 4;
            int           ypos        = 0;
            float         iconposx    = 4;
            float         iconposy    = 0;
            int           currentrow  = 0;
            int           PanelHeight = PastLifeClassPanel.Height;
            int           PanelWidth  = PastLifeClassPanel.Width;
            int           maxrow      = (int)System.Math.Ceiling((decimal)NumClasses / 4);
            StringBuilder controlName;

            ClassPanelEntry.ClassIcon = new IconClass[NumClasses];
            //ClassPanelEntry.ClassPastLifeValue = new Label[NumClasses];
            ClassPanelEntry.ClassPastLifeUpDown = new NumericUpDownWithBlank[NumClasses];
            ClassNames = ClassModel.GetNames();
            int xposstart = 10;

            for (int i = 0; i < NumClasses; i++)
            {
                //create Icon
                ClassPanelEntry.ClassIcon[i] = new IconClass("Classes\\" + ClassNames[i]);

                //create updown data entry
                controlName = new StringBuilder();
                controlName.Append("ClassUpDown");
                controlName.Append(i);


                ClassPanelEntry.ClassPastLifeUpDown[i]      = new NumericUpDownWithBlank();
                ClassPanelEntry.ClassPastLifeUpDown[i].Name = controlName.ToString();
                PastLifeClassPanel.Controls.Add(ClassPanelEntry.ClassPastLifeUpDown[i]);
                ClassPanelEntry.ClassPastLifeUpDown[i].Size          = new Size(39, 20);
                ClassPanelEntry.ClassPastLifeUpDown[i].Blank         = true;
                ClassPanelEntry.ClassPastLifeUpDown[i].ValueChanged += ClassUpDownValueChanged;
                ClassPanelEntry.ClassPastLifeUpDown[i].Minimum       = 1;
                //TODO: Hardcoded value! Remove into the database
                ClassPanelEntry.ClassPastLifeUpDown[i].Maximum = 3;

                //create position start point
                currentrow = (int)i / 4;
                xpos       = (i - (currentrow * 4)) * 100 + xposstart;
                iconposx   = ((float)xpos / (float)PanelWidth);
                ypos       = 30 + ((PastLifeClassPanel.Height - 30) / maxrow) * currentrow;
                iconposy   = ((float)ypos / (float)PanelHeight);
                // Place Icon and control
                ClassPanelEntry.ClassIcon[i].SetLocation(PastLifeClassPanel.Width, PastLifeClassPanel.Height, new PointF(iconposx, iconposy));
                ClassPanelEntry.ClassPastLifeUpDown[i].Location = new Point(xpos + 40, ypos + 5);
            }
            //populate the Iconic past life panel
            xpos        = 4;
            ypos        = 0;
            iconposx    = 0;
            iconposy    = 0;
            currentrow  = 0;
            PanelHeight = PastLifeIconicPanel.Height;
            PanelWidth  = PastLifeIconicPanel.Width;
            maxrow      = (int)System.Math.Ceiling((decimal)NumIconic / 4);
            IconicPanelEntry.IconicIcon           = new IconClass[NumIconic];
            IconicPanelEntry.IconicPastLifeUpDown = new NumericUpDownWithBlank[NumIconic];
            IconicNames = RaceModel.GetIconicNames();
            for (int i = 0; i < NumIconic; i++)
            {
                //create Icon
                IconicPanelEntry.IconicIcon[i] = new IconClass("Races\\" + IconicNames[i] + " Icon");

                //create updown data entry
                controlName = new StringBuilder();
                controlName.Append("IconicUpDown");
                controlName.Append(i);

                IconicPanelEntry.IconicPastLifeUpDown[i]      = new NumericUpDownWithBlank();
                IconicPanelEntry.IconicPastLifeUpDown[i].Name = controlName.ToString();
                PastLifeIconicPanel.Controls.Add(IconicPanelEntry.IconicPastLifeUpDown[i]);
                IconicPanelEntry.IconicPastLifeUpDown[i].Size          = new Size(39, 20);
                IconicPanelEntry.IconicPastLifeUpDown[i].Blank         = true;
                IconicPanelEntry.IconicPastLifeUpDown[i].ValueChanged += IconiocUpDownValueChanged;
                IconicPanelEntry.IconicPastLifeUpDown[i].Minimum       = 1;
                //TODO: Hardcoded value! Remove into the database
                IconicPanelEntry.IconicPastLifeUpDown[i].Maximum = 3;

                //create position start point
                currentrow = (int)i / 4;
                xpos       = (i - (currentrow * 4)) * 100 + xposstart;
                iconposx   = ((float)xpos / (float)PanelWidth);
                ypos       = 30 + ((PastLifeClassPanel.Height - 30) / maxrow) * currentrow;
                iconposy   = ((float)ypos / (float)PanelHeight);
                // Place Icon and control
                IconicPanelEntry.IconicIcon[i].SetLocation(PastLifeIconicPanel.Width, PastLifeIconicPanel.Height, new PointF(iconposx, iconposy));
                IconicPanelEntry.IconicPastLifeUpDown[i].Location = new Point(xpos + 40, ypos + 10);
            }

            //populate the skills panel
            SkillNames = Enum.GetNames(typeof(CharacterSkillClass.Skills)).ToList();
            SkillTomePanelEntry.SkillLabel  = new Label[NumSkills];
            SkillTomePanelEntry.SkillUpDown = new NumericUpDownWithBlank[NumSkills];
            xpos = 20;
            ypos = 0;
            Control[] control;
            NumericUpDownWithBlank upDown;
            int rowsplit = (int)System.Math.Ceiling((decimal)NumSkills / 2);

            for (int i = 0; i < NumSkills; i++)
            {
                ypos = 30 * i;
                if (i >= rowsplit)
                {
                    ypos -= 30 * rowsplit;
                }
                SkillTomePanelEntry.SkillLabel[i] = new Label();
                SkillTomeSubPanel.Controls.Add(SkillTomePanelEntry.SkillLabel[i]);
                SkillTomePanelEntry.SkillLabel[i].Text      = SkillNames[i].Replace("_", " ");
                SkillTomePanelEntry.SkillLabel[i].Location  = new Point(xpos, ypos + 3);
                SkillTomePanelEntry.SkillLabel[i].AutoSize  = true;
                SkillTomePanelEntry.SkillLabel[i].ForeColor = System.Drawing.Color.Gold;
                SkillTomePanelEntry.SkillLabel[i].Font      = new Font("Times New Roman", 9, FontStyle.Bold);
                SkillTomePanelEntry.SkillLabel[i].Name      = "SkillLabel" + i;
                SkillTomePanelEntry.SkillUpDown[i]          = new NumericUpDownWithBlank();
                SkillTomeSubPanel.Controls.Add(SkillTomePanelEntry.SkillUpDown[i]);
                SkillTomePanelEntry.SkillUpDown[i].Location      = new Point(xpos + 120, ypos);
                SkillTomePanelEntry.SkillUpDown[i].Name          = "SkillUpDown" + SkillNames[i];
                SkillTomePanelEntry.SkillUpDown[i].Size          = new Size(39, 20);
                SkillTomePanelEntry.SkillUpDown[i].Blank         = true;
                SkillTomePanelEntry.SkillUpDown[i].Minimum       = 1;
                SkillTomePanelEntry.SkillUpDown[i].ValueChanged += SkillUpDownValueChanged;

                System.Guid SkillID   = SkillModel.GetIdFromName(SkillNames[i].Replace("_", " "));
                int         UpDownMax = TomeModel.GetMaxBonus(SkillID);
                SkillTomePanelEntry.SkillUpDown[i].Maximum = UpDownMax;
                if (i >= rowsplit - 1)
                {
                    xpos = 200;
                }
            }
            AllowChange = true;
            for (int i = 0; i < NumSkills; ++i)
            {
                SetSkillUpDown(SkillTomePanelEntry.SkillUpDown[i]);
            }
            SetAbilityUpDown(StrUpDown);
            SetAbilityUpDown(DexUpDown);
            SetAbilityUpDown(ConUpDown);
            SetAbilityUpDown(IntUpDown);
            SetAbilityUpDown(WisUpDown);
            SetAbilityUpDown(ChaUpDown);
            for (int i = 0; i < NumClasses; ++i)
            {
                controlName = new StringBuilder();
                controlName.Append("ClassUpDown");
                controlName.Append(i);
                control = Controls.Find(controlName.ToString(), true);
                upDown  = (NumericUpDownWithBlank)control[0];
                if (upDown == null)
                {
                    continue;
                }
                SetClassUpDown(upDown);
            }
            for (int i = 0; i < NumIconic; ++i)
            {
                controlName = new StringBuilder();
                controlName.Append("IconicUpDown");
                controlName.Append(i);
                control = Controls.Find(controlName.ToString(), true);
                upDown  = (NumericUpDownWithBlank)control[0];
                if (upDown == null)
                {
                    continue;
                }
                SetIconicUpDown(upDown);
            }

            ClassTooltipDisplay  = -1;
            IconicTooltipDisplay = -1;
        }
コード例 #8
0
        public void SetSkillUpDown(NumericUpDownWithBlank control)
        {
            string        controlName;
            List <string> SkillNames;

            CharacterSkillClass.Skills Skill;
            SkillNames = Enum.GetNames(typeof(CharacterSkillClass.Skills)).ToList();

            if (AllowChange == true)
            {
                bool SkillFound = false;
                controlName = control.Name;
                //determine the ability changed
                Skill = CharacterSkillClass.Skills.Balance;
                for (int i = 0; i < SkillNames.Count; ++i)
                {
                    if (controlName.Contains(SkillNames[i]))
                    {
                        Skill      = (CharacterSkillClass.Skills)i;
                        SkillFound = true;
                        if (SkillFound)
                        {
                            break;
                        }
                    }
                }
                if (!SkillFound)
                {
                    return;
                }

                int MaxSkill = TomeModel.GetMaxBonus(SkillModel.GetIdFromName(Skill.ToString().Replace("_", " ")));
                control.Maximum = MaxSkill;

                int maxValue;
                int CurrentValue;
                int CurrentBonus;
                CurrentValue = 0;
                maxValue     = 0;
                CurrentBonus = 0;
                for (int i = 0; i < MaxSkill; ++i)
                {
                    CurrentValue = CharacterManagerClass.CharacterManager.CharacterSkill.PriorLifeTome[(int)Skill, i];
                    if (CurrentValue > maxValue)
                    {
                        maxValue = CurrentValue;

                        CurrentBonus = i + 1;
                    }
                }
                if (maxValue != 0)
                {
                    control.Blank = false;
                    control.Value = CurrentBonus;
                }
                else
                {
                    control.Blank = true;
                }
            }
        }