Exemple #1
0
 protected virtual void Awake()
 {
     BnetPresenceMgr.Get().AddPlayersChangedListener(new BnetPresenceMgr.PlayersChangedCallback(this.OnPlayersChanged));
     BnetWhisperMgr.Get().AddWhisperListener(new BnetWhisperMgr.WhisperCallback(this.OnWhisper));
     ChatMgr.Get().AddPlayerChatInfoChangedListener(new ChatMgr.PlayerChatInfoChangedCallback(this.OnPlayerChatInfoChanged));
     RecruitListMgr.Get().AddRecruitsChangedListener(new RecruitListMgr.RecruitsChangedCallback(this.OnRecruitsChanged));
     this.m_RecruitUI = UnityEngine.Object.Instantiate <FriendListRecruitUI>(this.m_Prefabs.recruitUI);
     this.m_RecruitUI.transform.parent = base.gameObject.transform;
     this.m_RecruitUI.gameObject.SetActive(false);
     if (this.m_rankMedalSpawner == null)
     {
         this.m_rankMedal = UnityEngine.Object.Instantiate <TournamentMedal>(this.m_rankMedalPrefab);
         this.m_rankMedal.transform.parent        = base.transform;
         this.m_rankMedal.transform.localScale    = new Vector3(20f, 1f, 20f);
         this.m_rankMedal.transform.localRotation = Quaternion.Euler(new Vector3(-90f, 0f, 0f));
     }
     else
     {
         this.m_rankMedal = this.m_rankMedalSpawner.Spawn <TournamentMedal>();
     }
     this.m_rankMedal.RemoveEventListener(UIEventType.ROLLOVER, new UIEvent.Handler(this.m_rankMedal.MedalOver));
     this.m_rankMedal.AddEventListener(UIEventType.ROLLOVER, new UIEvent.Handler(this.RankMedalOver));
     if (UniversalInputManager.UsePhoneUI != null)
     {
         this.m_rankMedal.GetComponent <Collider>().enabled = false;
     }
     this.m_rankMedal.gameObject.SetActive(false);
     SceneUtils.SetLayer(this.m_rankMedal, GameLayer.BattleNetFriendList);
 }
 public void UpdateIcon()
 {
     if (this.m_player == null)
     {
         base.gameObject.SetActive(false);
     }
     else
     {
         List <BnetWhisper> whispersWithPlayer = BnetWhisperMgr.Get().GetWhispersWithPlayer(this.m_player);
         if (whispersWithPlayer == null)
         {
             base.gameObject.SetActive(false);
         }
         else if (whispersWithPlayer[whispersWithPlayer.Count - 1].IsSpeaker(BnetPresenceMgr.Get().GetMyPlayer()))
         {
             base.gameObject.SetActive(false);
         }
         else
         {
             PlayerChatInfo playerChatInfo = ChatMgr.Get().GetPlayerChatInfo(this.m_player);
             if ((playerChatInfo != null) && (Enumerable.LastOrDefault <BnetWhisper>(whispersWithPlayer, (Func <BnetWhisper, bool>)(whisper => whisper.IsSpeaker(this.m_player))) == playerChatInfo.GetLastSeenWhisper()))
             {
                 base.gameObject.SetActive(false);
             }
             else
             {
                 base.gameObject.SetActive(true);
             }
         }
     }
 }
Exemple #3
0
 private void OnFramesMoved()
 {
     if (ChatMgr.Get() != null)
     {
         ChatMgr.Get().OnChatFramesMoved();
     }
 }
Exemple #4
0
 private void OnSceneLoaded(SceneMgr.Mode mode, Scene scene, object userData)
 {
     if (mode == SceneMgr.Mode.FATAL_ERROR)
     {
         ChatMgr.Get().CleanUp();
     }
 }
Exemple #5
0
 private void OnBnetEventOccurred(BattleNet.BnetEvent bnetEvent, object userData)
 {
     if (bnetEvent == BattleNet.BnetEvent.Disconnected)
     {
         ChatMgr.Get().CleanUp();
     }
 }
 private bool UpdateEditModeButtonState()
 {
     if (this.m_player == null)
     {
         base.gameObject.SetActive(false);
         return(true);
     }
     if (((ChatMgr.Get() != null) && (ChatMgr.Get().FriendListFrame != null)) && ChatMgr.Get().FriendListFrame.IsInEditMode)
     {
         base.gameObject.SetActive(true);
         this.m_AvailableIcon.SetActive(false);
         this.m_BusyIcon.SetActive(false);
         this.m_SpectatorIcon.gameObject.SetActive(false);
         this.m_TavernBrawlChallengeIcon.SetActive(false);
         this.m_TavernBrawlBusyIcon.SetActive(false);
         if (this.m_DeleteIcon != null)
         {
             this.m_DeleteIcon.SetActive(true);
         }
         return(true);
     }
     if (this.m_DeleteIcon != null)
     {
         this.m_DeleteIcon.SetActive(false);
     }
     return(false);
 }
Exemple #7
0
 private void OnInputComplete(string input)
 {
     if (!string.IsNullOrEmpty(input))
     {
         if (this.m_receiver.IsOnline())
         {
             BnetWhisperMgr.Get().SendWhisper(this.m_receiver, input);
             ChatMgr.Get().AddRecentWhisperPlayerToTop(this.m_receiver);
         }
         else if (ChatMgr.Get().IsChatLogFrameShown())
         {
             if (!BnetWhisperMgr.Get().SendWhisper(this.m_receiver, input))
             {
                 this.m_chatLogFrame.m_chatLog.OnWhisperFailed();
             }
             ChatMgr.Get().AddRecentWhisperPlayerToTop(this.m_receiver);
         }
         else
         {
             object[] args    = new object[] { this.m_receiver.GetBestName() };
             string   message = GameStrings.Format("GLOBAL_CHAT_RECEIVER_OFFLINE", args);
             UIStatus.Get().AddError(message);
         }
     }
     if (ChatMgr.Get().IsChatLogFrameShown())
     {
         this.ShowInput(false);
     }
     else
     {
         UnityEngine.Object.Destroy(base.gameObject);
     }
 }
 public virtual bool HandleKeyboardInput()
 {
     if ((BackButton.backKey != KeyCode.None) && Input.GetKeyUp(BackButton.backKey))
     {
         if (DialogManager.Get().ShowingDialog())
         {
             DialogManager.Get().GoBack();
             return(true);
         }
         if (ChatMgr.Get().IsFriendListShowing() || ChatMgr.Get().IsChatLogFrameShown())
         {
             ChatMgr.Get().GoBack();
             return(true);
         }
         if ((OptionsMenu.Get() != null) && OptionsMenu.Get().IsShown())
         {
             OptionsMenu.Get().Hide(true);
             return(true);
         }
         if ((GameMenu.Get() != null) && GameMenu.Get().IsShown())
         {
             GameMenu.Get().Hide();
             return(true);
         }
         if (Navigation.GoBack())
         {
             return(true);
         }
     }
     return(false);
 }
 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();
     }
 }
Exemple #10
0
 private void OnCloseButtonReleased()
 {
     ChatMgr.Get().CloseChatUI();
     if (UniversalInputManager.UsePhoneUI != null)
     {
         ChatMgr.Get().ShowFriendsList();
     }
 }
Exemple #11
0
    public bool HandleKeyboardInput()
    {
        if (Input.GetKeyUp(KeyCode.Escape))
        {
            return(this.HandleEscapeKey());
        }
        ChatMgr mgr = ChatMgr.Get();

        return((mgr != null) && mgr.HandleKeyboardInput());
    }
Exemple #12
0
 protected virtual void OnDestroy()
 {
     BnetPresenceMgr.Get().RemovePlayersChangedListener(new BnetPresenceMgr.PlayersChangedCallback(this.OnPlayersChanged));
     BnetWhisperMgr.Get().RemoveWhisperListener(new BnetWhisperMgr.WhisperCallback(this.OnWhisper));
     RecruitListMgr.Get().RemoveRecruitsChangedListener(new RecruitListMgr.RecruitsChangedCallback(this.OnRecruitsChanged));
     if (ChatMgr.Get() != null)
     {
         ChatMgr.Get().RemovePlayerChatInfoChangedListener(new ChatMgr.PlayerChatInfoChangedCallback(this.OnPlayerChatInfoChanged));
     }
 }
Exemple #13
0
 private void Start()
 {
     this.InitRecentPlayerDropdown();
     if (ChatMgr.Get().IsChatLogFrameShown())
     {
         this.ShowChatLogFrame();
     }
     this.UpdateReceiver();
     ChatMgr.Get().OnChatReceiverChanged(this.m_receiver);
 }
Exemple #14
0
    private bool HandleEscapeKey()
    {
        if ((this.m_gameMenu != null) && this.m_gameMenu.IsShown())
        {
            this.m_gameMenu.Hide();
            return(true);
        }
        if ((OptionsMenu.Get() != null) && OptionsMenu.Get().IsShown())
        {
            OptionsMenu.Get().Hide(true);
            return(true);
        }
        if ((QuestLog.Get() != null) && QuestLog.Get().IsShown())
        {
            QuestLog.Get().Hide();
            return(true);
        }
        if ((GeneralStore.Get() != null) && GeneralStore.Get().IsShown())
        {
            GeneralStore.Get().Close();
            return(true);
        }
        ChatMgr mgr = ChatMgr.Get();

        if ((mgr == null) || !mgr.HandleKeyboardInput())
        {
            if ((CraftingTray.Get() != null) && CraftingTray.Get().IsShown())
            {
                CraftingTray.Get().Hide();
                return(true);
            }
            SceneMgr.Mode mode = SceneMgr.Get().GetMode();
            switch (mode)
            {
            case SceneMgr.Mode.FATAL_ERROR:
                return(true);

            case SceneMgr.Mode.LOGIN:
                return(true);

            case SceneMgr.Mode.STARTUP:
                return(true);
            }
            if ((mode != SceneMgr.Mode.GAMEPLAY) && !DemoMgr.Get().IsHubEscMenuEnabled())
            {
                return(true);
            }
            if ((PlatformSettings.OS == OSCategory.Android) && (mode == SceneMgr.Mode.HUB))
            {
                return(false);
            }
            this.ToggleGameMenu();
        }
        return(true);
    }
 private void OnInputComplete(string input)
 {
     if (!string.IsNullOrEmpty(input))
     {
         if (!BnetWhisperMgr.Get().SendWhisper(this.receiver, input))
         {
             this.chatLog.OnWhisperFailed();
         }
         ChatMgr.Get().AddRecentWhisperPlayerToTop(this.receiver);
     }
 }
Exemple #16
0
    private void UpdateRecentPlayers()
    {
        this.m_recentPlayers.Clear();
        List <BnetPlayer> recentWhisperPlayers = ChatMgr.Get().GetRecentWhisperPlayers();

        for (int i = 0; i < recentWhisperPlayers.Count; i++)
        {
            BnetPlayer item = recentWhisperPlayers[i];
            this.m_recentPlayers.Add(item);
        }
    }
Exemple #17
0
 public void SetReceiver(BnetPlayer player)
 {
     UniversalInputManager.Get().FocusTextInput(base.gameObject);
     if (this.m_receiver != player)
     {
         this.m_receiver = player;
         this.UpdateReceiver();
         this.m_recentPlayerDropdown.setSelection(player);
         ChatMgr.Get().OnChatReceiverChanged(player);
     }
 }
 private void UpdateLayout()
 {
     this.m_BnetBar.UpdateLayout();
     if (ChatMgr.Get() != null)
     {
         ChatMgr.Get().UpdateLayout();
     }
     if (SplashScreen.Get() != null)
     {
         SplashScreen.Get().UpdateLayout();
     }
 }
Exemple #19
0
 private void UpdateDisplayInfo()
 {
     this.UpdateName();
     this.UpdateRank();
     if (this.IsBnetPlayer() && !this.IsLocalUser())
     {
         BnetPlayer player = BnetPresenceMgr.Get().GetPlayer(this.m_gameAccountId);
         if (BnetFriendMgr.Get().IsFriend(player))
         {
             ChatMgr.Get().AddRecentWhisperPlayerToBottom(player);
         }
     }
 }
Exemple #20
0
 private void OnChatLogButtonReleased(UIEvent e)
 {
     if (ChatMgr.Get().IsChatLogFrameShown())
     {
         this.HideChatLogFrame();
     }
     else
     {
         this.ShowChatLogFrame();
     }
     this.UpdateReceiver();
     UniversalInputManager.Get().FocusTextInput(base.gameObject);
 }
 private void HandleGUIInputInactive()
 {
     if (!this.m_inputActive)
     {
         if (this.m_inputIgnoreState != TextInputIgnoreState.INVALID)
         {
             if (this.m_inputIgnoreState == TextInputIgnoreState.NEXT_CALL)
             {
                 this.m_inputIgnoreState = TextInputIgnoreState.INVALID;
             }
         }
         else if (ChatMgr.Get() != null)
         {
             ChatMgr.Get().HandleGUIInput();
         }
     }
 }
Exemple #22
0
    private void ShowChatLogFrame()
    {
        this.m_chatLogFrame = UnityEngine.Object.Instantiate <ChatLogFrame>(this.m_Prefabs.m_ChatLogFrame);
        bool flag = base.transform.localScale == BaseUI.Get().m_Bones.m_QuickChatVirtualKeyboard.localScale;

        if ((((UniversalInputManager.Get().IsTouchMode() && W8Touch.s_isWindows8OrGreater) || W8Touch.Get().IsVirtualKeyboardVisible()) && flag) || flag)
        {
            this.DefaultChatTransform();
        }
        this.m_chatLogFrame.transform.parent   = base.transform;
        this.m_chatLogFrame.transform.position = this.m_Bones.m_ChatLog.position;
        if ((((UniversalInputManager.Get().IsTouchMode() && W8Touch.s_isWindows8OrGreater) || W8Touch.Get().IsVirtualKeyboardVisible()) && flag) || flag)
        {
            this.TransformChatForKeyboard();
        }
        ChatMgr.Get().OnChatLogFrameShown();
    }
Exemple #23
0
    private void Update()
    {
        bool flag = DialogManager.Get().ShowingDialog();

        if (flag != this.wasShowingDialog)
        {
            if (flag && this.chatLogFrame.HasFocus)
            {
                this.OnPopupOpened();
            }
            else if ((!flag && !ChatMgr.Get().FriendListFrame.ShowingAddFriendFrame) && !this.chatLogFrame.HasFocus)
            {
                this.OnPopupClosed();
            }
            this.wasShowingDialog = flag;
        }
    }
Exemple #24
0
 public void Back()
 {
     if (!DialogManager.Get().ShowingDialog())
     {
         if (ChatMgr.Get().FriendListFrame.ShowingAddFriendFrame)
         {
             ChatMgr.Get().FriendListFrame.CloseAddFriendFrame();
         }
         else if (this.Receiver != null)
         {
             this.Receiver = null;
         }
         else
         {
             ChatMgr.Get().CloseChatUI();
         }
     }
 }
Exemple #25
0
 private void HideChatLogFrame()
 {
     UnityEngine.Object.Destroy(this.m_chatLogFrame.gameObject);
     this.m_chatLogFrame = null;
     ChatMgr.Get().OnChatLogFrameHidden();
 }
Exemple #26
0
 public void ShowFriendList()
 {
     ChatMgr.Get().ShowFriendsList();
     this.m_hasUnacknowledgedPendingInvites = false;
     this.m_friendButton.ShowPendingInvitesIcon(this.m_hasUnacknowledgedPendingInvites);
 }
Exemple #27
0
 public void HideFriendList()
 {
     ChatMgr.Get().CloseChatUI();
 }
 private bool IsFullScreenKeyboard()
 {
     return(ChatMgr.Get().KeyboardRect.height == Screen.height);
 }