Ejemplo n.º 1
0
 protected void UpdateOnlineStatus()
 {
     if (this.m_player.IsAway())
     {
         this.m_StatusText.Text = FriendUtils.GetAwayTimeString(this.m_player.GetBestAwayTimeMicrosec());
     }
     else if (this.m_player.IsBusy())
     {
         this.m_StatusText.Text = GameStrings.Get("GLOBAL_FRIENDLIST_BUSYSTATUS");
     }
     else
     {
         string statusText = PresenceMgr.Get().GetStatusText(this.m_player);
         if (statusText != null)
         {
             this.m_StatusText.Text = statusText;
         }
         else
         {
             BnetProgramId bestProgramId = this.m_player.GetBestProgramId();
             if (bestProgramId != null)
             {
                 this.m_StatusText.Text = BnetProgramId.GetName(bestProgramId);
             }
             else
             {
                 this.m_StatusText.Text = string.Empty;
             }
         }
     }
 }
Ejemplo n.º 2
0
        public async Task <GetUserResponse> Handle(GetUserRequest request, CancellationToken cancellationToken)
        {
            string currentUserId = httpContextReader.CurrentUserId;

            var user = await userService.GetUser(request.UserId, currentUserId);

            var userToReturn = !await rolesService.IsPermitted(currentUserId, RoleName.Admin)
                ? (UserDtoBase)mapper.Map <UserDto>(user)
                : mapper.Map <UserAdminDto>(user);

            if (user != null)
            {
                userToReturn = FriendUtils.SetFriendProperties(userToReturn, user, currentUserId);

                user.SortPosts();

                var userGroups = user.Groups.Concat(user.GroupMembers.Where(m => m.IsAccepted).Select(m => m.Group))
                                 .ToList();

                GroupUtils.SetGroupMemberParams(userToReturn.Groups.ToList(), userGroups, currentUserId);

                return(new GetUserResponse {
                    User = userToReturn
                });
            }

            throw new CrudException("User cannot be loaded");
        }
Ejemplo n.º 3
0
    public virtual void UpdateRecruit()
    {
        if ((base.gameObject != null) && base.gameObject.activeSelf)
        {
            this.m_RecruitUI.SetInfo(this.m_recruitInfo);
            if (this.m_recruitInfo != null)
            {
                this.m_PlayerNameText.Text = this.m_recruitInfo.Nickname;
                switch (this.m_recruitInfo.Status)
                {
                case 1:
                {
                    string requestElapsedTimeString = FriendUtils.GetRequestElapsedTimeString(this.m_recruitInfo.CreationTimeMicrosec);
                    this.m_StatusText.Text = string.Format("Invintation sent {0}", requestElapsedTimeString);
                    break;
                }

                case 2:
                    this.m_StatusText.Text = "Account ineligible!";
                    break;

                case 3:
                    this.m_StatusText.Text = "Invitation declined!";
                    break;

                case 4:
                    this.m_StatusText.Text = "Accepted";
                    break;
                }
            }
            this.UpdateLayout();
        }
    }
    private void UpdateTimeText()
    {
        string requestElapsedTimeString = FriendUtils.GetRequestElapsedTimeString(this.m_invite.GetCreationTimeMicrosec());

        object[] args = new object[] { requestElapsedTimeString };
        this.m_TimeText.Text = GameStrings.Format("GLOBAL_FRIENDLIST_REQUEST_SENT_TIME", args);
    }
 public override void UpdateFriend()
 {
     if (base.gameObject.activeSelf && (base.m_player != null))
     {
         base.UpdateFriend();
         base.m_PlayerIcon.UpdateIcon();
         if (base.m_player.IsOnline())
         {
             base.m_PlayerNameText.Text = FriendUtils.GetFriendListName(base.m_player, true);
             base.UpdateOnlineStatus();
         }
         else
         {
             base.m_PlayerNameText.Text = FriendUtils.GetFriendListName(base.m_player, true);
             base.UpdateOfflineStatus();
         }
         base.m_recruitInfo = RecruitListMgr.Get().GetRecruitInfoFromAccountId(base.m_player.GetAccountId());
         base.m_RecruitUI.SetInfo(base.m_recruitInfo);
         if (base.m_recruitInfo != null)
         {
             base.m_RecruitUI.m_recruitText.TextColor = base.m_PlayerNameText.TextColor;
         }
         this.m_ChallengeButton.UpdateButton();
         this.UpdateLayout();
     }
 }
 public static void OnPlayerChallengeButtonPressed(FriendListChallengeButton challengeButton, BnetPlayer player)
 {
     SoundManager.Get().LoadAndPlay("Small_Click");
     if (ChatMgr.Get().FriendListFrame.IsInEditMode)
     {
         ChatMgr.Get().FriendListFrame.ShowRemoveFriendPopup(player);
     }
     else
     {
         BnetGameAccountId hearthstoneGameAccountId = player.GetHearthstoneGameAccountId();
         SpectatorManager  manager = SpectatorManager.Get();
         if (manager.CanSpectate(player))
         {
             manager.SpectatePlayer(player);
         }
         else if (manager.IsSpectatingMe(hearthstoneGameAccountId))
         {
             AlertPopup.PopupInfo info = new AlertPopup.PopupInfo {
                 m_headerText = GameStrings.Get("GLOBAL_SPECTATOR_KICK_PROMPT_HEADER")
             };
             object[] args = new object[] { FriendUtils.GetUniqueName(player) };
             info.m_text             = GameStrings.Format("GLOBAL_SPECTATOR_KICK_PROMPT_TEXT", args);
             info.m_showAlertIcon    = true;
             info.m_responseDisplay  = AlertPopup.ResponseDisplay.CONFIRM_CANCEL;
             info.m_responseCallback = new AlertPopup.ResponseCallback(FriendListFriendFrame.OnKickSpectatorDialogResponse);
             info.m_responseUserData = player;
             DialogManager.Get().ShowPopup(info);
         }
         else if (manager.CanInviteToSpectateMyGame(hearthstoneGameAccountId))
         {
             manager.InviteToSpectateMe(player);
         }
         else if (manager.IsSpectatingPlayer(hearthstoneGameAccountId))
         {
             if ((GameMgr.Get().IsFindingGame() || SceneMgr.Get().IsTransitioning()) || GameMgr.Get().IsTransitionPopupShown())
             {
                 return;
             }
             AlertPopup.PopupInfo info2 = new AlertPopup.PopupInfo {
                 m_headerText       = GameStrings.Get("GLOBAL_SPECTATOR_LEAVE_PROMPT_HEADER"),
                 m_text             = GameStrings.Get("GLOBAL_SPECTATOR_LEAVE_PROMPT_TEXT"),
                 m_showAlertIcon    = true,
                 m_responseDisplay  = AlertPopup.ResponseDisplay.CONFIRM_CANCEL,
                 m_responseCallback = new AlertPopup.ResponseCallback(FriendListFriendFrame.OnLeaveSpectatingDialogResponse)
             };
             DialogManager.Get().ShowPopup(info2);
         }
         else if (!manager.IsInvitedToSpectateMyGame(hearthstoneGameAccountId) && challengeButton.CanChallenge())
         {
             FriendChallengeMgr.Get().SendChallenge(player);
         }
         else
         {
             return;
         }
         challengeButton.UpdateButton();
         ChatMgr.Get().CloseChatUI();
     }
 }
 public override void UpdateFriend()
 {
     if (base.gameObject.activeSelf && (base.m_player != null))
     {
         base.UpdateFriend();
         base.m_PlayerIcon.m_OnlinePortrait.SetProgramId(BnetProgramId.HEARTHSTONE);
         base.m_PlayerNameText.Text = FriendUtils.GetFriendListName(base.m_player, true);
         base.UpdateOnlineStatus();
     }
 }
Ejemplo n.º 8
0
 private void ShowISentChallengeDialog(BnetPlayer challengee)
 {
     AlertPopup.PopupInfo info = new AlertPopup.PopupInfo {
         m_headerText = GameStrings.Get("GLOBAL_FRIEND_CHALLENGE_HEADER")
     };
     object[] args = new object[] { FriendUtils.GetUniqueName(challengee) };
     info.m_text             = GameStrings.Format("GLOBAL_FRIEND_CHALLENGE_OPPONENT_WAITING_RESPONSE", args);
     info.m_showAlertIcon    = false;
     info.m_responseDisplay  = AlertPopup.ResponseDisplay.NONE;
     info.m_responseCallback = new AlertPopup.ResponseCallback(this.OnChallengeSentDialogResponse);
     DialogManager.Get().ShowPopup(info, new DialogManager.DialogProcessCallback(this.OnChallengeSentDialogProcessed));
 }
Ejemplo n.º 9
0
    private void ShowFriendChallengeWaitingForOpponentDialog(string dialogText, AlertPopup.ResponseCallback callback)
    {
        BnetPlayer myOpponent = FriendChallengeMgr.Get().GetMyOpponent();

        AlertPopup.PopupInfo info = new AlertPopup.PopupInfo();
        object[]             args = new object[] { FriendUtils.GetUniqueName(myOpponent) };
        info.m_text             = GameStrings.Format(dialogText, args);
        info.m_showAlertIcon    = false;
        info.m_responseDisplay  = AlertPopup.ResponseDisplay.CANCEL;
        info.m_responseCallback = callback;
        DialogManager.Get().ShowPopup(info, new DialogManager.DialogProcessCallback(this.OnFriendChallengeWaitingForOpponentDialogProcessed));
    }
Ejemplo n.º 10
0
    public void SetInfo(Info info)
    {
        string key = "GLOBAL_FRIEND_CHALLENGE_BODY1";

        if (FriendChallengeMgr.Get().IsChallengeTavernBrawl())
        {
            key = "GLOBAL_FRIEND_CHALLENGE_TAVERN_BRAWL_BODY1";
        }
        this.m_challengeText1.Text = GameStrings.Get(key);
        this.m_challengeText2.Text = GameStrings.Get("GLOBAL_FRIEND_CHALLENGE_BODY2");
        this.m_challengerName.Text = FriendUtils.GetUniqueName(info.m_challenger);
        this.m_responseCallback    = info.m_callback;
        bool flag = BnetNearbyPlayerMgr.Get().IsNearbyStranger(info.m_challenger);

        this.m_nearbyPlayerNote.gameObject.SetActive(flag);
    }
Ejemplo n.º 11
0
 private void ShowOpponentRemovedFromFriendsDialog(BnetPlayer otherPlayer)
 {
     if (this.m_challengeDialog != null)
     {
         this.m_challengeDialog.Hide();
         this.m_challengeDialog = null;
     }
     AlertPopup.PopupInfo info = new AlertPopup.PopupInfo {
         m_headerText = GameStrings.Get("GLOBAL_FRIEND_CHALLENGE_HEADER")
     };
     object[] args = new object[] { FriendUtils.GetUniqueName(otherPlayer) };
     info.m_text            = GameStrings.Format("GLOBAL_FRIEND_CHALLENGE_OPPONENT_FRIEND_REMOVED", args);
     info.m_showAlertIcon   = false;
     info.m_responseDisplay = AlertPopup.ResponseDisplay.OK;
     DialogManager.Get().ShowPopup(info);
 }
 public void SetPlayer(BnetPlayer player)
 {
     this.m_player = player;
     if (player == null)
     {
         this.m_usePlayer         = false;
         this.m_playerDisplayName = null;
     }
     else
     {
         this.m_usePlayer         = true;
         this.m_playerDisplayName = FriendUtils.GetUniqueName(this.m_player);
     }
     this.m_inputText           = this.m_playerDisplayName;
     this.m_InputTextField.Text = this.m_inputText;
     this.UpdateInstructions();
 }
Ejemplo n.º 13
0
 private void ShowOpponentDeclinedChallengeDialog(BnetPlayer challengee)
 {
     if (this.m_challengeDialog != null)
     {
         this.m_challengeDialog.Hide();
         this.m_challengeDialog = null;
     }
     if (!this.m_hasSeenDeclinedReason)
     {
         AlertPopup.PopupInfo info = new AlertPopup.PopupInfo {
             m_headerText = GameStrings.Get("GLOBAL_FRIEND_CHALLENGE_HEADER")
         };
         object[] args = new object[] { FriendUtils.GetUniqueName(challengee) };
         info.m_text            = GameStrings.Format("GLOBAL_FRIEND_CHALLENGE_OPPONENT_DECLINED", args);
         info.m_showAlertIcon   = false;
         info.m_responseDisplay = AlertPopup.ResponseDisplay.OK;
         DialogManager.Get().ShowPopup(info);
     }
 }
Ejemplo n.º 14
0
 private void ShowOpponentCanceledChallengeDialog(BnetPlayer otherPlayer)
 {
     if (this.m_challengeDialog != null)
     {
         this.m_challengeDialog.Hide();
         this.m_challengeDialog = null;
     }
     if ((((SceneMgr.Get() == null) || !SceneMgr.Get().IsInGame()) || ((GameState.Get() == null) || GameState.Get().IsGameOverNowOrPending())) || (((GameState.Get().GetOpposingSidePlayer() == null) || (GameState.Get().GetOpposingSidePlayer().GetBnetPlayer() == null)) || ((otherPlayer == null) || (otherPlayer.GetHearthstoneGameAccountId() != GameState.Get().GetOpposingSidePlayer().GetBnetPlayer().GetHearthstoneGameAccountId()))))
     {
         AlertPopup.PopupInfo info = new AlertPopup.PopupInfo {
             m_headerText = GameStrings.Get("GLOBAL_FRIEND_CHALLENGE_HEADER")
         };
         object[] args = new object[] { FriendUtils.GetUniqueName(otherPlayer) };
         info.m_text            = GameStrings.Format("GLOBAL_FRIEND_CHALLENGE_OPPONENT_CANCELED", args);
         info.m_showAlertIcon   = false;
         info.m_responseDisplay = AlertPopup.ResponseDisplay.OK;
         DialogManager.Get().ShowPopup(info);
     }
 }
Ejemplo n.º 15
0
    private void TavernBrawl_ReceivedChallenge_OnEnsureServerDataReady_OnDeckContentsReady(long deckId)
    {
        CollectionManager.Get().RemoveDeckContentsListener(new CollectionManager.DelOnDeckContents(this.TavernBrawl_ReceivedChallenge_OnEnsureServerDataReady_OnDeckContentsReady));
        TavernBrawlMission mission  = TavernBrawlManager.Get().CurrentMission();
        string             key      = null;
        DeclineReason?     nullable = null;

        if (mission == null)
        {
            nullable = 0;
        }
        if (((mission != null) && mission.canCreateDeck) && !TavernBrawlManager.Get().HasValidDeck())
        {
            nullable = 2;
            key      = "GLOBAL_FRIEND_CHALLENGE_TAVERN_BRAWL_RECIPIENT_NO_VALID_DECK_RECIPIENT";
        }
        if (key != null)
        {
            AlertPopup.PopupInfo info = new AlertPopup.PopupInfo {
                m_headerText = GameStrings.Get("GLOBAL_FRIEND_CHALLENGE_TAVERN_BRAWL_HEADER")
            };
            object[] args = new object[] { FriendUtils.GetUniqueName(this.m_challenger) };
            info.m_text            = GameStrings.Format(key, args);
            info.m_responseDisplay = AlertPopup.ResponseDisplay.OK;
            DialogManager.Get().ShowPopup(info);
        }
        if (nullable.HasValue)
        {
            BnetParty.SetPartyAttributeLong(this.m_partyId, "WTCG.Friendly.DeclineReason", (long)nullable.Value);
            this.DeclineChallenge();
        }
        else
        {
            if (this.IsChallengeTavernBrawl())
            {
                Enum[] enumArray1 = new Enum[] { PresenceStatus.TAVERN_BRAWL_FRIENDLY_WAITING };
                PresenceMgr.Get().SetStatus(enumArray1);
            }
            this.ShowIReceivedChallengeDialog(this.m_challenger);
        }
    }
Ejemplo n.º 16
0
 private void UpdateLastMessage()
 {
     if (this.m_chatLogFrame != null)
     {
         this.HideLastMessage();
     }
     else
     {
         BnetWhisper whisper = this.FindLastWhisperFromReceiver();
         if (whisper == null)
         {
             this.HideLastMessage();
         }
         else
         {
             this.m_LastMessageText.gameObject.SetActive(true);
             this.m_LastMessageText.Text = ChatUtils.GetMessage(whisper);
             TransformUtil.SetPoint((Component)this.m_LastMessageText, Anchor.BOTTOM_LEFT, (Component)this.m_Bones.m_LastMessage, Anchor.TOP_LEFT);
             this.m_ReceiverNameText.gameObject.SetActive(true);
             if (this.m_receiver.IsOnline())
             {
                 this.m_ReceiverNameText.TextColor = GameColors.PLAYER_NAME_ONLINE;
             }
             else
             {
                 this.m_ReceiverNameText.TextColor = GameColors.PLAYER_NAME_OFFLINE;
             }
             this.m_ReceiverNameText.Text = FriendUtils.GetUniqueName(this.m_receiver);
             TransformUtil.SetPoint((Component)this.m_ReceiverNameText, Anchor.BOTTOM_LEFT, (Component)this.m_LastMessageText, Anchor.TOP_LEFT);
             this.m_LastMessageShadow.SetActive(true);
             Bounds textWorldSpaceBounds = this.m_LastMessageText.GetTextWorldSpaceBounds();
             Bounds bounds2 = this.m_ReceiverNameText.GetTextWorldSpaceBounds();
             float  num     = Mathf.Max(textWorldSpaceBounds.max.y, bounds2.max.y);
             float  num2    = Mathf.Min(textWorldSpaceBounds.min.y, bounds2.min.y);
             float  num3    = num - num2;
             float  z       = (num3 * this.m_initialLastMessageShadowScaleZ) / this.m_initialLastMessageTextHeight;
             TransformUtil.SetLocalScaleZ(this.m_LastMessageShadow, z);
         }
     }
 }
Ejemplo n.º 17
0
        public async Task <GetUsersPaginationResponse> Handle(GetUsersPaginationRequest request,
                                                              CancellationToken cancellationToken)
        {
            string currentUserId = httpContextService.CurrentUserId;

            request.UserId = currentUserId;

            var users = await userService.GetUsers(request) as PagedList <Domain.Entities.Auth.User>;

            httpContextService.AddPagination(users.CurrentPage, users.PageSize, users.TotalCount, users.TotalPages);

            var usersToReturn = mapper.Map <List <UserDto> >(users);

            for (int i = 0; i < users.Count; i++)
            {
                usersToReturn[i] = (UserDto)FriendUtils.SetFriendProperties(usersToReturn[i], users[i], currentUserId);
            }

            return(new GetUsersPaginationResponse {
                Users = usersToReturn
            });
        }
 public virtual void UpdateNearbyPlayer()
 {
     if (base.gameObject.activeSelf)
     {
         if (this.m_player == null)
         {
             this.m_PlayerNameText.Text = string.Empty;
         }
         else
         {
             BnetPlayer friend = BnetFriendMgr.Get().FindFriend(this.m_player.GetAccountId());
             if (friend != null)
             {
                 this.m_PlayerNameText.Text = FriendUtils.GetFriendListName(friend, true);
             }
             else
             {
                 this.m_PlayerNameText.Text = FriendUtils.GetFriendListName(this.m_player, true);
             }
         }
         this.m_ChallengeButton.UpdateButton();
         this.UpdateLayout();
     }
 }
 private void UpdateReceiver()
 {
     this.m_playerIcon.UpdateIcon();
     this.m_NameText.Text = FriendUtils.GetUniqueNameWithColor(this.m_receiver);
 }
Ejemplo n.º 20
0
    private string OnRecentPlayerDropdownText(object val)
    {
        BnetPlayer friend = (BnetPlayer)val;

        return(FriendUtils.GetUniqueName(friend));
    }
Ejemplo n.º 21
0
 public static bool IsValidRecruitInput(string email)
 {
     return(FriendUtils.IsValidEmail(email) || true);
 }
Ejemplo n.º 22
0
    protected void UpdateOfflineStatus()
    {
        ulong bestLastOnlineMicrosec = this.m_player.GetBestLastOnlineMicrosec();

        this.m_StatusText.Text = FriendUtils.GetLastOnlineElapsedTimeString(bestLastOnlineMicrosec);
    }