Beispiel #1
0
        public override bool HandlesMouseClick(int mouseX, int mouseY, MouseButton button)
        {
            if (!HandlesAllInput)
            {
                return(false);
            }
            if (normalChat.Bounds.Contains(mouseX, mouseY))
            {
                int height = normalChat.GetUsedHeight();
                int y      = normalChat.Y + normalChat.Height - height;
                if (new Rectangle(normalChat.X, y, normalChat.Width, height).Contains(mouseX, mouseY))
                {
                    string text = normalChat.GetSelected(mouseX, mouseY);
                    if (text == null)
                    {
                        return(false);
                    }

                    if (Utils.IsUrlPrefix(text))
                    {
                        game.ShowWarning(new WarningScreen(
                                             game, text, "Are you sure you want to go to this url?",
                                             OpenUrl, AppendUrl, null, text,
                                             "Be careful - urls from strangers may link to websites that",
                                             " may have viruses, or things you may not want to open/see."
                                             ));
                    }
                    else if (game.ClickableChat)
                    {
                        for (int i = 0; i < text.Length; i++)
                        {
                            if (!IsValidInputChar(text[i]))
                            {
                                Console.WriteLine(i + "," + text[i]);
                                game.Chat.Add("&eChatline contained characters that can't be sent on this server.");
                                return(true);
                            }
                        }
                        textInput.AppendText(text);
                    }
                    return(true);
                }
                return(false);
            }
            return(textInput.HandlesMouseClick(mouseX, mouseY, button));
        }
Beispiel #2
0
        public override bool HandlesMouseClick(int mouseX, int mouseY, MouseButton button)
        {
            if (!HandlesAllInput || game.HideGui)
            {
                return(false);
            }
            if (!normalChat.Bounds.Contains(mouseX, mouseY))
            {
                return(textInput.HandlesMouseClick(mouseX, mouseY, button));
            }

            int height = normalChat.GetUsedHeight();
            int y      = normalChat.Y + normalChat.Height - height;

            if (new Rectangle(normalChat.X, y, normalChat.Width, height).Contains(mouseX, mouseY))
            {
                return(HandlesChatClick(mouseX, mouseY));
            }
            return(false);
        }