internal void InternalConnectLocalServer(bool generateConnectMsg)
        {
            if (m_FreeMessages == null)
            {
                m_FreeMessages = new Stack <InternalMsg>();
                for (int i = 0; i < k_InitialFreeMessagePoolSize; i++)
                {
                    InternalMsg msg = new InternalMsg();
                    m_FreeMessages.Push(msg);
                }
            }

            m_LocalServer = NetworkServer.instance;
            m_Connection  = new ULocalConnectionToServer(m_LocalServer);
            SetHandlers(m_Connection);
            m_Connection.connectionId = m_LocalServer.AddLocalClient(this);
            m_AsyncConnect            = ConnectState.Connected;

            SetActive(true);
            RegisterSystemHandlers(true);

            if (generateConnectMsg)
            {
                PostInternalMessage(MsgType.Connect);
            }
            m_Connected = true;
        }
        internal void InternalConnectLocalServer(bool generateConnectMsg)
        {
            m_Connection = new ULocalConnectionToServer();
            SetHandlers(m_Connection);
            m_Connection.connectionId = NetworkServer.AddLocalClient(this);
            m_AsyncConnect            = ConnectState.Connected;

            SetActive(true);
            RegisterSystemHandlers(true);

            if (generateConnectMsg)
            {
                PostInternalMessage((short)MsgType.Connect);
            }
            m_Connected = true;
        }
示例#3
0
 internal void InternalConnectLocalServer()
 {
     if (m_FreeMessages == null)
     {
         m_FreeMessages = new Stack <InternalMsg>();
         for (int i = 0; i < 64; i++)
         {
             m_FreeMessages.Push(default(InternalMsg));
         }
     }
     m_LocalServer = NetworkServer.instance;
     m_Connection  = new ULocalConnectionToServer(m_LocalServer);
     SetHandlers(m_Connection);
     m_Connection.connectionId = m_LocalServer.AddLocalClient(this);
     m_AsyncConnect            = ConnectState.Connected;
     NetworkClient.SetActive(state: true);
     RegisterSystemHandlers(localClient: true);
     PostInternalMessage(32);
     m_Connected = true;
 }