|
Last change
on this file since 384 was 382, checked in by alloc, 3 years ago |
|
Switched to use SpaceWizards.HttpListener
|
|
File size:
1.0 KB
|
| Line | |
|---|
| 1 | using AllocsFixes.NetConnections.Servers.Web;
|
|---|
| 2 | using AllocsFixes.NetConnections.Servers.Web.Handlers;
|
|---|
| 3 |
|
|---|
| 4 | namespace AllocsFixes {
|
|---|
| 5 | public class API : IModApi {
|
|---|
| 6 | private Web webInstance;
|
|---|
| 7 | private Mod modInstance;
|
|---|
| 8 |
|
|---|
| 9 | public void InitMod (Mod _modInstance) {
|
|---|
| 10 | ModEvents.GameStartDone.RegisterHandler (GameStartDone);
|
|---|
| 11 | ModEvents.GameShutdown.RegisterHandler (GameShutdown);
|
|---|
| 12 | ModEvents.CalcChunkColorsDone.RegisterHandler (CalcChunkColorsDone);
|
|---|
| 13 | modInstance = _modInstance;
|
|---|
| 14 | }
|
|---|
| 15 |
|
|---|
| 16 | private void GameStartDone () {
|
|---|
| 17 | // ReSharper disable once ObjectCreationAsStatement
|
|---|
| 18 | 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 | }
|
|---|
| 29 |
|
|---|
| 30 | private void GameShutdown () {
|
|---|
| 31 | webInstance?.Shutdown ();
|
|---|
| 32 | MapRendering.MapRendering.Shutdown ();
|
|---|
| 33 | }
|
|---|
| 34 |
|
|---|
| 35 | private void CalcChunkColorsDone (Chunk _chunk) {
|
|---|
| 36 | MapRendering.MapRendering.RenderSingleChunk (_chunk);
|
|---|
| 37 | }
|
|---|
| 38 | }
|
|---|
| 39 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.