mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-04 12:39:52 +00:00
Merge branch 'dev' of https://github.com/misternebula/quantum-space-buddies into dev
This commit is contained in:
commit
04c113f148
@ -8,6 +8,11 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
/*
|
||||
* For those who come here,
|
||||
* leave while you still can.
|
||||
*/
|
||||
|
||||
namespace QSB.EchoesOfTheEye.LightSensorSync.Patches;
|
||||
|
||||
[HarmonyPatch(typeof(SingleLightSensor))]
|
||||
|
@ -7,6 +7,11 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
/*
|
||||
* For those who come here,
|
||||
* leave while you still can.
|
||||
*/
|
||||
|
||||
namespace QSB.EchoesOfTheEye.LightSensorSync;
|
||||
|
||||
/// <summary>
|
||||
|
@ -7,6 +7,11 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
/*
|
||||
* For those who come here,
|
||||
* leave while you still can.
|
||||
*/
|
||||
|
||||
namespace QSB.EchoesOfTheEye.LightSensorSync.WorldObjects;
|
||||
|
||||
/// <summary>
|
||||
|
@ -40,7 +40,7 @@ internal class MenuManager : MonoBehaviour, IAddComponentOnStart
|
||||
private const int _titleButtonIndex = 2;
|
||||
private float _connectPopupOpenTime;
|
||||
|
||||
private const string UpdateChangelog = $"QSB Version 0.20.2\r\nFixed issues with the Little Scout and attaching/detaching from the ship.";
|
||||
private const string UpdateChangelog = "QSB Version 0.20.2\r\nFixed issues with the Little Scout and attaching/detaching from the ship.";
|
||||
|
||||
private Action<bool> PopupClose;
|
||||
|
||||
@ -120,7 +120,7 @@ internal class MenuManager : MonoBehaviour, IAddComponentOnStart
|
||||
{
|
||||
if (QSBSceneManager.CurrentScene != OWScene.TitleScreen)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Language changed while not in title screen?! Should be impossible!", OWML.Common.MessageType.Error);
|
||||
DebugLog.ToConsole("Error - Language changed while not in title screen?! Should be impossible!", OWML.Common.MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ internal class MenuManager : MonoBehaviour, IAddComponentOnStart
|
||||
|
||||
newPopup.transform.localPosition = Vector3.zero;
|
||||
newPopup.transform.localScale = Vector3.one;
|
||||
newPopup.GetComponentsInChildren<LocalizedText>().ToList().ForEach(x => Destroy(x));
|
||||
newPopup.GetComponentsInChildren<LocalizedText>().ForEach(Destroy);
|
||||
|
||||
var originalPopup = newPopup.GetComponent<PopupMenu>();
|
||||
|
||||
@ -204,9 +204,7 @@ internal class MenuManager : MonoBehaviour, IAddComponentOnStart
|
||||
InputLibrary.cancel,
|
||||
new ScreenPrompt(confirm1Text),
|
||||
new ScreenPrompt(confirm2Text),
|
||||
new ScreenPrompt(cancelText),
|
||||
true,
|
||||
true);
|
||||
new ScreenPrompt(cancelText));
|
||||
return popup;
|
||||
}
|
||||
|
||||
@ -227,7 +225,7 @@ internal class MenuManager : MonoBehaviour, IAddComponentOnStart
|
||||
|
||||
newPopup.transform.localPosition = Vector3.zero;
|
||||
newPopup.transform.localScale = Vector3.one;
|
||||
newPopup.GetComponentsInChildren<LocalizedText>().ToList().ForEach(x => Destroy(x));
|
||||
newPopup.GetComponentsInChildren<LocalizedText>().ForEach(Destroy);
|
||||
|
||||
var originalPopup = newPopup.GetComponent<PopupMenu>();
|
||||
|
||||
@ -265,9 +263,7 @@ internal class MenuManager : MonoBehaviour, IAddComponentOnStart
|
||||
new ScreenPrompt(confirm1Text),
|
||||
new ScreenPrompt(confirm2Text),
|
||||
new ScreenPrompt(confirm3Text),
|
||||
new ScreenPrompt(cancelText),
|
||||
true,
|
||||
true);
|
||||
new ScreenPrompt(cancelText));
|
||||
return popup;
|
||||
}
|
||||
|
||||
@ -358,7 +354,7 @@ internal class MenuManager : MonoBehaviour, IAddComponentOnStart
|
||||
HostGameTypePopup.OnPopupConfirm2 += () => Host(true);
|
||||
HostGameTypePopup.OnPopupConfirm3 += () =>
|
||||
{
|
||||
DebugLog.DebugWrite($"Replacing multiplayer save with singleplayer save");
|
||||
DebugLog.DebugWrite("Replacing multiplayer save with singleplayer save");
|
||||
QSBCore.IsInMultiplayer = true;
|
||||
StandaloneProfileManager.SharedInstance.SaveGame(QSBProfileManager._currentProfile.gameSave, null, null, null);
|
||||
Host(false);
|
||||
@ -413,10 +409,10 @@ internal class MenuManager : MonoBehaviour, IAddComponentOnStart
|
||||
DisconnectPopup._labelText.text = popupText;
|
||||
|
||||
var langController = QSBWorldSync.GetUnityObject<PauseMenuManager>().transform.GetChild(0).GetComponent<FontAndLanguageController>();
|
||||
langController.AddTextElement(DisconnectButton.transform.GetChild(0).GetChild(1).GetComponent<Text>(), true, true, false);
|
||||
langController.AddTextElement(DisconnectPopup._labelText, false, true, false);
|
||||
langController.AddTextElement(DisconnectPopup._confirmButton._buttonText, false, true, false);
|
||||
langController.AddTextElement(DisconnectPopup._cancelButton._buttonText, false, true, false);
|
||||
langController.AddTextElement(DisconnectButton.transform.GetChild(0).GetChild(1).GetComponent<Text>());
|
||||
langController.AddTextElement(DisconnectPopup._labelText, false);
|
||||
langController.AddTextElement(DisconnectPopup._confirmButton._buttonText, false);
|
||||
langController.AddTextElement(DisconnectPopup._cancelButton._buttonText, false);
|
||||
}
|
||||
|
||||
private void MakeTitleMenus()
|
||||
@ -455,24 +451,24 @@ internal class MenuManager : MonoBehaviour, IAddComponentOnStart
|
||||
}
|
||||
|
||||
var mainMenuFontController = GameObject.Find("MainMenu").GetComponent<FontAndLanguageController>();
|
||||
mainMenuFontController.AddTextElement(HostButton.transform.GetChild(0).GetChild(1).GetComponent<Text>(), true, true, false);
|
||||
mainMenuFontController.AddTextElement(ConnectButton.transform.GetChild(0).GetChild(1).GetComponent<Text>(), true, true, false);
|
||||
mainMenuFontController.AddTextElement(HostButton.transform.GetChild(0).GetChild(1).GetComponent<Text>());
|
||||
mainMenuFontController.AddTextElement(ConnectButton.transform.GetChild(0).GetChild(1).GetComponent<Text>());
|
||||
|
||||
mainMenuFontController.AddTextElement(OneButtonInfoPopup._labelText, false, true, false);
|
||||
mainMenuFontController.AddTextElement(OneButtonInfoPopup._confirmButton._buttonText, false, true, false);
|
||||
mainMenuFontController.AddTextElement(OneButtonInfoPopup._labelText, false);
|
||||
mainMenuFontController.AddTextElement(OneButtonInfoPopup._confirmButton._buttonText, false);
|
||||
|
||||
mainMenuFontController.AddTextElement(TwoButtonInfoPopup._labelText, false, true, false);
|
||||
mainMenuFontController.AddTextElement(TwoButtonInfoPopup._confirmButton._buttonText, false, true, false);
|
||||
mainMenuFontController.AddTextElement(TwoButtonInfoPopup._cancelButton._buttonText, false, true, false);
|
||||
mainMenuFontController.AddTextElement(TwoButtonInfoPopup._labelText, false);
|
||||
mainMenuFontController.AddTextElement(TwoButtonInfoPopup._confirmButton._buttonText, false);
|
||||
mainMenuFontController.AddTextElement(TwoButtonInfoPopup._cancelButton._buttonText, false);
|
||||
|
||||
mainMenuFontController.AddTextElement(ConnectPopup._labelText, false, true, false);
|
||||
mainMenuFontController.AddTextElement(ConnectPopup._confirmButton._buttonText, false, true, false);
|
||||
mainMenuFontController.AddTextElement(ConnectPopup._cancelButton._buttonText, false, true, false);
|
||||
mainMenuFontController.AddTextElement(ConnectPopup._labelText, false);
|
||||
mainMenuFontController.AddTextElement(ConnectPopup._confirmButton._buttonText, false);
|
||||
mainMenuFontController.AddTextElement(ConnectPopup._cancelButton._buttonText, false);
|
||||
|
||||
mainMenuFontController.AddTextElement(HostGameTypePopup._labelText, false, true, false);
|
||||
mainMenuFontController.AddTextElement(HostGameTypePopup._confirmButton1._buttonText, false, true, false);
|
||||
mainMenuFontController.AddTextElement(HostGameTypePopup._confirmButton2._buttonText, false, true, false);
|
||||
mainMenuFontController.AddTextElement(HostGameTypePopup._cancelButton._buttonText, false, true, false);
|
||||
mainMenuFontController.AddTextElement(HostGameTypePopup._labelText, false);
|
||||
mainMenuFontController.AddTextElement(HostGameTypePopup._confirmButton1._buttonText, false);
|
||||
mainMenuFontController.AddTextElement(HostGameTypePopup._confirmButton2._buttonText, false);
|
||||
mainMenuFontController.AddTextElement(HostGameTypePopup._cancelButton._buttonText, false);
|
||||
}
|
||||
|
||||
private void Disconnect()
|
||||
@ -498,22 +494,20 @@ internal class MenuManager : MonoBehaviour, IAddComponentOnStart
|
||||
|
||||
if (!doesSingleplayerSaveExist)
|
||||
{
|
||||
DebugLog.DebugWrite($"No singleplayer save exists.");
|
||||
DebugLog.DebugWrite("No singleplayer save exists.");
|
||||
if (!doesMultiplayerSaveExist)
|
||||
{
|
||||
DebugLog.DebugWrite($"No saves exist.");
|
||||
DebugLog.DebugWrite("No saves exist.");
|
||||
Host(true);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugLog.DebugWrite($"Multiplayer save exists.");
|
||||
Host(false);
|
||||
return;
|
||||
}
|
||||
|
||||
DebugLog.DebugWrite("Multiplayer save exists.");
|
||||
Host(false);
|
||||
return;
|
||||
}
|
||||
|
||||
DebugLog.DebugWrite($"A singleplayer save exists.");
|
||||
DebugLog.DebugWrite("A singleplayer save exists.");
|
||||
HostGameTypePopup.EnableMenu(true);
|
||||
}
|
||||
|
||||
@ -523,12 +517,12 @@ internal class MenuManager : MonoBehaviour, IAddComponentOnStart
|
||||
|
||||
if (newMultiplayerSave)
|
||||
{
|
||||
DebugLog.DebugWrite($"Resetting game...");
|
||||
DebugLog.DebugWrite("Resetting game...");
|
||||
PlayerData.ResetGame();
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugLog.DebugWrite($"Loading multiplayer game...");
|
||||
DebugLog.DebugWrite("Loading multiplayer game...");
|
||||
var profile = QSBProfileManager._currentProfile;
|
||||
PlayerData.Init(profile.multiplayerGameSave, profile.settingsSave, profile.graphicsSettings, profile.inputJSON);
|
||||
}
|
||||
|
@ -12,6 +12,9 @@ using UnityEngine.UI;
|
||||
|
||||
namespace QSB.SaveSync.Patches;
|
||||
|
||||
/// <summary>
|
||||
/// all these patches are to use QSBProfileData instead of the existing profile in order to support a separate multiplayer save
|
||||
/// </summary>
|
||||
internal class ProfileManagerPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnModStart;
|
||||
@ -162,7 +165,7 @@ internal class ProfileManagerPatches : QSBPatch
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(StandaloneProfileManager), nameof(StandaloneProfileManager.CurrentProfileHasBrokenData))]
|
||||
public static bool CurrentProfileHasBrokenData(StandaloneProfileManager __instance, ref bool __result)
|
||||
public static bool CurrentProfileHasBrokenData(StandaloneProfileManager __instance, out bool __result)
|
||||
{
|
||||
if (QSBProfileManager._currentProfile == null)
|
||||
{
|
||||
@ -183,7 +186,7 @@ internal class ProfileManagerPatches : QSBPatch
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(StandaloneProfileManager), nameof(StandaloneProfileManager.BackupExistsForBrokenData))]
|
||||
public static bool BackupExistsForBrokenData(StandaloneProfileManager __instance, ref bool __result)
|
||||
public static bool BackupExistsForBrokenData(StandaloneProfileManager __instance, out bool __result)
|
||||
{
|
||||
var text = __instance._profileBackupPath + "/" + QSBProfileManager._currentProfile.profileName;
|
||||
var savePath = text + "/data.owsave";
|
||||
@ -581,32 +584,32 @@ internal class ProfileManagerPatches : QSBPatch
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(StandaloneProfileManager), "get_currentProfileGameSave")]
|
||||
public static bool CurrentProfileGameSave(ref GameSave __result)
|
||||
[HarmonyPatch(typeof(StandaloneProfileManager), nameof(StandaloneProfileManager.currentProfileGameSave), MethodType.Getter)]
|
||||
public static bool CurrentProfileGameSave(out GameSave __result)
|
||||
{
|
||||
__result = QSBProfileManager._currentProfile?.gameSave;
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(StandaloneProfileManager), "get_currentProfileGameSettings")]
|
||||
public static bool CurrentProfileGameSettings(ref SettingsSave __result)
|
||||
[HarmonyPatch(typeof(StandaloneProfileManager), nameof(StandaloneProfileManager.currentProfileGameSettings), MethodType.Getter)]
|
||||
public static bool CurrentProfileGameSettings(out SettingsSave __result)
|
||||
{
|
||||
__result = QSBProfileManager._currentProfile?.settingsSave;
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(StandaloneProfileManager), "get_currentProfileGraphicsSettings")]
|
||||
public static bool CurrentProfileGraphicsSettings(ref GraphicSettings __result)
|
||||
[HarmonyPatch(typeof(StandaloneProfileManager), nameof(StandaloneProfileManager.currentProfileGraphicsSettings), MethodType.Getter)]
|
||||
public static bool CurrentProfileGraphicsSettings(out GraphicSettings __result)
|
||||
{
|
||||
__result = QSBProfileManager._currentProfile?.graphicsSettings;
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(StandaloneProfileManager), "get_currentProfileInputJSON")]
|
||||
public static bool CurrentProfileInputJSON(ref string __result)
|
||||
[HarmonyPatch(typeof(StandaloneProfileManager), nameof(StandaloneProfileManager.currentProfileInputJSON), MethodType.Getter)]
|
||||
public static bool CurrentProfileInputJSON(out string __result)
|
||||
{
|
||||
__result = QSBProfileManager._currentProfile?.inputJSON;
|
||||
return false;
|
||||
@ -614,7 +617,7 @@ internal class ProfileManagerPatches : QSBPatch
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(StandaloneProfileManager), "get_currentProfile")]
|
||||
public static bool CurrentProfile(ref StandaloneProfileManager.ProfileData __result)
|
||||
public static bool CurrentProfile(out StandaloneProfileManager.ProfileData __result)
|
||||
{
|
||||
DebugLog.DebugWrite($"Error - StandaloneProfileManager.currentProfile should not be used anymore." +
|
||||
$"{Environment.NewLine}Called by : {Environment.NewLine}{Environment.StackTrace}", OWML.Common.MessageType.Error);
|
||||
@ -624,7 +627,7 @@ internal class ProfileManagerPatches : QSBPatch
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(StandaloneProfileManager), "get_mostRecentProfile")]
|
||||
public static bool MostRecentProfile(ref StandaloneProfileManager.ProfileData __result)
|
||||
public static bool MostRecentProfile(out StandaloneProfileManager.ProfileData __result)
|
||||
{
|
||||
DebugLog.DebugWrite($"Error - StandaloneProfileManager.mostRecentProfile should not be used anymore." +
|
||||
$"{Environment.NewLine}Called by : {Environment.NewLine}{Environment.StackTrace}", OWML.Common.MessageType.Error);
|
||||
@ -634,7 +637,7 @@ internal class ProfileManagerPatches : QSBPatch
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(StandaloneProfileManager), "get_profiles")]
|
||||
public static bool Profiles(ref List<StandaloneProfileManager.ProfileData> __result)
|
||||
public static bool Profiles(out List<StandaloneProfileManager.ProfileData> __result)
|
||||
{
|
||||
DebugLog.DebugWrite($"Error - StandaloneProfileManager.profiles should not be used anymore." +
|
||||
$"{Environment.NewLine}Called by : {Environment.NewLine}{Environment.StackTrace}", OWML.Common.MessageType.Error);
|
||||
@ -644,7 +647,7 @@ internal class ProfileManagerPatches : QSBPatch
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(StandaloneProfileManager), nameof(StandaloneProfileManager.TryCreateProfile))]
|
||||
public static bool TryCreateProfile(StandaloneProfileManager __instance, string profileName, ref bool __result)
|
||||
public static bool TryCreateProfile(StandaloneProfileManager __instance, string profileName, out bool __result)
|
||||
{
|
||||
bool savedProfile = __instance.ValidateProfileName(profileName);
|
||||
if (savedProfile)
|
||||
@ -860,7 +863,7 @@ internal class ProfileManagerPatches : QSBPatch
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(StandaloneProfileManager), nameof(StandaloneProfileManager.SwitchProfile))]
|
||||
public static bool SwitchProfile(StandaloneProfileManager __instance, string profileName, ref bool __result)
|
||||
public static bool SwitchProfile(StandaloneProfileManager __instance, string profileName, out bool __result)
|
||||
{
|
||||
__instance.LoadSaveFilesFromProfiles();
|
||||
bool flag = false;
|
||||
@ -901,7 +904,7 @@ internal class ProfileManagerPatches : QSBPatch
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(StandaloneProfileManager), nameof(StandaloneProfileManager.ValidateProfileName))]
|
||||
public static bool ValidateProfileName(StandaloneProfileManager __instance, string profileName, ref bool __result)
|
||||
public static bool ValidateProfileName(StandaloneProfileManager __instance, string profileName, out bool __result)
|
||||
{
|
||||
bool result = true;
|
||||
if (profileName == "")
|
||||
|
Loading…
x
Reference in New Issue
Block a user