Пример #1
0
        /// <summary>
        /// Display an IM message in its currently open window. If there is no window, this will create a new one.
        /// </summary>
        public void PassMessage(MessageAuthor Sender, string Message)
        {
            UIMessageGroup group = GetMessageGroup(Sender.Author, UIMessageType.IM);

            if (group == null)
            {
                group = new UIMessageGroup(UIMessageType.IM, Sender, this);
                MessageWindows.Add(group);
                this.Add(group);
                ReorderIcons();
                group.Show(null);

                if (Message != null)
                {
                    HITVM.Get().PlaySoundEvent(UISounds.CallRecieveFirst);
                }
            }
            else
            {
                HITVM.Get().PlaySoundEvent((soundAlt) ? UISounds.CallRecieve : UISounds.CallRecieveNext);
                soundAlt = !soundAlt;
            }

            if (Message != null)
            {
                group.AddMessage(Message);
            }
        }
Пример #2
0
        /// <summary>
        /// Opens mail without the confirmation dialog. Use when manually opening mail from the inbox.
        /// </summary>
        public void OpenEmail(MessageAuthor sender, string subject, string message)
        {
            bool GroupExisted = false;

            for (int i = 0; i < MessageWindows.Count; i++)
            {
                //Did conversation already exist?
                if (MessageWindows[i].name.Equals(sender.Author, StringComparison.InvariantCultureIgnoreCase))
                {
                    GroupExisted = true;
                    //MessageWindows[i].AddMessage(message);
                    break;
                }
            }

            if (!GroupExisted)
            {
                var group = new UIMessageGroup(UIMessageType.Read, sender, this);
                MessageWindows.Add(group);
                Add(group);

                group.SetEmail(subject, message);
            }

            ReorderIcons();
        }
Пример #3
0
 /// <summary>
 /// User wanted to compose a new message!
 /// </summary>
 private void MessageButton_OnButtonClick(UIElement button)
 {
     if (Dropdown.MenuListBox.Items.Count != 0)
     {
         MessageAuthor Author = new MessageAuthor();
         Author.Author = (string)Dropdown.MenuListBox.SelectedItem.Columns[0];
         Author.GUID   = (string)Dropdown.MenuListBox.SelectedItem.Data.ToString();
     }
 }
Пример #4
0
        /// <summary>
        /// User wanted to compose a new message!
        /// </summary>
        private void MessageButton_OnButtonClick(UIElement button)
        {
            if (Dropdown.MenuListBox.Items.Count != 0)
            {
                MessageAuthor Author = new MessageAuthor();
                Author.Author = (string)Dropdown.MenuListBox.SelectedItem.Columns[0];
                Author.GUID   = (string)Dropdown.MenuListBox.SelectedItem.Data.ToString();

                //TODO: UIMessageType should be changed to Compose when later on to send letters
                //      instead of IMs.
                GameFacade.MessageController.PassMessage(Author, null);
            }
        }
Пример #5
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 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);
        }
Пример #6
0
        public UIMessageGroup(UIMessageType type, MessageAuthor author, UIMessageController parent)
        {
            this.parent = parent;
            this.name   = author.Author;
            this.type   = type;

            window = new UIMessageWindow();
            this.Add(window);
            window.X = GlobalSettings.Default.GraphicsWidth / 2 - 194;
            window.Y = GlobalSettings.Default.GraphicsHeight / 2 - 125;
            //icon = new UIMessageIcon(type);
            //this.Add(icon);

            icon.button.OnButtonClick           += new ButtonClickDelegate(Show);
            window.MinimizeButton.OnButtonClick += new ButtonClickDelegate(Hide);
            window.CloseButton.OnButtonClick    += new ButtonClickDelegate(Close);
            this.AddUpdateHook(new UpdateHookDelegate(ButtonAnim));
            Ticks = 0;
            Alert = false;

            Hide(this);
        }
Пример #7
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 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);
        }
Пример #8
0
        public UIMessageGroup(UIMessageType type, MessageAuthor author, UIMessageController parent)
        {
            this.parent = parent;
            this.name = author.Author;
            this.type = type;

            window = new UIMessage(type, author);
            this.Add(window);
            window.X = GlobalSettings.Default.GraphicsWidth / 2 - 194;
            window.Y = GlobalSettings.Default.GraphicsHeight / 2 - 125;
            icon = new UIMessageIcon(type);
            this.Add(icon);

            icon.button.OnButtonClick += new ButtonClickDelegate(Show);
            window.MinimizeButton.OnButtonClick += new ButtonClickDelegate(Hide);
            window.CloseButton.OnButtonClick += new ButtonClickDelegate(Close);
            this.AddUpdateHook(new UpdateHookDelegate(ButtonAnim));
            Ticks = 0;
            Alert = false;

            Hide(this);
        }
Пример #9
0
 public void SetMessageAuthor(MessageAuthor author)
 {
     Author = author;
     SimNameText.Caption = author.Author;
 }
Пример #10
0
 public void SetMessageAuthor(MessageAuthor author)
 {
     Author = author;
     SimNameText.Caption = author.Author;
 }
Пример #11
0
 /// <summary>
 /// Brings up a "You've got mail!" dialog and upon confirming that you want to see it, opens the message.
 /// If multiple messages are recieved while the dialog is open it will be updated.
 /// </summary>
 public void PassEmail(MessageAuthor sender, string subject, string message)
 {
     HITVM.Get.PlaySoundEvent(UISounds.LetterRecieve);
     //PendingEmails.Add(new EmailStore(sender, message));
     OpenEmail(sender, subject, message); //will eventually show alert asking if you want to do this...
 }
Пример #12
0
        /// <summary>
        /// User wanted to compose a new message!
        /// </summary>
        private void MessageButton_OnButtonClick(UIElement button)
        {
            if (Dropdown.MenuListBox.Items.Count != 0)
            {
                MessageAuthor Author = new MessageAuthor();
                Author.Author = (string)Dropdown.MenuListBox.SelectedItem.Columns[0];
                Author.GUID = (string)Dropdown.MenuListBox.SelectedItem.Data.ToString();

                //TODO: UIMessageType should be changed to Compose when later on to send letters
                //      instead of IMs.
                GameFacade.MessageController.PassMessage(Author, null);
            }
        }
Пример #13
0
        /// <summary>
        /// Display an IM message in its currently open window. If there is no window, this will create a new one.
        /// </summary>
        public void PassMessage(MessageAuthor Sender, string Message)
        {
            UIMessageGroup group = GetMessageGroup(Sender.Author, UIMessageType.IM);
            if (group == null)
            {
                group = new UIMessageGroup(UIMessageType.IM, Sender, this);
                MessageWindows.Add(group);
                this.Add(group);
                ReorderIcons();
                group.Show(null);

                if (Message != null)
                {
                    HITVM.Get().PlaySoundEvent(UISounds.CallRecieveFirst);
                }
            }
            else
            {
                HITVM.Get().PlaySoundEvent((soundAlt) ? UISounds.CallRecieve : UISounds.CallRecieveNext);
                soundAlt = !soundAlt;
            }

            if (Message != null) group.AddMessage(Message);
        }
Пример #14
0
 /// <summary>
 /// Brings up a "You've got mail!" dialog and upon confirming that you want to see it, opens the message.
 /// If multiple messages are recieved while the dialog is open it will be updated.
 /// </summary>
 public void PassEmail(MessageAuthor sender, string subject, string message)
 {
     HITVM.Get().PlaySoundEvent(UISounds.LetterRecieve);
     //PendingEmails.Add(new EmailStore(sender, message));
     OpenEmail(sender, subject, message); //will eventually show alert asking if you want to do this...
 }
Пример #15
0
        /// <summary>
        /// Opens mail without the confirmation dialog. Use when manually opening mail from the inbox.
        /// </summary>
        public void OpenEmail(MessageAuthor sender, string subject, string message)
        {
            bool GroupExisted = false;

            for (int i = 0; i < MessageWindows.Count; i++)
            {
                //Did conversation already exist?
                if (MessageWindows[i].name.Equals(sender.Author, StringComparison.InvariantCultureIgnoreCase))
                {
                    GroupExisted = true;
                    MessageWindows[i].AddMessage(message);
                    break;
                }
            }

            if (!GroupExisted)
            {
                var group = new UIMessageGroup(UIMessageType.Read, sender, this);
                MessageWindows.Add(group);
                this.Add(group);

                group.SetEmail(subject, message);
            }

            ReorderIcons();
        }