source: binary-improvements/MapRendering/API.cs@ 368

Last change on this file since 368 was 367, checked in by alloc, 3 years ago

Web:

  • Added SSE (ServerSentEvents) subsystem
  • Added log endpoint to SSE. Less heavy weight and more responsive way of watching the server log
  • Bunch of refactoring
File size: 870 bytes
Line 
1using AllocsFixes.NetConnections.Servers.Web;
2using AllocsFixes.NetConnections.Servers.Web.Handlers;
3
4namespace AllocsFixes {
5 public class API : IModApi {
6 private Web webInstance;
7
8 public void InitMod () {
9 ModEvents.GameStartDone.RegisterHandler (GameStartDone);
10 ModEvents.GameShutdown.RegisterHandler (GameShutdown);
11 ModEvents.CalcChunkColorsDone.RegisterHandler (CalcChunkColorsDone);
12 }
13
14 private void GameStartDone () {
15 // ReSharper disable once ObjectCreationAsStatement
16 webInstance = new Web ();
17 LogBuffer.Init ();
18
19 if (ItemIconHandler.Instance != null) {
20 ItemIconHandler.Instance.LoadIcons ();
21 }
22 }
23
24 private void GameShutdown () {
25 webInstance.Shutdown ();
26 MapRendering.MapRendering.Shutdown ();
27 }
28
29 private void CalcChunkColorsDone (Chunk _chunk) {
30 MapRendering.MapRendering.RenderSingleChunk (_chunk);
31 }
32 }
33}
Note: See TracBrowser for help on using the repository browser.