mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Handle potentially missing ship log canvas
This commit is contained in:
parent
5d1a16f572
commit
e74dbfb863
@ -20,32 +20,40 @@ namespace NewHorizons.Handlers
|
||||
|
||||
var shipLogRoot = SearchUtilities.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);
|
||||
if (shipLogRoot != null)
|
||||
{
|
||||
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>();
|
||||
ShipLogStarChartMode = starChartLog.AddComponent<ShipLogStarChartMode>();
|
||||
|
||||
var reticleImage = GameObject.Instantiate(SearchUtilities.Find("Ship_Body/Module_Cabin/Systems_Cabin/ShipLogPivot/ShipLog/ShipLogPivot/ShipLogCanvas/DetectiveMode/ReticleImage (1)/"), starChartLog.transform);
|
||||
var reticleImage = GameObject.Instantiate(SearchUtilities.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 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 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 = SearchUtilities.Find("Ship_Body/Module_Cabin/Systems_Cabin/ShipLogPivot/ShipLog/OneShotAudio_ShipLog")?.GetComponent<OWAudioSource>();
|
||||
var centerPromptList = shipLogRoot.transform.Find("ScreenPromptListScaleRoot/ScreenPromptList_Center")?.GetComponent<ScreenPromptList>();
|
||||
var upperRightPromptList = shipLogRoot.transform.Find("ScreenPromptListScaleRoot/ScreenPromptList_UpperRight")?.GetComponent<ScreenPromptList>();
|
||||
var oneShotSource = SearchUtilities.Find("Ship_Body/Module_Cabin/Systems_Cabin/ShipLogPivot/ShipLog/OneShotAudio_ShipLog")?.GetComponent<OWAudioSource>();
|
||||
|
||||
ShipLogStarChartMode.Initialize(
|
||||
centerPromptList,
|
||||
upperRightPromptList,
|
||||
oneShotSource);
|
||||
}
|
||||
|
||||
_starSystemToFactID = new Dictionary<string, string>();
|
||||
_factIDToStarSystem = new Dictionary<string, string>();
|
||||
@ -57,11 +65,6 @@ namespace NewHorizons.Handlers
|
||||
RegisterFactForSystem(system.Config.factRequiredForWarp, system.UniqueID);
|
||||
}
|
||||
}
|
||||
|
||||
ShipLogStarChartMode.Initialize(
|
||||
centerPromptList,
|
||||
upperRightPromptList,
|
||||
oneShotSource);
|
||||
}
|
||||
|
||||
public static bool CanWarp()
|
||||
@ -98,8 +101,10 @@ namespace NewHorizons.Handlers
|
||||
if (_factIDToStarSystem.TryGetValue(factID, out var systemUnlocked))
|
||||
{
|
||||
Logger.Log($"Just learned [{factID}] and unlocked [{systemUnlocked}]");
|
||||
if (!Main.HasWarpDrive) Main.Instance.EnableWarpDrive();
|
||||
ShipLogStarChartMode.AddSystemCard(systemUnlocked);
|
||||
if (!Main.HasWarpDrive)
|
||||
Main.Instance.EnableWarpDrive();
|
||||
if (ShipLogStarChartMode != null)
|
||||
ShipLogStarChartMode.AddSystemCard(systemUnlocked);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user