Files
UltimateFishing/Assets/Scripts/Assembly-CSharp/ChangelogManager.cs
2026-02-21 16:45:37 +08:00

58 lines
1.5 KiB
C#

using System.Collections.Generic;
using BitStrap;
using UnityEngine;
using UnityEngine.UI;
public class ChangelogManager : MonoBehaviour
{
public Text changelogFullText;
public Text changelogLastText;
public RectTransform changelogFullBg;
public RectTransform newIndicator;
public int maxEntries = 10;
public RectTransform scrollWindow;
public Vector2 scrollWindowBottom = Vector2.zero;
[TextArea]
public List<string> changelogEntries = new List<string>();
[TextArea]
public List<string> changelogEntriesNonVR = new List<string>();
private void OnEnable()
{
Initialize();
}
[Button]
public void Initialize()
{
changelogFullText.text = string.Empty;
changelogFullText.transform.SetParent(changelogFullBg.transform);
scrollWindow.offsetMin = new Vector2(scrollWindow.offsetMin.x, scrollWindowBottom.x);
scrollWindow.offsetMin = new Vector2(scrollWindow.offsetMin.x, scrollWindowBottom.y);
int num = 0;
if (changelogEntries.Count > maxEntries)
{
num = changelogEntries.Count - maxEntries;
}
for (int num2 = changelogEntries.Count - 1; num2 >= num; num2--)
{
changelogFullText.text += changelogEntries[num2];
if (num2 > num)
{
changelogFullText.text += "\n\n";
}
}
changelogFullText.rectTransform.localScale = Vector3.one;
changelogFullText.rectTransform.anchoredPosition = new Vector2(-7f, -30f);
changelogFullBg.sizeDelta = new Vector2(changelogFullBg.sizeDelta.x, changelogFullText.rectTransform.sizeDelta.y);
}
}