Beispiel #1
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);

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

            LetterSlider.AttachButtons(LetterScrollUpButton, LetterScrollDownButton, 1);
            LetterTextEdit.AttachSlider(LetterSlider);
            RespondLetterButton.OnButtonClick += new ButtonClickDelegate(RespondLetterButton_OnButtonClick);
            SendLetterButton.OnButtonClick    += new ButtonClickDelegate(SendLetter);

            HistorySlider.AttachButtons(HistoryScrollUpButton, HistoryScrollDownButton, 1);
            HistoryTextEdit.AttachSlider(HistorySlider);

            HistoryTextEdit.TextStyle      = HistoryTextEdit.TextStyle.Clone();
            HistoryTextEdit.TextStyle.Size = 8;
            HistoryTextEdit.TextMargin     = new Microsoft.Xna.Framework.Rectangle(3, 3, 3, 3);
            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);

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

            MyUser = new Binding <UserReference>();

            User.ValueChanged += (x) => PersonButton.User.Value = x;
            Size = Background.Size.ToVector2();
        }
        /// <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 UIMessage(UIMessageType type, MessageAuthor author)
        {
            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);
            UIUtils.MakeDraggable(TypeBackground, this);

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

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

            LetterSlider.AttachButtons(LetterScrollUpButton, LetterScrollDownButton, 1);
            LetterTextEdit.AttachSlider(LetterSlider);
            RespondLetterButton.OnButtonClick += new ButtonClickDelegate(RespondLetterButton_OnButtonClick);
            SendLetterButton.OnButtonClick    += new ButtonClickDelegate(SendLetter);

            HistorySlider.AttachButtons(HistoryScrollUpButton, HistoryScrollDownButton, 1);
            HistoryTextEdit.AttachSlider(HistorySlider);

            HistoryTextEdit.TextStyle      = HistoryTextEdit.TextStyle.Clone();
            HistoryTextEdit.TextStyle.Size = 8;
            HistoryTextEdit.TextMargin     = new Microsoft.Xna.Framework.Rectangle(3, 3, 3, 3);
            HistoryTextEdit.SetSize(333, 100);

            CloseButton.OnButtonClick += new ButtonClickDelegate(CloseButton_OnButtonClick);

            SetType(type);
            SetMessageAuthor(author);
        }
Beispiel #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);
        }