2 using Microsoft.Xna.Framework;
3 using System.Collections.Generic;
4 using System.Collections.Immutable;
16 get {
return Params.ActivePrefab; }
43 [
Serialize(20.0f,
IsPropertySaveable.Yes, description:
"Connections with a length smaller or equal to this generate the smallest possible levels (using the MinWidth parameter in the level generation paramaters)."),
Editable(0.0f, 5000.0f)]
46 [
Serialize(200.0f,
IsPropertySaveable.Yes, description:
"Connections with a length larger or equal to this generate the largest possible levels (using the MaxWidth parameter in the level generation paramaters)."),
Editable(0.0f, 5000.0f)]
50 "Sites determine shape of the voronoi graph. Locations are placed at the vertices of the voronoi cells. " +
51 "(Decreasing this value causes the number of sites, and the complexity of the map, to increase exponentially - be careful when adjusting)"),
Editable]
63 [
Serialize(0.1f,
IsPropertySaveable.Yes, description:
"ConnectionIterationMultiplier for the UI indicator lines between locations."),
Editable(0.0f, 10.0f, DecimalCount = 2)]
66 [
Serialize(0.1f,
IsPropertySaveable.Yes, description:
"ConnectionDisplacementMultiplier for the UI indicator lines between locations."),
Editable(0.0f, 10.0f, DecimalCount = 2)]
74 public float MinZoom {
get;
set; }
77 public float MaxZoom {
get;
set; }
80 public float MapTileScale {
get;
set; }
82 [Serialize(15.0f,
IsPropertySaveable.Yes, description:
"Size of the location icons in pixels when at 100% zoom."),
Editable(1.0f, 1000.0f)]
83 public float LocationIconSize {
get;
set; }
85 [Serialize(5.0f,
IsPropertySaveable.Yes, description:
"Width of the connections between locations, in pixels when at 100% zoom."),
Editable(1.0f, 1000.0f)]
86 public float LocationConnectionWidth {
get;
set; }
88 [Serialize(
"220,220,100,255",
IsPropertySaveable.Yes, description:
"The color used to display the indicators (current location, selected location, etc)."),
Editable()]
89 public Color IndicatorColor {
get;
set; }
91 [Serialize(
"150,150,150,255",
IsPropertySaveable.Yes, description:
"The color used to display the connections between locations."),
Editable()]
92 public Color ConnectionColor {
get;
set; }
94 [Serialize(
"150,150,150,255",
IsPropertySaveable.Yes, description:
"The color used to display the connections between locations when they're highlighted."),
Editable()]
95 public Color HighlightedConnectionColor {
get;
set; }
97 [Serialize(
"150,150,150,255",
IsPropertySaveable.Yes, description:
"The color used to display the connections the player hasn't travelled through."),
Editable()]
98 public Color UnvisitedConnectionColor {
get;
set; }
100 public Sprite ConnectionSprite {
get;
private set; }
101 public Sprite PassedConnectionSprite {
get;
private set; }
103 public SpriteSheet DecorativeGraphSprite {
get;
private set; }
105 public Sprite MissionIcon {
get;
private set; }
106 public Sprite TypeChangeIcon {
get;
private set; }
108 public Sprite FogOfWarSprite {
get;
private set; }
109 public Sprite CurrentLocationIndicator {
get;
private set; }
110 public Sprite SelectedLocationIndicator {
get;
private set; }
112 public readonly ImmutableDictionary<Identifier, ImmutableArray<Sprite>> MapTiles;
115 public string Name => GetType().ToString();
129 if (gateCount ==
null)
137 GateCount = gateCount.ToImmutableArray();
139 Dictionary<Identifier, List<Sprite>> mapTiles =
new Dictionary<Identifier, List<Sprite>>();
141 foreach (var subElement
in element.Elements())
143 switch (subElement.Name.ToString().ToLowerInvariant())
146 case "connectionsprite":
147 ConnectionSprite =
new Sprite(subElement);
149 case "passedconnectionsprite":
150 PassedConnectionSprite =
new Sprite(subElement);
153 Identifier biome = subElement.GetAttributeIdentifier(
"biome",
"");
154 if (!mapTiles.ContainsKey(biome))
156 mapTiles[biome] =
new List<Sprite>();
158 mapTiles[biome].Add(
new Sprite(subElement));
160 case "fogofwarsprite":
161 FogOfWarSprite =
new Sprite(subElement);
163 case "locationindicator":
164 case "currentlocationindicator":
165 CurrentLocationIndicator =
new Sprite(subElement);
167 case "selectedlocationindicator":
168 SelectedLocationIndicator =
new Sprite(subElement);
170 case "decorativegraphsprite":
171 DecorativeGraphSprite =
new SpriteSheet(subElement);
174 MissionIcon =
new Sprite(subElement);
176 case "typechangeicon":
177 TypeChangeIcon =
new Sprite(subElement);
180 case "radiationparams":
186 MapTiles = mapTiles.Select(kvp => (kvp.Key, kvp.Value.ToImmutableArray())).ToImmutableDictionary();
193 ConnectionSprite?.Remove();
194 PassedConnectionSprite?.Remove();
195 SelectedLocationIndicator?.Remove();
196 CurrentLocationIndicator?.Remove();
197 DecorativeGraphSprite?.Remove();
198 MissionIcon?.Remove();
199 TypeChangeIcon?.Remove();
200 FogOfWarSprite?.Remove();
201 foreach (ImmutableArray<Sprite> spriteList
in MapTiles.Values)
203 foreach (
Sprite sprite
in spriteList)
int?[] GetAttributeIntArray(string key, int[]? def)
RadiationParams RadiationParams
static readonly PrefabSelector< MapGenerationParams > Params
readonly bool ShowLevelTypeNames
Dictionary< Identifier, SerializableProperty > SerializableProperties
readonly bool ShowLocations
float SmallLevelConnectionLength
float ConnectionIndicatorDisplacementMultiplier
static MapGenerationParams Instance
MapGenerationParams(ContentXElement element, MapGenerationParametersFile file)
float LargeLevelConnectionLength
Point VoronoiSiteVariance
float ConnectionIndicatorIterationMultiplier
float MinLocationDistance
Point VoronoiSiteInterval
float MinConnectionDistance
readonly bool ShowOverlay
readonly ImmutableArray< int > GateCount
readonly Identifier Identifier
static Dictionary< Identifier, SerializableProperty > DeserializeProperties(object obj, XElement element=null)