mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Separate StarChartHandler into its own thing
This commit is contained in:
parent
ed9308dcea
commit
862c98133c
@ -15,8 +15,7 @@ namespace NewHorizons.Builder.General
|
|||||||
public static class ShipLogBuilder
|
public static class ShipLogBuilder
|
||||||
{
|
{
|
||||||
public static readonly string PAN_ROOT_PATH = "Ship_Body/Module_Cabin/Systems_Cabin/ShipLogPivot/ShipLog/ShipLogPivot/ShipLogCanvas/MapMode/ScaleRoot/PanRoot";
|
public static readonly string PAN_ROOT_PATH = "Ship_Body/Module_Cabin/Systems_Cabin/ShipLogPivot/ShipLog/ShipLogPivot/ShipLogCanvas/MapMode/ScaleRoot/PanRoot";
|
||||||
|
|
||||||
public static ShipLogStarChartMode ShipLogStarChartMode;
|
|
||||||
private static Dictionary<string, NewHorizonsBody> astroIdToBody = new Dictionary<string, NewHorizonsBody>();
|
private static Dictionary<string, NewHorizonsBody> astroIdToBody = new Dictionary<string, NewHorizonsBody>();
|
||||||
|
|
||||||
private static NewHorizonsBody GetConfigFromEntry(ShipLogEntry entry)
|
private static NewHorizonsBody GetConfigFromEntry(ShipLogEntry entry)
|
||||||
@ -645,42 +644,5 @@ namespace NewHorizons.Builder.General
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public static void Init()
|
|
||||||
{
|
|
||||||
var shipLogRoot = GameObject.Find("Ship_Body/Module_Cabin/Systems_Cabin/ShipLogPivot/ShipLog/ShipLogPivot/ShipLogCanvas");
|
|
||||||
|
|
||||||
var starChartLog = new GameObject("StarChartMode");
|
|
||||||
starChartLog.SetActive(false);
|
|
||||||
starChartLog.transform.parent = shipLogRoot.transform;
|
|
||||||
starChartLog.transform.localScale = Vector3.one * 1f;
|
|
||||||
starChartLog.transform.localPosition = Vector3.zero;
|
|
||||||
starChartLog.transform.localRotation = Quaternion.Euler(0, 0, 0);
|
|
||||||
|
|
||||||
ShipLogStarChartMode = starChartLog.AddComponent<ShipLogStarChartMode>();
|
|
||||||
|
|
||||||
var reticleImage = GameObject.Instantiate(GameObject.Find("Ship_Body/Module_Cabin/Systems_Cabin/ShipLogPivot/ShipLog/ShipLogPivot/ShipLogCanvas/DetectiveMode/ReticleImage (1)/"), starChartLog.transform);
|
|
||||||
|
|
||||||
var scaleRoot = new GameObject("ScaleRoot");
|
|
||||||
scaleRoot.transform.parent = starChartLog.transform;
|
|
||||||
scaleRoot.transform.localScale = Vector3.one;
|
|
||||||
scaleRoot.transform.localPosition = Vector3.zero;
|
|
||||||
scaleRoot.transform.localRotation = Quaternion.Euler(0, 0, 0);
|
|
||||||
|
|
||||||
var panRoot = new GameObject("PanRoot");
|
|
||||||
panRoot.transform.parent = scaleRoot.transform;
|
|
||||||
panRoot.transform.localScale = Vector3.one;
|
|
||||||
panRoot.transform.localPosition = Vector3.zero;
|
|
||||||
panRoot.transform.localRotation = Quaternion.Euler(0,0,0);
|
|
||||||
|
|
||||||
var centerPromptList = shipLogRoot.transform.Find("ScreenPromptListScaleRoot/ScreenPromptList_Center")?.GetComponent<ScreenPromptList>();
|
|
||||||
var upperRightPromptList = shipLogRoot.transform.Find("ScreenPromptListScaleRoot/ScreenPromptList_UpperRight")?.GetComponent<ScreenPromptList>();
|
|
||||||
var oneShotSource = GameObject.Find("Ship_Body/Module_Cabin/Systems_Cabin/ShipLogPivot/ShipLog/OneShotAudio_ShipLog")?.GetComponent<OWAudioSource>();
|
|
||||||
|
|
||||||
ShipLogStarChartMode.Initialize(
|
|
||||||
centerPromptList,
|
|
||||||
upperRightPromptList,
|
|
||||||
oneShotSource);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
52
NewHorizons/Handlers/StarChartHandler.cs
Normal file
52
NewHorizons/Handlers/StarChartHandler.cs
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
using NewHorizons.Components;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace NewHorizons.Handlers
|
||||||
|
{
|
||||||
|
public static class StarChartHandler
|
||||||
|
{
|
||||||
|
public static ShipLogStarChartMode ShipLogStarChartMode;
|
||||||
|
|
||||||
|
public static void Init()
|
||||||
|
{
|
||||||
|
var shipLogRoot = GameObject.Find("Ship_Body/Module_Cabin/Systems_Cabin/ShipLogPivot/ShipLog/ShipLogPivot/ShipLogCanvas");
|
||||||
|
|
||||||
|
var starChartLog = new GameObject("StarChartMode");
|
||||||
|
starChartLog.SetActive(false);
|
||||||
|
starChartLog.transform.parent = shipLogRoot.transform;
|
||||||
|
starChartLog.transform.localScale = Vector3.one * 1f;
|
||||||
|
starChartLog.transform.localPosition = Vector3.zero;
|
||||||
|
starChartLog.transform.localRotation = Quaternion.Euler(0, 0, 0);
|
||||||
|
|
||||||
|
ShipLogStarChartMode = starChartLog.AddComponent<ShipLogStarChartMode>();
|
||||||
|
|
||||||
|
var reticleImage = GameObject.Instantiate(GameObject.Find("Ship_Body/Module_Cabin/Systems_Cabin/ShipLogPivot/ShipLog/ShipLogPivot/ShipLogCanvas/DetectiveMode/ReticleImage (1)/"), starChartLog.transform);
|
||||||
|
|
||||||
|
var scaleRoot = new GameObject("ScaleRoot");
|
||||||
|
scaleRoot.transform.parent = starChartLog.transform;
|
||||||
|
scaleRoot.transform.localScale = Vector3.one;
|
||||||
|
scaleRoot.transform.localPosition = Vector3.zero;
|
||||||
|
scaleRoot.transform.localRotation = Quaternion.Euler(0, 0, 0);
|
||||||
|
|
||||||
|
var panRoot = new GameObject("PanRoot");
|
||||||
|
panRoot.transform.parent = scaleRoot.transform;
|
||||||
|
panRoot.transform.localScale = Vector3.one;
|
||||||
|
panRoot.transform.localPosition = Vector3.zero;
|
||||||
|
panRoot.transform.localRotation = Quaternion.Euler(0, 0, 0);
|
||||||
|
|
||||||
|
var centerPromptList = shipLogRoot.transform.Find("ScreenPromptListScaleRoot/ScreenPromptList_Center")?.GetComponent<ScreenPromptList>();
|
||||||
|
var upperRightPromptList = shipLogRoot.transform.Find("ScreenPromptListScaleRoot/ScreenPromptList_UpperRight")?.GetComponent<ScreenPromptList>();
|
||||||
|
var oneShotSource = GameObject.Find("Ship_Body/Module_Cabin/Systems_Cabin/ShipLogPivot/ShipLog/OneShotAudio_ShipLog")?.GetComponent<OWAudioSource>();
|
||||||
|
|
||||||
|
ShipLogStarChartMode.Initialize(
|
||||||
|
centerPromptList,
|
||||||
|
upperRightPromptList,
|
||||||
|
oneShotSource);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -23,6 +23,7 @@ using UnityEngine;
|
|||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using Logger = NewHorizons.Utility.Logger;
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
|
using NewHorizons.Handlers;
|
||||||
|
|
||||||
namespace NewHorizons
|
namespace NewHorizons
|
||||||
{
|
{
|
||||||
@ -114,7 +115,7 @@ namespace NewHorizons
|
|||||||
HasWarpDrive = true;
|
HasWarpDrive = true;
|
||||||
|
|
||||||
_shipWarpController = GameObject.Find("Ship_Body").AddComponent<ShipWarpController>();
|
_shipWarpController = GameObject.Find("Ship_Body").AddComponent<ShipWarpController>();
|
||||||
Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => ShipLogBuilder.Init());
|
Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => StarChartHandler.Init());
|
||||||
|
|
||||||
LoadBody(LoadConfig(this, "AssetBundle/WarpDriveConfig.json"));
|
LoadBody(LoadConfig(this, "AssetBundle/WarpDriveConfig.json"));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,7 @@ using OWML.Utils;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Logger = NewHorizons.Utility.Logger;
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
using Object = UnityEngine.Object;
|
using Object = UnityEngine.Object;
|
||||||
|
using NewHorizons.Handlers;
|
||||||
|
|
||||||
namespace NewHorizons.Tools
|
namespace NewHorizons.Tools
|
||||||
{
|
{
|
||||||
@ -382,7 +383,7 @@ namespace NewHorizons.Tools
|
|||||||
{
|
{
|
||||||
if(__instance._playerAtFlightConsole && OWInput.IsNewlyPressed(InputLibrary.autopilot, InputMode.ShipCockpit))
|
if(__instance._playerAtFlightConsole && OWInput.IsNewlyPressed(InputLibrary.autopilot, InputMode.ShipCockpit))
|
||||||
{
|
{
|
||||||
var targetSystem = ShipLogBuilder.ShipLogStarChartMode.GetTargetStarSystem();
|
var targetSystem = StarChartHandler.ShipLogStarChartMode.GetTargetStarSystem();
|
||||||
if (targetSystem != null)
|
if (targetSystem != null)
|
||||||
{
|
{
|
||||||
Main.Instance.ChangeCurrentStarSystem(targetSystem, true);
|
Main.Instance.ChangeCurrentStarSystem(targetSystem, true);
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using NewHorizons.Builder.General;
|
using NewHorizons.Builder.General;
|
||||||
|
using NewHorizons.Handlers;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -35,7 +36,7 @@ namespace NewHorizons.Tools
|
|||||||
|
|
||||||
if (__instance._playerAtFlightConsole && OWInput.IsNewlyPressed(InputLibrary.autopilot, InputMode.ShipCockpit))
|
if (__instance._playerAtFlightConsole && OWInput.IsNewlyPressed(InputLibrary.autopilot, InputMode.ShipCockpit))
|
||||||
{
|
{
|
||||||
var targetSystem = ShipLogBuilder.ShipLogStarChartMode.GetTargetStarSystem();
|
var targetSystem = StarChartHandler.ShipLogStarChartMode.GetTargetStarSystem();
|
||||||
if (targetSystem != null)
|
if (targetSystem != null)
|
||||||
{
|
{
|
||||||
Main.Instance.ChangeCurrentStarSystem(targetSystem, true);
|
Main.Instance.ChangeCurrentStarSystem(targetSystem, true);
|
||||||
@ -52,7 +53,7 @@ namespace NewHorizons.Tools
|
|||||||
if (__instance._exiting
|
if (__instance._exiting
|
||||||
|| OWInput.GetInputMode() != InputMode.ShipComputer
|
|| OWInput.GetInputMode() != InputMode.ShipComputer
|
||||||
|| __instance._currentMode.AllowCancelInput() && OWInput.IsNewlyPressed(InputLibrary.cancel, InputMode.All)
|
|| __instance._currentMode.AllowCancelInput() && OWInput.IsNewlyPressed(InputLibrary.cancel, InputMode.All)
|
||||||
|| ShipLogBuilder.ShipLogStarChartMode == null)
|
|| StarChartHandler.ShipLogStarChartMode == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
__instance._exitPrompt.SetVisibility(__instance._currentMode.AllowCancelInput());
|
__instance._exitPrompt.SetVisibility(__instance._currentMode.AllowCancelInput());
|
||||||
@ -66,8 +67,8 @@ namespace NewHorizons.Tools
|
|||||||
__instance._currentMode = (flag ? __instance._detectiveMode : __instance._mapMode);
|
__instance._currentMode = (flag ? __instance._detectiveMode : __instance._mapMode);
|
||||||
|
|
||||||
if (currentMode.Equals(__instance._mapMode))
|
if (currentMode.Equals(__instance._mapMode))
|
||||||
__instance._currentMode = ShipLogBuilder.ShipLogStarChartMode;
|
__instance._currentMode = StarChartHandler.ShipLogStarChartMode;
|
||||||
else if (currentMode.Equals(ShipLogBuilder.ShipLogStarChartMode))
|
else if (currentMode.Equals(StarChartHandler.ShipLogStarChartMode))
|
||||||
__instance._currentMode = __instance._detectiveMode;
|
__instance._currentMode = __instance._detectiveMode;
|
||||||
else
|
else
|
||||||
__instance._currentMode = __instance._mapMode;
|
__instance._currentMode = __instance._mapMode;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user