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);
    }
Ejemplo n.º 2
0
    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);
    }
Ejemplo n.º 3
0
    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);
    }