mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
shenanigans
This commit is contained in:
parent
5d37898ce1
commit
e5b964d7c7
@ -15,20 +15,15 @@ namespace NewHorizons.Handlers
|
||||
{
|
||||
private static Dictionary<string, AudioType> _customAudioTypes;
|
||||
private static List<AudioLibrary.AudioEntry> _audioEntries;
|
||||
private static bool _postInitialized = false;
|
||||
|
||||
public static void Init(bool titleScreen = false)
|
||||
public static void Init()
|
||||
{
|
||||
_customAudioTypes = new Dictionary<string, AudioType>();
|
||||
_audioEntries = new List<AudioLibrary.AudioEntry>();
|
||||
_postInitialized = false;
|
||||
|
||||
if (titleScreen)
|
||||
Delay.RunWhenAndInNUpdates(
|
||||
PostInit,
|
||||
() => Locator.GetAudioManager()?._libraryAsset != null,
|
||||
1
|
||||
);
|
||||
else
|
||||
Delay.RunWhen(() => Locator.GetAudioManager()?._libraryAsset != null,
|
||||
Delay.RunWhen(() => Locator.GetAudioManager()?._libraryAsset != null && Locator.GetAudioManager()?._audioLibraryDict != null,
|
||||
PostInit
|
||||
);
|
||||
}
|
||||
@ -36,7 +31,12 @@ namespace NewHorizons.Handlers
|
||||
private static void PostInit()
|
||||
{
|
||||
NHLogger.LogVerbose($"Adding all custom AudioTypes to the library");
|
||||
_postInitialized = true;
|
||||
ModifyAudioLibrary();
|
||||
}
|
||||
|
||||
private static void ModifyAudioLibrary()
|
||||
{
|
||||
var library = Locator.GetAudioManager()._libraryAsset;
|
||||
var audioEntries = library.audioEntries; // store previous array
|
||||
library.audioEntries = library.audioEntries.Concat(_audioEntries).ToArray(); // concat custom entries
|
||||
@ -94,6 +94,8 @@ namespace NewHorizons.Handlers
|
||||
_audioEntries.Add(new AudioLibrary.AudioEntry(audioType, audioClips));
|
||||
_customAudioTypes.Add(id, audioType);
|
||||
|
||||
if (_postInitialized) ModifyAudioLibrary();
|
||||
|
||||
return audioType;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
using Epic.OnlineServices;
|
||||
using Epic.OnlineServices.Presence;
|
||||
using NewHorizons.Builder.Body;
|
||||
using NewHorizons.Builder.Props;
|
||||
@ -28,11 +29,24 @@ namespace NewHorizons.Handlers
|
||||
var ambientLight = SearchUtilities.Find("Scene/Background/PlanetPivot/AmbientLight_CaveTwin");
|
||||
ambientLight.transform.SetParent(planetRoot.transform, true);
|
||||
|
||||
TitleSceneHandler.InitSubtitles();
|
||||
InitSubtitles();
|
||||
AudioTypeHandler.Init();
|
||||
|
||||
// Load player data for fact and persistent condition checking
|
||||
var profileManager = StandaloneProfileManager.SharedInstance;
|
||||
profileManager.PreInitialize();
|
||||
profileManager.Initialize();
|
||||
PlayerData.Init(profileManager.currentProfileGameSave,
|
||||
profileManager.currentProfileGameSettings,
|
||||
profileManager.currentProfileGraphicsSettings,
|
||||
profileManager.currentProfileInputJSON);
|
||||
|
||||
// TODO: Select one title screen and if it has shareTitleScreen set to true do all the other ones that have it true too.
|
||||
var (mod, config) = Main.TitleScreenConfigs.FirstOrDefault(kvp => kvp.Value.KnowsFact() && kvp.Value.HasCondition());
|
||||
TitleSceneHandler.SetUp(mod, config);
|
||||
if (config != null)
|
||||
SetUp(mod, config);
|
||||
else
|
||||
DisplayBodiesOnTitleScreen();
|
||||
}
|
||||
|
||||
public static void InitSubtitles()
|
||||
@ -53,14 +67,7 @@ namespace NewHorizons.Handlers
|
||||
{
|
||||
if (!config.disableNHPlanets)
|
||||
{
|
||||
try
|
||||
{
|
||||
TitleSceneHandler.DisplayBodyOnTitleScreen(Main.BodyDict.Values.ToList().SelectMany(x => x).ToList());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
NHLogger.LogError($"Failed to make title screen bodies: {e}");
|
||||
}
|
||||
DisplayBodiesOnTitleScreen();
|
||||
}
|
||||
|
||||
if (config.menuTextTint != null)
|
||||
@ -154,6 +161,18 @@ namespace NewHorizons.Handlers
|
||||
}
|
||||
}
|
||||
|
||||
public static void DisplayBodiesOnTitleScreen()
|
||||
{
|
||||
try
|
||||
{
|
||||
TitleSceneHandler.DisplayBodyOnTitleScreen(Main.BodyDict.Values.ToList().SelectMany(x => x).ToList());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
NHLogger.LogError($"Failed to make title screen bodies: {e}");
|
||||
}
|
||||
}
|
||||
|
||||
public static void DisplayBodyOnTitleScreen(List<NewHorizonsBody> bodies)
|
||||
{
|
||||
// Try loading one planet why not
|
||||
|
||||
@ -422,7 +422,6 @@ namespace NewHorizons
|
||||
|
||||
if (isTitleScreen && CustomTitleScreen)
|
||||
{
|
||||
AudioTypeHandler.Init(true);
|
||||
TitleSceneHandler.Init();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user