Beispiel #1
0
    /// <summary>
    /// 获取一个对象池
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="name"></param>
    /// <returns></returns>
    public ISGGamePool <T> GetPoolControl <T>(string name)
    {
        ISGGamePool <T> t = default(ISGGamePool <T>);

        if (m_ControlPool.ContainsKey(name))
        {
            t = m_ControlPool[name] as ISGGamePool <T>;
        }

        return(t);
    }
Beispiel #2
0
    /// <summary>
    /// 压入一个对象池
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="t"></param>
    /// <param name="isChange">是否强制更换</param>
    public void PushControl <T>(ISGGamePool <T> t, bool isChange = false)
    {
        if (m_ControlPool.ContainsKey(t.PoolName))
        {
            if (!isChange)
            {
                Debug.LogWarningFormat("the pool:{0} had in dic.", t.PoolName);
                return;
            }

            RemovePool <T>(t.PoolName);
            m_ControlPool.Add(t.PoolName, t);
        }
        else
        {
            m_ControlPool.Add(t.PoolName, t);
        }
    }