Пример #1
0
        public GroupPresetSaveable SaveToSaveable()
        {
            var groupPresetSaveable = new GroupPresetSaveable();

            groupPresetSaveable.id   = this.id;
            groupPresetSaveable.name = this.name;
            if (this.groupOutfit != null)
            {
                groupPresetSaveable.groupOutfitIndex = groupOutfit.GetUniqueLoadID();
            }

            if (this.groupArea != null)
            {
                groupPresetSaveable.groupAreaIndex = this.groupArea.GetUniqueLoadID();
            }

            if (this.groupDrugPolicy != null)
            {
                groupPresetSaveable.groupDrugPolicyIndex = this.groupDrugPolicy.GetUniqueLoadID();
            }

            if (this.groupFoodRestriction != null)
            {
                groupPresetSaveable.groupDrugPolicyIndex = this.groupFoodRestriction.GetUniqueLoadID();
            }

            if (this.groupWorkPriorities != null && this.groupWorkPriorities.Any())
            {
                groupPresetSaveable.groupWorkPrioritiesDefnames = new Dictionary <string, int>();
                foreach (var data in groupWorkPriorities)
                {
                    groupPresetSaveable.groupWorkPrioritiesDefnames[data.Key.defName] = data.Value;
                }
            }
            if (this.activeWorkTypes != null && this.activeWorkTypes.Any())
            {
                groupPresetSaveable.activeWorkTypes = new Dictionary <string, WorkState>();
                foreach (var data in this.activeWorkTypes)
                {
                    if (data.Key.workTypeDef != null)
                    {
                        groupPresetSaveable.activeWorkTypes[data.Key.workTypeDef.defName] = data.Value;
                    }
                }
            }
            return(groupPresetSaveable);
        }