예제 #1
0
 private void MigrateCrewConfiguration(CrewConfiguration oldConfiguration, CrewConfiguration newConfiguration)
 {
     _scriptHost.CrewConfiguration = newConfiguration;
     if (oldConfiguration == null)
     {
         this.Element.Add(newConfiguration.Element);
     }
     else
     {
         oldConfiguration.Element.ReplaceWith(newConfiguration.Element);
     }
 }
예제 #2
0
        internal CrewInstance(CrewConfiguration configuration, string primaryRole, string[] secondaryRoles, int redundancyIndex)
        {
            _element = new XElement("crew");
            this.Element.SetAttributeValue("primaryRole", primaryRole);
            var secondaryRolesElement = new XElement("secondaryRoles");

            foreach (var secondaryRole in secondaryRoles)
            {
                secondaryRolesElement.Add(new XElement("role", secondaryRole));
            }

            _primaryRole    = primaryRole;
            _secondaryRoles = secondaryRoles;

            this.RedundancyIndex = redundancyIndex;

            this.Element.SetAttributeValue("identifier", this.Identifier);

#if MOBILE
            _availableSkills = new List <IXQueryable>();
#else
            _availableSkills         = new ObservableCollection <IXQueryable>();
            _readonlyAvailableSkills = new ReadOnlyObservableCollection <IXQueryable>(_availableSkills);
#endif

#if MOBILE
            _learntSkills = new List <IXQueryable>();
#else
            _learntSkills         = new ObservableCollection <IXQueryable>();
            _readonlyLearntSkills = new ReadOnlyObservableCollection <IXQueryable>(_learntSkills);

            _learntSkills.CollectionChanged += LearntSkills_CollectionChanged;
#endif

            this.Configuration = configuration;
            _crewInstanceInfo  = new CrewInstanceInfo(this.PrimaryRole);


            this.LastSkillTrainingLevel = 100;
        }