From 97901c9ee70d065a93db0ab814ff6896b5098d8a Mon Sep 17 00:00:00 2001 From: "Nick J. Connors" Date: Wed, 5 Jan 2022 19:07:20 -0500 Subject: [PATCH] Blank star chart log page in ship log --- .../Builder/Body/SingularityBuilder.cs | 2 +- NewHorizons/Builder/General/ShipLogBuilder.cs | 58 +++++++++++++------ .../Components/ShipLogStarChartMode.cs | 56 ++++++++++++++++++ NewHorizons/Utility/Patches.cs | 6 +- 4 files changed, 99 insertions(+), 23 deletions(-) create mode 100644 NewHorizons/Components/ShipLogStarChartMode.cs diff --git a/NewHorizons/Builder/Body/SingularityBuilder.cs b/NewHorizons/Builder/Body/SingularityBuilder.cs index 7386a983..0012f695 100644 --- a/NewHorizons/Builder/Body/SingularityBuilder.cs +++ b/NewHorizons/Builder/Body/SingularityBuilder.cs @@ -211,7 +211,7 @@ namespace NewHorizons.Builder.Body whiteHoleVolume._fluidVolume = whiteHoleFluidVolume; whiteHoleVolume._whiteHoleBody = OWRB; whiteHoleVolume._whiteHoleProxyShadowSuperGroup = body.GetComponent(); - + whiteHoleVolumeGO.GetComponent().radius = size; whiteHoleVolume.enabled = true; diff --git a/NewHorizons/Builder/General/ShipLogBuilder.cs b/NewHorizons/Builder/General/ShipLogBuilder.cs index 1502b5e6..ab711799 100644 --- a/NewHorizons/Builder/General/ShipLogBuilder.cs +++ b/NewHorizons/Builder/General/ShipLogBuilder.cs @@ -1,40 +1,60 @@ -using System; +using NewHorizons.Components; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; +using Logger = NewHorizons.Utility.Logger; namespace NewHorizons.Builder.General { public static class ShipLogBuilder { - public static ShipLogDetectiveMode StarChartMode; + public static ShipLogStarChartMode ShipLogStarChartMode; public static void Init() { - /* + Logger.Log("Fuck"); var shipLogRoot = GameObject.Find("Ship_Body/Module_Cabin/Systems_Cabin/ShipLogPivot/ShipLog/ShipLogPivot/ShipLogCanvas"); - var starChartLog = GameObject.Instantiate(shipLogRoot.transform.Find("DetectiveMode"), shipLogRoot.transform); - starChartLog.transform.name = "StarChartMode"; + Logger.Log("Fuck"); + var starChartLog = new GameObject("StarChartMode"); + starChartLog.SetActive(false); + starChartLog.transform.parent = shipLogRoot.transform; + starChartLog.transform.localScale = Vector3.one * 0.5f; + Logger.Log("Fuck"); + ShipLogStarChartMode = starChartLog.AddComponent(); + Logger.Log("Fuck"); + var reticleImage = GameObject.Instantiate(GameObject.Find("Ship_Body/Module_Cabin/Systems_Cabin/ShipLogPivot/ShipLog/ShipLogPivot/ShipLogCanvas/DetectiveMode/ReticleImage (1)/"), starChartLog.transform); + Logger.Log("Fuck"); + var scaleRoot = new GameObject("ScaleRoot"); + scaleRoot.transform.parent = starChartLog.transform; + scaleRoot.transform.localScale = Vector3.one; + Logger.Log("Fuck"); + var panRoot = new GameObject("PanRoot"); + panRoot.transform.parent = scaleRoot.transform; + panRoot.transform.localScale = Vector3.one; + Logger.Log("Fuck"); + CreateCard("Test", panRoot.transform); + } - var cardRoot = starChartLog.transform.Find("ScaleRoot").Find("PanRoot"); - foreach(Transform child in cardRoot) + public static GameObject _cardTemplate = null; + + public static void CreateCard(string name, Transform parent) + { + if(_cardTemplate == null) { - GameObject.Destroy(child.gameObject); + Logger.Log("Fuck"); + var panRoot = GameObject.Find("Ship_Body/Module_Cabin/Systems_Cabin/ShipLogPivot/ShipLog/ShipLogPivot/ShipLogCanvas/DetectiveMode/ScaleRoot/PanRoot"); + Logger.Log("Fuck"); + _cardTemplate = GameObject.Instantiate(panRoot.GetComponentInChildren().gameObject); + Logger.Log("Fuck"); + _cardTemplate.SetActive(false); } - var cardPrefab = GameObject.Find("Ship_Body/Module_Cabin/Systems_Cabin/ShipLogPivot/ShipLog/ShipLogPivot/ShipLogCanvas/DetectiveMode/ScaleRoot/PanRoot/TH_VILLAGE"); - - var detectiveMode = GameObject.Find("Ship_Body/Module_Cabin/Systems_Cabin/ShipLogPivot/ShipLog/ShipLogPivot/ShipLogCanvas/DetectiveMode/"); - var mapMode = GameObject.Find("Ship_Body/Module_Cabin/Systems_Cabin/ShipLogPivot/ShipLog/ShipLogPivot/ShipLogCanvas/MapMode/"); - - StarChartMode = starChartLog.GetComponent(); - - StarChartMode._cardDict = new Dictionary(); - StarChartMode._cardList = new List(); - StarChartMode._centerPromptList = detectiveMode.GetComponent()._centerPromptList; - */ + var newCard = GameObject.Instantiate(_cardTemplate, parent); + Logger.Log("Fuck"); + newCard.transform.Find("EntryCardRoot/NameBackground/Name").GetComponent().text = name; } } } diff --git a/NewHorizons/Components/ShipLogStarChartMode.cs b/NewHorizons/Components/ShipLogStarChartMode.cs new file mode 100644 index 00000000..54148c26 --- /dev/null +++ b/NewHorizons/Components/ShipLogStarChartMode.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NewHorizons.Components +{ + public class ShipLogStarChartMode : ShipLogMode + { + public override bool AllowCancelInput() + { + return true; + } + + public override bool AllowModeSwap() + { + return true; + } + + public override void EnterMode(string entryID = "", List revealQueue = null) + { + + } + + public override void ExitMode() + { + + } + + public override string GetFocusedEntryID() + { + return "0"; + } + + public override void Initialize(ScreenPromptList centerPromptList, ScreenPromptList upperRightPromptList, OWAudioSource oneShotSource) + { + + } + + public override void OnEnterComputer() + { + + } + + public override void OnExitComputer() + { + + } + + public override void UpdateMode() + { + + } + } +} diff --git a/NewHorizons/Utility/Patches.cs b/NewHorizons/Utility/Patches.cs index cd3fdcaa..91b2e1c6 100644 --- a/NewHorizons/Utility/Patches.cs +++ b/NewHorizons/Utility/Patches.cs @@ -345,7 +345,7 @@ namespace NewHorizons.Utility if (__instance._exiting || OWInput.GetInputMode() != InputMode.ShipComputer || __instance._currentMode.AllowCancelInput() && OWInput.IsNewlyPressed(InputLibrary.cancel, InputMode.All) - || ShipLogBuilder.StarChartMode == null) + || ShipLogBuilder.ShipLogStarChartMode == null) return true; __instance._exitPrompt.SetVisibility(__instance._currentMode.AllowCancelInput()); @@ -358,8 +358,8 @@ namespace NewHorizons.Utility __instance._currentMode = (flag ? __instance._detectiveMode : __instance._mapMode); if (currentMode.Equals(__instance._mapMode)) - __instance._currentMode = ShipLogBuilder.StarChartMode; - else if (currentMode.Equals(ShipLogBuilder.StarChartMode)) + __instance._currentMode = ShipLogBuilder.ShipLogStarChartMode; + else if (currentMode.Equals(ShipLogBuilder.ShipLogStarChartMode)) __instance._currentMode = __instance._detectiveMode; else __instance._currentMode = __instance._mapMode;