private ThingFilter SetFilterFromPreset(PresetZoneType preset) { List <ThingDef> database = DefDatabase <ThingDef> .AllDefsListForReading; if (preset == PresetZoneType.Meal) { return(DefaultFilters.DefaultFilter_MealZone()); } if (preset == PresetZoneType.Med) { return(DefaultFilters.DefaultFilter_MedZone()); } if (preset == PresetZoneType.Meat) { return(DefaultFilters.DefaultFilter_MeatZone()); } if (preset == PresetZoneType.Veg) { return(DefaultFilters.DefaultFilter_VegZone()); } if (preset == PresetZoneType.Joy) { return(DefaultFilters.DefaultFilter_JoyZone()); } if (preset == PresetZoneType.Animal) { return(DefaultFilters.DefaultFilter_AnimalZone()); } Log.Error("PresetFilteredZones:: Trying to make a zone with PresetZoneType of None."); return(DefaultFilters.DefaultFilter_SHTF()); }
public static Color NewZoneColor(PresetZoneType type) { if (type == PresetZoneType.Meal) { return(mealZonePalette.RandomElement()); } if (type == PresetZoneType.Med) { return(medZonePalette.RandomElement()); } if (type == PresetZoneType.Meat) { return(meatZonePalette.RandomElement()); } if (type == PresetZoneType.Veg) { return(vegZonePalette.RandomElement()); } if (type == PresetZoneType.Joy) { return(joyZonePalette.RandomElement()); } if (type == PresetZoneType.Animal) { return(animalZonePalette.RandomElement()); } return(ColorLibrary.Grey); }
public static ThingFilter GetFilterFromPreset(PresetZoneType preset) { List <ThingDef> database = DefDatabase <ThingDef> .AllDefsListForReading; ThingFilter f; switch (preset) { case PresetZoneType.None: Log.Error("PresetFilteredZones:: Trying to make a zone with PresetZoneType of None."); f = DefaultFilter_SHTF(); break; case PresetZoneType.Meal: f = DefaultFilter_MealZone(); break; case PresetZoneType.Meat: f = DefaultFilter_MeatZone(); break; case PresetZoneType.Veg: f = DefaultFilter_VegZone(); break; case PresetZoneType.Med: f = DefaultFilter_MedZone(); break; case PresetZoneType.Joy: f = DefaultFilter_JoyZone(); break; case PresetZoneType.Animal: f = DefaultFilter_AnimalZone(); break; case PresetZoneType.Rottable: f = DefaultFilter_RottableZone(); break; case PresetZoneType.Indoor: f = DefaultFilter_IndoorZone(); break; case PresetZoneType.Outdoor: f = DefaultFilter_OutdoorZone(); break; default: Log.Error("PresetFilteredZones:: Trying to make a zone with unknown PresetZoneType."); f = DefaultFilter_SHTF(); break; } return(f); }
public Zone_PresetStockpile(PresetZoneType preset, ZoneManager zoneManager) : base(Static.GetEnumDescription(preset), zoneManager) { zoneType = preset; cells = AllSlotCells().ToList(); settings = new StorageSettings(this); settings.filter = SetFilterFromPreset(preset); settings.Priority = StoragePriority.Important; slotGroup = new SlotGroup(this); color = NextZoneColor; }
//public static Texture2D GizmoShadeMeal = ContentFinder<Texture2D>.Get("Cupro/UI/GizmoShadeMeal", true); //public static Texture2D GizmoShadeMed = ContentFinder<Texture2D>.Get("Cupro/UI/GizmoShadeMed", true); //public static Texture2D GizmoShadeMeat = ContentFinder<Texture2D>.Get("Cupro/UI/GizmoShadeMeat", true); //public static Texture2D GizmoShadeVeg = ContentFinder<Texture2D>.Get("Cupro/UI/GizmoShadeVeg", true); //public static Texture2D GizmoShadeJoy = ContentFinder<Texture2D>.Get("Cupro/UI/GizmoShadeJoy", true); //public static Texture2D GizmoShadeAnimal = ContentFinder<Texture2D>.Get("Cupro/UI/GizmoShadeAnimal", true); public static string GetEnumDescription(PresetZoneType preset) { FieldInfo fieldInfo = preset.GetType().GetField(preset.ToString()); DescriptionAttribute[] attributes = (DescriptionAttribute[])fieldInfo.GetCustomAttributes(typeof(DescriptionAttribute), false); if (attributes != null && attributes.Length > 0) { return(attributes[0].description); } return(preset.ToString()); }