66 lines
1.8 KiB
C#
66 lines
1.8 KiB
C#
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
[Serializable]
|
|
public class LocalTextTableData : TableDataBase
|
|
{
|
|
public int ID;
|
|
public string s_Korean;
|
|
public string s_English;
|
|
public string s_Japan;
|
|
}
|
|
|
|
public class table_localtext : table_base
|
|
{
|
|
public static table_localtext Ins;
|
|
|
|
/// <summary>
|
|
/// 0 한국어, 1 영어, 2 일본어
|
|
/// </summary>
|
|
public int m_Language = 0;
|
|
|
|
List<LocalTextTableData> tableDatas;
|
|
// 선택 언어, id, 텍스트
|
|
Dictionary<int, Dictionary<int, string>> dic_text = new Dictionary<int, Dictionary<int, string>>
|
|
{
|
|
{ 0, new Dictionary<int, string>() }, { 1, new Dictionary<int, string>() }, { 2, new Dictionary<int, string>() },
|
|
};
|
|
|
|
protected override void Awake()
|
|
{
|
|
Ins = this;
|
|
base.Awake();
|
|
}
|
|
|
|
protected override void Start()
|
|
{
|
|
tableDatas = JsonConvert.DeserializeObject<List<LocalTextTableData>>(json_last);
|
|
for (int i = 0; i < tableDatas.Count; i++)
|
|
{
|
|
var temp = tableDatas[i];
|
|
dic_text[0].Add(temp.ID, temp.s_Korean);
|
|
dic_text[1].Add(temp.ID, temp.s_English);
|
|
dic_text[2].Add(temp.ID, temp.s_Japan);
|
|
}
|
|
|
|
base.Start();
|
|
}
|
|
|
|
public string Get_Text(int id)
|
|
{
|
|
if (dic_text[m_Language].ContainsKey(id))
|
|
return dic_text[m_Language][id];
|
|
else
|
|
return DSUtil.Format("No LocalText : {0}", id);
|
|
}
|
|
public string Get_Text(int id, params object[] objects)
|
|
{
|
|
if (dic_text[m_Language].ContainsKey(id))
|
|
return DSUtil.Format(dic_text[m_Language][id], objects);
|
|
else
|
|
return DSUtil.Format("No LocalText : {0}", id);
|
|
}
|
|
|
|
public string Get_StageNodeType(eStageNodeType type) { return Get_Text(10001 + (int)type); }
|
|
} |