示例#1
0
    static AsyncMsgInfoBase GetMsgInfo <T, U, V>(string eventType, T arg1, U arg2, V arg3)
    {
        Delegate d;

        if (m_eventListenTable.TryGetValue(eventType, out d))
        {
            Callback <T, U, V> callback = d as Callback <T, U, V>;
            if (callback != null)
            {
                AsyncMsgInfo <T, U, V> info = GetFromPool(eventType) as AsyncMsgInfo <T, U, V>;
                if (info == null)
                {
                    info = new AsyncMsgInfo <T, U, V>(eventType);
                }
                info.SetParam(callback, arg1, arg2, arg3);

                return(info);
            }
        }

        return(null);
    }
示例#2
0
    static private Dictionary <string, AsyncMsgInfoBase> m_eventTypeList_Pool = new Dictionary <string, AsyncMsgInfoBase>();    // 缓存池,每个事件都缓存

    // 得到一个对象
    static AsyncMsgInfoBase GetMsgInfo(string eventType)
    {
        Delegate d;

        if (m_eventListenTable.TryGetValue(eventType, out d))
        {
            Callback callback = d as Callback;

            if (callback != null)
            {
                AsyncMsgInfo info = GetFromPool(eventType) as AsyncMsgInfo;
                if (info == null)
                {
                    info = new AsyncMsgInfo(eventType);
                }
                info.SetParam(callback);

                return(info);
            }
        }

        return(null);
    }