Game.Areas.AreaTools
Assembly: Assembly-CSharp
Namespace: Game.Areas
Type: class
Base: System.Object
Summary:
Utility helper for working with map feature types. Provides a single helper method to map a MapFeature enum value to a string name used for icons (for example, UI or editor icons). The method is stateless and can be used anywhere a textual icon key for a map feature is required.
Fields
- This class does not declare any instance or static fields. {{ The class contains only a single static helper method and no stored state. }}
Properties
- This class does not declare any properties. {{ There are no properties; functionality is exposed via a static method. }}
Constructors
public AreaTools()
{{ No explicit constructors are defined in the source. The default parameterless constructor is provided by the runtime if an instance is created, though the class is typically used statically. }}
Methods
-
public static string GetMapFeatureIconName(MapFeature feature)
{{ Returns the icon name string corresponding to the provided MapFeature enum value. The method uses a switch expression to map feature values to human-readable icon keys (strings). Mapping performed: -
MapFeature.None => "None"
- MapFeature.Area => "Area"
- MapFeature.BuildableLand => "Building"
- MapFeature.FertileLand => "Fertility"
- MapFeature.Forest => "Forest"
- MapFeature.Oil => "Oil"
- MapFeature.Ore => "Coal" (note: Ore maps to the "Coal" icon key)
- MapFeature.SurfaceWater => "Water"
- MapFeature.GroundWater => "Water"
- default => "None"
The method is pure (no side effects) and safe to call from UI or editor code. Consumers should ensure the returned string matches the icon resource names used by their UI/theme (case-sensitive depending on resource lookup). If you add new MapFeature values, update this method to provide appropriate icon keys. }}
Usage Example
// Example usage in a UI or editor context:
string iconKey = Game.Areas.AreaTools.GetMapFeatureIconName(MapFeature.Forest);
// iconKey == "Forest"
// Use returned iconKey to load or select an icon sprite, e.g. (pseudo-code):
// var sprite = IconManager.GetSprite(iconKey);
{{ Example demonstrates retrieving the icon key for a map feature and using it to select an icon asset. }}