示例#1
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);
        }
示例#2
0
        /// <summary>
        ///     Creates the team view from the data given
        /// </summary>
        /// <param name="teamName"></param>
        /// <param name="teamProperties"></param>
        /// <returns></returns>
        protected virtual LobbyTeamUi CreateTeamView(string teamName,
                                                     LobbyTeamData data)
        {
            var teamView = TeamsPool.GetResource();

            teamView.Setup(teamName, data);
            teamView.gameObject.SetActive(true);
            teamView.transform.SetParent(TeamsLayoutGroup.transform, false);
            teamView.transform.SetAsLastSibling();

            return(teamView);
        }
示例#3
0
        protected virtual void OnLoadingStarted(EventsChannel.Promise promise, string message)
        {
            // Create an item
            var newItem = _pool.GetResource();

            newItem.Id           = promise.EventId;
            newItem.Message.text = message;

            // Move item to the list
            newItem.transform.SetParent(ItemsGroup.transform, false);
            newItem.transform.SetAsLastSibling();
            newItem.gameObject.SetActive(true);

            // Store the item
            _visibleLoadingItems.Add(newItem.Id, newItem);
        }