private void LoadGameTextures() { MapTexture = new Texture2D(mapSize, mapSize, TextureFormat.ARGB32, false, true); TextureLoadParams textureLoadParams = new TextureLoadParams() { makeNoLongerReadable = false }; for (int i = 0; i < tileCount; i++) { // Offset int y = ((i / tileEdge) + 1) * texSize, x = (i % tileEdge) * texSize; string name = "radar" + ((i < 10) ? "0" : "") + i; var texDict = TextureDictionary.Load(name); Texture2D tex = texDict.GetDiffuse(name, textureLoadParams).Texture; for (int ii = 0; ii < texSize; ++ii) { for (int jj = 0; jj < texSize; ++jj) { MapTexture.SetPixel(x + ii, texSize - (y + jj) - 1, tex.GetPixel(ii, jj)); } } // unload the texture (don't destroy it, because it can be a dummy texture) } MapTexture.Apply(false, true); var huds = TextureDictionary.Load("hud"); NorthBlip = huds.GetDiffuse("radar_north").Texture; PlayerBlip = huds.GetDiffuse("radar_centre").Texture; WaypointTexture = huds.GetDiffuse("radar_waypoint").Texture; VehicleTexture = huds.GetDiffuse("radar_impound").Texture; GreenHouseTexture = huds.GetDiffuse("radar_propertyG").Texture; northImage.sprite = Sprite.Create(NorthBlip, new Rect(0, 0, NorthBlip.width, NorthBlip.height), new Vector2(NorthBlip.width, NorthBlip.height) / 2); playerImage.texture = this.PlayerBlip; mapImage.texture = MapTexture; }
void LoadMapTexture() { MapTexture = new Texture2D(mapSize, mapSize, TextureFormat.ARGB32, false, true); if (Config.Get <bool>("skip_minimap_load")) { return; } TextureLoadParams textureLoadParams = new TextureLoadParams() { makeNoLongerReadable = false }; for (int i = 0; i < tileCount; i++) { // Offset int y = ((i / tileEdge) + 1) * texSize, x = (i % tileEdge) * texSize; string name = "radar" + ((i < 10) ? "0" : "") + i; var texDict = TextureDictionary.Load(name); Texture2D tex = texDict.GetDiffuse(name, textureLoadParams).Texture; for (int ii = 0; ii < texSize; ++ii) { for (int jj = 0; jj < texSize; ++jj) { MapTexture.SetPixel(x + ii, texSize - (y + jj) - 1, tex.GetPixel(ii, jj)); } } // unload the texture (don't destroy it, because it can be a dummy texture) } MapTexture.Apply(false, true); }