Esempio n. 1
0
 private void OnFramesMoved()
 {
     if (ChatMgr.Get() != null)
     {
         ChatMgr.Get().OnChatFramesMoved();
     }
 }
Esempio n. 2
0
 private void OnSceneLoaded(SceneMgr.Mode mode, Scene scene, object userData)
 {
     if (mode == SceneMgr.Mode.FATAL_ERROR)
     {
         ChatMgr.Get().CleanUp();
     }
 }
Esempio n. 3
0
 private void OnBnetEventOccurred(BattleNet.BnetEvent bnetEvent, object userData)
 {
     if (bnetEvent == BattleNet.BnetEvent.Disconnected)
     {
         ChatMgr.Get().CleanUp();
     }
 }
 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 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);
             }
         }
     }
 }
 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();
     }
 }
Esempio n. 7
0
 private void OnCloseButtonReleased()
 {
     ChatMgr.Get().CloseChatUI();
     if (UniversalInputManager.UsePhoneUI != null)
     {
         ChatMgr.Get().ShowFriendsList();
     }
 }
Esempio n. 8
0
        private void BurnTower(Character character)
        {
            Warmaster.Delete();
            // Notify the BG, remove this warmaster from the AIGroup.
            ChatMgr.SendSystemMessage(Instance.Characters, Name + " has been destroyed by the " + BaseOwner);

            // Check this: (the flag/tower should burn and become unusable)
            FlagStand.FirstSpawnEntry.AnimProgress = 255;
        }
Esempio n. 9
0
    public bool HandleKeyboardInput()
    {
        if (Input.GetKeyUp(KeyCode.Escape))
        {
            return(this.HandleEscapeKey());
        }
        ChatMgr mgr = ChatMgr.Get();

        return((mgr != null) && mgr.HandleKeyboardInput());
    }
Esempio n. 10
0
 private void Start()
 {
     this.InitRecentPlayerDropdown();
     if (ChatMgr.Get().IsChatLogFrameShown())
     {
         this.ShowChatLogFrame();
     }
     this.UpdateReceiver();
     ChatMgr.Get().OnChatReceiverChanged(this.m_receiver);
 }
Esempio n. 11
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));
     }
 }
Esempio n. 12
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);
     }
 }
Esempio n. 14
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);
        }
    }
Esempio n. 15
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();
     }
 }
Esempio n. 17
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);
         }
     }
 }
Esempio n. 18
0
 private void OnChatLogButtonReleased(UIEvent e)
 {
     if (ChatMgr.Get().IsChatLogFrameShown())
     {
         this.HideChatLogFrame();
     }
     else
     {
         this.ShowChatLogFrame();
     }
     this.UpdateReceiver();
     UniversalInputManager.Get().FocusTextInput(base.gameObject);
 }
Esempio n. 19
0
        private static void LoadChatChannelsDBC()
        {
            var ccDbcPath = RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_CHATCHANNELS);
            var reader    = new MappedDBCReader <ChatChannelEntry, ChatChannelConverter>(ccDbcPath);

            foreach (var entry in reader.Entries.Values)
            {
                ChatChannelGroup.DefaultChannelFlags.Add(entry.Id, new ChatChannelFlagsEntry
                {
                    Flags       = entry.ChannelFlags,
                    ClientFlags = ChatMgr.Convert(entry.ChannelFlags)
                });
            }

            return;
        }
 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();
         }
     }
 }
Esempio n. 21
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();
    }
Esempio n. 22
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;
        }
    }
Esempio n. 23
0
        public void TestSimpleChat()
        {
            var chr1 = Setup.AllianceCharacterPool.Create();
            var chr2 = Setup.AllianceCharacterPool.Create();

            DebugUtil.Dumps = true;

            chr1.EnsureInWorldAndLiving();
            chr2.EnsureLiving();

            chr2.EnsureXDistance(chr1, 1, true);

            Thread.Sleep(1000);

            chr1.Map.AddMessageAndWait(new Message1 <Map>(
                                           chr1.Map, (rgn) => ChatMgr.SendSystemMessage(rgn.Characters, "huhu")
                                           ));
        }
Esempio n. 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();
         }
     }
 }
Esempio n. 25
0
        private void ClampSize(float?desiredLeft = null, float?desiredBottom = null)
        {
            if (Parent == null)
            {
                return;
            }

            // var top = Rect.Top;
            var right  = Rect.Right;
            var left   = desiredLeft ?? Rect.Left;
            var bottom = desiredBottom ?? Rect.Bottom;

            // clamp so it doesn't go too high or low (leave space for alerts UI)
            var maxBottom = Parent.Size.Y - MinDistanceFromBottom;

            if (maxBottom <= MinHeight)
            {
                // we can't fit in our given space (window made awkwardly small), so give up
                // and overlap at our min height
                bottom = MinHeight;
            }
            else
            {
                bottom = Math.Clamp(bottom, MinHeight, maxBottom);
            }

            var maxLeft = Parent.Size.X - MinWidth;

            if (maxLeft <= MinLeft)
            {
                // window too narrow, give up and overlap at our max left
                left = maxLeft;
            }
            else
            {
                left = Math.Clamp(left, MinLeft, maxLeft);
            }

            LayoutContainer.SetMarginLeft(this, -((right + 10) - left));
            LayoutContainer.SetMarginBottom(this, bottom);

            ChatMgr.ChatBoxOnResized(new ChatResizedEventArgs(bottom));
        }
Esempio n. 26
0
        private static void EyeOfAcherusActivated(NPC npc)
        {
            //npc.SpellCast.TriggerSelf((SpellId)51860);
            npc.SpellCast.TriggerSelf(SpellId.EyeOfAcherusVisual);
            npc.Phase = 2;

            var chr = npc.Map.GetObject(npc.Creator) as Character;

            if (chr != null)
            {
                //TODO localise!
                ChatMgr.SendRaidBossWhisper(npc, chr, "The Eye of Acherus launches towards its destination.");

                npc.SpellCast.Trigger(SpellId.EyeOfAcherusFlightBoost, npc, chr);
                npc.Flying++;
                //npc.IncMechanicCount(SpellMechanic.Rooted);
                //Move to destination

                var points = new List <Vector3>(3)
                {
                    new Vector3(1758.007f, -5876.785f, 166.8667f),
                    new Vector3(1957.396f, -5844.105f, 273.8667f),
                    new Vector3(2341.571f, -5672.797f, 538.3942f),
                };


                npc.MoveToPointsThenExecute(points, unit =>
                {
                    unit.SpellCast.TriggerSelf(
                        SpellId.EyeOfAcherusFlight);
                    unit.Auras.Remove(
                        SpellId.EyeOfAcherusFlightBoost);
                    ChatMgr.SendRaidBossWhisper(unit, chr,
                                                "The Eye of Acherus is in your control.");
                    //unit.DecMechanicCount(SpellMechanic.Rooted);
                });
            }
        }
Esempio n. 27
0
 private void HideChatLogFrame()
 {
     UnityEngine.Object.Destroy(this.m_chatLogFrame.gameObject);
     this.m_chatLogFrame = null;
     ChatMgr.Get().OnChatLogFrameHidden();
 }
Esempio n. 28
0
        public static void PlayerLoginRequest(RealmClient client, RealmPacketIn packet)
        {
            if (client.Account == null)
            {
                return;
            }

            try
            {
                EntityId charGUID = packet.ReadEntityId();

                if (charGUID != EntityId.Zero)
                {
                    if (s_characters.ContainsKey(charGUID) && !s_characters[charGUID].IsLoggingOut)
                    {
                        s_log.Error(string.Format(Resources.CharacterAlreadyConnected, charGUID, client.Account.Username));

                        Character.SendCharacterLoginFail(client, LoginErrorCodes.CHAR_LOGIN_DUPLICATE_CHARACTER);
                    }
                    else
                    {
                        if (!client.Account.Characters.ContainsKey(charGUID))
                        {
                            s_log.Error(string.Format(Resources.CharacterNotFound, charGUID, client.Account.Username));

                            Character.SendCharacterLoginFail(client, LoginErrorCodes.CHAR_LOGIN_NO_CHARACTER);

                            client.Server.DisconnectClient(client);
                        }
                        else
                        {
                            Character existingChar = null;

                            // this handles character reconnection cases, which relinks a character
                            // in the process of being logged out.
                            if (s_characters.TryGetValue(charGUID, out existingChar))
                            {
                                existingChar.ReconnectCharacter(client);
                            }
                            else
                            {
                                // Set and register the current character.
                                client.ActiveCharacter = new Character(client.Account, client.Account.Characters[charGUID], client);
                                RegisterCharacter(client.ActiveCharacter);

                                // Start character login process
                                client.ActiveCharacter.FirstLogin();
                            }

                            // Give them our version. (as if they care :p)
                            Version ver     = Assembly.GetCallingAssembly().GetName().Version;
                            string  message = string.Format("Welcome to WCell {0}.{1}.{2}.{3}",
                                                            ver.Major, ver.Minor, ver.Revision, ver.Build);

                            ChatMgr.SendSystemMessage(client, message);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                s_log.Error(e);
                Character.SendCharacterLoginFail(client, LoginErrorCodes.CHAR_LOGIN_FAILED);
            }
        }
Esempio n. 29
0
 /// <summary>Say something to this target</summary>
 public void SendMessage(IChatter sender, string message)
 {
     ChatMgr.SendGuildMessage(sender, this, message);
 }
Esempio n. 30
0
 public void ShowFriendList()
 {
     ChatMgr.Get().ShowFriendsList();
     this.m_hasUnacknowledgedPendingInvites = false;
     this.m_friendButton.ShowPendingInvitesIcon(this.m_hasUnacknowledgedPendingInvites);
 }