mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Reload title screen on profile change
This commit is contained in:
parent
e07efa9a5c
commit
439093e65d
@ -13,6 +13,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
using Color = UnityEngine.Color;
|
using Color = UnityEngine.Color;
|
||||||
|
|
||||||
namespace NewHorizons.Handlers
|
namespace NewHorizons.Handlers
|
||||||
@ -23,6 +24,7 @@ namespace NewHorizons.Handlers
|
|||||||
internal static NewHorizonsBody[] eligibleBodies => Main.BodyDict.Values.ToList().SelectMany(x => x).ToList()
|
internal static NewHorizonsBody[] eligibleBodies => Main.BodyDict.Values.ToList().SelectMany(x => x).ToList()
|
||||||
.Where(b => (b.Config.HeightMap != null || b.Config.Atmosphere?.clouds != null) && b.Config.Star == null && b.Config.canShowOnTitle).ToArray();
|
.Where(b => (b.Config.HeightMap != null || b.Config.Atmosphere?.clouds != null) && b.Config.Star == null && b.Config.canShowOnTitle).ToArray();
|
||||||
internal static int eligibleCount => eligibleBodies.Count();
|
internal static int eligibleCount => eligibleBodies.Count();
|
||||||
|
internal static bool reloaded = false;
|
||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
@ -48,6 +50,7 @@ namespace NewHorizons.Handlers
|
|||||||
|
|
||||||
// Load player data for fact and persistent condition checking
|
// Load player data for fact and persistent condition checking
|
||||||
var profileManager = StandaloneProfileManager.SharedInstance;
|
var profileManager = StandaloneProfileManager.SharedInstance;
|
||||||
|
profileManager.OnProfileSignInComplete += OnProfileSignInComplete;
|
||||||
profileManager.PreInitialize();
|
profileManager.PreInitialize();
|
||||||
profileManager.Initialize();
|
profileManager.Initialize();
|
||||||
if (profileManager.currentProfile != null) // check if there is even a profile made yet
|
if (profileManager.currentProfile != null) // check if there is even a profile made yet
|
||||||
@ -105,6 +108,16 @@ namespace NewHorizons.Handlers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void OnProfileSignInComplete(ProfileManagerSignInResult result)
|
||||||
|
{
|
||||||
|
NHLogger.LogError($"OnProfileSignInComplete {result}: {StandaloneProfileManager.SharedInstance.currentProfile.profileName}");
|
||||||
|
reloaded = true;
|
||||||
|
|
||||||
|
// Taken and modified from SubmitActionLoadScene.ConfirmSubmit
|
||||||
|
LoadManager.LoadScene(OWScene.TitleScreen);
|
||||||
|
Locator.GetMenuInputModule().DisableInputs();
|
||||||
|
}
|
||||||
|
|
||||||
public static void InitSubtitles()
|
public static void InitSubtitles()
|
||||||
{
|
{
|
||||||
GameObject subtitleContainer = SearchUtilities.Find("TitleMenu/TitleCanvas/TitleLayoutGroup/Logo_EchoesOfTheEye");
|
GameObject subtitleContainer = SearchUtilities.Find("TitleMenu/TitleCanvas/TitleLayoutGroup/Logo_EchoesOfTheEye");
|
||||||
|
|||||||
@ -165,7 +165,9 @@ namespace NewHorizons
|
|||||||
if (wasUsingCustomTitleScreen != CustomTitleScreen && SceneManager.GetActiveScene().name == "TitleScreen" && _wasConfigured)
|
if (wasUsingCustomTitleScreen != CustomTitleScreen && SceneManager.GetActiveScene().name == "TitleScreen" && _wasConfigured)
|
||||||
{
|
{
|
||||||
NHLogger.LogVerbose("Reloading");
|
NHLogger.LogVerbose("Reloading");
|
||||||
SceneManager.LoadScene("TitleScreen", LoadSceneMode.Single);
|
// Taken and modified from SubmitActionLoadScene.ConfirmSubmit
|
||||||
|
LoadManager.LoadScene(OWScene.TitleScreen);
|
||||||
|
Locator.GetMenuInputModule().DisableInputs();
|
||||||
}
|
}
|
||||||
|
|
||||||
_wasConfigured = true;
|
_wasConfigured = true;
|
||||||
|
|||||||
34
NewHorizons/Patches/TitleScenePatches.cs
Normal file
34
NewHorizons/Patches/TitleScenePatches.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
using HarmonyLib;
|
||||||
|
using NewHorizons.Handlers;
|
||||||
|
using NewHorizons.Utility.OWML;
|
||||||
|
using OWML.Utils;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace NewHorizons.Patches;
|
||||||
|
|
||||||
|
[HarmonyPatch]
|
||||||
|
internal static class TitleScenePatches
|
||||||
|
{
|
||||||
|
[HarmonyPrefix, HarmonyPatch(typeof(TitleScreenAnimation), nameof(TitleScreenAnimation.Awake))]
|
||||||
|
public static void TitleScreenAnimation_Awake(TitleScreenAnimation __instance)
|
||||||
|
{
|
||||||
|
// Skip Splash on title screen reload
|
||||||
|
if (TitleSceneHandler.reloaded)
|
||||||
|
{
|
||||||
|
TitleSceneHandler.reloaded = false;
|
||||||
|
|
||||||
|
TitleScreenAnimation titleScreenAnimation = __instance;
|
||||||
|
titleScreenAnimation._fadeDuration = 0;
|
||||||
|
titleScreenAnimation._gamepadSplash = false;
|
||||||
|
titleScreenAnimation._introPan = false;
|
||||||
|
|
||||||
|
TitleAnimationController titleAnimationController = GameObject.FindObjectOfType<TitleAnimationController>();
|
||||||
|
titleAnimationController._logoFadeDelay = 0.001f;
|
||||||
|
titleAnimationController._logoFadeDuration = 0.001f;
|
||||||
|
titleAnimationController._optionsFadeDelay = 0.001f;
|
||||||
|
titleAnimationController._optionsFadeDuration = 0.001f;
|
||||||
|
titleAnimationController._optionsFadeSpacing = 0.001f;
|
||||||
|
titleAnimationController.FadeInTitleLogo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user