private static void MenuIllustration_LoadFile_1(On.Menu.MenuIllustration.orig_LoadFile_1 orig, Menu.MenuIllustration self, string folder) { if (folder.Contains("CustomResources")) { try { CustomWorldMod.Log($"Custom Regions: Loading custom resources at MenuIllustration. Folder [{folder}] and fileName [{self.fileName}]"); self.www = new WWW(string.Concat(new object[] { "file:///", Custom.RootFolderDirectory(), folder, Path.DirectorySeparatorChar, self.fileName, ".png" })); self.texture = new Texture2D(1, 1, TextureFormat.ARGB32, false); self.texture.wrapMode = TextureWrapMode.Clamp; if (self.crispPixels) { self.texture.anisoLevel = 0; self.texture.filterMode = FilterMode.Point; } self.www.LoadImageIntoTexture(self.texture); HeavyTexturesCache.LoadAndCacheAtlasFromTexture(self.fileName, self.texture); self.www = null; } catch (Exception e) { CustomWorldMod.Log($"Custom Regions: Failed loading textures for {folder} - {self.fileName} " + e); } } else { orig(self, folder); } }
// Add SlugBase character resources as a "virtual file" that illustrations may be read from // Folder: "SlugBase Resources" // File: "PlayerName\Dir1\Dir2\...\DirN\Image.png" private static void MenuIllustration_LoadFile_1(On.Menu.MenuIllustration.orig_LoadFile_1 orig, Menu.MenuIllustration self, string folder) { Texture2D customTex; if (folder == resourceFolderName && ((customTex = LoadTextureFromResources(self.fileName)) != null)) { self.texture = customTex; self.texture.wrapMode = TextureWrapMode.Clamp; if (self.crispPixels) { self.texture.anisoLevel = 0; self.texture.filterMode = FilterMode.Point; } HeavyTexturesCache.LoadAndCacheAtlasFromTexture(self.fileName, self.texture); return; } else { orig(self, folder); } }
private static void CustomIllustLoad(MenuIllustration self, string folder) { //Resource Assembly assembly = Assembly.GetExecutingAssembly(); string name = assembly.GetManifestResourceNames().Single(str => str.EndsWith(self.fileName + ".txt")); Debug.Log("LoadingCustomIllustration: " + name); string s; using (Stream manifestResourceStream = assembly.GetManifestResourceStream(name)) { using (StreamReader streamReader = new StreamReader(manifestResourceStream)) { s = streamReader.ReadToEnd(); } } byte[] data = Convert.FromBase64String(s); string text = Custom.RootFolderDirectory() + self.fileName + ".txt"; File.WriteAllBytes(text, data); self.www = new WWW("file:///" + text); //Apply self.texture = new Texture2D(1, 1, TextureFormat.ARGB32, false); self.texture.wrapMode = TextureWrapMode.Clamp; if (self.crispPixels) { self.texture.anisoLevel = 0; self.texture.filterMode = FilterMode.Point; } self.www.LoadImageIntoTexture(self.texture); HeavyTexturesCache.LoadAndCacheAtlasFromTexture(self.fileName, self.texture); self.www = null; File.Delete(text); }
// Token: 0x06000E40 RID: 3648 RVA: 0x00096624 File Offset: 0x00094824 public BattleRoomRain(Room rm) { if (rm.waterObject != null) { rm.waterObject.fWaterLevel = rm.waterObject.originalWaterLevel + this.flood; } this.dangerType = DangerType.FloodAndRain; if (rm.abstractRoom.shelter) { this.dangerType = BattleRoomRain.DangerType.Flood; } this.splashTiles = new List <IntVector2>(); this.rainReach = new int[rm.TileWidth]; this.shelterTex = new Texture2D(rm.TileWidth, rm.TileHeight); for (int i = 0; i < rm.TileWidth; i++) { bool flag = true; for (int j = rm.TileHeight - 1; j >= 0; j--) { if (flag && rm.GetTile(i, j).Solid) { flag = false; if (j < rm.TileHeight - 1) { this.splashTiles.Add(new IntVector2(i, j)); } this.rainReach[i] = j; } this.shelterTex.SetPixel(i, j, (!flag) ? new Color(0f, 0f, 0f) : new Color(1f, 0f, 0f)); } } if (rm.water) { for (int k = 0; k < rm.TileWidth; k++) { if (!rm.GetTile(k, rm.defaultWaterLevel).Solid) { this.shelterTex.SetPixel(k, rm.defaultWaterLevel, (this.shelterTex.GetPixel(k, rm.defaultWaterLevel).r <= 0.5f) ? new Color(0f, 0f, 1f) : new Color(1f, 0f, 1f)); int num = rm.defaultWaterLevel; while (num < rm.TileHeight && (float)num < (float)rm.defaultWaterLevel + 20f) { if (rm.GetTile(k, num).Solid) { break; } this.shelterTex.SetPixel(k, num + 1, (this.shelterTex.GetPixel(k, num + 1).r <= 0.5f) ? new Color(0f, 0f, 1f) : new Color(1f, 0f, 1f)); num++; } } } } else { bool flag2 = false; for (int l = 0; l < rm.TileWidth; l++) { if (!rm.GetTile(l, 0).Solid) { flag2 = true; this.shelterTex.SetPixel(l, 0, (this.shelterTex.GetPixel(l, 0).r <= 0.5f) ? new Color(0f, 0f, 1f) : new Color(1f, 0f, 1f)); } } if (flag2) { rm.deathFallGraphic = new DeathFallGraphic(); rm.AddObject(rm.deathFallGraphic); } } this.shelterTex.wrapMode = TextureWrapMode.Clamp; HeavyTexturesCache.LoadAndCacheAtlasFromTexture("RainMask_" + rm.abstractRoom.name, this.shelterTex); this.shelterTex.Apply(); this.splashes = this.splashTiles.Count * 2 / rm.cameraPositions.Length; if (this.intensity > 0f) { this.lastIntensity = 0f; } else { this.lastIntensity = 1f; } this.bulletDrips = new List <BulletDrip>(); if (this.dangerType != BattleRoomRain.DangerType.Flood) { this.normalRainSound = new DisembodiedDynamicSoundLoop(this); this.normalRainSound.sound = SoundID.Normal_Rain_LOOP; this.normalRainSound.VolumeGroup = 3; this.heavyRainSound = new DisembodiedDynamicSoundLoop(this); this.heavyRainSound.sound = SoundID.Heavy_Rain_LOOP; this.heavyRainSound.VolumeGroup = 3; } this.deathRainSound = new DisembodiedDynamicSoundLoop(this); this.deathRainSound.sound = ((this.dangerType == BattleRoomRain.DangerType.Flood) ? SoundID.Death_Rain_Heard_From_Underground_LOOP : SoundID.Death_Rain_LOOP); this.deathRainSound.VolumeGroup = 3; this.rumbleSound = new DisembodiedDynamicSoundLoop(this); this.rumbleSound.sound = SoundID.Death_Rain_Rumble_LOOP; this.rumbleSound.VolumeGroup = 3; if (this.dangerType != BattleRoomRain.DangerType.Rain) { this.floodingSound = new DisembodiedDynamicSoundLoop(this); this.floodingSound.sound = SoundID.Flash_Flood_LOOP; this.floodingSound.VolumeGroup = ((this.dangerType != BattleRoomRain.DangerType.Flood) ? 0 : 3); } this.distantDeathRainSound = new DisembodiedDynamicSoundLoop(this); this.distantDeathRainSound.sound = ((this.dangerType == BattleRoomRain.DangerType.Flood) ? SoundID.Death_Rain_Approaching_Heard_From_Underground_LOOP : SoundID.Death_Rain_Approaching_LOOP); this.SCREENSHAKESOUND = new DisembodiedDynamicSoundLoop(this); this.SCREENSHAKESOUND.sound = SoundID.Screen_Shake_LOOP; }