Changeset 444 for TFP-WebServer/MapRendering
- Timestamp:
- Jun 10, 2023, 6:33:56 PM (18 months ago)
- Location:
- TFP-WebServer/MapRendering
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TFP-WebServer/MapRendering/ModInfo.xml
r440 r444 5 5 <Description value="Render the game map to image map tiles as it is uncovered" /> 6 6 <Author value="The Fun Pimps LLC" /> 7 <Version value="21.0. 293.0" />7 <Version value="21.0.310.0" /> 8 8 <Website value="" /> 9 9 </xml> -
TFP-WebServer/MapRendering/src/Api/Map.cs
r434 r444 10 10 public class Map : AbsRestApi { 11 11 12 private static readonly byte[] jsonEnabledKey = JsonWriter.GetEncodedPropertyNameWithBeginObject ("enabled");13 14 12 protected override void HandleRestGet (RequestContext _context) { 15 13 string id = _context.RequestPath; … … 19 17 switch (id) { 20 18 case "config": 21 writer.WriteRaw (jsonEnabledKey); 22 writer.WriteBoolean (MapRenderer.Enabled); 23 writer.WriteEndObject (); 19 writeConfig (ref writer); 24 20 break; 25 21 default: … … 29 25 30 26 SendEnvelopedResult (_context, ref writer); 27 } 28 29 private static readonly byte[] jsonKeyEnabled = JsonWriter.GetEncodedPropertyNameWithBeginObject ("enabled"); 30 private static readonly byte[] jsonKeyMapBlockSize = JsonWriter.GetEncodedPropertyNameWithPrefixValueSeparator ("mapBlockSize"); 31 private static readonly byte[] jsonKeyMaxZoom = JsonWriter.GetEncodedPropertyNameWithPrefixValueSeparator ("maxZoom"); 32 private static readonly byte[] jsonKeyMapSize = JsonWriter.GetEncodedPropertyNameWithPrefixValueSeparator ("mapSize"); 33 34 private void writeConfig (ref JsonWriter writer) { 35 writer.WriteRaw (jsonKeyEnabled); 36 writer.WriteBoolean (MapRenderer.Enabled); 37 38 writer.WriteRaw (jsonKeyMapBlockSize); 39 writer.WriteInt32 (Constants.MapBlockSize); 40 41 writer.WriteRaw (jsonKeyMaxZoom); 42 writer.WriteInt32 (Constants.Zoomlevels - 1); 43 44 GameManager.Instance.World.GetWorldExtent (out Vector3i worldMinPos, out Vector3i worldMaxPos); 45 Vector3i worldSize = worldMaxPos - worldMinPos; 46 47 writer.WriteRaw (jsonKeyMapSize); 48 JsonCommons.WriteVector3I (ref writer, worldSize); 49 50 writer.WriteEndObject (); 31 51 } 32 52
Note:
See TracChangeset
for help on using the changeset viewer.