コード例 #1
0
        private void BuildClassContent(Class @class)
        {
            SelectedClass     = @class;
            SelectedClassList = null;

            gridSettings.Visibility    = Visibility.Visible;
            spClassSettings.Visibility = Visibility.Visible;

            tbName.Text = @class.Name;
            textSelector.SelectByTag(@class.ShownName);

            tbName.IsEnabled       = true;
            textSelector.IsEnabled = true;

            spAbilityModifiers.Children.Clear();

            foreach (var ability in Project.Current.Config.CharacterConfig.Abilities)
            {
                spAbilityModifiers.Children.Add(new UCEAbilityModifier(@class, ability.Name));
            }

            tlSetAttributes.ClearList();
            tlForbiddenAttributes.ClearList();
            spItemModifiers.Children.Clear();
            spSpellModifiers.Children.Clear();

            foreach (var modif in @class.Modifiers)
            {
                if (modif is AttributeModifier)
                {
                    AttributeModifier attributeModifier = (AttributeModifier)modif;
                    if (attributeModifier.Option == AttributeModifier.AttributeModifierOptions.SET)
                    {
                        var elem = tlSetAttributes.AddTextToList(attributeModifier.AttributeName);
                        elem.Tag = attributeModifier;
                    }
                    else if (attributeModifier.Option == AttributeModifier.AttributeModifierOptions.FORBID)
                    {
                        var elem = tlForbiddenAttributes.AddTextToList(attributeModifier.AttributeName);
                        elem.Tag = attributeModifier;
                    }
                }
                else if (modif is ItemModifier)
                {
                    var textElem = CreateItemModifierElem((ItemModifier)modif);
                    spItemModifiers.Children.Add(textElem);
                }
                else if (modif is SpellModifier)
                {
                    var textElem = CreateSpellModifierElem((SpellModifier)modif);
                    spSpellModifiers.Children.Add(textElem);
                }
            }
        }
コード例 #2
0
 public AttributeModifier GetAttributeModifier(string attributeName)
 {
     foreach (ClassModifier modifier in Modifiers)
     {
         if (modifier is AttributeModifier)
         {
             AttributeModifier attributeModifier = (AttributeModifier)modifier;
             if (attributeModifier.AttributeName == attributeName)
             {
                 return(attributeModifier);
             }
         }
     }
     return(null);
 }
コード例 #3
0
 public bool ContainsAttributeModifier(string attributeName)
 {
     foreach (ClassModifier modifier in Modifiers)
     {
         if (modifier is AttributeModifier)
         {
             AttributeModifier attributeModifier = (AttributeModifier)modifier;
             if (attributeModifier.AttributeName == attributeName)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
コード例 #4
0
 public void UpdateAttributeModifier(AttributeModifier attributeModifier)
 {
     if (attributeModifier.Option != AttributeModifier.AttributeModifierOptions.NONE)
     {
         //if given modifier does not exist, we add it
         if (!Modifiers.Contains(attributeModifier))
         {
             Modifiers.Add(attributeModifier);
         }
     }
     else
     {
         //if given modifier exists in our list, and it's option is NONE, we delete it
         if (Modifiers.Contains(attributeModifier))
         {
             Modifiers.Remove(attributeModifier);
         }
     }
 }