Changeset 391 for binary-improvements2/MapRendering/src/ModApi.cs
- Timestamp:
- Aug 7, 2022, 3:02:24 PM (2 years ago)
- Location:
- binary-improvements2/MapRendering/src
- Files:
-
- 1 added
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements2/MapRendering/src/ModApi.cs
r390 r391 1 using AllocsFixes.NetConnections.Servers.Web; 2 using AllocsFixes.NetConnections.Servers.Web.Handlers; 1 using JetBrains.Annotations; 3 2 4 namespace AllocsFixes { 5 public class API : IModApi { 6 private Web webInstance; 7 private Mod modInstance; 8 3 namespace MapRendering { 4 [UsedImplicitly] 5 public class ModApi : IModApi { 9 6 public void InitMod (Mod _modInstance) { 10 ModEvents.GameStartDone.RegisterHandler (GameStartDone);11 7 ModEvents.GameShutdown.RegisterHandler (GameShutdown); 12 8 ModEvents.CalcChunkColorsDone.RegisterHandler (CalcChunkColorsDone); 13 modInstance = _modInstance;14 }15 16 private void GameStartDone () {17 // ReSharper disable once ObjectCreationAsStatement18 if (!ConnectionManager.Instance.IsServer) {19 return;20 }21 22 webInstance = new Web (modInstance.Path);23 LogBuffer.Init ();24 25 if (ItemIconHandler.Instance != null) {26 ItemIconHandler.Instance.LoadIcons ();27 }28 9 } 29 10 30 11 private void GameShutdown () { 31 webInstance?.Shutdown (); 32 MapRendering.MapRendering.Shutdown (); 12 MapRenderer.Shutdown (); 33 13 } 34 14 35 15 private void CalcChunkColorsDone (Chunk _chunk) { 36 MapRender ing.MapRendering.RenderSingleChunk (_chunk);16 MapRenderer.RenderSingleChunk (_chunk); 37 17 } 38 18 }
Note:
See TracChangeset
for help on using the changeset viewer.