mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-13 00:47:27 +08:00
[+] Generate example config via attributes
This commit is contained in:
@@ -3,15 +3,12 @@ using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using AquaMai.Fix;
|
||||
using AquaMai.Helpers;
|
||||
using AquaMai.MaimaiDX2077;
|
||||
using AquaMai.Resources;
|
||||
using AquaMai.Utils;
|
||||
using AquaMai.UX;
|
||||
using MelonLoader;
|
||||
using Monitor;
|
||||
using Tomlet;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -90,13 +87,6 @@ namespace AquaMai
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
private static extern bool SetConsoleOutputCP(uint wCodePageID);
|
||||
|
||||
private void WriteEmbeddedResourceToFile(string resource, string file)
|
||||
{
|
||||
using var s = MelonAssembly.Assembly.GetManifestResourceStream(resource);
|
||||
using var fs = File.Open(file, FileMode.Create);
|
||||
s.CopyTo(fs);
|
||||
}
|
||||
|
||||
private static void InitLocale()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(AppConfig.UX.Locale))
|
||||
@@ -123,13 +113,12 @@ namespace AquaMai
|
||||
// Check if AquaMai.toml exists
|
||||
if (!File.Exists("AquaMai.toml"))
|
||||
{
|
||||
WriteEmbeddedResourceToFile("AquaMai.AquaMai.toml", "AquaMai.example.toml");
|
||||
WriteEmbeddedResourceToFile("AquaMai.AquaMai.zh.toml", "AquaMai.example.zh.toml");
|
||||
ConfigGenerator.GenerateConfig();
|
||||
MelonLogger.Error("======================================!!!");
|
||||
MelonLogger.Error("AquaMai.toml not found! Please create it.");
|
||||
MelonLogger.Error("找不到配置文件 AquaMai.toml!请创建。");
|
||||
MelonLogger.Error("Example copied to AquaMai.example.toml");
|
||||
MelonLogger.Error("示例已复制到 AquaMai.example.zh.toml");
|
||||
MelonLogger.Error("Example copied to AquaMai.en.toml");
|
||||
MelonLogger.Error("示例已复制到 AquaMai.zh.toml");
|
||||
MelonLogger.Error("=========================================");
|
||||
return;
|
||||
}
|
||||
@@ -137,10 +126,6 @@ namespace AquaMai
|
||||
// Read AquaMai.toml to load settings
|
||||
AppConfig = TomletMain.To<Config>(File.ReadAllText("AquaMai.toml"));
|
||||
|
||||
// Migrate old settings
|
||||
AppConfig.UX.LoadAssetsPng = AppConfig.UX.LoadAssetsPng || AppConfig.UX.LoadJacketPng;
|
||||
AppConfig.UX.LoadJacketPng = false;
|
||||
|
||||
// Init locale with patching C# runtime
|
||||
// https://stackoverflow.com/questions/1952638/single-assembly-multi-language-windows-forms-deployment-ilmerge-and-satellite-a
|
||||
Patch(typeof(I18nSingleAssemblyHook));
|
||||
@@ -179,24 +164,24 @@ namespace AquaMai
|
||||
// New Features & Changes
|
||||
// 现在自定义皮肤相关的功能应该有 CustomSkin, JudgeDisplay4B, CustomTrackStartDiff
|
||||
// 后续应该还会接着做, 所以也许可以考虑把自定义皮肤相关的部分单独分一类 ?
|
||||
Patch(typeof(CustomSkins)); // Rename: CustomNoteSkin -> CustomSkins
|
||||
Patch(typeof(JudgeDisplay4B));
|
||||
Patch(typeof(CustomTrackStartDiff));
|
||||
|
||||
Patch(typeof(RealisticRandomJudge)); // 本来是用来调试判定显示4B的, 觉得还挺有趣就单独做成功能了
|
||||
|
||||
Patch(typeof(DisableTrackStartTabs)); // 从 TrackStartProcessTweak 里单独拆出来了
|
||||
|
||||
// Patch(typeof(CustomSkins)); // Rename: CustomNoteSkin -> CustomSkins
|
||||
// Patch(typeof(JudgeDisplay4B));
|
||||
// Patch(typeof(CustomTrackStartDiff));
|
||||
|
||||
// Patch(typeof(RealisticRandomJudge)); // 本来是用来调试判定显示4B的, 觉得还挺有趣就单独做成功能了
|
||||
|
||||
// Patch(typeof(DisableTrackStartTabs)); // 从 TrackStartProcessTweak 里单独拆出来了
|
||||
|
||||
// 以下三项拆分自 SlideJudgeTweak
|
||||
Patch(typeof(FanJudgeFlip));
|
||||
Patch(typeof(BreakSlideJudgeBlink));
|
||||
Patch(typeof(FixCircleSlideJudge)); // 这个我觉得算无副作用, 可以常开
|
||||
|
||||
// Patch(typeof(FanJudgeFlip));
|
||||
// Patch(typeof(BreakSlideJudgeBlink));
|
||||
// Patch(typeof(FixCircleSlideJudge)); // 这个我觉得算无副作用, 可以常开
|
||||
|
||||
// 这是一项往 Sinmai 里加各种新 note 的企划, 目前只完成了可高度自定义形状的星星
|
||||
// 未来还会缓慢更新, 我建议单开一个功能分类
|
||||
// 注意需要往 UserLib 里放入 System.Numeric.dll
|
||||
Patch(typeof(CustomNoteTypePatch));
|
||||
|
||||
// Patch(typeof(CustomNoteTypePatch));
|
||||
|
||||
# if DEBUG
|
||||
Patch(typeof(LogNetworkErrors));
|
||||
# endif
|
||||
|
||||
Reference in New Issue
Block a user