Example #1
0
        public UIPropertyLog()
            : base(UIDialogStyle.Standard | UIDialogStyle.Close, true)
        {
            //todo: this dialog is resizable. The elements use offests from each side to size and position themselves.
            //right now we're just using positions.

            History = new List <VMChatEvent>();

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

            this.Caption = "Property Log";

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

            ChatHistorySlider.AttachButtons(ChatHistoryScrollUpButton, ChatHistoryScrollDownButton, 1);
            ChatHistorySlider.SetSize(ChatHistorySlider.Size.X, 138 + 30);
            ChatHistoryScrollDownButton.Position += new Vector2(0, 30);
            ChatHistoryText.AttachSlider(ChatHistorySlider);

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

            histStyle.Size            = 8;
            ChatHistoryText.Size      = new Vector2(322, 150 + 30);
            ChatHistoryText.MaxLines  = 13;
            ChatHistoryText.TextStyle = histStyle;

            Remove(ChatEntryTextEdit);
            CloseButton.OnButtonClick += CloseButton_OnButtonClick;
        }
Example #2
0
        public void ResizeChatDialogByDelta(int delta)
        {
            if (chatSize + delta < 7 || chatSize + delta > 11)
            {
                return;
            }
            chatSize += delta;

            var updatedSize = delta * 30; //Incease or decrease by 30px

            var histStyle = ChatHistoryText.TextStyle.Clone();

            histStyle.Size            = chatSize;
            ChatHistoryText.TextStyle = histStyle;

            this.SetSize((int)Math.Round(this.Size.X) + updatedSize, (int)Math.Round(this.Size.Y) + updatedSize);

            ChatHistoryBackground.SetSize(ChatHistoryBackground.Size.X + updatedSize, ChatHistoryBackground.Size.Y + updatedSize);
            ChatHistoryText.SetSize(ChatHistoryBackground.Size.X - 19, ChatHistoryBackground.Size.Y - 16);

            ChatHistorySlider.Position = new Vector2(ChatHistorySlider.Position.X + updatedSize, ChatHistorySlider.Position.Y);
            ChatHistorySlider.SetSize(ChatHistorySlider.Size.X, ChatHistoryBackground.Size.Y - 26);
            ChatHistoryScrollUpButton.Position   = new Vector2(ChatHistoryScrollUpButton.Position.X + updatedSize, ChatHistoryScrollUpButton.Position.Y);
            ChatHistoryScrollDownButton.Position = new Vector2(ChatHistoryScrollDownButton.Position.X + updatedSize, ChatHistoryScrollDownButton.Position.Y + updatedSize);

            ChatEntryTextEdit.Position = new Vector2(ChatEntryTextEdit.Position.X, ChatEntryTextEdit.Position.Y + updatedSize);
            ChatEntryTextEdit.SetSize(ChatEntryTextEdit.Size.X, ChatEntryTextEdit.Size.Y);
            ChatEntryBackground.Position = new Vector2(ChatEntryBackground.Position.X, ChatEntryBackground.Position.Y + updatedSize);
            ChatEntryBackground.SetSize(ChatEntryBackground.Size.X + updatedSize, ChatEntryBackground.Size.Y);

            ChatEntryTextEdit.ComputeDrawingCommands();
            ChatHistoryText.ComputeDrawingCommands();
        }
Example #3
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));
        }
Example #4
0
        private void ChangeSizeTo(Vector2 size)
        {
            if (Size == size && LastCategories == Categories.HasButtons)
            {
                return;
            }

            var wasAtBottom = ChatHistoryText.VerticalScrollPosition == ChatHistoryText.VerticalScrollMax;

            var delta = size.ToPoint().ToVector2() - Size;

            if (LastCategories != Categories.HasButtons)
            {
                var yDelta = Categories.HasButtons ? 10 : -10;
                foreach (var child in Children)
                {
                    if (child != Categories && child != Background)
                    {
                        child.Y += yDelta;
                    }
                }
                LastCategories = Categories.HasButtons;
                delta.Y       -= yDelta;
            }

            this.SetSize((int)size.X, (int)size.Y);

            ChatHistoryBackground.SetSize(ChatHistoryBackground.Size.X + delta.X, ChatHistoryBackground.Size.Y + delta.Y);
            ChatHistoryText.SetSize(ChatHistoryBackground.Size.X - 19, ChatHistoryBackground.Size.Y - 16);

            ChatHistorySlider.Position = new Vector2(ChatHistorySlider.Position.X + delta.X, ChatHistorySlider.Position.Y);
            ChatHistorySlider.SetSize(ChatHistorySlider.Size.X, ChatHistoryBackground.Size.Y - 26);
            ChatHistoryScrollUpButton.Position   = new Vector2(ChatHistoryScrollUpButton.Position.X + delta.X, ChatHistoryScrollUpButton.Position.Y);
            ChatHistoryScrollDownButton.Position = new Vector2(ChatHistoryScrollDownButton.Position.X + delta.X, ChatHistoryScrollDownButton.Position.Y + delta.Y);

            ChatEntryTextEdit.Position = new Vector2(ChatEntryTextEdit.Position.X, ChatEntryTextEdit.Position.Y + delta.Y);
            ChatEntryTextEdit.SetSize(ChatEntryTextEdit.Size.X + delta.X, ChatEntryTextEdit.Size.Y);
            ChatEntryBackground.Position = new Vector2(ChatEntryBackground.Position.X, ChatEntryBackground.Position.Y + delta.Y);
            ChatEntryBackground.SetSize(ChatEntryBackground.Size.X + delta.X, ChatEntryBackground.Size.Y);

            ChatEntryTextEdit.ComputeDrawingCommands();
            ChatHistoryText.ComputeDrawingCommands();

            if (wasAtBottom)
            {
                ChatHistoryText.VerticalScrollPosition = ChatHistoryText.VerticalScrollMax;
            }
        }
Example #5
0
        public UIChatDialog()
            : base(UIDialogStyle.Standard | UIDialogStyle.OK | UIDialogStyle.Close, true)
        {
            //todo: this dialog is resizable. The elements use offests from each side to size and position themselves.
            //right now we're just using positions.

            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);

            ChatEntryTextEdit.OnEnterPress += SendMessageEnter;

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

            histStyle.Size            = 8;
            ChatHistoryText.Size      = new Vector2(322, 150);
            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;
        }