mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-14 01:37:28 +08:00
[+] Show tip when saving is done
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
using Main;
|
||||||
using Process;
|
using Process;
|
||||||
|
|
||||||
namespace AquaMai.Helpers;
|
namespace AquaMai.Helpers;
|
||||||
@@ -6,6 +7,7 @@ namespace AquaMai.Helpers;
|
|||||||
public class SharedInstances
|
public class SharedInstances
|
||||||
{
|
{
|
||||||
public static ProcessDataContainer ProcessDataContainer { get; private set; }
|
public static ProcessDataContainer ProcessDataContainer { get; private set; }
|
||||||
|
public static GameMainObject GameMainObject { get; private set; }
|
||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(ProcessDataContainer), MethodType.Constructor)]
|
[HarmonyPatch(typeof(ProcessDataContainer), MethodType.Constructor)]
|
||||||
@@ -13,4 +15,11 @@ public class SharedInstances
|
|||||||
{
|
{
|
||||||
ProcessDataContainer = __instance;
|
ProcessDataContainer = __instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HarmonyPrefix]
|
||||||
|
[HarmonyPatch(typeof(GameMainObject), "Awake")]
|
||||||
|
public static void OnCreateGameMainObject(GameMainObject __instance)
|
||||||
|
{
|
||||||
|
GameMainObject = __instance;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,19 +175,11 @@ namespace AquaMai
|
|||||||
if (_hasErrors)
|
if (_hasErrors)
|
||||||
{
|
{
|
||||||
MelonLogger.Warning("========================================================================!!!");
|
MelonLogger.Warning("========================================================================!!!");
|
||||||
MelonLogger.Warning("加载过程中检测到错误!");
|
MelonLogger.Warning(Locale.LoadError);
|
||||||
MelonLogger.Warning("- 请检查你是否安装了错误的 AquaMai 版本,比如在 SDGA 上使用了 SDEZ 的版本");
|
|
||||||
MelonLogger.Warning("- 你是否正在使用魔改的 Assembly-CSharp.dll,这会导致函数不一致而无法找到需要修改的函数");
|
|
||||||
MelonLogger.Warning("- 请检查是否有冲突的 Mod,或者开启了不兼容的选项");
|
|
||||||
MelonLogger.Warning("===========================================================================");
|
|
||||||
MelonLogger.Warning("Errors detected while loading!");
|
|
||||||
MelonLogger.Warning("- Check if you have installed the wrong version of AquaMai, such as using SDEZ version on SDGA");
|
|
||||||
MelonLogger.Warning("- Are you using a modified Assembly-CSharp.dll, which will cause inconsistent functions and cannot find the functions that need to be modified");
|
|
||||||
MelonLogger.Warning("- Check for conflicting mods, or enabled incompatible options");
|
|
||||||
MelonLogger.Warning("===========================================================================");
|
MelonLogger.Warning("===========================================================================");
|
||||||
}
|
}
|
||||||
|
|
||||||
MelonLogger.Msg("Loaded!");
|
MelonLogger.Msg(Locale.Loaded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
32
AquaMai/Resources/Locale.Designer.cs
generated
32
AquaMai/Resources/Locale.Designer.cs
generated
@@ -7,8 +7,6 @@
|
|||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
using MelonLoader;
|
|
||||||
|
|
||||||
namespace AquaMai.Resources {
|
namespace AquaMai.Resources {
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
@@ -61,6 +59,27 @@ namespace AquaMai.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Loaded!.
|
||||||
|
/// </summary>
|
||||||
|
internal static string Loaded {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Loaded", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Errors detected while loading!
|
||||||
|
///- Check if you have installed the wrong version of AquaMai, such as using SDEZ version on SDGA
|
||||||
|
///- Are you using a modified Assembly-CSharp.dll, which will cause inconsistent functions and cannot find the functions that need to be modified
|
||||||
|
///- Check for conflicting mods, or enabled incompatible options.
|
||||||
|
/// </summary>
|
||||||
|
internal static string LoadError {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("LoadError", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to End.
|
/// Looks up a localized string similar to End.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -124,6 +143,15 @@ namespace AquaMai.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Saving... Do not exit the game.
|
||||||
|
/// </summary>
|
||||||
|
internal static string SavingDontExit {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("SavingDontExit", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Seek <<.
|
/// Looks up a localized string similar to Seek <<.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -57,4 +57,16 @@
|
|||||||
<data name="SpeedReset" xml:space="preserve">
|
<data name="SpeedReset" xml:space="preserve">
|
||||||
<value>Speed Reset</value>
|
<value>Speed Reset</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="LoadError" xml:space="preserve">
|
||||||
|
<value>Errors detected while loading!
|
||||||
|
- Check if you have installed the wrong version of AquaMai, such as using SDEZ version on SDGA
|
||||||
|
- Are you using a modified Assembly-CSharp.dll, which will cause inconsistent functions and cannot find the functions that need to be modified
|
||||||
|
- Check for conflicting mods, or enabled incompatible options</value>
|
||||||
|
</data>
|
||||||
|
<data name="SavingDontExit" xml:space="preserve">
|
||||||
|
<value>Saving... Do not exit the game</value>
|
||||||
|
</data>
|
||||||
|
<data name="Loaded" xml:space="preserve">
|
||||||
|
<value>Loaded!</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|||||||
@@ -50,4 +50,16 @@
|
|||||||
<data name="SpeedUp" xml:space="preserve">
|
<data name="SpeedUp" xml:space="preserve">
|
||||||
<value>速度 +</value>
|
<value>速度 +</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="LoadError" xml:space="preserve">
|
||||||
|
<value>加载过程中检测到错误!
|
||||||
|
- 请检查你是否安装了错误的 AquaMai 版本,比如在 SDGA 上使用了 SDEZ 的版本
|
||||||
|
- 你是否正在使用魔改的 Assembly-CSharp.dll,这会导致函数不一致而无法找到需要修改的函数
|
||||||
|
- 请检查是否有冲突的 Mod,或者开启了不兼容的选项</value>
|
||||||
|
</data>
|
||||||
|
<data name="SavingDontExit" xml:space="preserve">
|
||||||
|
<value>正在保存… 请不要关闭游戏</value>
|
||||||
|
</data>
|
||||||
|
<data name="Loaded" xml:space="preserve">
|
||||||
|
<value>加载完成!</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using AquaMai.Helpers;
|
||||||
|
using AquaMai.Resources;
|
||||||
using DB;
|
using DB;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using MAI2.Util;
|
using MAI2.Util;
|
||||||
@@ -15,9 +17,10 @@ using Net.Packet.Helper;
|
|||||||
using Net.Packet.Mai2;
|
using Net.Packet.Mai2;
|
||||||
using Process;
|
using Process;
|
||||||
using Process.UserDataNet.State.UserDataULState;
|
using Process.UserDataNet.State.UserDataULState;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace AquaMai.UX;
|
||||||
|
|
||||||
namespace AquaMai.UX
|
|
||||||
{
|
|
||||||
public class ImmediateSave
|
public class ImmediateSave
|
||||||
{
|
{
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
@@ -28,15 +31,39 @@ namespace AquaMai.UX
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static SavingUi ui;
|
||||||
|
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(ResultProcess), "OnStart")]
|
[HarmonyPatch(typeof(ResultProcess), "OnStart")]
|
||||||
public static void ResultProcessOnStart()
|
public static void ResultProcessOnStart()
|
||||||
{
|
{
|
||||||
|
var doneCount = 0;
|
||||||
|
|
||||||
|
void CheckSaveDone()
|
||||||
|
{
|
||||||
|
doneCount++;
|
||||||
|
if (doneCount == 4)
|
||||||
|
{
|
||||||
|
if (ui != null)
|
||||||
|
{
|
||||||
|
UnityEngine.Object.Destroy(ui);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
var userData = Singleton<UserDataManager>.Instance.GetUserData(i);
|
var userData = Singleton<UserDataManager>.Instance.GetUserData(i);
|
||||||
if(!userData.IsEntry) continue;
|
if (!userData.IsEntry || userData.IsGuest())
|
||||||
if(userData.IsGuest()) continue;
|
{
|
||||||
|
doneCount += 2;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ui == null)
|
||||||
|
{
|
||||||
|
ui = SharedInstances.GameMainObject.gameObject.AddComponent<SavingUi>();
|
||||||
|
}
|
||||||
|
|
||||||
SaveDataFix(userData);
|
SaveDataFix(userData);
|
||||||
# if SDGA145
|
# if SDGA145
|
||||||
@@ -45,12 +72,18 @@ namespace AquaMai.UX
|
|||||||
var accessToken = Singleton<OperationManager>.Instance.GetAccessToken(i);
|
var accessToken = Singleton<OperationManager>.Instance.GetAccessToken(i);
|
||||||
PacketHelper.StartPacket(new PacketUploadUserPlaylog(i, userData, (int)GameManager.MusicTrackNumber - 1, accessToken,
|
PacketHelper.StartPacket(new PacketUploadUserPlaylog(i, userData, (int)GameManager.MusicTrackNumber - 1, accessToken,
|
||||||
# endif
|
# endif
|
||||||
delegate { MelonLogger.Msg("Playlog saved"); },
|
delegate
|
||||||
|
{
|
||||||
|
MelonLogger.Msg("Playlog saved");
|
||||||
|
CheckSaveDone();
|
||||||
|
},
|
||||||
delegate(PacketStatus err)
|
delegate(PacketStatus err)
|
||||||
{
|
{
|
||||||
SoundManager.PlaySE(Mai2.Mai2Cue.Cue.SE_ENTRY_AIME_ERROR, i);
|
SoundManager.PlaySE(Mai2.Mai2Cue.Cue.SE_ENTRY_AIME_ERROR, i);
|
||||||
MelonLogger.Error("Playlog save error");
|
MelonLogger.Error("Playlog save error");
|
||||||
MelonLogger.Error(err);
|
MelonLogger.Error(err);
|
||||||
|
MessageHelper.ShowMessage("Playlog save error");
|
||||||
|
CheckSaveDone();
|
||||||
}));
|
}));
|
||||||
# if SDGA145
|
# if SDGA145
|
||||||
PacketHelper.StartPacket(new PacketUpsertUserAll(i, userData, delegate(int code)
|
PacketHelper.StartPacket(new PacketUpsertUserAll(i, userData, delegate(int code)
|
||||||
@@ -61,18 +94,23 @@ namespace AquaMai.UX
|
|||||||
if (code == 1)
|
if (code == 1)
|
||||||
{
|
{
|
||||||
MelonLogger.Msg("UserAll saved");
|
MelonLogger.Msg("UserAll saved");
|
||||||
|
CheckSaveDone();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SoundManager.PlaySE(Mai2.Mai2Cue.Cue.SE_ENTRY_AIME_ERROR, i);
|
SoundManager.PlaySE(Mai2.Mai2Cue.Cue.SE_ENTRY_AIME_ERROR, i);
|
||||||
MelonLogger.Error("UserAll upsert error");
|
MelonLogger.Error("UserAll upsert error");
|
||||||
MelonLogger.Error(code);
|
MelonLogger.Error(code);
|
||||||
|
MessageHelper.ShowMessage("UserAll upsert error");
|
||||||
|
CheckSaveDone();
|
||||||
}
|
}
|
||||||
}, delegate(PacketStatus err)
|
}, delegate(PacketStatus err)
|
||||||
{
|
{
|
||||||
SoundManager.PlaySE(Mai2.Mai2Cue.Cue.SE_ENTRY_AIME_ERROR, i);
|
SoundManager.PlaySE(Mai2.Mai2Cue.Cue.SE_ENTRY_AIME_ERROR, i);
|
||||||
MelonLogger.Error("UserAll upsert error");
|
MelonLogger.Error("UserAll upsert error");
|
||||||
MelonLogger.Error(err);
|
MelonLogger.Error(err);
|
||||||
|
MessageHelper.ShowMessage("UserAll upsert error");
|
||||||
|
CheckSaveDone();
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -187,9 +225,30 @@ namespace AquaMai.UX
|
|||||||
userData.Detail.LastPlayMode = 2;
|
userData.Detail.LastPlayMode = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# if SDGA145
|
||||||
|
userData.Detail.LastGameId = "SDGA";
|
||||||
|
# else
|
||||||
userData.Detail.LastGameId = "SDEZ";
|
userData.Detail.LastGameId = "SDEZ";
|
||||||
|
# endif
|
||||||
userData.Detail.LastRomVersion = Singleton<SystemConfig>.Instance.config.romVersionInfo.versionNo.versionString;
|
userData.Detail.LastRomVersion = Singleton<SystemConfig>.Instance.config.romVersionInfo.versionNo.versionString;
|
||||||
userData.Detail.LastDataVersion = Singleton<SystemConfig>.Instance.config.dataVersionInfo.versionNo.versionString;
|
userData.Detail.LastDataVersion = Singleton<SystemConfig>.Instance.config.dataVersionInfo.versionNo.versionString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class SavingUi : MonoBehaviour
|
||||||
|
{
|
||||||
|
public void OnGUI()
|
||||||
|
{
|
||||||
|
var y = Screen.height * .075f;
|
||||||
|
var width = GuiSizes.FontSize * 20f;
|
||||||
|
var x = GuiSizes.PlayerCenter + GuiSizes.PlayerWidth / 2f - width;
|
||||||
|
var rect = new Rect(x, y, width, GuiSizes.LabelHeight * 2.5f);
|
||||||
|
|
||||||
|
var labelStyle = GUI.skin.GetStyle("label");
|
||||||
|
labelStyle.fontSize = (int)(GuiSizes.FontSize * 1.2);
|
||||||
|
labelStyle.alignment = TextAnchor.MiddleCenter;
|
||||||
|
|
||||||
|
GUI.Box(rect, "");
|
||||||
|
GUI.Label(rect, Locale.SavingDontExit);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user