Last change
on this file since 383 was 382, checked in by alloc, 2 years ago |
Switched to use SpaceWizards.HttpListener
|
File size:
1.0 KB
|
Rev | Line | |
---|
[325] | 1 | using AllocsFixes.NetConnections.Servers.Web;
|
---|
| 2 | using AllocsFixes.NetConnections.Servers.Web.Handlers;
|
---|
[224] | 3 |
|
---|
[331] | 4 | namespace AllocsFixes {
|
---|
[324] | 5 | public class API : IModApi {
|
---|
[367] | 6 | private Web webInstance;
|
---|
[382] | 7 | private Mod modInstance;
|
---|
[367] | 8 |
|
---|
[369] | 9 | public void InitMod (Mod _modInstance) {
|
---|
[325] | 10 | ModEvents.GameStartDone.RegisterHandler (GameStartDone);
|
---|
| 11 | ModEvents.GameShutdown.RegisterHandler (GameShutdown);
|
---|
| 12 | ModEvents.CalcChunkColorsDone.RegisterHandler (CalcChunkColorsDone);
|
---|
[382] | 13 | modInstance = _modInstance;
|
---|
[325] | 14 | }
|
---|
| 15 |
|
---|
[337] | 16 | private void GameStartDone () {
|
---|
[324] | 17 | // ReSharper disable once ObjectCreationAsStatement
|
---|
[369] | 18 | if (!ConnectionManager.Instance.IsServer) {
|
---|
| 19 | return;
|
---|
| 20 | }
|
---|
| 21 |
|
---|
[382] | 22 | webInstance = new Web (modInstance.Path);
|
---|
[326] | 23 | LogBuffer.Init ();
|
---|
[224] | 24 |
|
---|
[325] | 25 | if (ItemIconHandler.Instance != null) {
|
---|
| 26 | ItemIconHandler.Instance.LoadIcons ();
|
---|
[291] | 27 | }
|
---|
| 28 | }
|
---|
[267] | 29 |
|
---|
[324] | 30 | private void GameShutdown () {
|
---|
[369] | 31 | webInstance?.Shutdown ();
|
---|
[351] | 32 | MapRendering.MapRendering.Shutdown ();
|
---|
[299] | 33 | }
|
---|
| 34 |
|
---|
[324] | 35 | private void CalcChunkColorsDone (Chunk _chunk) {
|
---|
[351] | 36 | MapRendering.MapRendering.RenderSingleChunk (_chunk);
|
---|
[224] | 37 | }
|
---|
| 38 | }
|
---|
[325] | 39 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.