Ejemplo n.º 1
0
        public UIChatDialog(UILotControl owner)
            : base(UIDialogStyle.Standard | UIDialogStyle.OK | UIDialogStyle.Close, false)
        {
            //todo: this dialog is resizable. The elements use offests from each side to size and position themselves.
            //right now we're just using positions.

            CloseButton.Tooltip = GameFacade.Strings.GetString("f113", "43");
            Owner   = owner;
            History = new List <VMChatEvent>();

            this.RenderScript("chatdialog.uis");
            this.SetSize(400, 255);

            this.Caption = "Property Chat (?) - ???";

            ChatEntryBackground          = new UIImage(GetTexture((ulong)0x7A400000001)).With9Slice(13, 13, 13, 13);
            ChatEntryBackground.Position = new Vector2(25, 211);
            ChatEntryBackground.SetSize(323, 26);
            AddAt(5, ChatEntryBackground);

            ChatHistoryBackground          = new UIImage(GetTexture((ulong)0x7A400000001)).With9Slice(13, 13, 13, 13);
            ChatHistoryBackground.Position = new Vector2(19, 39);
            ChatHistoryBackground.SetSize(341, 166);
            AddAt(5, ChatHistoryBackground);

            ChatHistorySlider.AttachButtons(ChatHistoryScrollUpButton, ChatHistoryScrollDownButton, 1);
            ChatHistoryText.AttachSlider(ChatHistorySlider);

            ChatHistoryText.Position      = new Vector2(29, 47);
            ChatHistoryText.BBCodeEnabled = true;
            var histStyle = ChatHistoryText.TextStyle.Clone();

            histStyle.Size            = chatSize;
            ChatHistoryText.Size      = new Vector2(ChatHistoryBackground.Size.X - 19, ChatHistoryBackground.Size.Y - 16);
            ChatHistoryText.MaxLines  = 10;
            ChatHistoryText.TextStyle = histStyle;

            ChatEntryTextEdit.OnChange += ChatEntryTextEdit_OnChange;
            ChatEntryTextEdit.Position  = new Vector2(38, 216);
            ChatEntryTextEdit.Size      = new Vector2(295, 17);

            OKButton.Disabled       = true;
            OKButton.OnButtonClick += SendMessage;

            CloseButton.OnButtonClick += CloseButton_OnButtonClick;

            var emojis = new UIEmojiSuggestions(ChatEntryTextEdit);

            DynamicOverlay.Add(emojis);
            emojis.Parent = this;
            ChatEntryTextEdit.OnEnterPress += SendMessageEnter;

            Background.ListenForMouse(new UIMouseEvent(DragMouseEvents));

            Categories          = new UIChatCategoryList(this);
            Categories.Position = new Vector2(31, 29);
            Add(Categories);
            ChangeSizeTo(new Vector2(GlobalSettings.Default.ChatSizeX, GlobalSettings.Default.ChatSizeY));
        }
Ejemplo n.º 2
0
        public UIEmojiSuggestion(string emojiName, UIEmojiSuggestions parent)
        {
            PxWhite    = TextureGenerator.GetPxWhite(GameFacade.GraphicsDevice);
            Style      = TextStyle.DefaultLabel.Clone();
            Style.Size = 8;
            EmojiName  = emojiName;
            Owner      = parent;

            Emoji        = GameFacade.Emojis.GetEmoji(GameFacade.Emojis.EmojiFromName(emojiName)).Item2;
            ClickHandler =
                ListenForMouse(new Rectangle(0, 0, 200, 22), new UIMouseEvent(MouseEvent));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a new UIMessage instance.
        /// </summary>
        /// <param name="type">The type of message (IM, compose or read).</param>
        /// <param name="author">Author if type is read or IM, recipient if type is compose.</param>
        public UIMessageWindow()
        {
            var script = this.RenderScript("message.uis");

            Messages = new List <IMEntry>();

            BtnBackground   = new UIImage(backgroundBtnImage);
            BtnBackground.X = 313;
            BtnBackground.Y = 216;
            this.AddAt(0, BtnBackground);

            TypeBackground   = new UIImage(backgroundMessageImage);
            TypeBackground.X = 10;
            TypeBackground.Y = 12;
            this.AddAt(0, TypeBackground);

            Background = new UIImage(backgroundImage);
            this.AddAt(0, Background);

            UIUtils.MakeDraggable(Background, this, true);
            UIUtils.MakeDraggable(TypeBackground, this, true);

            LetterSubjectTextEdit.MaxLines   = 1;
            LetterSubjectTextEdit.TextMargin = new Microsoft.Xna.Framework.Rectangle(2, 2, 2, 2);
            LetterSubjectTextEdit.MaxChars   = 128;

            MessageSlider.AttachButtons(MessageScrollUpButton, MessageScrollDownButton, 1);
            MessageTextEdit.AttachSlider(MessageSlider);
            MessageTextEdit.OnChange        += new ChangeDelegate(MessageTextEdit_OnChange);
            SendMessageButton.OnButtonClick += new ButtonClickDelegate(SendMessage);

            var emojis = new UIEmojiSuggestions(MessageTextEdit);

            DynamicOverlay.Add(emojis);
            MessageTextEdit.OnEnterPress += new KeyPressDelegate(SendMessageEnter);

            SendMessageButton.Disabled = true;

            LetterSlider.AttachButtons(LetterScrollUpButton, LetterScrollDownButton, 1);
            LetterTextEdit.AttachSlider(LetterSlider);
            LetterTextEdit.MaxChars = 1000;

            var emojis2 = new UIEmojiSuggestions(LetterTextEdit);

            DynamicOverlay.Add(emojis2);

            RespondLetterButton.OnButtonClick += new ButtonClickDelegate(RespondLetterButton_OnButtonClick);
            SendLetterButton.OnButtonClick    += new ButtonClickDelegate(SendLetter);

            HistorySlider.AttachButtons(HistoryScrollUpButton, HistoryScrollDownButton, 1);
            HistoryTextEdit.AttachSlider(HistorySlider);
            HistoryTextEdit.BBCodeEnabled  = true;
            HistoryTextEdit.TextStyle      = HistoryTextEdit.TextStyle.Clone();
            HistoryTextEdit.TextStyle.Size = 8;
            HistoryTextEdit.TextMargin     = new Microsoft.Xna.Framework.Rectangle(3, 1, 3, 3);
            HistoryTextEdit.TextStyle.LineHeightModifier = -1;
            HistoryTextEdit.SetSize(333, 100);

            CloseButton.OnButtonClick    += new ButtonClickDelegate(CloseButton_OnButtonClick);
            MinimizeButton.OnButtonClick += MinimizeButton_OnButtonClick;

            PersonButton           = script.Create <UIPersonButton>("AvatarThumbnail");
            PersonButton.FrameSize = UIPersonButtonSize.SMALL;
            Add(PersonButton);

            SpecialButton                = new UIButton();
            SpecialButton.Visible        = false;
            SpecialButton.OnButtonClick += SpecialButton_OnButtonClick;
            Add(SpecialButton);

            User = new Binding <UserReference>()
                   .WithBinding(SimNameText, "Caption", "Name");

            MyUser = new Binding <UserReference>();

            User.ValueChanged += (x) => PersonButton.User.Value = x;
            Size = Background.Size.ToVector2();


            this.Opacity = GlobalSettings.Default.ChatWindowsOpacity;
            this.AddUpdateHook(ChatOpacityChangedListener);
        }
Ejemplo n.º 4
0
        public UIChatPanel(VM vm, UILotControl owner)
        {
            this.vm    = vm;
            this.Owner = owner;

            if (FSOEnvironment.SoftwareKeyboard)
            {
                //need a button to initiate chat history
                var btn = new UIButton();
                btn.Caption        = "Chat";
                btn.Position       = new Vector2(10, 10);
                btn.OnButtonClick += (state) =>
                {
                    HistoryDialog.Visible = !HistoryDialog.Visible;
                };
                Add(btn);
            }

            Style        = TextStyle.DefaultTitle.Clone();
            Style.Size   = 16;
            Style.Shadow = true;
            Labels       = new List <UIChatBalloon>();

            TextBox = new UITextBox();
            TextBox.SetBackgroundTexture(null, 0, 0, 0, 0);
            TextBox.Visible = false;
            Add(TextBox);
            TextBox.Position = new Vector2(25, 25);
            TextBox.SetSize(GlobalSettings.Default.GraphicsWidth - 50, 25);

            var emojis = new UIEmojiSuggestions(TextBox);

            Add(emojis);
            emojis.Parent = this;

            TextBox.OnEnterPress += TextBox_OnEnterPress;

            SelectionFillColor = new Color(0, 25, 70);

            //-- populate invalid areas --
            //chat bubbles will be pushed out of these areas
            //when this happens, they will also begin displaying the name of the speaking avatar.

            InvalidAreas = new List <Rectangle>();
            InvalidAreas.Add(new Rectangle(-100000, -100000, 100020, 200000 + GlobalSettings.Default.GraphicsHeight));                                   //left
            InvalidAreas.Add(new Rectangle(-100000, -100000, 200000 + GlobalSettings.Default.GraphicsWidth, 100020));                                    //top
            InvalidAreas.Add(new Rectangle(GlobalSettings.Default.GraphicsWidth - 20, -100000, 100020, 200000 + GlobalSettings.Default.GraphicsHeight)); //right
            InvalidAreas.Add(new Rectangle(-100000, GlobalSettings.Default.GraphicsHeight - 20, 200000 + GlobalSettings.Default.GraphicsWidth, 100020)); //bottom
            InvalidAreas.Add(new Rectangle(-100000, GlobalSettings.Default.GraphicsHeight - 230, 100230, 100230));                                       //ucp

            HistoryDialog                = new UIChatDialog(owner);
            HistoryDialog.Position       = new Vector2(20, 20);
            HistoryDialog.Visible        = true;
            HistoryDialog.Opacity        = 0.8f;
            HistoryDialog.OnSendMessage += SendMessage;
            this.Add(HistoryDialog);

            PropertyLog          = new UIPropertyLog();
            PropertyLog.Position = new Vector2(400, 20);
            PropertyLog.Visible  = false;
            PropertyLog.Opacity  = 0.8f;
            this.Add(PropertyLog);
        }