Esempio n. 1
0
        private void FillcomboPullFrom()
        {
            string methodName;

            methodName = comboModifierMethod.SelectedItem.ToString();

            PullFromNames.Clear();
            comboPullFrom.Items.Clear();
            if (methodName == "AbilityBonus")
            {
                PullFromNames = AbilityModel.GetNames();
            }
            else if (methodName == "Attribute")
            {
                PullFromNames = AttributeModel.GetNames();
            }
            else if (methodName == "AbilitySwap")
            {
                PullFromNames = AbilityModel.GetNames();
            }
            else
            {
                //We should not reach this point
                Debug.WriteLine("Error: No modifer Method exists for the one selected. ModifierDialogClass::FillcomboPullFrom()");
            }

            foreach (string name in PullFromNames)
            {
                comboPullFrom.Items.Add(name);
            }
        }
Esempio n. 2
0
        public override void OnAttack(AbilityModel ability)
        {
            var lPoints = new List <Vector2>();
            var rPoints = new List <Vector2>();

            switch (ability.Text)
            {
            case "Slash":
            default:

                SetSlashMovements(lPoints, rPoints);

                break;

            case "Stab":

                SetStabMovements(lPoints, rPoints);

                break;
            }

            _leftHand.AttackMovement(lPoints);
            _rightHand.AttackMovement(rPoints);

            _leftHandWeapon.Position = _leftHand.Position;
        }
        private string BuildRequirementText(Guid requirementId, string requirementComparison, double requirementValue)
        {
            string           text;
            string           tableName;
            RequirementModel reqModel;

            text = "";
            //text = RequirementModel.GetNameFromId(requirementId) + " " + requirementComparison + " " + requirementValue.ToString();
            reqModel = new RequirementModel();
            reqModel.Initialize(requirementId);
            tableName = TableNamesModel.GetTableNameFromId(reqModel.TableNamesId);
            if (tableName == "Ability")
            {
                text = AbilityModel.GetNameFromId(reqModel.ApplytoId) + " " + requirementComparison + " " + requirementValue.ToString();
            }
            else if (tableName == "Alignments")
            {
                text = "Alignment: " + requirementComparison + " " + AlignmentModel.GetNameFromID(reqModel.ApplytoId);
            }
            else if (tableName == "Attribute")
            {
                text = AttributeModel.GetNameFromId(reqModel.ApplytoId) + " " + requirementComparison + " " + requirementValue.ToString();
            }
            else if (tableName == "Character")
            {
                text = "Character " + requirementComparison + " Level " + requirementValue.ToString();
            }
            else if (tableName == "Class")
            {
                text = ClassModel.GetNameFromId(reqModel.ApplytoId) + " " + requirementComparison + " Level " + requirementValue.ToString();
            }
            else if (tableName == "Enhancement")
            {
                text = "Enhnacement: " + EnhancementModel.GetNameFromId(reqModel.ApplytoId) + " " + requirementComparison + " Rank " + requirementValue.ToString();
            }
            else if (tableName == "EnhancementSlot")
            {
                text = "Enhancement Slot: " + BuildSlotName(reqModel.ApplytoId) + " " + requirementComparison + " Rank " + requirementValue.ToString();
            }
            else if (tableName == "Feat")
            {
                text = "Feat: " + FeatModel.GetNameFromId(reqModel.ApplytoId);
            }
            else if (tableName == "Race")
            {
                text = RaceModel.GetNameFromId(reqModel.ApplytoId) + " " + requirementComparison + " Level " + requirementValue.ToString();
            }
            else if (tableName == "Skill")
            {
                text = SkillModel.GetNameFromId(reqModel.ApplytoId) + " " + requirementComparison + " " + requirementValue.ToString();
            }
            else
            {
                //we should not reach here
                Debug.WriteLine("Error: No category exists for this requirement. RequirementPanel2: BuildRequirementText()");
            }

            return(text);
        }
Esempio n. 4
0
    public static AbilityModel Build(string abilityLabel, string abilityDescription, bool abilityKnown)
    {
        var buildedAbility = new AbilityModel();

        buildedAbility.AbilityLabel       = abilityLabel;
        buildedAbility.AbilityDescription = abilityDescription;
        buildedAbility.AbilityKnown       = abilityKnown;
        return(buildedAbility);
    }
 public void Initialization(AbilityModel abilityModel)
 {
     abilityId         = abilityModel.Id;
     abilityImg.sprite = abilityModel.AbilitySprite;
     Cooldown          = abilityModel.Delay;
     Delay             = Cooldown;
     Active            = true;
     cdImg.enabled     = false;
 }
        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;
        }
Esempio n. 7
0
    private void AbilityUsedHandler(int abilityId)
    {
        AbilityModel model = abilityModels.FirstOrDefault(ability => ability.Id == abilityId);

        if (model != null)
        {
            GameObject ability = Instantiate(model.AbilityViewPrefab, AbilitySpotPoint.transform);
            ability.GetComponent <Rigidbody2D>().velocity = new Vector2(-1f, 0f) * Random.Range(3f, 6f);
            ability.GetComponent <AbilityView>().Initialization(model.AbilityDamage);
        }
    }
        /// <summary>
        /// Get the all AbilityToSimulation with this AbilityModel
        /// </summary>
        /// <param name="abiltyModel"></param>
        /// <returns></returns>
        public static List <AbilityToSimulation> GetAbilitySims(this AbilityModel abiltyModel)
        {
            Il2CppSystem.Collections.Generic.List <AbilityToSimulation> abilitySims = InGame.instance?.bridge?.GetAllAbilities(true);
            if (abilitySims is null || !abilitySims.Any())
            {
                return(null);
            }

            List <AbilityToSimulation> results = abilitySims.Where(ability => ability.ability.abilityModel.IsEqual(abiltyModel)).ToSystemList();

            return(results);
        }
        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);
        }
Esempio n. 10
0
        private void FillcomboModifier()
        {
            string categoryName;

            categoryName = comboCategory.SelectedItem.ToString();
            ModifierNames.Clear();
            comboModifier.Items.Clear();

            if (categoryName == "Ability")
            {
                labelModifier.Text = "Select an Ability";
                ModifierNames      = AbilityModel.GetNames();
            }
            else if (categoryName == "Attribute")
            {
                labelModifier.Text = "Select an Attribute";
                ModifierNames      = AttributeModel.GetNames();
            }
            else if (categoryName == "Feat")
            {
                labelModifier.Text = "Select a Feat";
                ModifierNames      = FeatModel.GetNames();
            }
            else if (categoryName == "Save")
            {
                labelModifier.Text = "Select a Save";
                ModifierNames      = SaveModel.GetNames();
            }
            else if (categoryName == "Skill")
            {
                labelModifier.Text = "Select a Skill";
                ModifierNames      = SkillModel.GetNames();
            }
            else if (categoryName == "Spell")
            {
                labelModifier.Text = "Select a Spell";
                ModifierNames      = SpellModel.GetNames();
            }
            else
            {
                //We should never reach this, if so, we need to add a category of fix one.
                Debug.WriteLine("Error: no category exist for the selected. ModifierDialogClass::FillcomboModifier()");
                return;
            }

            foreach (string name in ModifierNames)
            {
                comboModifier.Items.Add(name);
            }
        }
Esempio n. 11
0
        public override void OnAttack(AbilityModel ability)
        {
            switch (ability.Text)
            {
            case "Slap":
            default:
                Slap();
                break;

            case "xyz":
                xyz();
                break;
            }
        }
        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;
        }
        private void AddModifierRecord()
        {
            ModifierModel model;
            string        categoryName;
            string        applyToName;

            categoryName = CategoryComboBox.SelectedItem.ToString();
            applyToName  = ApplyToComboBox.SelectedItem.ToString();

            model = new ModifierModel();
            model.Initialize(Guid.Empty);
            model.TableNamesId = TableNamesModel.GetIdFromTableName(categoryName);
            if (categoryName == "Ability")
            {
                model.ApplyToId = AbilityModel.GetIdFromName(applyToName);
            }
            else if (categoryName == "Attribute")
            {
                model.ApplyToId = AttributeModel.GetIdFromName(applyToName);
            }
            else if (categoryName == "Feat")
            {
                model.ApplyToId = AttributeModel.GetIdFromName(applyToName);
            }
            else if (categoryName == "Save")
            {
                model.ApplyToId = AttributeModel.GetIdFromName(applyToName);
            }
            else if (categoryName == "Skill")
            {
                model.ApplyToId = AttributeModel.GetIdFromName(applyToName);
            }
            else if (categoryName == "Spell")
            {
                model.ApplyToId = AttributeModel.GetIdFromName(applyToName);
            }
            else
            {
                Debug.WriteLine("Error: No category exists for the one selected. NewModifierDialogClass: AddModifierRecord()");
                return;
            }
            model.Name = NameTextBox.Text;
            model.Save();
            NewModifierId = model.Id;
        }
        private void CategoryComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            string category;

            category = CategoryComboBox.SelectedItem.ToString();

            ApplyToNames.Clear();
            if (category == "Ability")
            {
                ApplyToLabel.Text = "Select an Ability";
                ApplyToNames      = AbilityModel.GetNames();
            }
            else if (category == "Attribute")
            {
                ApplyToLabel.Text = "Select an Attribute";
                ApplyToNames      = AttributeModel.GetNames();
            }
            else if (category == "Feat")
            {
                ApplyToLabel.Text = "Select a Feat";
                ApplyToNames      = FeatModel.GetNames();
            }
            else if (category == "Save")
            {
                ApplyToLabel.Text = "Select a Save";
                ApplyToNames      = SaveModel.GetNames();
            }
            else if (category == "Skill")
            {
                ApplyToLabel.Text = "Select a Skill";
                ApplyToNames      = SkillModel.GetNames();
            }
            else if (category == "Spell")
            {
                ApplyToLabel.Text = "Select a spell";
                ApplyToNames      = SpellModel.GetNames();
            }
            else
            {
                Debug.WriteLine("Error: No category exists for the one selected. NewModifierDialogClass : CategoryComboBox_SelectedIndexChanged()");
                return;
            }
            FillApplyToComboBox();
            UpdateNameField();
        }
Esempio n. 15
0
        public void Update(GameTime gameTime, List <UnitModel> targets)
        {
            _previousTargets = _targets;
            _targets         = targets;

            _previousUnit = _currentUnit;
            _currentUnit  = _units[UnitsGroup.CurrentIndex];

            _previousAbility = _currentAbility;
            _currentAbility  = _currentUnit.Abilities.Get(AbilitiesGroup.CurrentIndex);

            CheckIfUnitChanged();

            CheckIfTargetChanged();

            //CheckIfAbilityChanged();

            _endTurnButton.Update(gameTime);

            if (_endTurnButton.Clicked)
            {
                NextState = BattleStates.EnemyTurn;
            }

            for (int i = 0; i < UnitsGroup.Buttons.Count; i++)
            {
                UnitsGroup.Buttons[i].IsEnabled = true;

                if (_units[i].Stamina <= 0)
                {
                    UnitsGroup.Buttons[i].IsEnabled = false;
                }
            }

            for (int i = 0; i < AbilitiesGroup.Buttons.Count; i++)
            {
                AbilitiesGroup.Buttons[i].IsEnabled = _units[UnitsGroup.CurrentIndex].Abilities.Get(i).IsEnabled;
            }

            UnitsGroup.Update(gameTime);

            AbilitiesGroup.Update(gameTime);

            TargetsGroup.Update(gameTime);
        }
Esempio n. 16
0
        public AbilityInstance(IEntity source, IEntity target, AbilityModel ability)
        {
            Source  = source;
            Target  = target;
            Ability = ability;

            StartTime = Environment.TickCount;
            EndTime   = StartTime + (ability != null ? ability.CastTimeMS : 0);

            if (StartTime == EndTime)
            {
                State = AbilityState.Finished;
            }
            else
            {
                State = AbilityState.Casting;
            }
        }
Esempio n. 17
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);
        }
Esempio n. 18
0
        public void Save(AbilityModel ability)
        {
            var serializer = new JsonSerializer();

            serializer.NullValueHandling = NullValueHandling.Ignore;
            serializer.Formatting        = Formatting.Indented;

            if (!Directory.Exists(Path))
            {
                Directory.CreateDirectory(Path);
            }

            using (var writer = new StreamWriter($@"{Path}\\{ability.Id}_{ability.Name}.json"))
            {
                using (var json = new JsonTextWriter(writer))
                {
                    serializer.Serialize(json, ability);
                }
            }
        }
        private void PullFromComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            string methodName;

            if (AllowEvents == false)
            {
                return;
            }

            methodName = ModifierMethodComboBox.SelectedItem.ToString();
            if (methodName == "AbilityBonus" || methodName == "AbilitySwap")
            {
                SelectedPullFromId = AbilityModel.GetIdFromName(PullFromComboBox.SelectedItem.ToString());
            }
            else
            {
                SelectedPullFromId = AttributeModel.GetIdFromName(PullFromComboBox.SelectedItem.ToString());
            }

            CheckToEnableOkButton();
        }
        public DataInputTomeScreenClass()
        {
            InitializeComponent();

            Model = new TomeModel();

            //populate the list of abilty and skill names
            AbilityNames = AbilityModel.GetNames();
            SkillNames   = SkillModel.GetNames();

            foreach (string Name in AbilityNames)
            {
                ModifierListBox.Items.Add(Name);
            }

            //populate the tome list box
            TomeListNames = TomeModel.GetNames();
            foreach (string Name in TomeListNames)
            {
                TomeListBox.Items.Add(Name);
            }
        }
        private void FillPullFromComboBox()
        {
            PullFromNames.Clear();
            PullFromComboBox.Items.Clear();
            if (ModifierMethodComboBox.SelectedItem.ToString() == "AbilityBonus")
            {
                PullFromNames = AbilityModel.GetNames();
            }
            else if (ModifierMethodComboBox.SelectedItem.ToString() == "Attribute")
            {
                PullFromNames = AttributeModel.GetNames();
            }
            else if (ModifierMethodComboBox.SelectedItem.ToString() == "AbilitySwap")
            {
                PullFromNames = AbilityModel.GetNames();
            }

            foreach (string name in PullFromNames)
            {
                PullFromComboBox.Items.Add(name);
            }
        }
        /// <summary>
        /// for a given selected record, show its data in the appropriate fields
        /// </summary>
        /// <param name="recordName">The name of the record to show</param>
        private void PopulateFields(string recordName)
        {
            int index;

            if (recordName == string.Empty)
            {
                ClearScreen();
                DataHasChanged = false;
                return;
            }

            Model.Initialize(recordName);

            TomeNameInputBox.Text         = Model.TomeName;
            TomeBonusInput.Value          = Model.TomeBonus;
            MinimumLevelInputUpDown.Value = Model.MinLevel;
            TomeNameLabel.Text            = Model.TomeLongName;
            if (Model.TomeType == "Ability")
            {
                TomeTypeAbilityRadioButton.Checked = true;
                index = AbilityNames.IndexOf(AbilityModel.GetNameFromId(Model.ModifiedID));
                ModifierListBox.SetSelected(index, true);
            }
            else
            {
                TomeTypeSkillRadioButton.Checked = true;
                index = SkillNames.IndexOf(SkillModel.GetNameFromId(Model.ModifiedID));
                ModifierListBox.SetSelected(index, true);
            }

            ModVersionLabel.Text = Model.LastUpdatedVersion;
            ModDateLabel.Text    = Model.LastUpdatedDate.ToString();
            RecordGUIDLabel.Text = Model.Id.ToString();

            //make sure we haven't changed the data (Populating data from the database doesn't count as a change!)
            DataHasChanged = false;
        }
        private string GetApplyToName(Guid requirementId)
        {
            string           applyToName;
            string           tableName;
            RequirementModel reqModel;
            EnhancementModel enhancementModel;

            reqModel = GetRequirementModel(requirementId);
            //tableName = "Class";

            tableName = TableNamesModel.GetTableNameFromId(reqModel.TableNamesId);

            if (tableName == "Ability")
            {
                applyToName = AbilityModel.GetNameFromId(reqModel.ApplytoId);
            }
            else if (tableName == "Alignments")
            {
                applyToName = AlignmentModel.GetNameFromID(reqModel.ApplytoId);
            }
            else if (tableName == "Attribute")
            {
                applyToName = AttributeModel.GetNameFromId(reqModel.ApplytoId);
            }
            else if (tableName == "Character")
            {
                applyToName = "Level";
            }
            else if (tableName == "Class")
            {
                applyToName = ClassModel.GetNameFromId(reqModel.ApplytoId);
            }
            else if (tableName == "Enhancement")
            {
                //"Pos " + model.DisplayOrder.ToString() + ":: " + model.Name)
                enhancementModel = new EnhancementModel();
                enhancementModel.Initialize(reqModel.ApplytoId);
                applyToName = "Pos " + enhancementModel.DisplayOrder + ":: " + enhancementModel.Name;
            }
            else if (tableName == "EnhancementSlot")
            {
                applyToName = BuildSlotName(GetSlotModel(requirementId));
            }
            else if (tableName == "Feat")
            {
                applyToName = FeatModel.GetNameFromId(reqModel.ApplytoId);
            }
            else if (tableName == "Race")
            {
                applyToName = RaceModel.GetNameFromId(reqModel.ApplytoId);
            }
            else if (tableName == "Skill")
            {
                applyToName = SkillModel.GetNameFromId(reqModel.ApplytoId);
            }
            else
            {
                applyToName = "";
            }
            Debug.WriteLine("ApplyToName = " + applyToName);
            return(applyToName);
        }
        private void comboCategory_SelectedIndexChanged(object sender, EventArgs e)
        {
            string categoryName;

            categoryName = comboCategory.SelectedItem.ToString();

            ApplyToNames.Clear();
            comboApplyTo.Items.Clear();
            comboTree.Items.Clear();
            //resize our form
            this.Size = new Size(DefaultWidth, DefaultHeight);
            //hide our optional controls
            labelTree.Visible = false;
            comboTree.Visible = false;
            labelSlot.Visible = false;
            comboSlot.Visible = false;

            if (categoryName == "Ability")
            {
                ApplyToNames      = AbilityModel.GetNames();
                labelApplyTo.Text = "Select an Ability";
            }

            else if (categoryName == "Alignments")
            {
                ApplyToNames      = AlignmentModel.GetNames();
                labelApplyTo.Text = "Select an Alignment";
            }
            else if (categoryName == "Attribute")
            {
                ApplyToNames      = AttributeModel.GetNames();
                labelApplyTo.Text = "Select an Attribute";
            }

            else if (categoryName == "Character")
            {
                ApplyToNames.Add("Level");
                labelApplyTo.Text = "Select Character Property";
            }

            else if (categoryName == "Class")
            {
                ApplyToNames      = ClassModel.GetNames();
                labelApplyTo.Text = "Select a Class";
            }

            else if (categoryName == "Enhancement")
            {
                //lets resie our form to make room for other controls
                this.Size         = new Size(DefaultWidth, DefaultHeight + 99);
                labelTree.Visible = true;
                comboTree.Visible = true;
                labelSlot.Visible = true;
                comboSlot.Visible = true;
                TreeNames         = EnhancementTreeModel.GetNames();
                foreach (string name in TreeNames)
                {
                    comboTree.Items.Add(name);
                }
                labelApplyTo.Text = "Select an Enhancement";
                buttonOk.Enabled  = false;
                return;
            }

            else if (categoryName == "EnhancementSlot")
            {
                //lets resize our form to make room for other controls
                this.Size         = new Size(DefaultWidth, DefaultHeight + 47);
                labelTree.Visible = true;
                comboTree.Visible = true;
                TreeNames         = EnhancementTreeModel.GetNames();
                foreach (string name in TreeNames)
                {
                    comboTree.Items.Add(name);
                }
                labelApplyTo.Text = "Select an Enhancement Slot";
                buttonOk.Enabled  = false;
                return;
            }

            else if (categoryName == "Feat")
            {
                ApplyToNames      = FeatModel.GetNames();
                labelApplyTo.Text = "Select a Feat";
            }

            else if (categoryName == "Race")
            {
                ApplyToNames      = RaceModel.GetNames();
                labelApplyTo.Text = "Select a Race";
            }

            else if (categoryName == "Skill")
            {
                ApplyToNames      = SkillModel.GetNames();
                labelApplyTo.Text = "Select a Skill";
            }

            else
            {
                Debug.WriteLine("Error: No category exists for the one selected. RequirementDialogClass : comboCategory_SelectedIndexChanged()");
                return;
            }

            foreach (string name in ApplyToNames)
            {
                comboApplyTo.Items.Add(name);
            }
            buttonOk.Enabled = false;
        }
 public static void RemoveBehavior <T>(this AbilityModel model, T behavior) where T : AbilityBehaviorModel
 {
     model.behaviors = model.behaviors.RemoveItem(behavior);
 }
Esempio n. 26
0
 /// <summary>
 /// Creates a new instance of <see cref="AbilityViewModel"/>
 /// </summary>
 public AbilityViewModel(AbilityModel abilityModel)
 {
     _abilityModel = abilityModel;
 }
Esempio n. 27
0
        private void CategoryComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            string category;

            category = CategoryComboBox.SelectedItem.ToString();

            ApplyToNames.Clear();
            ApplyToComboBox.Items.Clear();
            TreeComboBox.Items.Clear();
            //Lets set the default size of our form
            this.Size = new Size(DefaultWidth, DefaultHeight);
            //Hide our optional controls
            TreeLabel.Visible    = false;
            TreeComboBox.Visible = false;
            SlotLabel.Visible    = false;
            SlotComboBox.Visible = false;

            if (category == "Ability")
            {
                ApplyToNames      = AbilityModel.GetNames();
                ApplyToLabel.Text = "Select an Ability";
            }

            else if (category == "Attribute")
            {
                ApplyToNames      = AttributeModel.GetNames();
                ApplyToLabel.Text = "Select an Attribute";
            }

            else if (category == "Class")
            {
                ApplyToNames      = ClassModel.GetNames();
                ApplyToLabel.Text = "Select a Class";
            }

            else if (category == "Enhancement")
            {
                //Lets resize our form to make room for other controls
                this.Size            = new Size(DefaultWidth + 100, DefaultHeight + 94);
                TreeLabel.Visible    = true;
                TreeComboBox.Visible = true;
                SlotLabel.Visible    = true;
                SlotComboBox.Visible = true;
                TreeNames            = EnhancementTreeModel.GetNames();
                foreach (string name in TreeNames)
                {
                    TreeComboBox.Items.Add(name);
                }
                ApplyToLabel.Text = "Select an Enhancement";
                UpdateNameField();
                return;
            }

            else if (category == "EnhancementSlot")
            {
                //Lets resize our form to make room for other controls
                this.Size            = new Size(DefaultWidth + 100, DefaultHeight + 42);
                TreeLabel.Visible    = true;
                TreeComboBox.Visible = true;
                TreeNames            = EnhancementTreeModel.GetNames();
                foreach (string name in TreeNames)
                {
                    TreeComboBox.Items.Add(name);
                }
                ApplyToLabel.Text = "Select An Enhancement Slot";
                UpdateNameField();
                return;
            }
            else if (category == "Feat")
            {
                ApplyToNames      = FeatModel.GetNames();
                ApplyToLabel.Text = "Select a Feat";
            }

            else if (category == "Race")
            {
                ApplyToNames      = RaceModel.GetNames();
                ApplyToLabel.Text = "Select a Race";
            }

            else if (category == "Skill")
            {
                ApplyToNames      = SkillModel.GetNames();
                ApplyToLabel.Text = "Select a Skill";
            }

            else
            {
                Debug.WriteLine("Error: No category exists for the one selected. NewRequirementDialogClass : CategoryComboBox_SelectedIndexChanged()");
                return;
            }

            foreach (string name in ApplyToNames)
            {
                ApplyToComboBox.Items.Add(name);
            }

            UpdateNameField();
        }
Esempio n. 28
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;
        }
 public static bool HasBehavior <T>(this AbilityModel model) where T : AbilityBehaviorModel
 {
     return(model.behaviors.HasItemsOfType <AbilityBehaviorModel, T>());
 }
 public static void RemoveBehaviors <T>(this AbilityModel model) where T : AbilityBehaviorModel
 {
     model.behaviors = model.behaviors.RemoveItemsOfType <AbilityBehaviorModel, T>();
 }