43 lines
984 B
C#
43 lines
984 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using I2.Loc;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class TextFormatInput : MonoBehaviour
|
|
{
|
|
[Serializable]
|
|
public class FormatInput
|
|
{
|
|
public string inputId = string.Empty;
|
|
|
|
public bool negative;
|
|
|
|
public bool isMoveControls;
|
|
}
|
|
|
|
public string textId = string.Empty;
|
|
|
|
public List<FormatInput> formatInputs = new List<FormatInput>();
|
|
|
|
private Text text;
|
|
|
|
private void OnEnable()
|
|
{
|
|
if (text == null)
|
|
{
|
|
text = GetComponent<Text>();
|
|
}
|
|
if ((bool)GetComponent<Localize>())
|
|
{
|
|
GetComponent<Localize>().enabled = false;
|
|
}
|
|
string[] array = new string[formatInputs.Count];
|
|
for (int i = 0; i < array.Length; i++)
|
|
{
|
|
array[i] = "<color=#ffa500ff>" + ((!formatInputs[i].isMoveControls) ? UtilitiesInput.GetActionKeyName(formatInputs[i].inputId, !formatInputs[i].negative) : UtilitiesInput.GetMoveControls()) + "</color>";
|
|
}
|
|
text.text = string.Format(Utilities.GetTranslation(textId), array);
|
|
}
|
|
}
|