Changeset 291 for binary-improvements/MapRendering
- Timestamp:
- Sep 25, 2016, 1:51:43 PM (8 years ago)
- Location:
- binary-improvements/MapRendering
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/MapRendering/API.cs
r267 r291 10 10 } 11 11 12 //public override void GameStartDone () {13 //if (AllocsFixes.NetConnections.Servers.Web.Handlers.ItemIconHandler.Instance != null) {14 //AllocsFixes.NetConnections.Servers.Web.Handlers.ItemIconHandler.Instance.LoadIcons ();15 //}16 //}12 public override void GameStartDone () { 13 if (AllocsFixes.NetConnections.Servers.Web.Handlers.ItemIconHandler.Instance != null) { 14 AllocsFixes.NetConnections.Servers.Web.Handlers.ItemIconHandler.Instance.LoadIcons (); 15 } 16 } 17 17 18 18 public override void CalcChunkColorsDone (Chunk _chunk) { -
binary-improvements/MapRendering/Web/Handlers/ItemIconHandler.cs
r267 r291 27 27 public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user, int permissionLevel) { 28 28 if (!loaded) { 29 if (!LoadIcons ()) { 30 resp.StatusCode = (int)HttpStatusCode.NotFound; 31 Log.Out ("Web:IconHandler: Could not load icons"); 32 return; 33 } 29 resp.StatusCode = (int)HttpStatusCode.InternalServerError; 30 Log.Out ("Web:IconHandler: Icons not loaded"); 31 return; 34 32 } 35 33 … … 74 72 } 75 73 74 string textureResourceName = atlas.PrebakedAtlas; 75 List<UISpriteData> sprites; 76 int elementWidth, elementHeight; 77 Texture2D atlasTex; 78 79 if (!DynamicUIAtlasTools.ReadPrebakedAtlasDescriptor (textureResourceName, out sprites, out elementWidth, out elementHeight)) { 80 SdtdConsole.Instance.Output ("Web:IconHandler: Could not read dynamic atlas descriptor"); 81 return false; 82 } 83 84 if (!DynamicUIAtlasTools.ReadPrebakedAtlasTexture (textureResourceName, out atlasTex)) { 85 SdtdConsole.Instance.Output ("Web:IconHandler: Could not read dynamic atlas texture"); 86 return false; 87 } 88 76 89 Dictionary<string, List<Color>> tintedIcons = new Dictionary<string, List<Color>> (); 77 90 foreach (ItemClass ic in ItemClass.list) { … … 89 102 } 90 103 91 Texture2D atlasTex = atlas.texture as Texture2D; 92 93 foreach (UISpriteData data in atlas.spriteList) { 104 foreach (UISpriteData data in sprites) { 94 105 string name = data.name; 95 106 Texture2D tex = new Texture2D (data.width, data.height, TextureFormat.ARGB32, false); … … 120 131 } 121 132 133 Resources.UnloadAsset(atlasTex); 134 122 135 loaded = true; 123 136 Log.Out ("Web:IconHandler: Icons loaded - {0} ms", microStopwatch.ElapsedMilliseconds);
Note:
See TracChangeset
for help on using the changeset viewer.