[+] Config

pull/7/head
Azalea 2024-02-07 02:38:36 -05:00
parent dcdf951ebc
commit b403189afb
7 changed files with 56 additions and 7 deletions

1
AquaMai/.gitignore vendored
View File

@ -373,3 +373,4 @@ MigrationBackup/
Output Output
.idea .idea
Libs/Assembly-CSharp.dll Libs/Assembly-CSharp.dll
packages

View File

@ -60,6 +60,9 @@
<Reference Include="System.Xml"> <Reference Include="System.Xml">
<HintPath>Libs\System.Xml.dll</HintPath> <HintPath>Libs\System.Xml.dll</HintPath>
</Reference> </Reference>
<Reference Include="Tomlyn, Version=0.17.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Tomlyn.0.17.0\lib\netstandard2.0\Tomlyn.dll</HintPath>
</Reference>
<Reference Include="Unity.Analytics.DataPrivacy"> <Reference Include="Unity.Analytics.DataPrivacy">
<HintPath>Libs\Unity.Analytics.DataPrivacy.dll</HintPath> <HintPath>Libs\Unity.Analytics.DataPrivacy.dll</HintPath>
</Reference> </Reference>
@ -260,9 +263,17 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="CutsceneSkipping.cs" /> <Compile Include="Config.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Main.cs" /> <Compile Include="Main.cs" />
<Compile Include="UX\SkipWarningScreen.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="AquaMai.toml" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View File

@ -0,0 +1,7 @@
# ===================================
# UX: User Experience Improvements
[UX]
# Skip the warning screen and logo shown after the POST sequence
SkipWarningScreen=1

15
AquaMai/Config.cs 100644
View File

@ -0,0 +1,15 @@
using System.Diagnostics.CodeAnalysis;
namespace AquaMai
{
[SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")]
public class Config
{
public UXConfig UX { get; set; }
public class UXConfig
{
public bool SkipWarningScreen { get; set; }
}
}
}

View File

@ -1,5 +1,6 @@
using MelonLoader; using AquaMai.UX;
using HarmonyLib; using MelonLoader;
using Tomlyn;
namespace AquaMai namespace AquaMai
{ {
@ -15,10 +16,20 @@ namespace AquaMai
public class AquaMai : MelonMod public class AquaMai : MelonMod
{ {
public static Config AppConfig { get; private set; }
public override void OnInitializeMelon() public override void OnInitializeMelon()
{ {
MelonLogger.Msg("OnApplicationStart"); MelonLogger.Msg("OnApplicationStart");
HarmonyLib.Harmony.CreateAndPatchAll(typeof(CutsceneSkipping));
// Read AquaMai.toml to load settings
AppConfig = Toml.ToModel<Config>("AquaMai.toml");
if (AppConfig.UX.SkipWarningScreen)
{
MelonLogger.Msg("Patching CutsceneSkipping");
HarmonyLib.Harmony.CreateAndPatchAll(typeof(SkipWarningScreen));
}
} }
} }
} }

View File

@ -1,9 +1,9 @@
using HarmonyLib; using HarmonyLib;
using Monitor; using Monitor;
namespace AquaMai namespace AquaMai.UX
{ {
public class CutsceneSkipping public class SkipWarningScreen
{ {
/* /*
* Patch PlayLogo to disable the warning screen * Patch PlayLogo to disable the warning screen

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Tomlyn" version="0.17.0" targetFramework="net472" />
</packages>