Ejemplo n.º 1
0
        public ChatBox()
        {
            enableCheats = !Program.releaseBuild;
            Texture2D chatboxTexture = Game1.content.Load <Texture2D>("LooseSprites\\chatBox");

            chatBox = new ChatTextBox(chatboxTexture, null, Game1.smallFont, Color.White);
            e       = textBoxEnter;
            chatBox.OnEnterPressed += e;
            Game1.keyboardDispatcher.Subscriber = chatBox;
            emojiTexture  = Game1.content.Load <Texture2D>("LooseSprites\\emojis");
            emojiMenuIcon = new ClickableTextureComponent(new Rectangle(0, 0, 40, 36), emojiTexture, new Rectangle(0, 0, 9, 9), 4f);
            emojiMenu     = new EmojiMenu(this, emojiTexture, chatboxTexture);
            updatePosition();
            chatBox.Selected = false;
        }
Ejemplo n.º 2
0
 public virtual void textBoxEnter(TextBox sender)
 {
     if (sender is ChatTextBox)
     {
         ChatTextBox box = sender as ChatTextBox;
         if (box.finalText.Count > 0)
         {
             bool include_color_information = true;
             if (box.finalText[0].message != null && box.finalText[0].message.Length > 0 && box.finalText[0].message.ToString()[0] == '/' && box.finalText[0].message.Split(' ')[0].Length > 1)
             {
                 include_color_information = false;
             }
             if (box.finalText.Count != 1 || ((box.finalText[0].message != null || box.finalText[0].emojiIndex != -1) && (box.finalText[0].message == null || box.finalText[0].message.Trim().Length != 0)))
             {
                 string textToSend = ChatMessage.makeMessagePlaintext(box.finalText, include_color_information);
                 textBoxEnter(textToSend);
             }
         }
         box.reset();
         cheatHistoryPosition = -1;
     }
     sender.Text = "";
     clickAway();
 }