예제 #1
0
 private void UpdateSavedTalents()
 {
     if (_character != null)
     {
         List <SavedTalentSpec> classTalents = new List <SavedTalentSpec>();
         SavedTalentSpec        current      = null;
         foreach (SavedTalentSpec spec in _savedTalents)
         {
             if (spec.Class == _character.Class)
             {
                 classTalents.Add(spec);
                 if (spec.Equals(_talents))
                 {
                     current = spec;
                 }
             }
         }
         if (current == null)
         {
             current = new SavedTalentSpec("Custom", null, _tree1Count, _tree2Count, _tree3Count);
             classTalents.Add(current);
         }
         _updateSaved = true;
         comboBoxTalentSpec.DataSource   = classTalents;
         comboBoxTalentSpec.SelectedItem = current;
         _updateSaved = false;
     }
 }
예제 #2
0
        public List <SavedTalentSpec> SpecsFor(CharacterClass charClass)
        {
            List <SavedTalentSpec> classTalents = new List <SavedTalentSpec>();

            foreach (SavedTalentSpec spec in _savedTalents)
            {
                if (spec.Class == _character.Class)
                {
                    classTalents.Add(spec);
                }
            }
            if (((SavedTalentSpec)comboBoxTalentSpec.SelectedItem).Spec == null)
            {
                CustomSpec = new SavedTalentSpec("Custom", _talents, _tree1Count, _tree2Count, _tree3Count);
                classTalents.Add(CustomSpec);
            }
            return(classTalents);
        }
예제 #3
0
 private void talentSpecButton_Click(object sender, EventArgs e)
 {
     if (((SavedTalentSpec)comboBoxTalentSpec.SelectedItem).Spec == null)
     {
         List <SavedTalentSpec> classTalents = new List <SavedTalentSpec>();
         foreach (SavedTalentSpec spec in _savedTalents)
         {
             if (spec.Class == _character.Class)
             {
                 classTalents.Add(spec);
             }
         }
         FormSaveTalentSpec form = new FormSaveTalentSpec(classTalents);
         if (form.ShowDialog(this) == DialogResult.OK)
         {
             SavedTalentSpec spec     = form.TalentSpec();
             String          specName = form.TalentSpecName();
             if (spec == null)
             {
                 spec = new SavedTalentSpec(specName, _talents, _tree1Count, _tree2Count, _tree3Count);
                 _savedTalents.Add(spec);
             }
             else
             {
                 spec.Spec = _talents.ToString();
             }
             UpdateSavedTalents();
             SaveTalentSpecs();
             _character.OnCalculationsInvalidated();
         }
         form.Dispose();
     }
     else
     {
         _savedTalents.Remove((SavedTalentSpec)comboBoxTalentSpec.SelectedItem);
         UpdateSavedTalents();
         SaveTalentSpecs();
         _character.OnCalculationsInvalidated();
     }
 }