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();
     }
 }
Beispiel #2
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));
 }
Beispiel #3
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));
    }
Beispiel #4
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);
    }
Beispiel #5
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();
 }
Beispiel #7
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);
     }
 }
Beispiel #8
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);
     }
 }
Beispiel #9
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);
        }
    }
Beispiel #10
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);
         }
     }
 }
Beispiel #11
0
    private string OnRecentPlayerDropdownText(object val)
    {
        BnetPlayer friend = (BnetPlayer)val;

        return(FriendUtils.GetUniqueName(friend));
    }