public override void CreateModMenuSection(TextMenu menu, bool inGame, EventInstance snapshot) { if (!inGame) { if (Everest.Updater.HasUpdate) { menu.Add(new TextMenu.Button(Dialog.Clean("modoptions_coremodule_update").Replace("((version))", Everest.Updater.Newest.Version.ToString())).Pressed(() => { Everest.Updater.Update(OuiModOptions.Instance.Overworld.Goto <OuiLoggedProgress>()); })); } // Allow downgrading travis / dev builds. if (Celeste.PlayMode == Celeste.PlayModes.Debug || Everest.VersionSuffix.StartsWith("travis-") || Everest.VersionSuffix == "dev") { menu.Add(new TextMenu.Button(Dialog.Clean("modoptions_coremodule_versionlist")).Pressed(() => { OuiModOptions.Instance.Overworld.Goto <OuiVersionList>(); })); } } base.CreateModMenuSection(menu, inGame, snapshot); menu.Add(new TextMenu.Button(Dialog.Clean("modoptions_coremodule_recrawl")).Pressed(() => { Everest.Content.Recrawl(); Everest.Content.Reprocess(); VirtualContentExt.ForceReload(); AreaData.Load(); })); }
public void ctor_LevelLoader(Session session, Vector2?startPosition = default(Vector2?)) { if (CoreModule.Settings.LazyLoading) { VirtualContentExt.UnloadOverworld(); } orig_ctor_LevelLoader(session, startPosition); }
public override void CreateModMenuSection(TextMenu menu, bool inGame, EventInstance snapshot) { base.CreateModMenuSection(menu, inGame, snapshot); menu.Add(new TextMenu.Button(Dialog.Clean("modoptions_coremodule_recrawl")).Pressed(() => { Everest.Content.Recrawl(); Everest.Content.Reprocess(); VirtualContentExt.ForceReload(); AreaData.Load(); })); }
public void ctor(Session session, Vector2?startPosition = default(Vector2?)) { if (LastLoadingThread != null && LastLoadingThread.TryGetTarget(out Thread lastThread) && (lastThread?.IsAlive ?? false)) { lastThread?.Abort(); } if (CoreModule.Settings.LazyLoading) { MainThreadHelper.Do(() => VirtualContentExt.UnloadOverworld()); } // Vanilla TileToIndex mappings. SurfaceIndex.TileToIndex = new Dictionary <char, int> { { '1', 3 }, { '3', 4 }, { '4', 7 }, { '5', 8 }, { '6', 8 }, { '7', 8 }, { '8', 8 }, { '9', 13 }, { 'a', 8 }, { 'b', 23 }, { 'c', 8 }, { 'd', 8 }, { 'e', 8 }, { 'f', 8 }, { 'g', 8 }, { 'G', 8 }, // Reflection alt - unassigned in vanilla. { 'h', 33 }, { 'i', 4 }, { 'j', 8 }, { 'k', 3 }, { 'l', 25 }, { 'm', 44 }, { 'n', 40 }, { 'o', 43 } }; AreaData area = AreaData.Get(session); MapMeta meta = area.GetMeta(); string path; path = meta?.BackgroundTiles; if (string.IsNullOrEmpty(path)) { path = Path.Combine("Graphics", "BackgroundTiles.xml"); } GFX.BGAutotiler = new Autotiler(path); path = meta?.ForegroundTiles; if (string.IsNullOrEmpty(path)) { path = Path.Combine("Graphics", "ForegroundTiles.xml"); } GFX.FGAutotiler = new Autotiler(path); path = meta?.AnimatedTiles; if (string.IsNullOrEmpty(path)) { path = Path.Combine("Graphics", "AnimatedTiles.xml"); } GFX.AnimatedTilesBank = new AnimatedTilesBank(); XmlElement animatedData = Calc.LoadContentXML(path)["Data"]; foreach (XmlElement el in animatedData) { if (el != null) { GFX.AnimatedTilesBank.Add( el.Attr("name"), el.AttrFloat("delay", 0f), el.AttrVector2("posX", "posY", Vector2.Zero), el.AttrVector2("origX", "origY", Vector2.Zero), GFX.Game.GetAtlasSubtextures(el.Attr("path")) ); } } GFX.SpriteBank = new SpriteBank(GFX.Game, Path.Combine("Graphics", "Sprites.xml")); path = meta?.Sprites; if (!string.IsNullOrEmpty(path)) { SpriteBank bankOrig = GFX.SpriteBank; SpriteBank bankMod = new SpriteBank(GFX.Game, path); foreach (KeyValuePair <string, SpriteData> kvpBank in bankMod.SpriteData) { string key = kvpBank.Key; SpriteData valueMod = kvpBank.Value; if (bankOrig.SpriteData.TryGetValue(key, out SpriteData valueOrig)) { IDictionary animsOrig = valueOrig.Sprite.GetAnimations(); IDictionary animsMod = valueMod.Sprite.GetAnimations(); foreach (DictionaryEntry kvpAnim in animsMod) { animsOrig[kvpAnim.Key] = kvpAnim.Value; } valueOrig.Sources.AddRange(valueMod.Sources); // replay the starting animation to be sure it is referring to the new sprite. valueOrig.Sprite.Stop(); if (valueMod.Sprite.CurrentAnimationID != "") { valueOrig.Sprite.Play(valueMod.Sprite.CurrentAnimationID); } } else { bankOrig.SpriteData[key] = valueMod; } } } // This is done exactly once in the vanilla GFX.LoadData method. PlayerSprite.ClearFramesMetadata(); PlayerSprite.CreateFramesMetadata("player"); PlayerSprite.CreateFramesMetadata("player_no_backpack"); PlayerSprite.CreateFramesMetadata("badeline"); PlayerSprite.CreateFramesMetadata("player_badeline"); PlayerSprite.CreateFramesMetadata("player_playback"); path = meta?.Portraits; if (string.IsNullOrEmpty(path)) { path = Path.Combine("Graphics", "Portraits.xml"); } GFX.PortraitsSpriteBank = new SpriteBank(GFX.Portraits, path); orig_ctor(session, startPosition); LastLoadingThread = patch_RunThread.Current; }
public override void CreateModMenuSection(TextMenu menu, bool inGame, EventInstance snapshot) { if (!inGame) { if (Everest.Updater.HasUpdate) { menu.Add(new TextMenu.Button(Dialog.Clean("modoptions_coremodule_update").Replace("((version))", Everest.Updater.Newest.Version.ToString())).Pressed(() => { Everest.Updater.Update(OuiModOptions.Instance.Overworld.Goto <OuiLoggedProgress>()); })); } // Allow downgrading travis / dev builds. if (Celeste.PlayMode == Celeste.PlayModes.Debug || Everest.VersionSuffix.StartsWith("travis-") || Everest.VersionSuffix == "dev") { menu.Add(new TextMenu.Button(Dialog.Clean("modoptions_coremodule_versionlist")).Pressed(() => { OuiModOptions.Instance.Overworld.Goto <OuiVersionList>(); })); } } base.CreateModMenuSection(menu, inGame, snapshot); // Get all Input GUI prefixes and add a slider for switching between them. List <string> inputGuiPrefixes = new List <string>(); inputGuiPrefixes.Add(""); // Auto foreach (KeyValuePair <string, MTexture> kvp in GFX.Gui.GetTextures()) { string path = kvp.Key; if (!path.StartsWith("controls/")) { continue; } path = path.Substring(9); int indexOfSlash = path.IndexOf('/'); if (indexOfSlash == -1) { continue; } path = path.Substring(0, indexOfSlash); if (!inputGuiPrefixes.Contains(path)) { inputGuiPrefixes.Add(path); } } menu.Add( new TextMenu.Slider(Dialog.Clean("modoptions_coremodule_inputgui"), i => { string inputGuiPrefix = inputGuiPrefixes[i]; string fullName = $"modoptions_coremodule_inputgui_{inputGuiPrefix.ToLowerInvariant()}"; return(fullName.DialogCleanOrNull() ?? inputGuiPrefix.ToUpperInvariant()); }, 0, inputGuiPrefixes.Count - 1, Math.Max(0, inputGuiPrefixes.IndexOf(Settings.InputGui))) .Change(i => { Settings.InputGui = inputGuiPrefixes[i]; Input.OverrideInputPrefix = inputGuiPrefixes[i]; }) ); if (Celeste.PlayMode == Celeste.PlayModes.Debug) { menu.Add(new TextMenu.Button(Dialog.Clean("modoptions_coremodule_recrawl")).Pressed(() => { Everest.Content.Recrawl(); Everest.Content.Reprocess(); VirtualContentExt.ForceReload(); AreaData.Load(); })); } }
public void ctor(Session session, Vector2?startPosition = default(Vector2?)) { if (CoreModule.Settings.LazyLoading) { MainThreadHelper.Do(() => VirtualContentExt.UnloadOverworld()); } // Vanilla TileToIndex mappings. SurfaceIndex.TileToIndex = new Dictionary <char, int> { { '1', 3 }, { '3', 4 }, { '4', 7 }, { '5', 8 }, { '6', 8 }, { '7', 8 }, { '8', 8 }, { '9', 13 }, { 'a', 8 }, { 'b', 23 }, { 'c', 8 }, { 'd', 8 }, { 'e', 8 }, { 'f', 8 }, { 'g', 8 }, { 'h', 33 }, { 'i', 4 }, { 'j', 8 }, { 'k', 3 }, { 'l', 25 }, { 'm', 44 }, { 'n', 40 }, { 'o', 43 } }; AreaData area = AreaData.Get(session); MapMeta meta = area.GetMeta(); string path; path = meta?.BackgroundTiles; if (string.IsNullOrEmpty(path)) { path = Path.Combine("Graphics", "BackgroundTiles.xml"); } GFX.BGAutotiler = new Autotiler(path); path = meta?.ForegroundTiles; if (string.IsNullOrEmpty(path)) { path = Path.Combine("Graphics", "ForegroundTiles.xml"); } GFX.FGAutotiler = new Autotiler(path); path = meta?.AnimatedTiles; if (string.IsNullOrEmpty(path)) { path = Path.Combine("Graphics", "AnimatedTiles.xml"); } GFX.AnimatedTilesBank = new AnimatedTilesBank(); XmlElement animatedData = Calc.LoadContentXML(path)["Data"]; foreach (XmlElement el in animatedData) { if (el != null) { GFX.AnimatedTilesBank.Add( el.Attr("name"), el.AttrFloat("delay", 0f), el.AttrVector2("posX", "posY", Vector2.Zero), el.AttrVector2("origX", "origY", Vector2.Zero), GFX.Game.GetAtlasSubtextures(el.Attr("path")) ); } } GFX.SpriteBank = new SpriteBank(GFX.Game, Path.Combine("Graphics", "Sprites.xml")); path = meta?.Sprites; if (!string.IsNullOrEmpty(path)) { SpriteBank bankOrig = GFX.SpriteBank; SpriteBank bankMod = new SpriteBank(GFX.Game, path); foreach (KeyValuePair <string, SpriteData> kvpBank in bankMod.SpriteData) { string key = kvpBank.Key; SpriteData valueMod = kvpBank.Value; if (bankOrig.SpriteData.TryGetValue(key, out SpriteData valueOrig)) { IDictionary animsOrig = valueOrig.Sprite.GetAnimations(); IDictionary animsMod = valueMod.Sprite.GetAnimations(); foreach (DictionaryEntry kvpAnim in animsMod) { animsOrig[kvpAnim.Key] = kvpAnim.Value; } } else { bankOrig.SpriteData[key] = valueMod; } } } path = meta?.Portraits; if (string.IsNullOrEmpty(path)) { path = Path.Combine("Graphics", "Portraits.xml"); } GFX.PortraitsSpriteBank = new SpriteBank(GFX.Portraits, path); orig_ctor(session, startPosition); }
public void ctor(Session session, Vector2?startPosition = default(Vector2?)) { if (CoreModule.Settings.LazyLoading) { VirtualContentExt.UnloadOverworld(); } // Vanilla TileToIndex mappings. SurfaceIndex.TileToIndex = new Dictionary <char, int> { { '1', 3 }, { '3', 4 }, { '4', 7 }, { '5', 8 }, { '6', 8 }, { '7', 8 }, { '8', 8 }, { '9', 13 }, { 'a', 8 }, { 'b', 23 }, { 'c', 8 }, { 'd', 8 }, { 'e', 8 }, { 'f', 8 }, { 'g', 8 }, { 'h', 33 }, { 'i', 4 }, { 'j', 8 }, { 'k', 3 }, { 'l', 33 }, { 'm', 3 } }; AreaData area = AreaData.Get(session); MapMeta meta = area.GetMeta(); string path; path = meta?.BackgroundTiles; if (string.IsNullOrEmpty(path)) { path = Path.Combine("Graphics", "BackgroundTiles.xml"); } GFX.BGAutotiler = new Autotiler(path); path = meta?.ForegroundTiles; if (string.IsNullOrEmpty(path)) { path = Path.Combine("Graphics", "ForegroundTiles.xml"); } GFX.FGAutotiler = new Autotiler(path); path = meta?.AnimatedTiles; if (string.IsNullOrEmpty(path)) { path = Path.Combine("Graphics", "AnimatedTiles.xml"); } GFX.AnimatedTilesBank = new AnimatedTilesBank(); XmlElement animatedData = Calc.LoadContentXML(path)["Data"]; foreach (XmlElement el in animatedData) { if (el != null) { GFX.AnimatedTilesBank.Add( el.Attr("name"), el.AttrFloat("delay", 0f), el.AttrVector2("posX", "posY", Vector2.Zero), el.AttrVector2("origX", "origY", Vector2.Zero), GFX.Game.GetAtlasSubtextures(el.Attr("path")) ); } } path = meta?.Sprites; if (string.IsNullOrEmpty(path)) { path = Path.Combine("Graphics", "Sprites.xml"); } GFX.SpriteBank = new SpriteBank(GFX.Game, path); path = meta?.Portraits; if (string.IsNullOrEmpty(path)) { path = Path.Combine("Graphics", "Portraits.xml"); } GFX.PortraitsSpriteBank = new SpriteBank(GFX.Portraits, path); orig_ctor(session, startPosition); }