Exemple #1
0
    public void ServerSignalNotification(int node, NetEventState state)
    {
        string str = "Node:" + node + " type:" + state.type.ToString() + " State:" + state.ToString();

        Debug.Log("ServerSignalNotification called");
        Debug.Log(str);

        switch (state.type)
        {
        case NetEventType.Connect: {
            NodeInfo info = new NodeInfo();
            info.node = node;
            m_nodes.Add(node, info);
            if (m_handler != null)
            {
                m_handler(node, state);
            }
        }       break;

        case NetEventType.Disconnect: {
            if (m_handler != null)
            {
                m_handler(node, state);
            }
            m_nodes.Remove(node);
        }       break;
        }
    }
Exemple #2
0
    //
    public virtual void OnEventHandling(ITransport itransport, NetEventState state)
    {
        int node = itransport.GetNodeId();

        string str = "SignalNotification[" + node + "] :" + state.type.ToString() + " state:" + state.ToString();

        Debug.Log(str);

        do
        {
            if (m_transports.ContainsKey(node) == false)
            {
                // 찾지 못했을 때.
                string msg = "NodeId[" + node + "] is not founded.";
                Debug.Log(msg);
                break;
            }

            switch (state.type)
            {
            case NetEventType.Connect:
                break;

            case NetEventType.Disconnect:
                LeaveSession(node);
                break;
            }
        } while (false);

        // 이벤트 통지 함수가 등록되어 있으면 콜백합니다.
        if (m_handler != null)
        {
            m_handler(node, state);
        }
    }