IsJoined() public method

public IsJoined ( ) : bool
return bool
コード例 #1
0
        /// <summary>
        ///  Join the specified session.
        /// </summary>
        /// <param name="session">Session to join.</param>
        /// <returns>True if the session is being joined or is already joined.</returns>
        public bool JoinSession(Session session)
        {
            // TODO Should prevent joining multiple sessions at the same time
            if (session != null)
            {
                return(session.IsJoined() || session.Join());
            }

            return(false);
        }
コード例 #2
0
        private void OnUserLeftSession(Session session, User user)
        {
            if (!session.IsJoined())
            {
                return;
            }

            if (CurrentUsers.RemoveAll(x => x.GetID() == user.GetID()) > 0)
            {
                //Debug.LogFormat("User {0} left current session.", user.GetName());
                UserLeft.RaiseEvent(user);
            }
        }
コード例 #3
0
        private void OnUserJoinedSession(Session session, User user)
        {
            if (!session.IsJoined())
            {
                return;
            }

            if (!CurrentUsers.Contains(user))
            {
                //Debug.LogFormat("User {0} joined current session.", user.GetName());
                CurrentUsers.RemoveAll(x => x.GetID() == user.GetID());                 // in case there was an old user with the same ID
                CurrentUsers.Add(user);
                UserJoined.RaiseEvent(user);
            }
        }
コード例 #4
0
        private void OnUserLeftSession(Session session, User user)
        {
            if (!session.IsJoined())
            {
                return;
            }

            for (int i = CurrentUsers.Count - 1; i >= 0; i--)
            {
                if (CurrentUsers[i].GetID() == user.GetID())
                {
                    CurrentUsers.RemoveAt(i);
                    UserLeft.RaiseEvent(user);
                    // Debug.LogFormat("User {0} left current session.", user.GetName());
                }
            }
        }
コード例 #5
0
        private void OnUserJoinedSession(Session session, User user)
        {
            if (!session.IsJoined())
            {
                return;
            }

            if (!CurrentUsers.Contains(user))
            {
                // Remove any old users with the same ID
                for (int i = CurrentUsers.Count - 1; i >= 0; i--)
                {
                    if (CurrentUsers[i].GetID() == user.GetID())
                    {
                        CurrentUsers.RemoveAt(i);
                    }
                }

                CurrentUsers.Add(user);
                UserJoined.RaiseEvent(user);
                // Debug.LogFormat("User {0} joined current session.", user.GetName());
            }
        }