Пример #1
0
 public object Clone()
 {
     AttributeModifier mod = new AttributeModifier();
     mod.ItemId = ItemId;
     mod.Attribute = Attribute;
     mod.Value = Value;
     mod.Type = Type;
     mod.Duration = Duration;
     mod.TimeLeft = TimeLeft;
     return mod;
 }
Пример #2
0
        public object Clone()
        {
            AttributeModifier mod = new AttributeModifier();

            mod.ItemId    = ItemId;
            mod.Attribute = Attribute;
            mod.Value     = Value;
            mod.Type      = Type;
            mod.Duration  = Duration;
            mod.TimeLeft  = TimeLeft;
            return(mod);
        }
Пример #3
0
        public void AddModifier(AttributeModifier modifier)
        {
            AttributeSheet sheet = Global.Player.Attributes;
            switch (modifier.Type)
            {
                case ModifierType.Current:
                    int att = sheet.Current[modifier.Attribute] + modifier.Value;
                    if (att > sheet.Calculated[modifier.Attribute])
                        att = sheet.Calculated[modifier.Attribute];
                    else if (att < 0)
                        att = 0;
                    sheet.Current[modifier.Attribute] = att;
                    break;

                case ModifierType.Permanent:
                case ModifierType.Temporary:
                case ModifierType.Equipment:
                    sheet.Modifiers.Add(modifier);
                    break;
            }

            sheet.Recalculate();
        }
Пример #4
0
        private void modEditButton_Click(object sender, EventArgs e)
        {
            if (currentModifier != null)
                modifiers.Remove(currentModifier);
            else
                currentModifier = new AttributeModifier();
            
            currentModifier.Attribute = (CharacterAttribute)Enum.Parse(typeof(CharacterAttribute), modAttribute.Text);
            currentModifier.Type = (ModifierType)Enum.Parse(typeof(ModifierType), modType.Text);
            currentModifier.Value = int.Parse(modValue.Text);

            modifiers.Add(currentModifier);

            LoadModifiers();
        }
Пример #5
0
 private void modList_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (currentItem != null && modList.SelectedIndex >= 0 && modList.SelectedIndex < currentItem.Modifiers.Count)
     {
         currentModifier = modifiers[modList.SelectedIndex];
         FillModifier();
     }
 }
Пример #6
0
 private void modNewButton_Click(object sender, EventArgs e)
 {
     currentModifier = null;
     modList.SelectedIndex = -1;
     ClearModifier();
 }
Пример #7
0
        private void Clear()
        {
            currentItem = null;
            currentModifier = null;
            imagePicker.ResetGid();

            var allTextBoxes = Utils.GetChildControls<TextBox>(this);
            foreach (TextBox tb in allTextBoxes)
            {
                tb.Text = "";
            }

            ClearModifier();
            modList.Items.Clear();
            modifiers.Clear();
        }