source: binary-improvements2/WebServer/src/ModApi.cs@ 400

Last change on this file since 400 was 391, checked in by alloc, 2 years ago

Major refactoring/cleanup

File size: 722 bytes
Line 
1using JetBrains.Annotations;
2using Webserver.UrlHandlers;
3
4namespace Webserver {
5 [UsedImplicitly]
6 public class ModApi : IModApi {
7 private Web webInstance;
8 private Mod modInstance;
9
10 public void InitMod (Mod _modInstance) {
11 ModEvents.GameStartDone.RegisterHandler (GameStartDone);
12 ModEvents.GameShutdown.RegisterHandler (GameShutdown);
13 modInstance = _modInstance;
14 }
15
16 private void GameStartDone () {
17 if (!ConnectionManager.Instance.IsServer) {
18 return;
19 }
20
21 webInstance = new Web (modInstance.Path);
22 LogBuffer.Init ();
23
24 if (ItemIconHandler.Instance != null) {
25 ItemIconHandler.Instance.LoadIcons ();
26 }
27 }
28
29 private void GameShutdown () {
30 webInstance?.Shutdown ();
31 }
32 }
33}
Note: See TracBrowser for help on using the repository browser.