27 lines
836 B
C#
27 lines
836 B
C#
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
public class table_base : MonoBehaviour
|
||
|
|
{
|
||
|
|
public TextAsset m_json;
|
||
|
|
|
||
|
|
protected string json_last;
|
||
|
|
protected bool LoadComplete = false;
|
||
|
|
|
||
|
|
protected virtual void Awake()
|
||
|
|
{
|
||
|
|
json_last = m_json.text;
|
||
|
|
Resources.UnloadAsset(m_json);
|
||
|
|
m_json = null;
|
||
|
|
}
|
||
|
|
protected virtual void Start() { LoadComplete = true; }
|
||
|
|
public bool Get_LoadComplete() { return LoadComplete; }
|
||
|
|
|
||
|
|
protected bool IsPercentValue(string str) { return str.Contains("%"); }
|
||
|
|
protected float Get_Value(string str)
|
||
|
|
{
|
||
|
|
if (IsPercentValue(str)) return float.Parse(str.Replace("%", "")) * 0.01f;
|
||
|
|
else if (str.Contains("s")) return float.Parse(str.Replace("s", ""));
|
||
|
|
else if (str.Contains("exp")) return float.Parse(str.Replace("exp", ""));
|
||
|
|
return float.Parse(str);
|
||
|
|
}
|
||
|
|
}
|