Ejemplo n.º 1
0
        public virtual void OnMemberJoined(LobbyMemberData member)
        {
            Users.Add(member.Username, CreateMemberView(member));

            UpdateStartGameButton();
            UpdatePlayerCount();
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Creates user view from the date given
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        protected virtual LobbyUserUi CreateMemberView(LobbyMemberData data)
        {
            // Get team
            var team = Teams[data.Team];

            // Get user view
            var user = UsersPool.GetResource();

            user.Reset();
            user.gameObject.SetActive(true);
            user.Setup(data);
            user.IsCurrentPlayer = data.Username == CurrentUser;

            // Add user to team
            user.transform.SetParent(team.UsersLayoutGroup.transform, false);
            user.transform.SetAsLastSibling();

            // Set ready status from data
            if (data.Username == CurrentUser)
            {
                IsReady = data.IsReady;
            }

            user.SetReadyStatusVisibility(AreUserReadyStatesVisible());

            // Generate username text
            user.Username.text = GenerateUsernameText(user);

            return(user);
        }
Ejemplo n.º 3
0
        public virtual void OnMemberLeft(LobbyMemberData member)
        {
            LobbyUserUi user;

            Users.TryGetValue(member.Username, out user);

            if (user == null)
            {
                return;
            }

            Users.Remove(member.Username);

            UsersPool.Store(user);

            UpdateStartGameButton();
            UpdatePlayerCount();
        }
Ejemplo n.º 4
0
        public virtual void OnMemberReadyStatusChanged(LobbyMemberData member, bool isReady)
        {
            LobbyUserUi user;

            Users.TryGetValue(member.Username, out user);

            if (user == null)
            {
                return;
            }

            user.SetReady(isReady);

            if (member.Username == CurrentUser)
            {
                IsReady = isReady;
                UpdateReadyButton();
            }

            UpdateStartGameButton();
        }
Ejemplo n.º 5
0
        public virtual void OnMemberTeamChanged(LobbyMemberData member, LobbyTeamData team)
        {
            LobbyUserUi user;

            Users.TryGetValue(member.Username, out user);

            if (user == null)
            {
                return;
            }

            // Player changed teams
            var newTeam = Teams[team.Name];

            user.transform.SetParent(newTeam.UsersLayoutGroup.transform, false);

            if (member.Username == CurrentUser)
            {
                UpdateReadyButton();
            }

            UpdateTeamJoinButtons();
            UpdateStartGameButton();
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Sets up the view from the data given
 /// </summary>
 /// <param name="data"></param>
 public void Setup(LobbyMemberData data)
 {
     RawData       = data;
     Username.text = data.Username;
     SetReady(data.IsReady);
 }
Ejemplo n.º 7
0
 public virtual void OnMemberPropertyChanged(LobbyMemberData member, string property, string value)
 {
 }