Пример #1
0
    /// <summary>
    /// 更新用户状态
    /// </summary>
    void UpdateClientStatus()
    {
        curPlayer = host.GetClientCount();
        Queue <int> loginClient      = host.GetLoginClient();
        bool        updatePlayerInfo = false;

        while (loginClient.Count > 0)
        {
            OnClientLogin(loginClient.Dequeue());
            updatePlayerInfo = true;
        }
        Queue <int> logoutClient = host.GetLogOutClient();

        while (logoutClient.Count > 0)
        {
            OnClientLogOut(logoutClient.Dequeue());
            updatePlayerInfo = true;
        }
        if (updatePlayerInfo)
        {
            OnClientChange(curPlayer);
        }
    }