diff --git a/AquaMai/AquaMai.csproj b/AquaMai/AquaMai.csproj
index 2ae6bd60..120ca7be 100644
--- a/AquaMai/AquaMai.csproj
+++ b/AquaMai/AquaMai.csproj
@@ -284,9 +284,6 @@ DEBUG
Libs\UnityEngine.XRModule.dll
-
- Libs\UrGUI.dll
-
@@ -304,6 +301,7 @@ DEBUG
+
@@ -318,9 +316,11 @@ DEBUG
+
+
@@ -334,7 +334,6 @@ DEBUG
-
diff --git a/AquaMai/AquaMai.toml b/AquaMai/AquaMai.toml
index fa4c3bee..6cd79dec 100644
--- a/AquaMai/AquaMai.toml
+++ b/AquaMai/AquaMai.toml
@@ -48,8 +48,6 @@ CustomPlaceName=""
# In the song selection screen, press the Service button or the "7" key (the round button in the middle of the arrow keys in the default ADX firmware) to toggle the display of self-made charts.
# A directory is considered to contain self-made charts if it does not have DataConfig.xml or OfficialChartsMark.txt in the Axxx directory.
HideSelfMadeCharts=true
-# Show detail of selected song in music selection screen
-SelectionDetail=true
[Fix]
# Allow login with higher data version
@@ -78,6 +76,8 @@ Windowed=false
# If set to 0, windowed mode will remember the user-set size, fullscreen mode will use the current display resolution
Width=0
Height=0
+# Show detail of selected song in music selection screen
+SelectionDetail=true
# ===================================
# Save some potentially unnecessary time
diff --git a/AquaMai/AquaMai.zh.toml b/AquaMai/AquaMai.zh.toml
index d5049b7e..65c9bba5 100644
--- a/AquaMai/AquaMai.zh.toml
+++ b/AquaMai/AquaMai.zh.toml
@@ -57,8 +57,6 @@ CustomPlaceName=""
# 选歌界面按下 Service 键或者键盘上的 “7” 键(ADX 默认固件下箭头键中间的圆形按键)切换自制谱的显示和隐藏
# 是否是自制谱的判断方式是 Axxx 目录里没有 DataConfig.xml 或 OfficialChartsMark.txt 就认为这个目录里是自制谱
HideSelfMadeCharts=true
-# 选歌界面显示选择的歌曲的详情
-SelectionDetail=true
# ===================================
# 修复一些潜在的问题
@@ -94,6 +92,8 @@ Windowed=false
# 如果设为 0,窗口化将记住用户设定的大小,全屏时将使用当前显示器分辨率
Width=0
Height=0
+# 选歌界面显示选择的歌曲的详情
+SelectionDetail=true
# ===================================
# 节省一些不知道有用没用的时间
diff --git a/AquaMai/Config.cs b/AquaMai/Config.cs
index 8b441a81..7ea65902 100644
--- a/AquaMai/Config.cs
+++ b/AquaMai/Config.cs
@@ -34,7 +34,6 @@ namespace AquaMai
public bool LoadLocalBga { get; set; }
public bool TestProof { get; set; }
public bool HideSelfMadeCharts { get; set; }
- public bool SelectionDetail { get; set; }
public string CustomVersionString { get; set; } = "";
public string CustomPlaceName { get; set; } = "";
public string ExecOnIdle { get; set; } = "";
@@ -61,6 +60,7 @@ namespace AquaMai
public int Width { get; set; }
public int Height { get; set; }
public bool PractiseMode { get; set; }
+ public bool SelectionDetail { get; set; }
}
public class TimeSavingConfig
diff --git a/AquaMai/Helpers/GuiSizes.cs b/AquaMai/Helpers/GuiSizes.cs
new file mode 100644
index 00000000..0235df7d
--- /dev/null
+++ b/AquaMai/Helpers/GuiSizes.cs
@@ -0,0 +1,12 @@
+using UnityEngine;
+
+namespace AquaMai.Helpers;
+
+public static class GuiSizes
+{
+ public static float PlayerWidth => Screen.height / 1920f * 1080;
+ public static float PlayerCenter => AquaMai.AppConfig.UX.SinglePlayer ? Screen.width / 2f : Screen.width / 2f - PlayerWidth / 2;
+ public static int FontSize => (int)(PlayerWidth * .015f);
+ public static float LabelHeight => FontSize * 1.5f;
+ public static float Margin => PlayerWidth * .005f;
+}
diff --git a/AquaMai/Libs/UrGUI.dll b/AquaMai/Libs/UrGUI.dll
deleted file mode 100644
index 46c3194b..00000000
Binary files a/AquaMai/Libs/UrGUI.dll and /dev/null differ
diff --git a/AquaMai/Main.cs b/AquaMai/Main.cs
index 706bc4df..e79a6fe2 100644
--- a/AquaMai/Main.cs
+++ b/AquaMai/Main.cs
@@ -140,6 +140,9 @@ namespace AquaMai
Patch(typeof(RunCommandOnEvents));
// Utils
Patch(typeof(JudgeAdjust));
+# if DEBUG
+ Patch(typeof(LogNetworkErrors));
+# endif
// Apply patches based on the settings
ApplyPatches();
diff --git a/AquaMai/Utils/LogNetworkErrors.cs b/AquaMai/Utils/LogNetworkErrors.cs
new file mode 100644
index 00000000..718eb2f3
--- /dev/null
+++ b/AquaMai/Utils/LogNetworkErrors.cs
@@ -0,0 +1,47 @@
+using System.Diagnostics;
+using HarmonyLib;
+using Manager;
+using Manager.Operation;
+using MelonLoader;
+using Net.Packet;
+
+namespace AquaMai.Utils;
+
+public class LogNetworkErrors
+{
+ [HarmonyPostfix]
+ [HarmonyPatch(typeof(Packet), "ProcImpl")]
+ public static void Postfix(PacketState __result, Packet __instance)
+ {
+ if (__result == PacketState.Error)
+ {
+ MelonLogger.Msg($"[LogNetworkErrors] {__instance.Query.Api}: {__instance.Status}");
+ }
+ }
+
+ [HarmonyPostfix]
+ [HarmonyPatch(typeof(DataDownloader), "NotifyOffline")]
+ public static void DataDownloader()
+ {
+ MelonLogger.Msg("[LogNetworkErrors] DataDownloader NotifyOffline");
+ var stackTrace = new StackTrace();
+ MelonLogger.Msg(stackTrace.ToString());
+ }
+
+ [HarmonyPostfix]
+ [HarmonyPatch(typeof(OnlineCheckInterval), "NotifyOffline")]
+ public static void OnlineCheckInterval()
+ {
+ MelonLogger.Msg("[LogNetworkErrors] OnlineCheckInterval NotifyOffline");
+ var stackTrace = new StackTrace();
+ MelonLogger.Msg(stackTrace.ToString());
+ }
+
+ [HarmonyPostfix]
+ [HarmonyPatch(typeof(OperationManager), "IsAliveAimeServer", MethodType.Getter)]
+ public static void IsAliveAimeServer(bool __result)
+ {
+ if (__result == false)
+ MelonLogger.Msg($"[LogNetworkErrors] IsAliveAimeServer Is {__result}");
+ }
+}
diff --git a/AquaMai/Utils/PractiseMode.cs b/AquaMai/Utils/PractiseMode.cs
index e2319411..fd8498bb 100644
--- a/AquaMai/Utils/PractiseMode.cs
+++ b/AquaMai/Utils/PractiseMode.cs
@@ -8,7 +8,6 @@ using Manager;
using Monitor;
using Process;
using UnityEngine;
-using UrGUI.GUIWindow;
namespace AquaMai.Utils;
@@ -80,33 +79,6 @@ public class PractiseMode
SetSpeed();
}
- private class DebugWindow : MonoBehaviour
- {
- private GUIWindow window;
-
- public void Start()
- {
- window = GUIWindow.Begin("练习模式 测试");
- window.Button("暂停", () => DebugFeature.Pause = !DebugFeature.Pause);
- window.SameLine();
- window.Button("向前", () => DebugFeature.Seek(-1000));
- window.Button("向后", () => DebugFeature.Seek(1000));
- window.SameLine(1, 1, 1);
- window.Button("循环开始", () => repeatStart = DebugFeature.CurrentPlayMsec);
- window.Button("循环结束", () => SetRepeatEnd(DebugFeature.CurrentPlayMsec));
- window.Button("循环解除", ClearRepeat);
- window.SameLine(1, 1, 1);
- window.Button("加速", SpeedUp);
- window.Button("减速", SpeedDown);
- window.Button("速度重置", SpeedReset);
- }
-
- private void OnGUI()
- {
- window?.Draw();
- }
- }
-
public static PractiseModeUI ui;
[HarmonyPatch(typeof(GameProcess), "OnStart")]
@@ -124,11 +96,7 @@ public class PractiseMode
[HarmonyPatch(typeof(GenericProcess), "OnUpdate")]
public static void OnGenericProcessUpdate(GenericMonitor[] ____monitors)
{
- if (Input.GetKeyDown(KeyCode.F12))
- {
- ____monitors[0].gameObject.AddComponent();
- }
- else if (Input.GetKeyDown(KeyCode.F11))
+ if (Input.GetKeyDown(KeyCode.F11))
{
____monitors[0].gameObject.AddComponent();
}
diff --git a/AquaMai/Utils/PractiseModeUI.cs b/AquaMai/Utils/PractiseModeUI.cs
index e057f05e..79da940b 100644
--- a/AquaMai/Utils/PractiseModeUI.cs
+++ b/AquaMai/Utils/PractiseModeUI.cs
@@ -1,65 +1,42 @@
using System;
using AquaMai.Fix;
+using AquaMai.Helpers;
using Manager;
using UnityEngine;
-using UrGUI.GUIWindow;
namespace AquaMai.Utils;
public class PractiseModeUI : MonoBehaviour
{
- private float playerWidth;
- private float playerCenter;
- private float windowTop;
- private float controlHeight;
- private float margin;
- private float sideButtonWidth;
- private float centerButtonWidth;
- private int fontSize;
+ private static float windowTop => Screen.height - GuiSizes.PlayerWidth + GuiSizes.PlayerWidth * .22f;
+ private static float controlHeight => GuiSizes.PlayerWidth * .13f;
+ private static float sideButtonWidth => GuiSizes.PlayerWidth * .1f;
+ private static float centerButtonWidth => GuiSizes.PlayerWidth * .28f;
+ private static int fontSize => (int)(GuiSizes.PlayerWidth * .02f);
- public void Start()
- {
- playerWidth = Screen.height / 1920f * 1080;
- if (AquaMai.AppConfig.UX.SinglePlayer)
- {
- playerCenter = Screen.width / 2f;
- }
- else
- {
- playerCenter = Screen.width / 2f - playerWidth / 2;
- }
-
- windowTop = Screen.height - playerWidth + playerWidth * .22f;
- controlHeight = playerWidth * .13f;
- margin = playerWidth * .01f;
- sideButtonWidth = playerWidth * .1f;
- centerButtonWidth = playerWidth * .28f;
- fontSize = (int)(playerWidth * .02f);
- }
-
- public Rect GetButtonRect(int pos, int row)
+ private static Rect GetButtonRect(int pos, int row)
{
float x;
float width;
switch (pos)
{
case 0:
- x = playerCenter - centerButtonWidth / 2 - sideButtonWidth - margin;
+ x = GuiSizes.PlayerCenter - centerButtonWidth / 2 - sideButtonWidth - GuiSizes.Margin;
width = sideButtonWidth;
break;
case 1:
- x = playerCenter - centerButtonWidth / 2;
+ x = GuiSizes.PlayerCenter - centerButtonWidth / 2;
width = centerButtonWidth;
break;
case 2:
- x = playerCenter + centerButtonWidth / 2 + margin;
+ x = GuiSizes.PlayerCenter + centerButtonWidth / 2 + GuiSizes.Margin;
width = sideButtonWidth;
break;
default:
throw new ArgumentOutOfRangeException(nameof(pos), pos, null);
}
- return new Rect(x, windowTop + (margin + controlHeight) * row + margin, width, controlHeight);
+ return new Rect(x, windowTop + (GuiSizes.Margin + controlHeight) * row + GuiSizes.Margin, width, controlHeight);
}
public void OnGUI()
@@ -72,10 +49,10 @@ public class PractiseModeUI : MonoBehaviour
buttonStyle.fontSize = fontSize;
GUI.Box(new Rect(
- playerCenter - centerButtonWidth / 2 - sideButtonWidth - margin * 2,
+ GuiSizes.PlayerCenter - centerButtonWidth / 2 - sideButtonWidth - GuiSizes.Margin * 2,
windowTop,
- centerButtonWidth + sideButtonWidth * 2 + margin * 4,
- controlHeight * 4 + margin * 5
+ centerButtonWidth + sideButtonWidth * 2 + GuiSizes.Margin * 4,
+ controlHeight * 4 + GuiSizes.Margin * 5
), "");
GUI.Button(GetButtonRect(0, 0), "Seek <<");
diff --git a/AquaMai/UX/SelectionDetail.cs b/AquaMai/Utils/SelectionDetail.cs
similarity index 68%
rename from AquaMai/UX/SelectionDetail.cs
rename to AquaMai/Utils/SelectionDetail.cs
index fe41c19d..14702de6 100644
--- a/AquaMai/UX/SelectionDetail.cs
+++ b/AquaMai/Utils/SelectionDetail.cs
@@ -1,4 +1,5 @@
-using System.Linq;
+using System.Collections.Generic;
+using System.Linq;
using AquaMai.Helpers;
using HarmonyLib;
using MAI2.Util;
@@ -8,9 +9,8 @@ using Manager.UserDatas;
using Monitor;
using Process;
using UnityEngine;
-using UrGUI.GUIWindow;
-namespace AquaMai.UX;
+namespace AquaMai.Utils;
public class SelectionDetail
{
@@ -65,31 +65,38 @@ public class SelectionDetail
private abstract class Window : MonoBehaviour
{
- private GUIWindow window;
protected abstract int player { get; }
- public void Start()
+ public void OnGUI()
{
- var x = Screen.width / 2f - 100;
- if (!AquaMai.AppConfig.UX.SinglePlayer)
- {
- var halfPlayerWidth = Screen.height / 1920f * 1080 / 2;
- x += halfPlayerWidth * (player == 0 ? -1 : 1);
- }
-
- window = GUIWindow.Begin($"ID: {SelectData.MusicData.name.id}", x, Screen.height * 0.87f, 200, 50, 10, 22, 5, true, true, true);
- window.Label(MusicDirHelper.LookupPath(SelectData.MusicData.name.id).Split('/').Reverse().ToArray()[3]);
+ var dataToShow = new List();
+ dataToShow.Add($"ID: {SelectData.MusicData.name.id}");
+ dataToShow.Add(MusicDirHelper.LookupPath(SelectData.MusicData.name.id).Split('/').Reverse().ToArray()[3]);
if (SelectData.MusicData.genreName is not null) // SelectData.MusicData.genreName.str may not correct
- window.Label(Singleton.Instance.GetMusicGenre(SelectData.MusicData.genreName.id)?.genreName);
+ dataToShow.Add(Singleton.Instance.GetMusicGenre(SelectData.MusicData.genreName.id)?.genreName);
if (SelectData.MusicData.AddVersion is not null)
- window.Label(Singleton.Instance.GetMusicVersion(SelectData.MusicData.AddVersion.id)?.genreName);
+ dataToShow.Add(Singleton.Instance.GetMusicVersion(SelectData.MusicData.AddVersion.id)?.genreName);
var notesData = SelectData.MusicData.notesData[difficulty[player]];
- window.Label($"{notesData?.level}.{notesData?.levelDecimal}");
+ dataToShow.Add($"{notesData?.level}.{notesData?.levelDecimal}");
var rate = CalcB50(SelectData.MusicData, difficulty[player]);
if (rate > 0)
{
- window.Label($"SSS+ => DXRating += {rate}");
+ dataToShow.Add($"SSS+ => DXRating += {rate}");
+ }
+
+
+ var x = GuiSizes.PlayerCenter - 100 + GuiSizes.PlayerWidth * player;
+ var y = Screen.height * 0.87f;
+
+ var labelStyle = GUI.skin.GetStyle("label");
+ labelStyle.fontSize = GuiSizes.FontSize;
+ labelStyle.alignment = TextAnchor.MiddleCenter;
+
+ GUI.Box(new Rect(x, y, 200, dataToShow.Count * GuiSizes.LabelHeight + 2 * GuiSizes.Margin), "");
+ for (var i = 0; i < dataToShow.Count; i++)
+ {
+ GUI.Label(new Rect(x, y + GuiSizes.Margin + i * GuiSizes.LabelHeight, 200, GuiSizes.LabelHeight), dataToShow[i]);
}
}
@@ -107,11 +114,6 @@ public class SelectionDetail
return 0;
}
- private void OnGUI()
- {
- window?.Draw();
- }
-
public void Close()
{
Destroy(this);