47 lines
1.1 KiB
C#
47 lines
1.1 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using TMPro;
|
|
|
|
namespace BF
|
|
{
|
|
[System.Serializable]
|
|
public struct GlobalInfo
|
|
{
|
|
public TextMeshProUGUI tx;
|
|
public string key;
|
|
}
|
|
[ExecuteInEditMode]
|
|
[DisallowMultipleComponent]
|
|
public class GlobalHelper : MonoBehaviour
|
|
{
|
|
public List<GlobalInfo> globalInfoList = new List<GlobalInfo>();
|
|
public int GetListCount()
|
|
{
|
|
return globalInfoList.Count;
|
|
}
|
|
public string GetGlobalByIndex(int index)
|
|
{
|
|
if (index >= 0 && index < globalInfoList.Count)
|
|
{
|
|
return globalInfoList[index].key;
|
|
}
|
|
return "";
|
|
}
|
|
public void SetText(int index, string v)
|
|
{
|
|
if (index >= 0 && index < globalInfoList.Count)
|
|
{
|
|
globalInfoList[index].tx.text = v;
|
|
}
|
|
}
|
|
|
|
void OnDestroy()
|
|
{
|
|
globalInfoList.Clear();
|
|
globalInfoList = null;
|
|
}
|
|
}
|
|
}
|