Exemple #1
0
        private void ChangeDisplayOrder(Direction direction)
        {
            RaceModel swapRaceModel;
            int       saveSequence;
            int       selected;

            //Turn off change events
            AllowChangeEvents = false;

            swapRaceModel = new RaceModel();
            if (direction == Direction.Up)
            {
                swapRaceModel.Initialize(ModelofRace.Sequence - 1);
            }
            else
            {
                swapRaceModel.Initialize(ModelofRace.Sequence + 1);
            }

            if (swapRaceModel.Id != Guid.Empty)
            {
                saveSequence           = ModelofRace.Sequence;
                ModelofRace.Sequence   = swapRaceModel.Sequence;
                swapRaceModel.Sequence = 255;

                //swap sequences such that the database wont' complain about duplicate entries
                swapRaceModel.SaveSequence();
                ModelofRace.SaveSequence();
                swapRaceModel.Sequence = saveSequence;
                swapRaceModel.SaveSequence();

                if (direction == Direction.Up)
                {
                    RaceListBox.SelectedIndex--;
                }
                else
                {
                    RaceListBox.SelectedIndex++;
                }

                //repopulate the list box to show the new order
                selected = RaceListBox.SelectedIndex;
                RaceListBox.Items.Clear();
                PopulateRaceListBox();
                RaceListBox.SelectedIndex = selected;
            }

            //Turn change events back on
            AllowChangeEvents = true;
        }
Exemple #2
0
        /// <summary>
        /// Load the data for this class
        /// </summary>
        private void LoadData()
        {
            List <int> values;
            List <RaceBonusFeatModel> bonusRaceFeats;

            Model.Initialize(Name);
            Description = Model.Description;
            values      = new List <int>();
            values.Add(Model.StrengthMinimum);
            values.Add(Model.DexterityMinimum);
            values.Add(Model.ConstitutionMinimum);
            values.Add(Model.IntelligenceMinimum);
            values.Add(Model.WisdomMinimum);
            values.Add(Model.CharismaMinimum);
            BaseAbility = values;
            values      = new List <int>();
            values.Add(Model.StrengthMaximum);
            values.Add(Model.DexterityMaximum);
            values.Add(Model.ConstitutionMaximum);
            values.Add(Model.IntelligenceMaximum);
            values.Add(Model.WisdomMaximum);
            values.Add(Model.CharismaMaximum);
            BaseAbilityMax       = values;
            iconicRace           = Model.Iconic;
            _iconName            = Model.MaleImageFileName;
            _iconicStartingClass = DataManagerClass.DataManager.ClassDataCollection.GetClassName(Model.StartingClassId);

            _autoGrantedFeats = new List <AutoGrantedFeatDataClass>();
            bonusRaceFeats    = RaceBonusFeatModel.GetAll(Model.Id);

            foreach (RaceBonusFeatModel rfModel in bonusRaceFeats)
            {
                _autoGrantedFeats.Add(new AutoGrantedFeatDataClass(rfModel.FeatId, rfModel.Level, rfModel.HasPreRequirements));
            }

            IsLoaded = true;
        }
Exemple #3
0
        private void OnDeleteRaceButtonClick(object sender, EventArgs e)
        {
            int       selection;
            RaceModel nextModel;
            int       nextSequence;

            ModelofRace.Delete();

            //We need to fix the sequence numbers
            nextSequence = ModelofRace.Sequence + 1;
            nextModel    = new RaceModel();
            nextModel.Initialize(nextSequence);
            while (nextModel.Id != Guid.Empty)
            {
                nextModel.Sequence--;
                nextModel.SaveSequence();
                nextSequence++;
                nextModel = new RaceModel();
                nextModel.Initialize(nextSequence);
            }

            //Lets reset the RaceList Box
            selection = RaceListBox.SelectedIndex - 1;
            if (selection < 0)
            {
                selection = 0;
            }

            RaceListBox.Items.Clear();
            PopulateRaceListBox();
            AllowChangeEvents         = false;
            RaceListBox.SelectedIndex = selection;
            AllowChangeEvents         = true;
            //Now we can reset our flags and fields
            ResetFieldsandFlags(RaceListBox.SelectedItem.ToString());
        }
Exemple #4
0
        private void PopulateFields(string raceName)
        {
            string   controlName;
            TextBox  skillPointsBox;
            ComboBox bonusFeatChoiceBox;

            ModelofRace = new RaceModel();
            ModelofRace.Initialize(raceName);
            //set our Original values for error checking unique values.
            DatabaseName         = ModelofRace.Name;
            DatabaseAbbreviation = ModelofRace.Abbreviation;

            //Set the Main Control Values
            NameInputBox.Text                  = ModelofRace.Name;
            AbbreviationInputBox.Text          = ModelofRace.Abbreviation;
            PastLifeFeatCombo.SelectedItem     = FeatModel.GetNameFromId(ModelofRace.PastLifeFeatId);
            StartingClassComboBox.SelectedItem = ClassModel.GetNameFromId(ModelofRace.StartingClassId);
            IconicCheckBox.Checked             = ModelofRace.Iconic;

            DescriptionWebBrowser.Navigate("about:blank");
            DescriptionWebBrowser.Document.OpenNew(false);
            DescriptionWebBrowser.Document.Write(ModelofRace.Description);
            DescriptionWebBrowser.Refresh();
            MaleIconNameInputBox.Text   = ModelofRace.MaleImageFileName;
            FemaleIconNameInputBox.Text = ModelofRace.FemaleImageFileName;
            MaleIcon = new IconClass(ModelofRace.MaleImageFileName);
            MaleIcon.SetLocation(this.Width, this.Height, MaleIconLocation);
            FemaleIcon = new IconClass(ModelofRace.FemaleImageFileName);
            FemaleIcon.SetLocation(this.Width, this.Height, FemaleIconLocation);
            //Starting Stat Boxes
            StrengthMinimumBox.SelectedItem     = ModelofRace.StrengthMinimum.ToString();
            StrengthMaximumBox.SelectedItem     = ModelofRace.StrengthMaximum.ToString();
            DexterityMinimumBox.SelectedItem    = ModelofRace.DexterityMinimum.ToString();
            DexterityMaximumBox.SelectedItem    = ModelofRace.DexterityMaximum.ToString();
            ConstitutionMinimumBox.SelectedItem = ModelofRace.ConstitutionMinimum.ToString();
            ConstitutionMaximumBox.SelectedItem = ModelofRace.ConstitutionMaximum.ToString();
            IntelligenceMinimumBox.SelectedItem = ModelofRace.IntelligenceMinimum.ToString();
            IntelligenceMaximumBox.SelectedItem = ModelofRace.IntelligenceMaximum.ToString();
            WisdomMinimumBox.SelectedItem       = ModelofRace.WisdomMinimum.ToString();
            WisdomMaximumBox.SelectedItem       = ModelofRace.WisdomMaximum.ToString();
            CharismaMinimumBox.SelectedItem     = ModelofRace.CharismaMinimum.ToString();
            CharismaMaximumBox.SelectedItem     = ModelofRace.CharismaMaximum.ToString();
            //System Boxes
            GuidLabel.Text               = ModelofRace.Id.ToString();
            LastUpdatedDateLabel.Text    = ModelofRace.LastUpdatedDate.ToString();
            LastUpdatedVersionLabel.Text = ModelofRace.LastUpdatedVersion;

            //LevelDetails Information
            ModelofRaceDetail = RaceLevelDetailModel.GetAll(ModelofRace.Id);
            if (ModelofRaceDetail == null)
            {
                //no detail records exist for this race, so we need to create them
                ModelofRaceDetail = new List <RaceLevelDetailModel>();
                for (int i = 0; i < Constant.NumHeroicLevels; i++)
                {
                    ModelofRaceDetail.Add(new RaceLevelDetailModel());
                    ModelofRaceDetail[i].Level = i + 1;
                }
                NewRecord = true;
            }
            //now lets fill in our Level Detail Controls
            for (int i = 0; i < Constant.NumHeroicLevels; i++)
            {
                controlName         = "SkillPointsInputBox" + (i + 1);
                skillPointsBox      = (TextBox)this.LevelDetailsPanel.Controls[controlName];
                skillPointsBox.Text = ModelofRaceDetail[i].BonusSkillPoints.ToString();

                controlName        = "BonusFeatChoiceCombo" + (i + 1);
                bonusFeatChoiceBox = (ComboBox)this.LevelDetailsPanel.Controls[controlName];
                bonusFeatChoiceBox.SelectedItem = FeatTypeModel.GetNameFromId(ModelofRaceDetail[i].FeatTypeId);
            }
        }