private Message AddMessage(Message message)
        {
            if (ActiveMessages.Count(x => x.Type == message.Type) >= 3)
            {
                HIT.HITVM.Get().PlaySoundEvent("ui_call_q_full");
                return(null);
            }

            var existing = (message.Type == MessageType.ReadLetter)?GetLetterByID(message.LetterID):GetMessageByUser(message.Type, message.User.Type, message.User.Id);

            if (existing != null)
            {
                return(existing);
            }

            var window = new UIMessageWindow();

            ControllerUtils.BindController <MessagingWindowController>(window).Init(message, this);
            Game.AddWindow(window);
            MessageWindows.Add(message, window);
            ActiveMessages.Add(message);

            Tray.SetItems(ActiveMessages);
            UpdateTray();

            return(message);
        }
Esempio n. 2
0
        private Message AddMessage(Message message)
        {
            if (ActiveMessages.Count >= 3)
            {
                //TODO: Play a sound
                return(null);
            }

            var existing = GetMessageByUser(message.User.Type, message.User.Id);

            if (existing != null)
            {
                return(existing);
            }

            var window = new UIMessageWindow();

            window.BindController <MessagingWindowController>().Init(message, this);
            Game.AddWindow(window);
            MessageWindows.Add(message, window);
            ActiveMessages.Add(message);

            Tray.SetItems(ActiveMessages);
            UpdateTray();

            return(message);
        }