-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Menu Variants is now compatible with Fortrise new version! #16
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I request a small changes on changing the obsolete signature that will be removed next major version. The path concatenation with _separator
could be replaced with Path.Combine
instead.
MenuVariantsMod/BezelLoad.cs
Outdated
@@ -28,24 +19,17 @@ public static void Load() { | |||
{ | |||
Console.WriteLine(text); | |||
var text2 = text.Replace("Content" + _separator, ""); | |||
Atlas atlas = new Atlas(text2 + _separator + "atlas.xml", text2 + _separator + "atlas.png", true); | |||
Atlas atlas = AtlasExt.CreateAtlas(content, text2 + _separator + "atlas.xml", text2 + _separator + "atlas.png", true, ContentAccess.Content); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should remove the 4th argument since this signature is obsolete and will be removed in 5.0
MenuVariantsMod/LogoLoad.cs
Outdated
Atlas atlas = new Atlas(text2 + _separator + "atlas.xml", text2 + _separator + "atlas.png", true); | ||
var LogoData = Calc.LoadXML(text + _separator + "LogoData.xml"); | ||
Console.WriteLine(customLogoPath); | ||
Atlas atlas = AtlasExt.CreateAtlas(content, customLogoPath + _separator + "atlas.xml", customLogoPath + _separator + "atlas.png", true, ContentAccess.Root); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one as well is using the obsolete signature
Hi @Terria-K, Thank you for the feedback! I've followed your instructions and updated the code to use Path.Combine for creating the custom assets path. Additionally, I have changed the CreateAtlas method to use the non-obsolete signature as recommended. I also made several corrections to some mistakes I had made and renamed the main module class to something more appropriate, rather than leaving it as ExampleModModule. One concern I had was the hardcoding of the mod's folder name. I wanted to avoid assuming that players will always use the same folder name. Is there a way to dynamically retrieve the mod folder name, perhaps via ContentAccess.ModContent or another method? Any guidance here would be greatly appreciated!
|
There's a way to do this if you want to look inside of the mod content itself which uses
Basic usage would be like: private static readonly string CUSTOM_LOGOS_DIR = Path.Combine("Content", "CustomLogos" );
/* inside of LoadContent */
string anotherPath = Path.Combine(CUSTOM_LOGOS_DIR, "path/to/file").Replace('\\'. '/');
using Stream stream = Content[anotherPath].Stream;
// Do someting with the stream The
If you need to iterate all files from a directory, you need to lookup a directory from a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe I have completed all the changes I intended, and the code is now stable and ready for a new release. If you encounter any issues, please let me know, and I will address them.
{ | ||
Atlas atlas = AtlasExt.CreateAtlas(content, Path.Combine(customBezelPath, "atlas.xml"), Path.Combine(customBezelPath,"atlas.png")); | ||
var BezelData = Calc.LoadXML(Path.Combine(customBezelPath, "BezelData.xml")); | ||
Atlas atlas = AtlasExt.CreateAtlas(content, $"{resource.Path}/atlas.xml", $"{resource.Path}/atlas.png", ContentAccess.ModContent); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loading based on Mod Content Folder concatenating string with $, i also needed to get the logo xml resource and then then load the XML, i think its better then using a path from root
@@ -5,6 +5,9 @@ public class MyBezel | |||
{ | |||
public static void MyLoad() | |||
{ | |||
if (MenuVariantModModule.Settings.BezelVariant > 0 && !BezelLoad.BezelList.Any()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put this check so that when the configuration is set to use a custom logo, if on the next start this custom bezel is not present it will use the default one (user can delete the custom bezel folder and it dont crash)
@@ -37,6 +37,10 @@ public static void ctor(On.TowerFall.Logo.orig_ctor orig, Logo self) | |||
self.RemoveAll(); | |||
var towerTarget = LogoData.Get<Vector2>("towerTarget"); | |||
var coreTarget = LogoData.Get<Vector2>("towerTarget"); | |||
|
|||
if (MenuVariantModModule.Settings.MenuVariant >= MenuVariantModModule.Vanilla.Count) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing for logos
<NoWarn>1701;1702;0104;1061;0246;0118;0123</NoWarn> | ||
<WarningLevel>0</WarningLevel> | ||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
<OutputPath>..\Towerfall - Ascension\Mods\MenuVariantsMod\</OutputPath> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For simplicity, output in the mod base folder; Fortrise ONLY loads from the Towerfall\Mods
folder.
Add credits
Merged! A later update will be added for more QOL features and customization options. |
This pull request fixes issue #6
Updated Atlas Creation:
I Replaced the deprecated new Atlas() with the recommended AtlasExt.CreateAtlas() method to ensure compatibility with the latest system architecture.
Improved Logo and Bezel Loading:
Modified the logo and bezel loading process so that assets no longer need to be placed in the root Content folder. Instead, logos and bezels can now be stored directly within the Mod's Content folder for better organization and modularity.
Enhanced Mod Settings Menu:
Updated the Mod Settings menu to utilize the new CreateModSettings(TextContainer textContainer) hook, allowing players to change logos and bezels in real-time without the need to restart the game.
Let me know if you need any clarification or further adjustments. I’m happy to assist with any questions or issues that may arise.