54 lines
1.5 KiB
C#
54 lines
1.5 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using I2.Loc;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Ichni.UI
|
|
{
|
|
public abstract class SettingsUIElementBase : MonoBehaviour
|
|
{
|
|
public string title;
|
|
public string subTitle;
|
|
|
|
public Image titleBackground;
|
|
public TMP_Text titleText;
|
|
public TMP_Text subTitleText;
|
|
|
|
public UnityAction updateValueAction;
|
|
|
|
public virtual void SetUp(string title = "", string subTitle = "")
|
|
{
|
|
if (title != "")
|
|
{
|
|
SetTitle(title, subTitle);
|
|
}
|
|
else
|
|
{
|
|
titleBackground.gameObject.SetActive(false);
|
|
titleText.gameObject.SetActive(false);
|
|
subTitleText.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
public void SetTitle(string title, string subTitle = "")
|
|
{
|
|
this.title = title;
|
|
this.subTitle = subTitle;
|
|
titleText.gameObject.SetActive(true);
|
|
titleText.GetComponent<Localize>().SetTerm(title);
|
|
|
|
if (subTitle != "")
|
|
{
|
|
subTitleText.gameObject.SetActive(true);
|
|
subTitleText.GetComponent<Localize>().SetTerm(subTitle);
|
|
}
|
|
else
|
|
{
|
|
subTitleText.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
}
|
|
} |