mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-02-05 09:42:21 +08:00
HideTips v1.0.2
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using BepInEx;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HideTips;
|
||||
|
||||
@@ -15,6 +16,7 @@ public class HideTips : BaseUnityPlugin
|
||||
private static bool _noAchievementCardPopups = false;
|
||||
private static bool _noMilestoneCardPopups = true;
|
||||
private static bool _skipPrologue = true;
|
||||
private static bool _hideMenuDemo = false;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -24,8 +26,13 @@ public class HideTips : BaseUnityPlugin
|
||||
_noAchievementCardPopups = Config.Bind("General", "NoAchievementCardPopups", _noAchievementCardPopups, "Disable Achievement Card Popups").Value;
|
||||
_noMilestoneCardPopups = Config.Bind("General", "NoMilestoneCardPopups", _noMilestoneCardPopups, "Disable Milestone Card Popups").Value;
|
||||
_skipPrologue = Config.Bind("General", "SkipPrologue", _skipPrologue, "Skip prologue for new game").Value;
|
||||
_hideMenuDemo = Config.Bind("General", "HideMenuDemo", _hideMenuDemo, "Disable title screen demo scene loading").Value;
|
||||
if (!_cfgEnabled) return;
|
||||
Harmony.CreateAndPatchAll(typeof(HideTips));
|
||||
if (_hideMenuDemo)
|
||||
{
|
||||
Harmony.CreateAndPatchAll(typeof(HideMenuDemo));
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
@@ -75,10 +82,80 @@ public class HideTips : BaseUnityPlugin
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(DSPGame), "StartGame", typeof(GameDesc))]
|
||||
private static bool OnStartGame(GameDesc _gameDesc)
|
||||
private static bool DSPGame_OnStartGame_Prefix(GameDesc _gameDesc)
|
||||
{
|
||||
if (!_skipPrologue) return true;
|
||||
DSPGame.StartGameSkipPrologue(_gameDesc);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch]
|
||||
class HideMenuDemo
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(DSPGame), "StartDemoGame", typeof(int))]
|
||||
private static bool DSPGame_OnStartDemoGame_Prefix()
|
||||
{
|
||||
if (DSPGame.Game != null)
|
||||
{
|
||||
DSPGame.EndGame();
|
||||
}
|
||||
|
||||
DSPGame.IsMenuDemo = true;
|
||||
DSPGame.CreateGameMainObject();
|
||||
DSPGame.Game.isMenuDemo = true;
|
||||
DSPGame.Game.CreateIconSet();
|
||||
GameMain.data = new GameData();
|
||||
GameMain.data.mainPlayer = Player.Create(GameMain.data, 1);
|
||||
GameMain.data.galaxy = new GalaxyData
|
||||
{
|
||||
starCount = 0
|
||||
};
|
||||
|
||||
if (GameMain.universeSimulator != null)
|
||||
{
|
||||
UnityEngine.Object.Destroy(GameMain.universeSimulator.gameObject);
|
||||
}
|
||||
GameMain.universeSimulator = UnityEngine.Object.Instantiate(Configs.builtin.universeSimulatorPrefab);
|
||||
GameMain.universeSimulator.spaceAudio = new GameObject("Space Audio")
|
||||
{
|
||||
transform =
|
||||
{
|
||||
parent = GameMain.universeSimulator.transform
|
||||
}
|
||||
}.AddComponent<SpaceAudio>();
|
||||
GameMain.Begin();
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(VFPreload), "IsMenuDemoLoaded")]
|
||||
private static bool VFPreload_IsMenuDemoLoaded_Prefix(ref bool __result)
|
||||
{
|
||||
__result = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(DSPGame), "LateUpdate")]
|
||||
[HarmonyPatch(typeof(GameMain), "LateUpdate")]
|
||||
[HarmonyPatch(typeof(GameMain), "FixedUpdate")]
|
||||
[HarmonyPatch(typeof(GameMain), "Update")]
|
||||
[HarmonyPatch(typeof(GameCamera), "LateUpdate")]
|
||||
private static bool DSPGame_LateUpdate_Prefix()
|
||||
{
|
||||
return !DSPGame.IsMenuDemo;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPriority(Priority.Last)]
|
||||
[HarmonyPatch(typeof(GameMain), "Begin")]
|
||||
private static bool GameMain_Begin_Prefix()
|
||||
{
|
||||
if (!DSPGame.IsMenuDemo) return true;
|
||||
DSPGame.Game._loading = false;
|
||||
DSPGame.Game._running = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user