Files
HauntedBloodlines/Assets/Scripts/CollectibleEntries/CollectableEntryMenuItem.cs
2025-05-29 22:31:40 +03:00

55 lines
2.1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using UnityEngine.UI;
using UnityEngine.Localization;
public class CollectableEntryMenuItem : MonoBehaviour
{
[SerializeField] TextMeshProUGUI buttonDiaryDescriptionText;
[Header("Collectible Entry")]
[Tooltip("This is a title, so the entry can be saved")]
public string entryName;
[Tooltip("What is the number of this entry, goes according to date")]
[SerializeField] int _entryID;
[Tooltip("Whose entry is that?")]
[SerializeField] string _entryType; //{Medea,Children,Daniel,Investigators}
[Tooltip("How much space does this text take?")]
[SerializeField] float diaryScrollViewContentNewHeight;
[Tooltip("Entry Text")]
[TextArea(3/*min lines*/, 15/*max lines*/)]
[SerializeField] string _entryText; //here goes the text of the entry
public LocalizedString entryText;
[Tooltip("Players thoughts about the entry")]
[TextArea(3/*min lines*/, 5/*max lines*/)]
[SerializeField] string _playerThoughtsText;
[Tooltip("Diary Entry Image")]
public Texture diaryEntryImage;
void Start()
{
if (diaryScrollViewContentNewHeight < 1080)
{
diaryScrollViewContentNewHeight = 1080; //1080 is the default price of this in Unity
}
}
public void UpdateEntry()
{
buttonDiaryDescriptionText.text = entryName;
}
public void DisplayDiaryEntryOnClick()
{
//InventoryCollectablesMenuManager.GetInstance().diaryEntryTextScrollView.gameObject.SetActive(true);
InventoryCollectablesMenuManager.GetInstance().entryText.text = entryText.GetLocalizedString();
InventoryCollectablesMenuManager.GetInstance().entryImage.texture = diaryEntryImage;
InventoryCollectablesMenuManager.GetInstance().diaryEntryTextScrollView.sizeDelta = new Vector2(/*InventoryCollectablesMenuManager.GetInstance().diaryEntryTextScrollView.sizeDelta.x*/ 0f, diaryScrollViewContentNewHeight);
InventoryCollectablesMenuManager.GetInstance().GoToPreviewEntryPage();
//ExaminableItemData.GetInstance().sentencesText.text = _playerThoughtsText;
}
}