blob: c7e2fc396ce0d2cfe9d9615a276c3d707b6ca8b0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
using System;
using UnityEngine;
using XUpdater;
namespace XUtliPoolLib
{
public class XStringTable : XSingleton<XStringTable>
{
private XTableAsyncLoader _async_loader = null;
private StringTable _reader = new StringTable();
private bool _inited = false;
public bool ReInit(TextAsset ta)
{
this.Uninit();
bool flag = XSingleton<XResourceLoaderMgr>.singleton.ReadFile(ta, this._reader);
bool result;
if (flag)
{
this._inited = true;
result = true;
}
else
{
result = false;
}
return result;
}
public bool SyncInit()
{
bool inited = this._inited;
bool result;
if (inited)
{
result = true;
}
else
{
this._inited = XSingleton<XResourceLoaderMgr>.singleton.ReadFile("Table/StringTable", this._reader);
bool inited2 = this._inited;
if (inited2)
{
}
result = this._inited;
}
return result;
}
public override bool Init()
{
bool inited = this._inited;
bool result;
if (inited)
{
result = true;
}
else
{
bool flag = this._async_loader == null;
if (flag)
{
this._async_loader = new XTableAsyncLoader();
this._async_loader.AddTask("Table/StringTable", this._reader, false);
this._async_loader.Execute(null);
}
this._inited = this._async_loader.IsDone;
result = this._inited;
}
return result;
}
public override void Uninit()
{
this._inited = false;
this._async_loader = null;
}
public bool StringTableUpdated()
{
return XSingleton<XUpdater.XUpdater>.singleton.ContainRes(XSingleton<XCommon>.singleton.XHash("Table/StringTable"));
}
public string GetString(string key)
{
string text = "";
bool data = this.GetData(key, out text);
string result;
if (data)
{
result = text;
}
else
{
bool flag = key != "UNKNOWN_TARGET";
if (flag)
{
result = this.GetString("UNKNOWN_TARGET") + " " + key;
}
else
{
result = "UNKNOWN_TARGET not found in StringTable";
}
}
return result;
}
public bool GetData(string key, out string value)
{
uint key2 = XSingleton<XCommon>.singleton.XHash(key);
return this._reader.Table.TryGetValue(key2, out value);
}
}
}
|