Ejemplo n.º 1
0
        public void ResetPersonaToDefault()
        {
            var defaulPersona = PersonaList.FirstOrDefault(x => x.Value == _compendiumIndex);

            if (defaulPersona == null)
            {
                return;
            }

            IsEnabled           = true;
            PersonaId           = _compendiumIndex;
            _persona.Level      = defaulPersona.Properties.Level;
            _persona.Experience = 0;
            _persona.Strength   = defaulPersona.Properties.Strength;
            _persona.Magic      = defaulPersona.Properties.Magic;
            _persona.Endurance  = defaulPersona.Properties.Endurance;
            _persona.Agility    = defaulPersona.Properties.Agility;
            _persona.Luck       = defaulPersona.Properties.Luck;

            for (int i = defaulPersona.Properties.Skills.Count; i < _persona.Skills.Length; i++)
            {
                _persona.Skills[i] = Skill.Empty;
            }
            for (int i = Math.Min(defaulPersona.Properties.Skills.Count, _persona.Skills.Length) - 1; i >= 0; i--)
            {
                _persona.Skills[i] = (Skill)defaulPersona.Properties.Skills[i];
            }

            OnAllPropertiesChanged();
        }
Ejemplo n.º 2
0
 public PersonaViewModel(Persona persona, IPersonaList personaList, ISkillList skillList)
 {
     _persona     = persona;
     _personaList = personaList;
     _skillList   = skillList;
     _vm          = PersonaList.FirstOrDefault(x => x.Value == PersonaId);
 }
Ejemplo n.º 3
0
        public PersonaViewModel(int compendiumIndex, Persona persona, IPersonaList personaList, ISkillList skillList)
        {
            _compendiumIndex = compendiumIndex;
            _persona         = persona;
            _personaList     = personaList;
            _skillList       = skillList;
            _vm = PersonaList.FirstOrDefault(x => x.Value == PersonaId);
            ResetPersonaCommand = new RelayCommand(_ =>
            {
                if (MessageBox.Show("This will reset stats and skills of your persona. Do you want to continue?",
                                    "Reset Persona to default", MessageBoxButton.YesNo, MessageBoxImage.Warning) != MessageBoxResult.Yes)
                {
                    return;
                }

                ResetPersonaToDefault();
            }, _ => _compendiumIndex >= 0);
        }