Changeset 242 for binary-improvements
- Timestamp:
 - Jul 6, 2015, 10:34:17 AM (10 years ago)
 - Location:
 - binary-improvements/MapRendering
 - Files:
 - 
      
- 2 edited
 
- 
          
  ModInfo.xml (modified) (1 diff)
 - 
          
  Web/ItemIconHandler.cs (modified) (1 diff)
 
 
Legend:
- Unmodified
 - Added
 - Removed
 
- 
      
binary-improvements/MapRendering/ModInfo.xml
r238 r242 5 5 <Description value="Render the game map to image map tiles as it is uncovered" /> 6 6 <Author value="Christian 'Alloc' Illy" /> 7 <Version value=" 4" />7 <Version value="5" /> 8 8 <Website value="http://7dtd.illy.bz" /> 9 9 </ModInfo>  - 
      
binary-improvements/MapRendering/Web/ItemIconHandler.cs
r238 r242 46 46 47 47 private bool LoadIcons () { 48 loaded = true; 48 lock (icons) { 49 if (loaded) { 50 return true; 51 } 49 52 50 GameObject atlasObj = GameObject.Find ("/NGUI Root (2D)/ItemIconAtlas"); 51 if (atlasObj == null) { 52 Log.Error ("Web:IconHandler: Atlas object not found"); 53 return false; 53 GameObject atlasObj = GameObject.Find ("/NGUI Root (2D)/ItemIconAtlas"); 54 if (atlasObj == null) { 55 Log.Error ("Web:IconHandler: Atlas object not found"); 56 loaded = true; 57 return false; 58 } 59 DynamicUIAtlas atlas = atlasObj.GetComponent<DynamicUIAtlas> (); 60 if (atlas == null) { 61 Log.Error ("Web:IconHandler: Atlas component not found"); 62 loaded = true; 63 return false; 64 } 65 66 Texture2D atlasTex = atlas.texture as Texture2D; 67 68 foreach (UISpriteData data in atlas.spriteList) { 69 string name = data.name; 70 Texture2D tex = new Texture2D (data.width, data.height, TextureFormat.ARGB32, false); 71 tex.SetPixels (atlasTex.GetPixels (data.x, atlasTex.height - data.height - data.y, data.width, data.height)); 72 byte[] pixData = tex.EncodeToPNG (); 73 74 icons.Add (name, pixData); 75 UnityEngine.Object.Destroy (tex); 76 } 77 78 loaded = true; 79 Log.Out ("Web:IconHandler: Icons loaded"); 80 81 return true; 54 82 } 55 DynamicUIAtlas atlas = atlasObj.GetComponent<DynamicUIAtlas> ();56 if (atlas == null) {57 Log.Error ("Web:IconHandler: Atlas component not found");58 return false;59 }60 61 Texture2D atlasTex = atlas.texture as Texture2D;62 63 foreach (UISpriteData data in atlas.spriteList) {64 string name = data.name;65 Texture2D tex = new Texture2D (data.width, data.height, TextureFormat.ARGB32, false);66 tex.SetPixels (atlasTex.GetPixels (data.x, atlasTex.height - data.height - data.y, data.width, data.height));67 byte[] pixData = tex.EncodeToPNG ();68 69 icons.Add (name, pixData);70 UnityEngine.Object.Destroy (tex);71 }72 73 return true;74 83 } 75 84 }  
  Note:
 See   TracChangeset
 for help on using the changeset viewer.
  ![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)