| Last change
 on this file since 405 was             402, checked in by alloc, 3 years ago | 
        
          | Major refactoring
Using Utf8Json for (de)serialization
Moving APIs to REST
Removing dependencies from WebServer and MapRenderer to ServerFixes
 | 
        
          | File size:
            712 bytes | 
      
      
| Rev | Line |  | 
|---|
| [391] | 1 | using JetBrains.Annotations; | 
|---|
| [402] | 2 | using Webserver; | 
|---|
|  | 3 | using Webserver.UrlHandlers; | 
|---|
| [224] | 4 |  | 
|---|
| [391] | 5 | namespace MapRendering { | 
|---|
|  | 6 | [UsedImplicitly] | 
|---|
|  | 7 | public class ModApi : IModApi { | 
|---|
| [369] | 8 | public void InitMod (Mod _modInstance) { | 
|---|
| [325] | 9 | ModEvents.GameShutdown.RegisterHandler (GameShutdown); | 
|---|
|  | 10 | ModEvents.CalcChunkColorsDone.RegisterHandler (CalcChunkColorsDone); | 
|---|
| [402] | 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 | }; | 
|---|
| [325] | 20 | } | 
|---|
|  | 21 |  | 
|---|
| [324] | 22 | private void GameShutdown () { | 
|---|
| [391] | 23 | MapRenderer.Shutdown (); | 
|---|
| [299] | 24 | } | 
|---|
|  | 25 |  | 
|---|
| [324] | 26 | private void CalcChunkColorsDone (Chunk _chunk) { | 
|---|
| [391] | 27 | MapRenderer.RenderSingleChunk (_chunk); | 
|---|
| [224] | 28 | } | 
|---|
|  | 29 | } | 
|---|
| [325] | 30 | } | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.