From 5706af238407c1dd0a160058e4c4151872709f3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dami=C3=A1n=20Garro?= Date: Fri, 9 Feb 2024 00:06:09 -0300 Subject: [PATCH] Add question mark, use it in the mode --- SuitLog/SuitLogItemList.cs | 19 +++++++++++++++++-- SuitLog/SuitLogMode.cs | 20 +++++++++++++++++--- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/SuitLog/SuitLogItemList.cs b/SuitLog/SuitLogItemList.cs index 8af0293..b22d43b 100644 --- a/SuitLog/SuitLogItemList.cs +++ b/SuitLog/SuitLogItemList.cs @@ -16,6 +16,7 @@ public class SuitLogItemList : MonoBehaviour public OWAudioSource oneShotSource; // Well this is used for the custom modes I guess public Text nameField; public Image photo; + public Text questionMark; public DescriptionField descriptionField; public int selectedIndex; @@ -50,13 +51,27 @@ public static void CreatePrefab(ScreenPromptList upperRightPromptList) private void Setup(GameObject canvas, ScreenPromptList upperRightPromptList) { - // TODO: Make this part of list + // Photo & Question Mark Transform probeDisplay = canvas.transform.Find("HUDProbeDisplay"); GameObject photoRoot = Instantiate(probeDisplay.gameObject, transform); photoRoot.transform.localPosition = probeDisplay.transform.localPosition - _commonParent.localPosition; // Offset to match the original photoRoot.DestroyAllComponents(); photoRoot.SetActive(true); photo = photoRoot.GetComponentInChildren(); + photo.enabled = true; + photo.gameObject.SetActive(false); + questionMark = SuitLog.CreateText(); + questionMark.name = "QuestionMark"; + RectTransform questionMarkTransform = questionMark.transform as RectTransform; + SuitLog.SetParent(questionMarkTransform, photoRoot.transform); + questionMarkTransform!.SetAsFirstSibling(); // Bellow photo, like in Ship Log + questionMarkTransform.localPosition = photo.transform.localPosition; + questionMarkTransform.pivot = new Vector2(0.5f, 0.5f); + questionMark.alignment = TextAnchor.MiddleCenter; + questionMark.fontSize = 220; + questionMark.text = "?"; + questionMark.color = new Color(1, 0.6f, 0); // Same as Ship Log's, although it looks different + questionMark.gameObject.SetActive(false); // Title nameField = SuitLog.CreateText(); @@ -199,7 +214,7 @@ public void UpdateListUI() } // TODO: Clarify this in docs - if (photo.enabled) + if (photo.gameObject.activeSelf || questionMark.gameObject.activeSelf) { SetPromptsPosition(-250f); } diff --git a/SuitLog/SuitLogMode.cs b/SuitLog/SuitLogMode.cs index c6575b8..8c88f05 100644 --- a/SuitLog/SuitLogMode.cs +++ b/SuitLog/SuitLogMode.cs @@ -304,6 +304,7 @@ private void CloseEntryMenu() itemList.DescriptionFieldClose(); LoadAstroObjectsMenu(); HidePhoto(); + HideQuestionMark(); _displayedEntryItems.Clear(); // TODO: Why? _isEntryMenuOpen = false; _oneShotSource.PlayOneShot(AudioType.ShipLogDeselectPlanet); @@ -352,7 +353,7 @@ private void UpdateSelectedEntry() } else { - HidePhoto(); + ShowQuestionMark(); } } else @@ -360,21 +361,34 @@ private void UpdateSelectedEntry() // In MapModeMode, this would happen at OpenEntryMenu itemList.DescriptionFieldGetNextItem() .DisplayText(UITextLibrary.GetString(UITextType.LogNoDiscoveriesPrompt)); + ShowQuestionMark(); } } private void ShowPhoto(ShipLogEntry entry) { - itemList.photo.enabled = true; + HideQuestionMark(); + itemList.photo.gameObject.SetActive(true); itemList.photo.sprite = entry.GetSprite(); } private void HidePhoto() { - itemList.photo.enabled = false; + itemList.photo.gameObject.SetActive(false); itemList.photo.sprite = null; } + private void ShowQuestionMark() + { + HidePhoto(); + itemList.questionMark.gameObject.SetActive(true); + } + + private void HideQuestionMark() + { + itemList.questionMark.gameObject.SetActive(false); + } + public override bool AllowModeSwap() { return true;