Skip to content

Commit

Permalink
tried to fix a bug but fuck????
Browse files Browse the repository at this point in the history
  • Loading branch information
headassbtw committed Jul 18, 2021
1 parent 28cbb15 commit 816049d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 15 deletions.
12 changes: 6 additions & 6 deletions CustomMenuText.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomMenuText", "CustomMen
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BD778688-A364-4686-9D97-B7FB0E34C684}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BD778688-A364-4686-9D97-B7FB0E34C684}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BD778688-A364-4686-9D97-B7FB0E34C684}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BD778688-A364-4686-9D97-B7FB0E34C684}.Release|Any CPU.Build.0 = Release|Any CPU
{BD778688-A364-4686-9D97-B7FB0E34C684}.Debug|x64.ActiveCfg = Debug|x64
{BD778688-A364-4686-9D97-B7FB0E34C684}.Debug|x64.Build.0 = Debug|x64
{BD778688-A364-4686-9D97-B7FB0E34C684}.Release|x64.ActiveCfg = Release|x64
{BD778688-A364-4686-9D97-B7FB0E34C684}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
8 changes: 8 additions & 0 deletions CustomMenuText/CustomMenuText.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@
<DisableCopyToPlugins>True</DisableCopyToPlugins>
<DisableZipRelease>True</DisableZipRelease>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<OutputPath>bin\x64\Release\</OutputPath>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<OutputPath>bin\x64\Debug\</OutputPath>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony, Version=2.0.2.0, Culture=neutral, processorArchitecture=MSIL">
<Private>False</Private>
Expand Down
32 changes: 23 additions & 9 deletions CustomMenuText/Views/TextSelector/TextSelectorViewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -345,28 +345,42 @@ public void SetupTextList()
}
public void SetupFontList()
{
//this should prevent selecting a font that doesn't exist
if (Configuration.PluginConfig.Instance.Font > FontManager.Fonts.Count)
Configuration.PluginConfig.Instance.Font = FontManager.Fonts.Count;
fontListData.data.Clear();
foreach (var font in FontManager.Fonts)
{
string name = Path.GetFileNameWithoutExtension(font.sourceFontFile.name);
Plugin.Log.Notice($"adding font\"{name}\" to table");

CustomListTableData.CustomCellInfo fontCell;
if (name.ToLower().Equals("neontubes2") || name.ToLower().Equals("beon") || name.ToLower().Equals("teko"))
try
{
fontCell = new CustomListTableData.CustomCellInfo(name, "Built-In");
fontListData.data.Add(fontCell);
string name = Path.GetFileNameWithoutExtension(font.sourceFontFile.name);
Plugin.Log.Notice($"adding font\"{name}\" to table");

if (name.ToLower().Equals("neontubes2") || name.ToLower().Equals("beon") || name.ToLower().Equals("teko"))
{
fontCell = new CustomListTableData.CustomCellInfo(name, "Built-In");
fontListData.data.Add(fontCell);
}
else
{
fontCell = new CustomListTableData.CustomCellInfo(name);
fontListData.data.Add(fontCell);
}
}
else
catch (Exception e)
{
fontCell = new CustomListTableData.CustomCellInfo(name);
fontCell = new CustomListTableData.CustomCellInfo("Broken Font", "please remove it");
fontListData.data.Add(fontCell);
Plugin.Log.Critical("Exception while adding font:");
Console.WriteLine(e.ToString());
}

}
fontListData.tableView.ReloadData();
fontListData.tableView.SelectCellWithIdx(Configuration.PluginConfig.Instance.Font);

try{fontListData.tableView.SelectCellWithIdx(Configuration.PluginConfig.Instance.Font);}
catch(IndexOutOfRangeException){Plugin.Log.Critical("Tried to select a font beyond the bounds of the list");}
Plugin.mainText.font = FontManager.Fonts[Configuration.PluginConfig.Instance.Font];
Plugin.bottomText.font = FontManager.Fonts[Configuration.PluginConfig.Instance.Font];
}
Expand Down

0 comments on commit 816049d

Please sign in to comment.