Exemplo n.º 1
0
        private EventNotification(string title, AsyncTexture2D icon, string message)
        {
            _icon = icon;

            this.Opacity          = 0f;
            this.Size             = new Point(NOTIFICATION_WIDTH, NOTIFICATION_HEIGHT);
            this.Location         = new Point(60, 60 + (NOTIFICATION_HEIGHT + 15) * _visibleNotifications);
            this.BasicTooltipText = "Right click to dismiss";

            string wrappedTitle = DrawUtil.WrapText(Content.DefaultFont14, title, this.Width - NOTIFICATION_HEIGHT - 20 - 32);
            var    titleLbl     = new Label()
            {
                Parent   = this,
                Location = new Point(NOTIFICATION_HEIGHT + 10, 0),
                Size     = new Point(this.Width - NOTIFICATION_HEIGHT - 10 - 32, this.Height / 2),
                Font     = Content.DefaultFont14,
                Text     = wrappedTitle,
            };

            string wrapped    = DrawUtil.WrapText(Content.DefaultFont14, message, this.Width - NOTIFICATION_HEIGHT - 20 - 32);
            var    messageLbl = new Label()
            {
                Parent   = this,
                Location = new Point(NOTIFICATION_HEIGHT + 10, this.Height / 2),
                Size     = new Point(this.Width - NOTIFICATION_HEIGHT - 10 - 32, this.Height / 2),
                Text     = wrapped,
            };

            _visibleNotifications++;

            this.RightMouseButtonReleased += delegate { this.Dispose(); };
        }
Exemplo n.º 2
0
        public static void ShowNotification(string title, AsyncTexture2D icon, string message, float duration)
        {
            var notif = new EventNotification(title, icon, message)
            {
                Parent = Graphics.SpriteScreen
            };

            notif.Show(duration);
        }
        private EventNotification(string title, AsyncTexture2D icon, string message, string waypoint)
        {
            const string TOOLTIP_TEXT = "Left click to copy waypoint.\nRight click to dismiss.";

            _icon = icon;

            this.Opacity          = 0f;
            this.Size             = new Point(NOTIFICATION_WIDTH, NOTIFICATION_HEIGHT);
            this.Location         = new Point(180, 60 + (NOTIFICATION_HEIGHT + 15) * _visibleNotifications);
            this.BasicTooltipText = TOOLTIP_TEXT;

            string wrappedTitle = DrawUtil.WrapText(Content.DefaultFont14, title, this.Width - NOTIFICATION_HEIGHT - 20 - 32);

            var titleLbl = new Label()
            {
                Parent           = this,
                Location         = new Point(NOTIFICATION_HEIGHT + 10, 5),
                Size             = new Point(this.Width - NOTIFICATION_HEIGHT - 10 - 32, this.Height / 2),
                Font             = Content.DefaultFont14,
                BasicTooltipText = TOOLTIP_TEXT,
                Text             = wrappedTitle,
            };

            string wrapped = DrawUtil.WrapText(Content.DefaultFont14, message, this.Width - NOTIFICATION_HEIGHT - 20 - 32);

            var messageLbl = new Label()
            {
                Parent           = this,
                Location         = new Point(NOTIFICATION_HEIGHT + 10, this.Height / 2),
                Size             = new Point(this.Width - NOTIFICATION_HEIGHT - 10 - 32, this.Height / 2),
                BasicTooltipText = TOOLTIP_TEXT,
                Text             = wrapped,
            };

            _visibleNotifications++;

            this.RightMouseButtonReleased += delegate { this.Dispose(); };
            this.LeftMouseButtonReleased  += delegate {
                ClipboardUtil.WindowsClipboardService.SetTextAsync(waypoint)
                .ContinueWith((clipboardResult) => {
                    if (clipboardResult.IsFaulted)
                    {
                        ScreenNotification.ShowNotification("Failed to copy waypoint to clipboard. Try again.", ScreenNotification.NotificationType.Red, duration: 2);
                    }
                    else
                    {
                        ScreenNotification.ShowNotification("Copied waypoint to clipboard!", duration: 2);
                    }
                });

                this.Dispose();
            };
        }
        private ScreenshotNotification(string filePath, string message)
        {
            _filePath      = filePath;
            _thumbnail     = ScreenshotManagerModule.ModuleInstance.GetThumbnail(_filePath);
            _thumbnailSize = ScreenshotManagerModule.ModuleInstance._thumbnailSize;
            _inspectIcon   = ScreenshotManagerModule.ModuleInstance._inspectIcon;

            Opacity = 0f;

            Size = new Point(_thumbnailSize.X + PanelMargin, _thumbnailSize.Y + HEADING_HEIGHT + PanelMargin);

            Location = new Point(60, 60 + (Size.Y + 15) * _visibleNotifications);

            ShowBorder = true;
            ShowTint   = true;

            var borderPanel = new Panel
            {
                Parent          = this,
                Size            = new Point(Size.X, _thumbnailSize.Y + PanelMargin),
                Location        = new Point(0, HEADING_HEIGHT),
                BackgroundColor = Color.Black,
                ShowTint        = true,
                ShowBorder      = true
            };
            var messageLbl = new Label
            {
                Parent   = this,
                Location = new Point(0, 2),
                Size     = Size,
                Font     = GameService.Content.GetFont(ContentService.FontFace.Menomonia, ContentService.FontSize.Size14,
                                                       ContentService.FontStyle.Regular),
                VerticalAlignment   = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Center,
                Text = message
            };

            _visibleNotifications++;
            Click += delegate
            {
                ScreenshotManagerModule.ModuleInstance.CreateInspectionPanel(_filePath);
                GameService.Overlay.BlishHudWindow.Show();
                GameService.Overlay.BlishHudWindow.Navigate(ScreenshotManagerModule.ModuleInstance.modulePanel);
                Dispose();
            };
        }
Exemplo n.º 5
0
        public CachedStringRender(string text,
                                  BitmapFont font,
                                  Rectangle destinationRectangle,
                                  Color color,
                                  bool wrap,
                                  bool stroke,
                                  int strokeDistance = 1,
                                  HorizontalAlignment horizontalAlignment = HorizontalAlignment.Left,
                                  VerticalAlignment verticalAlignment     = VerticalAlignment.Middle)
        {
            this.Text = text;
            this.Font = font;
            this.DestinationRectangle = new Rectangle(Point.Zero, destinationRectangle.Size);
            this.Color               = color;
            this.Wrap                = wrap;
            this.Stroke              = stroke;
            this.StrokeDistance      = strokeDistance;
            this.HorizontalAlignment = horizontalAlignment;
            this.VerticalAlignment   = verticalAlignment;

            _cachedRender = new AsyncTexture2D(ContentService.Textures.TransparentPixel.Duplicate());
        }
        private PlayerNotification(string title, AsyncTexture2D icon, string message)
        {
            _icon = icon;

            Opacity          = 0f;
            Size             = new Point(NOTIFICATION_WIDTH, NOTIFICATION_HEIGHT);
            Location         = new Point(60, 60 + (NOTIFICATION_HEIGHT + 15) * _visibleNotifications);
            BasicTooltipText = "Right click to view profile";

            var wrappedTitle = DrawUtil.WrapText(Content.DefaultFont14, title, Width - NOTIFICATION_HEIGHT - 20 - 32);
            var titleLbl     = new Label
            {
                Parent   = this,
                Location = new Point(NOTIFICATION_HEIGHT + 10, 0),
                Size     = new Point(Width - NOTIFICATION_HEIGHT - 10 - 32, Height / 2),
                Font     = Content.DefaultFont14,
                Text     = wrappedTitle
            };

            var wrapped    = DrawUtil.WrapText(Content.DefaultFont14, message, Width - NOTIFICATION_HEIGHT - 20 - 32);
            var messageLbl = new Label
            {
                Parent   = this,
                Location = new Point(NOTIFICATION_HEIGHT + 10, Height / 2),
                Size     = new Point(Width - NOTIFICATION_HEIGHT - 10 - 32, Height / 2),
                Text     = wrapped
            };

            _visibleNotifications++;

            RightMouseButtonReleased += delegate
            {
                GameService.Overlay.BlishHudWindow.Show();
                GameService.Overlay.BlishHudWindow.Navigate(
                    KillProofModule.ModuleInstance.BuildKillProofPanel(GameService.Overlay.BlishHudWindow,
                                                                       new CommonFields.Player(null, title, 0, 0, false)));
                Dispose();
            };
        }
Exemplo n.º 7
0
 public WindowTab(string name, AsyncTexture2D icon) : this(name, icon, name.GetHashCode()) /* NOOP */ }