public void ReturnObj(string path, UnityEngine.Object obj)
    {
        ObjectPool pool = null;

        if (objectPoolDic.ContainsKey(path))
        {
            pool = objectPoolDic[path];
            pool.ReturnObject(obj);
        }
        else
        {
            Logx.LogWarning("ObjectPoolGroup : GetObject : the path is not found : " + path);
        }
    }
    public void ReturnObject <T>(string path, T obj) where T : UnityEngine.Object
    {
        var             type  = typeof(T);
        ObjectPoolGroup group = null;

        if (objectPoolGroupDic.ContainsKey(type))
        {
            group = objectPoolGroupDic[type];
            group.ReturnObj(path, obj);
        }
        else
        {
            Logx.LogWarning("the type is not found : " + type.ToString());
        }
    }
    internal void ReturnObject(UnityEngine.Object obj)
    {
        var isGo  = obj is GameObject;
        var insId = obj.GetInstanceID();

        if (isGo)
        {
            if (objectDic.ContainsKey(insId))
            {
                var findObj = objectDic[insId];
                findObj.Return();
            }
            else
            {
                Logx.LogWarning("the insId is not found : " + insId);
            }
        }
    }
Esempio n. 4
0
    //No parameters

    static public void Broadcast(int eventType)
    {
        OnBroadcasting(eventType);

        Delegate d;

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

            if (callback != null)
            {
                callback();
            }
            else
            {
                //throw CreateBroadcastSignatureException(eventType);
                Logx.LogWarning("the event hasnt listener : " + eventType);
            }
        }
    }
    void OnConnectCallback(IAsyncResult ar)
    {
        var s = (Socket)ar.AsyncState;

        Logx.Log("net", "OnConnectCallback : on connect : " + s.Connected);
        if (s.Connected)
        {
            netState = NetState.Connect;
            s.EndConnect(ar);

            s.BeginReceive(buffer, 0, buffer.Length, SocketFlags.None, new AsyncCallback(OnReceiveCallback), s);
        }
        else
        {
            Logx.LogWarning("OnConnectCallback : the socket connect fail");
        }
        //heartBeatService.Start();
        bool isSuccessConnect = netSocket.Connected;

        connectAction?.Invoke(isSuccessConnect);
    }