public T GetObj <T>(eResourceKind kind, string name) where T : class { if (_resourceData.ContainsKey(kind)) { if (_resourceData[kind].ContainsKey(name)) { object o = _resourceData[kind][name]; return((T)Convert.ChangeType(o, typeof(T))); } } return(null); }
void LoadData <T>(eResourceKind kind, eTableType type) where T : class { Dictionary <string, object> tempDic = new Dictionary <string, object>(); TableBase tb = TableManager._instance.Get(type); foreach (string key in tb._datas.Keys) { object obj = Resources.Load(tb._datas[key]["Location"], typeof(T)); T temp = (T)Convert.ChangeType(obj, typeof(T)); tempDic.Add(tb._datas[key]["Name"], temp); } _resourceData.Add(kind, tempDic); }
public T GetObj <T>(eResourceKind kind, string name) where T : class { if (_resourceData.ContainsKey(kind)) { if (_resourceData[kind].ContainsKey(name)) { object obj = _resourceData[kind][name]; return((T)Convert.ChangeType(obj, typeof(T))); } else { Debug.LogWarning("Key is not exist / name : " + name); } } else { Debug.LogWarning("Key is not exist / kind : " + kind.ToString()); } return(null); }