Last change
on this file since 403 was 402, checked in by alloc, 22 months ago |
- Major refactoring
- Using Utf8Json for (de)serialization
- Moving APIs to REST
- Removing dependencies from WebServer and MapRenderer to ServerFixes
|
File size:
712 bytes
|
Line | |
---|
1 | using JetBrains.Annotations;
|
---|
2 | using Webserver;
|
---|
3 | using Webserver.UrlHandlers;
|
---|
4 |
|
---|
5 | namespace MapRendering {
|
---|
6 | [UsedImplicitly]
|
---|
7 | public class ModApi : IModApi {
|
---|
8 | public void InitMod (Mod _modInstance) {
|
---|
9 | ModEvents.GameShutdown.RegisterHandler (GameShutdown);
|
---|
10 | ModEvents.CalcChunkColorsDone.RegisterHandler (CalcChunkColorsDone);
|
---|
11 |
|
---|
12 | Web.ServerInitialized += _web => {
|
---|
13 | _web.RegisterPathHandler ("/map/", new StaticHandler (
|
---|
14 | $"{GameIO.GetSaveGameDir ()}/map",
|
---|
15 | MapRenderer.GetTileCache (),
|
---|
16 | false,
|
---|
17 | "web.map")
|
---|
18 | );
|
---|
19 | };
|
---|
20 | }
|
---|
21 |
|
---|
22 | private void GameShutdown () {
|
---|
23 | MapRenderer.Shutdown ();
|
---|
24 | }
|
---|
25 |
|
---|
26 | private void CalcChunkColorsDone (Chunk _chunk) {
|
---|
27 | MapRenderer.RenderSingleChunk (_chunk);
|
---|
28 | }
|
---|
29 | }
|
---|
30 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.