diff --git a/AquaMai/AquaMai.csproj b/AquaMai/AquaMai.csproj
index 0f42a5de..0ec5818a 100644
--- a/AquaMai/AquaMai.csproj
+++ b/AquaMai/AquaMai.csproj
@@ -327,6 +327,7 @@ DEBUG
+
diff --git a/AquaMai/AquaMai.toml b/AquaMai/AquaMai.toml
index 6cd79dec..26cd6916 100644
--- a/AquaMai/AquaMai.toml
+++ b/AquaMai/AquaMai.toml
@@ -96,6 +96,8 @@ IWontTapOrSlideVigorously=true
SkipGameOverScreen=true
# Skip TrackStart screen
SkipTrackStart=true
+# Show reason when net icon is gray
+ShowNetErrorDetail=true
[TouchSensitivity]
# Enable custom sensitivity
diff --git a/AquaMai/AquaMai.zh.toml b/AquaMai/AquaMai.zh.toml
index 65c9bba5..f01f8065 100644
--- a/AquaMai/AquaMai.zh.toml
+++ b/AquaMai/AquaMai.zh.toml
@@ -94,6 +94,8 @@ Width=0
Height=0
# 选歌界面显示选择的歌曲的详情
SelectionDetail=true
+# 出现灰网时显示原因
+ShowNetErrorDetail=true
# ===================================
# 节省一些不知道有用没用的时间
diff --git a/AquaMai/Config.cs b/AquaMai/Config.cs
index e89d6011..88981f7c 100644
--- a/AquaMai/Config.cs
+++ b/AquaMai/Config.cs
@@ -62,6 +62,7 @@ namespace AquaMai
public int Height { get; set; }
public bool PractiseMode { get; set; }
public bool SelectionDetail { get; set; }
+ public bool ShowNetErrorDetail { get; set; }
}
public class TimeSavingConfig
diff --git a/AquaMai/Main.cs b/AquaMai/Main.cs
index bb24ed04..5bce860e 100644
--- a/AquaMai/Main.cs
+++ b/AquaMai/Main.cs
@@ -174,8 +174,7 @@ namespace AquaMai
if (_hasErrors)
{
- MelonLogger.Warning("========================================================================!!!");
- MelonLogger.Warning(Locale.LoadError);
+ MelonLogger.Warning("========================================================================!!!\n" + Locale.LoadError);
MelonLogger.Warning("===========================================================================");
}
diff --git a/AquaMai/Resources/Locale.Designer.cs b/AquaMai/Resources/Locale.Designer.cs
index bf09b17c..2e6303cb 100644
--- a/AquaMai/Resources/Locale.Designer.cs
+++ b/AquaMai/Resources/Locale.Designer.cs
@@ -98,6 +98,42 @@ namespace AquaMai.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Aime reader error.
+ ///
+ internal static string NetErrIsAliveAimeReader {
+ get {
+ return ResourceManager.GetString("NetErrIsAliveAimeReader", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Aime server error.
+ ///
+ internal static string NetErrIsAliveAimeServer {
+ get {
+ return ResourceManager.GetString("NetErrIsAliveAimeServer", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Server communication error.
+ ///
+ internal static string NetErrIsAliveServer {
+ get {
+ return ResourceManager.GetString("NetErrIsAliveServer", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Data download not success.
+ ///
+ internal static string NetErrWasDownloadSuccessOnce {
+ get {
+ return ResourceManager.GetString("NetErrWasDownloadSuccessOnce", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Pause.
///
diff --git a/AquaMai/Resources/Locale.resx b/AquaMai/Resources/Locale.resx
index bbab57db..93004b44 100644
--- a/AquaMai/Resources/Locale.resx
+++ b/AquaMai/Resources/Locale.resx
@@ -69,4 +69,16 @@
Loaded!
+
+ Server communication error
+
+
+ Aime reader error
+
+
+ Aime server error
+
+
+ Data download not success
+
diff --git a/AquaMai/Resources/Locale.zh.resx b/AquaMai/Resources/Locale.zh.resx
index f637f92b..8f0111d9 100644
--- a/AquaMai/Resources/Locale.zh.resx
+++ b/AquaMai/Resources/Locale.zh.resx
@@ -62,4 +62,16 @@
加载完成!
+
+ 主服务器通信错误
+
+
+ Aime 读卡器错误
+
+
+ AimeDB 通信错误
+
+
+ 数据下载不成功
+
diff --git a/AquaMai/UX/ImmediateSave.cs b/AquaMai/UX/ImmediateSave.cs
index 7a73857d..a978c15b 100644
--- a/AquaMai/UX/ImmediateSave.cs
+++ b/AquaMai/UX/ImmediateSave.cs
@@ -42,13 +42,10 @@ public class ImmediateSave
void CheckSaveDone()
{
doneCount++;
- if (doneCount == 4)
- {
- if (ui != null)
- {
- UnityEngine.Object.Destroy(ui);
- }
- }
+ if (doneCount != 4) return;
+ if (ui == null) return;
+ UnityEngine.Object.Destroy(ui);
+ ui = null;
}
for (int i = 0; i < 2; i++)
diff --git a/AquaMai/Utils/ShowNetErrorDetail.cs b/AquaMai/Utils/ShowNetErrorDetail.cs
new file mode 100644
index 00000000..c3691689
--- /dev/null
+++ b/AquaMai/Utils/ShowNetErrorDetail.cs
@@ -0,0 +1,69 @@
+using System.Collections.Generic;
+using AquaMai.Helpers;
+using AquaMai.Resources;
+using HarmonyLib;
+using MAI2.Util;
+using Manager;
+using MelonLoader;
+using Monitor;
+using Process;
+using UnityEngine;
+
+namespace AquaMai.Utils;
+
+public class ShowNetErrorDetail
+{
+ [HarmonyPatch(typeof(CommonProcess), "OnStart")]
+ [HarmonyPostfix]
+ public static void SetIconStatus(CommonMonitor[] ____monitors)
+ {
+ ____monitors[0].gameObject.AddComponent();
+ }
+
+ private class DetailUi : MonoBehaviour
+ {
+ public void OnGUI()
+ {
+ var errors = new List();
+ if (!Singleton.Instance.IsAliveServer)
+ {
+ errors.Add(Locale.NetErrIsAliveServer);
+ }
+
+ if (!Singleton.Instance.IsAliveAimeReader)
+ {
+ errors.Add(Locale.NetErrIsAliveAimeReader);
+ }
+
+ if (!Singleton.Instance.IsAliveAimeServer)
+ {
+ errors.Add(Locale.NetErrIsAliveAimeServer);
+ }
+
+ if (!Singleton.Instance.WasDownloadSuccessOnce)
+ {
+ errors.Add(Locale.NetErrWasDownloadSuccessOnce);
+ }
+
+ if (errors.Count == 0)
+ {
+ return;
+ }
+
+ var labelStyle = GUI.skin.GetStyle("label");
+ labelStyle.fontSize = GuiSizes.FontSize;
+ labelStyle.alignment = TextAnchor.MiddleCenter;
+
+ var x = GuiSizes.PlayerCenter + GuiSizes.PlayerWidth * .2f;
+ var y = Screen.height * .01f;
+ var width = GuiSizes.FontSize * 15f;
+ var height = GuiSizes.LabelHeight * errors.Count + GuiSizes.Margin * 2;
+
+ GUI.Box(new Rect(x, y, width, height), "");
+ for (var i = 0; i < errors.Count; i++)
+ {
+ GUI.Label(new Rect(x, y + GuiSizes.Margin + GuiSizes.LabelHeight * i, width, GuiSizes.LabelHeight), errors[i]);
+ }
+ }
+ }
+}