Skip to content
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

Merged
merged 4 commits into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions MenuVariantsMod/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea
Folder.DotSettings.user
48 changes: 16 additions & 32 deletions MenuVariantsMod/BezelLoad.cs
Original file line number Diff line number Diff line change
@@ -1,51 +1,35 @@
using Monocle;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using TowerFall;
using FortRise;
using MonoMod.ModInterop;
using System.Diagnostics;

namespace MenuVariantsMod
{
public class BezelLoad
{
public static List<CustomBezel> BezelList;
public static List<string> BezelNames = new List<string>();
public static void Load() {
var _separator = Path.DirectorySeparatorChar.ToString();
var _customLogos = "Content" + _separator + "Mod" + _separator + "CustomBezels" + _separator;
string[] directories = Directory.GetDirectories(_customLogos);
string[] array = directories;
public static List<CustomBezel> BezelList = new();
public static List<string> BezelNames = new();

private static readonly string CUSTOM_BEZELS_DIR ="Content/CustomBezels";

public static void Load(FortContent content)
{
BezelNames.Add("DEFAULT");
BezelList = new List<CustomBezel>();
foreach (string text in array)

foreach (RiseCore.Resource resource in content[CUSTOM_BEZELS_DIR].Childrens)
{
Console.WriteLine(text);
var text2 = text.Replace("Content" + _separator, "");
Atlas atlas = new Atlas(text2 + _separator + "atlas.xml", text2 + _separator + "atlas.png", true);
var BezelData = Calc.LoadXML(text + _separator + "BezelData.xml");
Atlas atlas = AtlasExt.CreateAtlas(content, $"{resource.Path}/atlas.xml", $"{resource.Path}/atlas.png", ContentAccess.ModContent);
Copy link
Contributor Author

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


RiseCore.Resource bezelDataResource = content[$"{resource.Path}/BezelData.xml"];
var BezelData = Calc.LoadXML(bezelDataResource.Stream);
var TrueBezelData = BezelData["BezelData"];
Console.WriteLine(atlas);
if (atlas == null)
{
Debugger.Break();
}
//if (TrueLogoData != null)
//{
CustomBezel BezelCustomData = new CustomBezel(TrueBezelData, atlas);
//if (logoCustomData != null)
//{
BezelList.Add(BezelCustomData);
BezelNames.Add(TrueBezelData.ChildText("Name"));
// }

//}
CustomBezel BezelCustomData = new CustomBezel(TrueBezelData, atlas);
BezelList.Add(BezelCustomData);
BezelNames.Add(TrueBezelData.ChildText("Name"));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<BezelData>
<Name>ASCENSION</Name>
<Left>aspectBarLeft</Left>
<Right>aspectBarRight</Right>
</BezelData>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions MenuVariantsMod/Content/CustomBezels/ClassicBlue/atlas.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<TextureAtlas imagePath="atlas.png">
<SubTexture name="aspectBarLeft" x="1" y="0" width="55" height="240"/>
<SubTexture name="aspectBarRight" x="64" y="0" width="55" height="240"/>
</TextureAtlas>
18 changes: 18 additions & 0 deletions MenuVariantsMod/Content/CustomLogos/TowerSus/LogoData.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<LogoData>
<Name>TOWERSUS</Name>
<VanillaAscension>True</VanillaAscension>
<VanillaAscensionCore>True</VanillaAscensionCore>
<VanillaBg>False</VanillaBg>
<VanillaArrow>True</VanillaArrow>
<VanillaTitle>False</VanillaTitle>

<Title>title/TowerSus</Title>
<TitleLight>title/TowerSusLight</TitleLight>
<Ascension>title/ascension</Ascension>
<Bg>title/TowerSusBg</Bg>
<Arrow>title/bigArrow</Arrow>
<AscensionCore>title/ascensionCoreAnimation</AscensionCore>

<BgOrigin x="148" y = "64"/>
</LogoData>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions MenuVariantsMod/Content/CustomLogos/TowerSus/atlas.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<TextureAtlas imagePath="atlas.png">
<SubTexture name="title/TowerSus" x="14" y="275" width="256" height="78"/>
<SubTexture name="title/TowerSusLight" x="14" y="197" width="256" height="78"/>
<SubTexture name="title/TowerSusBg" x="11" y="9" width="272" height="125"/>
</TextureAtlas>
10 changes: 0 additions & 10 deletions MenuVariantsMod/CustomBezel.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
using Monocle;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using System.Xml;
using System.Security.Cryptography.X509Certificates;
using Microsoft.Xna.Framework;

namespace MenuVariantsMod
{
public class CustomBezel //Just the class for BEZELS....
{

public string Name;
public string Left;
public string Right;
Expand All @@ -26,6 +17,5 @@ public CustomBezel(XmlElement xml, Atlas atlas)
Right = xml.ChildText("Right", defaultValue: "Name Not Defined");
Atlas = atlas;
}

}
}
10 changes: 1 addition & 9 deletions MenuVariantsMod/CustomLogo.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
using Monocle;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using System.Xml;
using System.Security.Cryptography.X509Certificates;
using Microsoft.Xna.Framework;

namespace MenuVariantsMod
{
public class CustomLogo //Just the class for logos....
public class CustomLogo
{
public bool VanillaBg;
public bool VanillaArrow;
Expand Down Expand Up @@ -45,6 +38,5 @@ public CustomLogo(XmlElement xml, Atlas atlas)
Atlas = atlas;
BgOrigin = xml.ChildPosition("BgOrigin", defaultValue: new Vector2(148f, 74f));
}

}
}
123 changes: 0 additions & 123 deletions MenuVariantsMod/ExampleModModule.cs

This file was deleted.

48 changes: 17 additions & 31 deletions MenuVariantsMod/LogoLoad.cs
Original file line number Diff line number Diff line change
@@ -1,53 +1,39 @@
using Monocle;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using TowerFall;
using FortRise;
using MonoMod.ModInterop;
using System.Diagnostics;

namespace MenuVariantsMod
{
public class LogoLoad
{
public static List<CustomLogo> LogoList;
public static void Load() {
private static readonly string CUSTOM_LOGOS_DIR = "Content/CustomLogos";

public static void Load(FortContent content)
{
MenuVariantModModule.Vanilla = new List<bool>();
MenuVariantModModule.Vanilla.Add(true);
MenuVariantModModule.Vanilla.Add(true);
var _separator = Path.DirectorySeparatorChar.ToString();
var _customLogos = "Content" + _separator + "Mod" + _separator + "CustomLogos" + _separator;
string[] directories = Directory.GetDirectories(_customLogos);
string[] array = directories;

LogoList = new List<CustomLogo>();
foreach (string text in array)
foreach (RiseCore.Resource resource in content[CUSTOM_LOGOS_DIR].Childrens)
{
Console.WriteLine(text);
var text2 = text.Replace("Content" + _separator, "");
Atlas atlas = new Atlas(text2 + _separator + "atlas.xml", text2 + _separator + "atlas.png", true);
var LogoData = Calc.LoadXML(text + _separator + "LogoData.xml");
if (resource.Childrens == null)
continue;

Atlas atlas = AtlasExt.CreateAtlas(content, $"{resource.Path}/atlas.xml" , $"{resource.Path}/atlas.png", ContentAccess.ModContent);
RiseCore.Resource logoDataResource = content[$"{resource.Path}/LogoData.xml"];
var LogoData = Calc.LoadXML(logoDataResource.Stream);
var TrueLogoData = LogoData["LogoData"];
Console.WriteLine(atlas);

if (atlas == null)
{
Debugger.Break();
}
//if (TrueLogoData != null)
//{
CustomLogo logoCustomData = new CustomLogo(TrueLogoData, atlas);
//if (logoCustomData != null)
//{
LogoList.Add(logoCustomData);
MenuVariantModModule.MenuVariantNames.Add(TrueLogoData.ChildText("Name"));
MenuVariantModModule.Vanilla.Add(false);
// }

//}
CustomLogo logoCustomData = new CustomLogo(TrueLogoData, atlas);
LogoList.Add(logoCustomData);
MenuVariantModModule.MenuVariantNames.Add(TrueLogoData.ChildText("Name"));
MenuVariantModModule.Vanilla.Add(false);
}
}
}
Expand Down
Loading