blob: 400b8ee6bc64afda0d072782a312950651fcc39d (
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
|
using System;
using System.Collections.Generic;
using XUtliPoolLib;
namespace XMainClient
{
internal class XTakeCostMgr : XSingleton<XTakeCostMgr>
{
private Dictionary<string, ICostHandler> m_CostCache = new Dictionary<string, ICostHandler>();
private static ICostHandler MakeCostHandler()
{
return new DragonCoinCostHandler();
}
public CostInfo QueryCost(string CostName, int Times)
{
CostInfo costInfo;
costInfo.type = (ItemEnum)0;
costInfo.count = 0u;
ICostHandler handler = this.GetHandler(CostName);
bool flag = handler == null;
CostInfo result;
if (flag)
{
XSingleton<XDebug>.singleton.AddErrorLog(string.Format("Can't find CostName: {0} in globalconfig.txt", CostName), null, null, null, null, null);
result = costInfo;
}
else
{
result = handler.GetCost(Times);
}
return result;
}
public ICostHandler GetHandler(string CostName)
{
ICostHandler costHandler = null;
bool flag = !this.m_CostCache.TryGetValue(CostName, out costHandler);
if (flag)
{
string value = XSingleton<XGlobalConfig>.singleton.GetValue(CostName);
bool flag2 = value != "";
if (flag2)
{
costHandler = XTakeCostMgr.MakeCostHandler();
bool flag3 = !costHandler.ParseCostConfigString(value);
if (flag3)
{
costHandler = null;
}
this.m_CostCache.Add(CostName, costHandler);
}
}
return costHandler;
}
}
}
|