Example #1
0
        public MouseCaptureScreen(BaseScreenComponent manager) : base(manager)
        {
            DefaultMouseMode = MouseMode.Captured;

            Background = new BorderBrush(Color.Green);

            StackPanel stack = new StackPanel(manager);

            Controls.Add(stack);

            Label title = new Label(manager)
            {
                TextColor = Color.White,
                Text      = "Press ESC to return to Main Screen",
            };

            output = new Label(manager)
            {
                TextColor = Color.White,
                Text      = position.ToString(),
            };

            stack.Controls.Add(title);
            stack.Controls.Add(output);
        }
        public StartScreen(BaseScreenComponent manager) : base(manager)
        {
            Background = new BorderBrush(Color.DarkRed);

            StackPanel stack = new StackPanel(manager);

            Controls.Add(stack);

            // Button zur Controls Demo
            Button controlScreenButton = Button.TextButton(manager, "Controls", "special"); //Button mit speziellen Style erstellen

            controlScreenButton.LeftMouseClick += (s, e) =>                                 //Click Event festlegen
            {
                manager.NavigateToScreen(new SplitScreen(manager));                         //Screen wechseln
            };
            stack.Controls.Add(controlScreenButton);                                        //Button zu Root hinzufügen

            // Button zur Mouse Capture Demo
            Button capturedMouseButton = Button.TextButton(manager, "Captured Mouse", "special");

            capturedMouseButton.LeftMouseClick += (s, e) => manager.NavigateToScreen(new MouseCaptureScreen(manager));
            stack.Controls.Add(capturedMouseButton);

            Button tabDemoScreen = Button.TextButton(manager, "Tab Demo", "special");

            tabDemoScreen.LeftMouseClick += (s, e) => manager.NavigateToScreen(new TabScreen(manager));
            stack.Controls.Add(tabDemoScreen);

            Button dragDropScreen = Button.TextButton(manager, "Drag & Drop", "special");

            dragDropScreen.LeftMouseClick += (s, e) => manager.NavigateToScreen(new DragDropScreen(manager));
            stack.Controls.Add(dragDropScreen);
        }
Example #3
0
        public override void RenderOverride(RenderContext localRenderContext)
        {
            PerformLayout(localRenderContext);

            if (_backgroundContext != null)
            {
                if (Background.BeginRenderBrush(_backgroundContext, localRenderContext))
                {
                    _backgroundContext.Render(0);
                    Background.EndRender();
                }
            }

            if (_borderContext != null)
            {
                if (BorderBrush.BeginRenderBrush(_borderContext, localRenderContext))
                {
                    _borderContext.Render(0);
                    BorderBrush.EndRender();
                }
            }

            FrameworkElement content = _initializedContent;

            if (content != null)
            {
                content.Render(localRenderContext);
            }
        }
        private void DrawHealthBar(WorldLayer layer, IMonster m, ref float yref)
        {
            var    w      = m.CurHealth * w2 / m.MaxHealth;
            var    per    = LightFont.GetTextLayout((m.CurHealth * 100 / m.MaxHealth).ToString(PercentageDescriptor) + "%");
            var    y      = YPos + py * 8 * yref;
            IBrush cBrush = null;
            IFont  cFont  = null;

            //Brush selection
            switch (m.Rarity)
            {
            case ActorRarity.Boss:
                cBrush = BossBrush;
                break;

            case ActorRarity.Champion:
                cBrush = ChampionBrush;
                break;

            case ActorRarity.Rare:
                cBrush = RareBrush;
                break;

            case ActorRarity.RareMinion:
                cBrush = RareMinionBrush;
                break;

            default:
                cBrush = BackgroundBrush;
                break;
            }

            //Jugger Highlight
            if (JuggernautHighlight && m.Rarity == ActorRarity.Rare && HasAffix(m, MonsterAffix.Juggernaut))
            {
                cFont  = RedFont;
                cBrush = RareJuggerBrush;
            }
            else
            {
                cFont = NameFont;
            }


            //Draw Rectangles
            BackgroundBrush.DrawRectangle(XPos, y, w2, h);
            BorderBrush.DrawRectangle(XPos, y, w2, h);
            cBrush.DrawRectangle(XPos, y, (float)w, h);
            LightFont.DrawText(per, XPos + 8 + w2, y - py);

            //Draw MonsterType
            if (ShowMonsterType)
            {
                var name = cFont.GetTextLayout(m.SnoMonster.NameLocalized);
                cFont.DrawText(name, XPos + 3, y - py);
            }

            //increase linecount
            yref += 1.0f;
        }
Example #5
0
 protected override void OnUpdate(RenderContext2D context)
 {
     base.OnUpdate(context);
     if (strokeChanged)
     {
         (SceneNode as BorderNode2D).BorderBrush = BorderBrush.ToD2DBrush(context.DeviceContext);
         strokeChanged = false;
     }
 }
Example #6
0
        public MessageScreen(ScreenComponent manager, string title, string content, string buttonText = "OK", Action <Control, MouseEventArgs> buttonClick = null) : base(manager)
        {
            assets = manager.Game.Assets;

            IsOverlay  = true;
            Background = new BorderBrush(Color.Black * 0.5f);
            Title      = title;

            panel = new Panel(manager)
            {
                Padding             = Border.All(20),
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center
            };
            Controls.Add(panel);

            StackPanel spanel = new StackPanel(manager);

            panel.Controls.Add(spanel);

            Label headLine = new Label(manager)
            {
                Text = title,
                Font = Skin.Current.HeadlineFont,
                HorizontalAlignment = HorizontalAlignment.Stretch
            };

            spanel.Controls.Add(headLine);

            Label contentLabel = new Label(manager)
            {
                Text = content,
                Font = Skin.Current.TextFont,
                HorizontalAlignment = HorizontalAlignment.Stretch
            };

            spanel.Controls.Add(contentLabel);

            Button closeButton = Button.TextButton(manager, buttonText);

            closeButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            closeButton.LeftMouseClick     += (s, e) =>
            {
                if (buttonClick != null)
                {
                    buttonClick(s, e);
                }
                else
                {
                    manager.NavigateBack();
                }
            };
            spanel.Controls.Add(closeButton);

            panel.Background = NineTileBrush.FromSingleTexture(assets.LoadTexture(typeof(ScreenComponent), "panel"), 30, 30);
        }
Example #7
0
        public void PaintExpandedHint(float x, float y, float w, float h, HorizontalAlign align)
        {
            if (!Enabled)
            {
                return;
            }
            if (ExpandedHintFont == null)
            {
                return;
            }

            var hint = HintFunc != null?HintFunc.Invoke() : null;

            if (string.IsNullOrEmpty(hint))
            {
                return;
            }

            if (BackgroundTexture1 != null)
            {
                BackgroundTexture1.Draw(x, y, w, h, BackgroundTextureOpacity1);
            }

            if (BackgroundTexture2 != null)
            {
                BackgroundTexture2.Draw(x, y, w, h, BackgroundTextureOpacity2);
            }

            if (BackgroundBrush != null)
            {
                BackgroundBrush.DrawRectangle(x, y, w, h);
            }

            var layout = ExpandedHintFont.GetTextLayout(hint);

            switch (align)
            {
            case HorizontalAlign.Left:
                ExpandedHintFont.DrawText(layout, x, y + (h - layout.Metrics.Height) / 2);
                break;

            case HorizontalAlign.Center:
                ExpandedHintFont.DrawText(layout, x + (w - layout.Metrics.Width) / 2, y + (h - layout.Metrics.Height) / 2);
                break;

            case HorizontalAlign.Right:
                ExpandedHintFont.DrawText(layout, x + w - layout.Metrics.Width, y + (h - layout.Metrics.Height) / 2);
                break;
            }

            if (BorderBrush != null)
            {
                BorderBrush.DrawRectangle(x, y, w, h);
            }
        }
Example #8
0
        public SplitScreen(IScreenManager manager) : base(manager)
        {
            Background = new BorderBrush(Color.Gray);

            Button backButton = Button.TextButton(manager, "Back");

            backButton.HorizontalAlignment = HorizontalAlignment.Left;
            backButton.VerticalAlignment   = VerticalAlignment.Top;
            backButton.LeftMouseClick     += (s, e) => { manager.NavigateBack(); };
            Controls.Add(backButton);
        }
Example #9
0
        public StartScreen(IScreenManager manager) : base(manager)
        {
            Background = new BorderBrush(Color.DarkRed);

            Button nextButton = Button.TextButton(manager, "Next", "special");

            nextButton.LeftMouseClick += (s, e) =>
            {
                manager.NavigateToScreen(new SplitScreen(manager));
            };
            Controls.Add(nextButton);
        }
Example #10
0
 public override void Allocate()
 {
     base.Allocate();
     if (BorderBrush != null)
     {
         BorderBrush.Allocate();
     }
     if (Background != null)
     {
         Background.Allocate();
     }
 }
        private void DrawLabel(IBrush label, string buffText)
        {
            _activeBuffsCount++;
            _yPosTemp += YPosIncrement * SizeModifier;
            float xJump = CalculateJump();

            BorderBrush.DrawRectangle(hudWidth * _xPosTemp - (lWidth * 1.05f * .5f) + xJump, hudHeight * _yPosTemp - lHeight * 1.1f, lWidth * 1.05f, lHeight * 1.2f);
            label.DrawRectangle(hudWidth * _xPosTemp - lWidth * .5f + xJump, hudHeight * _yPosTemp - lHeight, lWidth, lHeight);

            var layout = TextFont.GetTextLayout(buffText);

            TextFont.DrawText(layout, hudWidth * _xPosTemp - (layout.Metrics.Width * 0.5f) + xJump, hudHeight * _yPosTemp - (layout.Metrics.Height * 1.1f));
        }
Example #12
0
        public void Paint(float x, float y, float w, float h, string text, string title = null, string hint = null)
        {
            if (!Enabled)
            {
                return;
            }
            if (TextFont == null)
            {
                return;
            }

            var displaySize         = Hud.Window.Size;
            var screenBorderPadding = 0.0f;

            if (BorderBrush != null)
            {
                screenBorderPadding += BorderBrush.RealStrokeWidth;
            }

            var layout = TextFont.GetTextLayout(text);

            var rect = new RectangleF(x, y, w, h);

            if (!string.IsNullOrEmpty(hint) && Hud.Window.CursorInsideRect(x, y, w, h))
            {
                Hud.Render.SetHint(hint);
            }

            if (BackgroundBrush != null)
            {
                BackgroundBrush.DrawRectangle(rect);
            }

            var realY = y;

            if ((TitleFont != null) && (BorderBrush != null) && !string.IsNullOrEmpty(title))
            {
                var titleLayout = TitleFont.GetTextLayout(title);
                var pad         = 3 * Hud.Window.Size.Height / 1200.0f;
                realY = y + pad + titleLayout.Metrics.Height + pad;
                BorderBrush.DrawLine(x, realY, x + w, realY);
                TitleFont.DrawText(titleLayout, x + (w - titleLayout.Metrics.Width) / 2, y + pad);
            }

            TextFont.DrawText(layout, x + (w - layout.Metrics.Width) / 2, realY + (h - (realY - y) - layout.Metrics.Height) / 2);

            if (BorderBrush != null)
            {
                BorderBrush.DrawRectangle(rect);
            }
        }
Example #13
0
        // Allocation/Deallocation of _initializedContent not necessary because UIElement handles all direct children

        public override void Deallocate()
        {
            base.Deallocate();
            if (BorderBrush != null)
            {
                BorderBrush.Deallocate();
            }
            if (Background != null)
            {
                Background.Deallocate();
            }
            _performLayout = true;
            PrimitiveBuffer.DisposePrimitiveBuffer(ref _backgroundContext);
            PrimitiveBuffer.DisposePrimitiveBuffer(ref _borderContext);
        }
Example #14
0
        public void PaintTopInGame(ClipState clipState)
        {
            if (clipState != ClipState.BeforeClip)
            {
                return;
            }
            if (!Hud.Game.IsInGame || Hud.Game.IsInTown)
            {
                return;
            }
            bool near = Hud.Game.Players.Where(p => !p.IsMe && p.HasValidActor && (p.HeroClassDefinition.HeroClass == Heroclass) && (p.CentralXyDistanceToMe <= Distance)).Any();

            (near?BackgroundBrush1:BackgroundBrush2).DrawRectangle(xPos, yPos, WidthRectangle, HeightRectangle);
            BorderBrush.DrawRectangle(xPos, yPos, WidthRectangle, HeightRectangle);
        }
Example #15
0
        public Ceil Clone()
        {
            var ceil       = new Ceil();
            var stackPanel = (StackPanel)Child;

            ceil.Column          = Column;
            ceil.Row             = Row;
            ceil.BorderBrush     = BorderBrush.Clone();
            ceil.BorderThickness = BorderThickness;
            ceil.Child           = new StackPanel
            {
                Width      = stackPanel.Width,
                Height     = stackPanel.Height,
                Background = stackPanel.Background.Clone()
            };

            return(ceil);
        }
Example #16
0
        public void PaintTopInGame(ClipState clipState)
        {
            if (Hud.Render.UiHidden)
            {
                return;
            }
            if (clipState != ClipState.BeforeClip)
            {
                return;
            }

            RuleList.CalculatePaintInfo(Hud.Game.Me);
            if (RuleList.PaintInfoList.Count > 0)
            {
                var uiMinimapRect = Hud.Render.MinimapUiElement.Rectangle;

                FillBrush.DrawRectangleGridFit(uiMinimapRect.X, uiMinimapRect.Y, uiMinimapRect.Width, uiMinimapRect.Height);
                BorderBrush.DrawRectangleGridFit(uiMinimapRect.X, uiMinimapRect.Y, uiMinimapRect.Width, uiMinimapRect.Height);
            }
        }
Example #17
0
 private void button_MouseLeave(object sender, MouseEventArgs e)
 {
     if (BackgroundAnimation && backgroundTemp is SolidColorBrush)
     {
         ColorAnimation ca = new ColorAnimation();
         ca.To         = (backgroundTemp as SolidColorBrush).Color;
         ca.SpeedRatio = AnimationSpeed;
         Background.BeginAnimation(SolidColorBrush.ColorProperty, ca);
     }
     if (BorderAnimation && borderTemp is SolidColorBrush)
     {
         ColorAnimation ca2 = new ColorAnimation();
         ca2.To         = (borderTemp as SolidColorBrush).Color;
         ca2.SpeedRatio = AnimationSpeed;
         BorderBrush.BeginAnimation(SolidColorBrush.ColorProperty, ca2);
     }
     if (PaddingAnimation && paddingTemp != null)
     {
         ThicknessAnimation t = new ThicknessAnimation();
         t.To         = paddingTemp;
         t.SpeedRatio = AnimationSpeed / 2;
         PowerEase pe = new PowerEase();
         pe.Power         = Power;
         t.EasingFunction = new PowerEase();
         BeginAnimation(PaddingProperty, t);
     }
     if (MarginAnimation && marginTemp != null)
     {
         ThicknessAnimation t2 = new ThicknessAnimation();
         t2.To         = marginTemp;
         t2.SpeedRatio = AnimationSpeed / 2;
         PowerEase pe = new PowerEase();
         pe.Power          = Power;
         t2.EasingFunction = new PowerEase();
         BeginAnimation(MarginProperty, t2);
     }
 }
Example #18
0
        protected void PerformLayoutBorder(RectangleF innerBorderRect, RenderContext context)
        {
            // Setup border brush
            if (BorderBrush != null && BorderThickness > 0)
            {
                // TODO: Draw border with thickness BorderThickness - doesn't work yet, the drawn line is only one pixel thick
                using (GraphicsPath path = CreateBorderRectPath(innerBorderRect))
                {
                    using (GraphicsPathIterator gpi = new GraphicsPathIterator(path))
                    {
                        PositionColoredTextured[][] subPathVerts = new PositionColoredTextured[gpi.SubpathCount][];
                        using (GraphicsPath subPath = new GraphicsPath())
                        {
                            for (int i = 0; i < subPathVerts.Length; i++)
                            {
                                bool isClosed;
                                gpi.NextSubpath(subPath, out isClosed);
                                PointF[]    pathPoints = subPath.PathPoints;
                                PenLineJoin lineJoin   = Math.Abs(CornerRadius) < DELTA_DOUBLE ? BorderLineJoin : PenLineJoin.Bevel;
                                TriangulateHelper.TriangulateStroke_TriangleList(pathPoints, (float)BorderThickness, isClosed, 1, lineJoin,
                                                                                 out subPathVerts[i]);
                            }
                        }
                        PositionColoredTextured[] verts;
                        GraphicsPathHelper.Flatten(subPathVerts, out verts);
                        BorderBrush.SetupBrush(this, ref verts, context.ZOrder, true);

                        PrimitiveBuffer.SetPrimitiveBuffer(ref _borderContext, ref verts, PrimitiveType.TriangleList);
                    }
                }
            }
            else
            {
                PrimitiveBuffer.DisposePrimitiveBuffer(ref _borderContext);
            }
        }
Example #19
0
        public TargetScreen(ScreenComponent manager, Action <int, int> tp, int x, int y) : base(manager)
        {
            assets = manager.Game.Assets;

            IsOverlay  = true;
            Background = new BorderBrush(Color.Black * 0.5f);
            Title      = "Select target";

            Texture2D panelBackground = assets.LoadTexture(typeof(ScreenComponent), "panel");
            Panel     panel           = new Panel(manager)
            {
                Background          = NineTileBrush.FromSingleTexture(panelBackground, 30, 30),
                Padding             = Border.All(20),
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center
            };

            Controls.Add(panel);

            StackPanel spanel = new StackPanel(manager);

            panel.Controls.Add(spanel);

            Label headLine = new Label(manager)
            {
                Text = Title,
                Font = Skin.Current.HeadlineFont,
                HorizontalAlignment = HorizontalAlignment.Stretch
            };

            spanel.Controls.Add(headLine);

            StackPanel vstack = new StackPanel(manager);

            vstack.Orientation = Orientation.Vertical;
            spanel.Controls.Add(vstack);

            StackPanel xStack = new StackPanel(manager);

            xStack.Orientation = Orientation.Horizontal;
            vstack.Controls.Add(xStack);

            Label xLabel = new Label(manager);

            xLabel.Text = "X:";
            xStack.Controls.Add(xLabel);

            Textbox xText = new Textbox(manager)
            {
                Background = new BorderBrush(Color.Gray),
                Width      = 150,
                Margin     = new Border(2, 10, 2, 10),
                Text       = x.ToString()
            };

            xStack.Controls.Add(xText);

            StackPanel yStack = new StackPanel(manager);

            yStack.Orientation = Orientation.Horizontal;
            vstack.Controls.Add(yStack);

            Label yLabel = new Label(manager);

            yLabel.Text = "Y:";
            yStack.Controls.Add(yLabel);

            Textbox yText = new Textbox(manager)
            {
                Background = new BorderBrush(Color.Gray),
                Width      = 150,
                Margin     = new Border(2, 10, 2, 10),
                Text       = y.ToString()
            };

            yStack.Controls.Add(yText);

            Button closeButton = Button.TextButton(manager, "Teleport");

            closeButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            closeButton.LeftMouseClick     += (s, e) =>
            {
                if (tp != null)
                {
                    tp(int.Parse(xText.Text), int.Parse(yText.Text));
                }
                else
                {
                    manager.NavigateBack();
                }
            };
            spanel.Controls.Add(closeButton);
        }
        public void Paint(IActor actor, IWorldCoordinate coord, string text)
        {
            if (!Enabled)
            {
                return;
            }

            if (actor == null)
            {
                return;
            }

            var rad     = Radius / 1200.0f * Hud.Window.Size.Height;
            var max     = CountDownFrom;
            var elapsed = (Hud.Game.CurrentGameTick - actor.CreatedAtInGameTick) / 60.0f;

            if (elapsed < 0)
            {
                return;
            }

            if (elapsed > max)
            {
                elapsed = max;
            }

            var screenCoord = coord.ToScreenCoordinate();
            var startAngle  = (Convert.ToInt32(360 / max * elapsed) - 90) / StepCount * StepCount;
            var endAngle    = 360 - 90;

            if (BackgroundBrushFill != null)
            {
                using (var pg = Hud.Render.CreateGeometry())
                {
                    using (var gs = pg.Open())
                    {
                        gs.BeginFigure(new Vector2(screenCoord.X, screenCoord.Y), FigureBegin.Filled);
                        for (var angle = startAngle; angle <= endAngle; angle += StepCount)
                        {
                            var mx     = rad * (float)Math.Cos(angle * Math.PI / 180.0f);
                            var my     = rad * (float)Math.Sin(angle * Math.PI / 180.0f);
                            var vector = new Vector2(screenCoord.X + mx, screenCoord.Y + my);
                            gs.AddLine(vector);
                        }

                        gs.EndFigure(FigureEnd.Closed);
                        gs.Close();
                    }

                    BackgroundBrushFill.DrawGeometry(pg);
                }
            }

            if (BackgroundBrushEmpty != null)
            {
                using (var pg = Hud.Render.CreateGeometry())
                {
                    using (var gs = pg.Open())
                    {
                        gs.BeginFigure(new Vector2(screenCoord.X, screenCoord.Y), FigureBegin.Filled);
                        for (var angle = endAngle; angle <= startAngle + 360; angle += StepCount)
                        {
                            var mx     = rad * (float)Math.Cos(angle * Math.PI / 180.0f);
                            var my     = rad * (float)Math.Sin(angle * Math.PI / 180.0f);
                            var vector = new Vector2(screenCoord.X + mx, screenCoord.Y + my);
                            gs.AddLine(vector);
                        }

                        gs.EndFigure(FigureEnd.Closed);
                        gs.Close();
                    }

                    BackgroundBrushEmpty.DrawGeometry(pg);
                }
            }

            if (BorderBrush != null)
            {
                using (var pg = Hud.Render.CreateGeometry())
                {
                    using (var gs = pg.Open())
                    {
                        var mx = rad * (float)Math.Cos(0 * Math.PI / 180.0f);
                        var my = rad * (float)Math.Sin(0 * Math.PI / 180.0f);

                        gs.BeginFigure(new Vector2(screenCoord.X + mx, screenCoord.Y + my), FigureBegin.Hollow);
                        for (var angle = StepCount; angle <= 360; angle += StepCount)
                        {
                            mx = rad * (float)Math.Cos(angle * Math.PI / 180.0f);
                            my = rad * (float)Math.Sin(angle * Math.PI / 180.0f);
                            var vector = new Vector2(screenCoord.X + mx, screenCoord.Y + my);
                            gs.AddLine(vector);
                        }

                        gs.EndFigure(FigureEnd.Closed);
                        gs.Close();
                    }

                    BorderBrush.DrawGeometry(pg);
                }
            }
        }
Example #21
0
        public InventoryScreen(ScreenComponent manager) : base(manager)
        {
            assets = manager.Game.Assets;

            foreach (var item in manager.Game.DefinitionManager.GetDefinitions())
            {
                Texture2D texture = manager.Game.Assets.LoadTexture(item.GetType(), item.Icon);
                toolTextures.Add(item.GetType().FullName, texture);
            }

            player = manager.Player;

            IsOverlay  = true;
            Background = new BorderBrush(Color.Black * 0.3f);

            backgroundBrush = new BorderBrush(Color.Black);
            hoverBrush      = new BorderBrush(Color.Brown);

            Texture2D panelBackground = assets.LoadTexture(typeof(ScreenComponent), "panel");

            Grid grid = new Grid(manager)
            {
                Width  = 800,
                Height = 500,
            };

            grid.Columns.Add(new ColumnDefinition()
            {
                ResizeMode = ResizeMode.Fixed, Width = 600
            });
            grid.Columns.Add(new ColumnDefinition()
            {
                ResizeMode = ResizeMode.Fixed, Width = 200
            });
            grid.Rows.Add(new RowDefinition()
            {
                ResizeMode = ResizeMode.Parts, Height = 1
            });
            grid.Rows.Add(new RowDefinition()
            {
                ResizeMode = ResizeMode.Fixed, Height = 100
            });

            Controls.Add(grid);

            inventory = new InventoryControl(manager)
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
                Background          = NineTileBrush.FromSingleTexture(panelBackground, 30, 30),
                Padding             = Border.All(20),
            };

            grid.AddControl(inventory, 0, 0);

            StackPanel infoPanel = new StackPanel(manager)
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
                Background          = NineTileBrush.FromSingleTexture(panelBackground, 30, 30),
                Padding             = Border.All(20),
                Margin = Border.All(10, 0, 0, 0),
            };

            nameLabel = new Label(manager);
            infoPanel.Controls.Add(nameLabel);
            massLabel = new Label(manager);
            infoPanel.Controls.Add(massLabel);
            volumeLabel = new Label(manager);
            infoPanel.Controls.Add(volumeLabel);
            grid.AddControl(infoPanel, 1, 0);

            Grid toolbar = new Grid(manager)
            {
                Margin = Border.All(0, 10, 0, 0),
                Height = 100,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
                Background          = NineTileBrush.FromSingleTexture(panelBackground, 30, 30),
            };

            toolbar.Columns.Add(new ColumnDefinition()
            {
                ResizeMode = ResizeMode.Parts, Width = 1
            });
            for (int i = 0; i < ToolBarComponent.TOOLCOUNT; i++)
            {
                toolbar.Columns.Add(new ColumnDefinition()
                {
                    ResizeMode = ResizeMode.Fixed, Width = 50
                });
            }
            toolbar.Columns.Add(new ColumnDefinition()
            {
                ResizeMode = ResizeMode.Parts, Width = 1
            });
            toolbar.Rows.Add(new RowDefinition()
            {
                ResizeMode = ResizeMode.Parts, Height = 1
            });

            images = new Image[ToolBarComponent.TOOLCOUNT];
            for (int i = 0; i < ToolBarComponent.TOOLCOUNT; i++)
            {
                Image image = images[i] = new Image(manager)
                {
                    Width               = 42,
                    Height              = 42,
                    Background          = backgroundBrush,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    Tag     = i,
                    Padding = Border.All(2),
                };

                image.StartDrag += (e) =>
                {
                    InventorySlot slot = player.Toolbar.Tools[(int)image.Tag];
                    if (slot != null)
                    {
                        e.Handled = true;
                        e.Icon    = toolTextures[slot.Definition.GetType().FullName];
                        e.Content = slot;
                        e.Sender  = toolbar;
                    }
                };

                image.DropEnter += (e) => { image.Background = hoverBrush; };
                image.DropLeave += (e) => { image.Background = backgroundBrush; };
                image.EndDrop   += (e) =>
                {
                    e.Handled = true;

                    if (e.Sender is Grid) // && ShiftPressed
                    {
                        // Swap
                        int           targetIndex = (int)image.Tag;
                        InventorySlot targetSlot  = player.Toolbar.Tools[targetIndex];

                        InventorySlot sourceSlot  = e.Content as InventorySlot;
                        int           sourceIndex = player.Toolbar.GetSlotIndex(sourceSlot);

                        player.Toolbar.SetTool(sourceSlot, targetIndex);
                        player.Toolbar.SetTool(targetSlot, sourceIndex);
                    }
                    else
                    {
                        // Inventory Drop
                        InventorySlot slot = e.Content as InventorySlot;
                        player.Toolbar.SetTool(slot, (int)image.Tag);
                    }
                };

                toolbar.AddControl(image, i + 1, 0);
            }

            grid.AddControl(toolbar, 0, 1, 2);
            Title = Languages.OctoClient.Inventory;
        }
        public void PaintWorld(WorldLayer layer)
        {
            var players = Hud.Game.Players.Where(player => !player.IsMe && player.CoordinateKnown && (player.HeadStone == null));

            foreach (var player in players)
            {
                if (player == null)
                {
                    continue;
                }
                var ScreenWidth      = Hud.Window.Size.Width;
                var ScreenHeight     = Hud.Window.Size.Height;
                var HeroTexture      = Hud.Texture.GetTexture(890155253);
                var HPbarWidth       = (float)(ScreenWidth / 13);
                var HPbarHeight      = (float)(ScreenHeight / 130);
                var ResbarWidth      = (float)(ScreenWidth / 13);
                var ResbarHeight     = (float)(ScreenHeight / 200);
                var CurRes           = 0f;
                var CurRes2          = 0f;
                var ScreenCoordinate = player.FloorCoordinate.ToScreenCoordinate();
                var PlayerX          = ScreenCoordinate.X;
                var PlayerY          = ScreenCoordinate.Y;
                if (HPbar == true)
                {
                    var CurHealth = player.Defense.HealthCur / player.Defense.HealthMax;
                    BorderBrush.DrawRectangle(PlayerX - (float)HPbarWidth / 2, PlayerY - (float)(ScreenHeight / 16) / 2, HPbarWidth, HPbarHeight);
                    BackgroundBrush.DrawRectangle(PlayerX - (float)HPbarWidth / 2, PlayerY - (float)(ScreenHeight / 16) / 2, HPbarWidth, HPbarHeight);
                    HPbarBrush.DrawRectangle(PlayerX - (float)HPbarWidth / 2, PlayerY - (float)(ScreenHeight / 16) / 2, HPbarWidth * CurHealth, HPbarHeight);
                }

                if (player.HeroClassDefinition.HeroClass.ToString() == "Barbarian")
                {
                    if (Resbar == true)
                    {
                        CurRes = player.Stats.ResourceCurFury / player.Stats.ResourceMaxFury;
                        BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight);
                        FuryBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight);
                    }

                    if (player.HeroIsMale)
                    {
                        HeroTexture = Hud.Texture.GetTexture(3921484788);                    // male/female can't be determined, let's keep it for later...
                    }
                    else
                    {
                        HeroTexture = Hud.Texture.GetTexture(1030273087);
                    }
                }
                else if (player.HeroClassDefinition.HeroClass.ToString() == "Crusader")
                {
                    if (Resbar == true)
                    {
                        CurRes = player.Stats.ResourceCurWrath / player.Stats.ResourceMaxWrath;
                        BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight);
                        WrathBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight);
                    }
                    if (player.HeroIsMale)
                    {
                        HeroTexture = Hud.Texture.GetTexture(3742271755);
                    }
                    else
                    {
                        HeroTexture = Hud.Texture.GetTexture(3435775766);
                    }
                }
                else if (player.HeroClassDefinition.HeroClass.ToString() == "DemonHunter")
                {
                    if (Resbar == true)
                    {
                        CurRes  = player.Stats.ResourceCurHatred / player.Stats.ResourceMaxHatred;
                        CurRes2 = player.Stats.ResourceCurDiscipline / player.Stats.ResourceMaxDiscipline;
                        BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight);
                        HatreBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight);
                        BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 40) / 1.45f, ResbarWidth, ResbarHeight);
                        DisciplineBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 40) / 1.45f, ResbarWidth * CurRes2, ResbarHeight);
                    }
                    if (player.HeroIsMale)
                    {
                        HeroTexture = Hud.Texture.GetTexture(3785199803);
                    }
                    else
                    {
                        HeroTexture = Hud.Texture.GetTexture(2939779782);
                    }
                }
                else if (player.HeroClassDefinition.HeroClass.ToString() == "Monk")
                {
                    if (Resbar == true)
                    {
                        CurRes = player.Stats.ResourceCurSpirit / player.Stats.ResourceMaxSpirit;
                        BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight);
                        SpiritBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight);
                    }
                    if (player.HeroIsMale)
                    {
                        HeroTexture = Hud.Texture.GetTexture(2227317895);
                    }
                    else
                    {
                        HeroTexture = Hud.Texture.GetTexture(2918463890);
                    }
                }
                else if (player.HeroClassDefinition.HeroClass.ToString() == "Necromancer")
                {
                    if (Resbar == true)
                    {
                        CurRes = player.Stats.ResourceCurEssence / player.Stats.ResourceMaxEssence;
                        BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight);
                        EssenceBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight);
                    }
                    if (player.HeroIsMale)
                    {
                        HeroTexture = Hud.Texture.GetTexture(3285997023);
                    }
                    else
                    {
                        HeroTexture = Hud.Texture.GetTexture(473831658);
                    }
                }
                else if (player.HeroClassDefinition.HeroClass.ToString() == "WitchDoctor")
                {
                    if (Resbar == true)
                    {
                        CurRes = player.Stats.ResourceCurMana / player.Stats.ResourceMaxMana;
                        BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight);
                        ManaBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight);
                    }
                    if (player.HeroIsMale)
                    {
                        HeroTexture = Hud.Texture.GetTexture(3925954876);
                    }
                    else
                    {
                        HeroTexture = Hud.Texture.GetTexture(1603231623);
                    }
                }
                else if (player.HeroClassDefinition.HeroClass.ToString() == "Wizard")
                {
                    if (Resbar == true)
                    {
                        CurRes = player.Stats.ResourceCurArcane / player.Stats.ResourceMaxArcane;
                        BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight);
                        ArcaneBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight);
                    }
                    if (player.HeroIsMale)
                    {
                        HeroTexture = Hud.Texture.GetTexture(44435619);
                    }
                    else
                    {
                        HeroTexture = Hud.Texture.GetTexture(876580014);
                    }
                }

                if (Tag == true)
                {
                    string battleTag = player.BattleTagAbovePortrait;
                    if (battleTag == null)
                    {
                        continue;
                    }
                    TagDecorator.TextFunc = () => battleTag.ToString();
                    var BattleTagTexture = Hud.Texture.GetTexture(3098562643);
                    BattleTagTexture.Draw(PlayerX - (float)(ScreenWidth / 10) / 2, PlayerY - (float)(ScreenHeight / 7.8f) / 2, (float)(ScreenWidth / 10), (float)(ScreenHeight / 28), 0.7843f);
                    HeroTexture.Draw(PlayerX - (float)(Hud.Window.Size.Height / 31) / 2, PlayerY - (float)(ScreenHeight / 6.1f) / 2, (float)(ScreenHeight / 31), (float)(Hud.Window.Size.Height / 31), 1f);
                    TagDecorator.Paint(PlayerX - (float)(ScreenWidth / 11.5) / 2, PlayerY - (float)(ScreenHeight / 9.23f) / 2, (float)(ScreenWidth / 11.5), (float)(ScreenHeight / 45), HorizontalAlign.Center);
                }
            }
        }
Example #23
0
        public DebugControl(ScreenComponent screenManager)
            : base(screenManager)
        {
            framebuffer = new float[buffersize];
            Player      = screenManager.Player;

            //Get ResourceManager for further Information later...
            resMan = ResourceManager.Instance;

            //Brush for Debug Background
            BorderBrush bg = new BorderBrush(Color.Black * 0.2f);

            //The left side of the Screen
            leftView = new StackPanel(ScreenManager)
            {
                Background          = bg,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Top,
            };

            //The right Side of the Screen
            rightView = new StackPanel(ScreenManager)
            {
                Background          = bg,
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment   = VerticalAlignment.Top,
            };

            //Creating all Labels
            devText      = new Label(ScreenManager);
            devText.Text = Languages.OctoClient.DevelopmentVersion;
            leftView.Controls.Add(devText);

            loadedChunks = new Label(ScreenManager);
            leftView.Controls.Add(loadedChunks);

            loadedInfo = new Label(ScreenManager);
            leftView.Controls.Add(loadedInfo);

            position = new Label(ScreenManager);
            rightView.Controls.Add(position);

            rotation = new Label(ScreenManager);
            rightView.Controls.Add(rotation);

            fps = new Label(ScreenManager);
            rightView.Controls.Add(fps);

            controlInfo = new Label(ScreenManager);
            leftView.Controls.Add(controlInfo);

            temperatureInfo = new Label(ScreenManager);
            rightView.Controls.Add(temperatureInfo);

            precipitationInfo = new Label(ScreenManager);
            rightView.Controls.Add(precipitationInfo);

            activeTool = new Label(ScreenManager);
            rightView.Controls.Add(activeTool);

            toolCount = new Label(ScreenManager);
            rightView.Controls.Add(toolCount);

            flyInfo = new Label(ScreenManager);
            rightView.Controls.Add(flyInfo);

            //This Label gets added to the root and is set to Bottom Left
            box = new Label(ScreenManager);
            box.VerticalAlignment   = VerticalAlignment.Bottom;
            box.HorizontalAlignment = HorizontalAlignment.Left;
            box.TextColor           = Color.White;
            Controls.Add(box);

            //Add the left & right side to the root
            Controls.Add(leftView);
            Controls.Add(rightView);

            //Label Setup - Set Settings for all Labels in one place
            foreach (Control control in leftView.Controls)
            {
                control.HorizontalAlignment = HorizontalAlignment.Left;
                if (control is Label)
                {
                    ((Label)control).TextColor = Color.White;
                }
            }
            foreach (Control control in rightView.Controls)
            {
                control.HorizontalAlignment = HorizontalAlignment.Right;
                if (control is Label)
                {
                    ((Label)control).TextColor = Color.White;
                }
            }
        }
        private void DrawHealthBar(WorldLayer layer, IMonster m, ref float yref)
        {
            if (m.Rarity == ActorRarity.RareMinion && !ShowRareMinions)
            {
                return;                                                             //no minions
            }
            if (m.SummonerAcdDynamicId != 0)
            {
                return;                                                             //no clones
            }
            var wint = m.CurHealth / m.MaxHealth; string whptext;

            if ((wint < 0) || (wint > 1))
            {
                wint = 1; whptext = "bug";
            }
            else
            {
                whptext = (wint * 100).ToString(PercentageDescriptor) + "%";
            }
            var w   = wint * w2;
            var per = LightFont.GetTextLayout(whptext);

            var y = YPos + py * 8 * yref;

//            IBrush cBrush = null;
//            IFont cFont = null;
            cBrush = null;
            cFont  = null;

            //Brush selection
            switch (m.Rarity)
            {
            case ActorRarity.Boss:
                cBrush = BossBrush;
                break;

            case ActorRarity.Champion:
                cBrush = ChampionBrush;
                break;

            case ActorRarity.Rare:
                cBrush = RareBrush;
                break;

            case ActorRarity.RareMinion:
                cBrush = RareMinionBrush;
                break;

            default:
                cBrush = BackgroundBrush;
                break;
            }

            //Jugger Highlight
            if (JuggernautHighlight && m.Rarity == ActorRarity.Rare && HasAffix(m, MonsterAffix.Juggernaut))
            {
                cFont  = RedFont;
                cBrush = RareJuggerBrush;
            }
            else
            {
                cFont = NameFont;
            }

            //Missing Highlight
            if (MissingHighlight && (m.Rarity == ActorRarity.Champion || m.Rarity == ActorRarity.Rare) && !m.IsOnScreen)
            {
                var missing = RedFont.GetTextLayout("\u26A0");
                RedFont.DrawText(missing, XPos - 17, y - py);
            }

            //Circle Non-Clones and Boss
            if (CircleNonIllusion && m.SummonerAcdDynamicId == 0 && HasAffix(m, MonsterAffix.Illusionist) || m.Rarity == ActorRarity.Boss && ShowBossHitBox)
            {
                HitBoxDecorator.Paint(layer, m, m.FloorCoordinate, string.Empty);
            }

            string d = string.Empty;

            //Show Debuffs on Monster
            if (ShowDebuffAndCC)
            {
                string textDebuff = null;
                if (m.Locust)
                {
                    textDebuff += (textDebuff == null ? "" : ", ") + "Locust";
                }
                if (m.Palmed)
                {
                    textDebuff += (textDebuff == null ? "" : ", ") + "Palm";
                }
                if (m.Haunted)
                {
                    textDebuff += (textDebuff == null ? "" : ", ") + "Haunt";
                }
                if (m.MarkedForDeath)
                {
                    textDebuff += (textDebuff == null ? "" : ", ") + "Mark";
                }
                //if (m.Strongarmed) textDebuff += (textDebuff == null ? "" : ", ") + "Strongarm"; // No funciona, reemplazado por otro código
                if (m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_2_Visual_Effect_None, 318772) == 1) //318772  2   power: ItemPassive_Unique_Ring_590_x1
                {
                    textDebuff += (textDebuff == null ? "" : ", ") + "Strongarm";
                }
                string textCC = null;
                if (m.Frozen)
                {
                    textCC += (textCC == null ? "" : ", ") + "Frozen";
                }
                if (m.Chilled)
                {
                    textCC += (textCC == null ? "" : ", ") + "Chill";
                }
                if (m.Slow)
                {
                    textCC += (textCC == null ? "" : ", ") + "Slow";
                }
                if (m.Stunned)
                {
                    textCC += (textCC == null ? "" : ", ") + "Stun";
                }
                if (m.Invulnerable)
                {
                    textCC += (textCC == null ? "" : ", ") + "Invulnerable";
                }
                if (m.Blind)
                {
                    textCC += (textCC == null ? "" : ", ") + "Blind";
                }
                if (textDebuff != null)
                {
                    d = textDebuff;
                }
                if (textCC != null)
                {
                    d += ((d != string.Empty)? " | ":"") + textCC;
                }
            }
            if (ShowCurses)
            {
                string Curses = null;
                if (m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_2_Visual_Effect_None, 471845) == 1)     //471845 1 power: Frailty
                {
                    Curses += (Curses == null ? "" : " ") + "F";
                }
                if (m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_2_Visual_Effect_None, 471869) == 1)      //471869 1 power: Leech
                {
                    Curses += (Curses == null ? "" : " ") + "L";
                }
                if (m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_2_Visual_Effect_None, 471738) == 1)     //471738 1 power: Decrepify
                {
                    Curses += (Curses == null ? "" : " ") + "D";
                }
                if (Curses != null)
                {
                    d += ((d != string.Empty)? " | ":"") + Curses;
                }
            }
            if (d != string.Empty)
            {
                LightFont.DrawText(LightFont.GetTextLayout(d), XPos + 65 + w2, y - py);
            }

            //Draw Rectangles
            BackgroundBrush.DrawRectangle(XPos, y, w2, h);
            BorderBrush.DrawRectangle(XPos, y, w2, h);
            cBrush.DrawRectangle(XPos, y, (float)w, h);
            LightFont.DrawText(per, XPos + 8 + w2, y - py);

            //Draw MonsterType
            if (ShowMonsterType)
            {
                var name = cFont.GetTextLayout(m.SnoMonster.NameLocalized);
                cFont.DrawText(name, XPos + 3, y - py);
            }

            //increase linecount
            yref += 0.95f;
        }
Example #25
0
        private void DrawHealthBar(WorldLayer layer, IMonster m, ref float yref)
        {
            if (m.Rarity == ActorRarity.RareMinion && !ShowRareMinions)
            {
                return;                                                             //no minions
            }
            if (m.SummonerAcdDynamicId != 0)
            {
                return;                                                             //no clones
            }
            var    w      = m.CurHealth * w2 / m.MaxHealth;
            var    per    = LightFont.GetTextLayout((m.CurHealth * 100 / m.MaxHealth).ToString(PercentageDescriptor) + "%");
            var    y      = YPos + py * 8 * yref;
            IBrush cBrush = null;
            IFont  cFont  = null;

            //Brush selection
            switch (m.Rarity)
            {
            case ActorRarity.Boss:
                cBrush = BossBrush;
                break;

            case ActorRarity.Champion:
                cBrush = ChampionBrush;
                break;

            case ActorRarity.Rare:
                cBrush = RareBrush;
                break;

            case ActorRarity.RareMinion:
                cBrush = RareMinionBrush;
                break;

            default:
                cBrush = BackgroundBrush;
                break;
            }

            //Jugger Highlight
            if (JuggernautHighlight && m.Rarity == ActorRarity.Rare && HasAffix(m, MonsterAffix.Juggernaut))
            {
                cFont  = RedFont;
                cBrush = RareJuggerBrush;
            }
            else
            {
                cFont = NameFont;
            }

            //Missing Highlight
            if (MissingHighlight && (m.Rarity == ActorRarity.Champion || m.Rarity == ActorRarity.Rare) && !m.IsOnScreen)
            {
                var missing = RedFont.GetTextLayout("⚠");
                RedFont.DrawText(missing, XPos - 17, y - py);
            }

            //Circle Non-Clones and Boss
            //if (CircleNonIllusion && m.SummonerAcdDynamicId == 0 && HasAffix(m, MonsterAffix.Illusionist) || m.Rarity == ActorRarity.Boss && ShowBossHitBox)
            //        HitBoxDecorator.Paint(layer, m, m.FloorCoordinate, string.Empty);

            //Show Debuffs on Monster
            if (ShowDebuffAndCC)
            {
                string textDebuff = null;
                if (m.Locust)
                {
                    textDebuff += (textDebuff == null ? "" : ", ") + "Locust";
                }
                //if (m.Palmed) textDebuff += (textDebuff == null ? "" : ", ") + "Palm";
                if (m.Haunted)
                {
                    textDebuff += (textDebuff == null ? "" : ", ") + "Haunt";
                }
                if (m.MarkedForDeath)
                {
                    textDebuff += (textDebuff == null ? "" : ", ") + "Mark";
                }
                if (m.Strongarmed)
                {
                    textDebuff += (textDebuff == null ? "" : ", ") + "Strongarm";
                }
                string textCC = null;
                //if (m.Frozen) textCC += (textCC == null ? "" : ", ") + "Frozen";
                //if (m.Chilled) textCC += (textCC == null ? "" : ", ") + "Chill";
                //if (m.Slow) textCC += (textCC == null ? "" : ", ") + "Slow";
                //if (m.Stunned) textCC += (textCC == null ? "" : ", ") + "Stun";
                if (m.Invulnerable)
                {
                    textCC += (textCC == null ? "" : ", ") + "Invulnerable";
                }
                //if (m.Blind) textCC += (textCC == null ? "" : ", ") + "Blind";
                var d = LightFont.GetTextLayout(textDebuff + (textDebuff != null && textCC != null ? " | " : "") + textCC);
                LightFont.DrawText(d, XPos + 65 + w2, y - py);
            }

            //Draw Rectangles
            BackgroundBrush.DrawRectangle(XPos, y, w2, h);
            BorderBrush.DrawRectangle(XPos, y, w2, h);
            cBrush.DrawRectangle(XPos, y, (float)w, h);
            LightFont.DrawText(per, XPos + 8 + w2, y - py);

            //Draw MonsterType
            if (ShowMonsterType)
            {
                var name = cFont.GetTextLayout(m.SnoMonster.NameLocalized);
                cFont.DrawText(name, XPos + 3, y - py);
            }

            //increase linecount
            yref += 1.0f;
        }
Example #26
0
        public SplitScreen(IScreenManager manager) : base(manager)
        {
            Background = new BorderBrush(Color.Gray);                               //Hintergrundfarbe festlegen

            Button backButton = Button.TextButton(manager, "Back");                 //Neuen TextButton erzeugen

            backButton.HorizontalAlignment = HorizontalAlignment.Left;              //Links
            backButton.VerticalAlignment   = VerticalAlignment.Top;                 //Oben
            backButton.LeftMouseClick     += (s, e) => { manager.NavigateBack(); }; //KlickEvent festlegen
            Controls.Add(backButton);                                               //Button zum Screen hinzufügen



            //ScrollContainer
            ScrollContainer scrollContainer = new ScrollContainer(manager)  //Neuen ScrollContainer erzeugen
            {
                VerticalAlignment   = VerticalAlignment.Stretch,            // 100% Höhe
                HorizontalAlignment = HorizontalAlignment.Stretch           //100% Breite
            };

            Controls.Add(scrollContainer);                                  //ScrollContainer zum Root(Screen) hinzufügen



            //Stackpanel - SubControls werden Horizontal oder Vertikal gestackt
            StackPanel panel = new StackPanel(manager);                 //Neues Stackpanel erzeugen

            panel.VerticalAlignment = VerticalAlignment.Stretch;        //100% Höhe
            scrollContainer.Content = panel;                            //Ein Scroll Container kann nur ein Control beherbergen

            //Label
            Label label = new Label(manager)
            {
                Text = "Control Showcase"
            };                                                              //Neues Label erzeugen

            panel.Controls.Add(label);                                      //Label zu Panel hinzufügen

            Button tB = Button.TextButton(manager, "TEST");

            tB.Background = new TextureBrush(LoadTexture2DFromFile("./test_texture_round.png", manager.GraphicsDevice), TextureBrushMode.Stretch);
            panel.Controls.Add(tB);

            //Button
            Button button = Button.TextButton(manager, "Dummy Button"); //Neuen TextButton erzeugen

            panel.Controls.Add(button);                                 //Button zu Panel hinzufügen

            //Progressbar
            ProgressBar pr = new ProgressBar(manager)                   //Neue ProgressBar erzeugen
            {
                Value  = 99,                                            //Aktueller Wert
                Height = 20,                                            //Höhe
                Width  = 200                                            //Breite
            };

            panel.Controls.Add(pr);                                     //ProgressBar zu Panel hinzufügen

            //ListBox
            Listbox <string> list = new Listbox <string>(manager);      //Neue ListBox erstellen

            list.TemplateGenerator = (item) =>                          //Template Generator festlegen
            {
                return(new Label(manager)
                {
                    Text = item
                });                                                     //Control (Label) erstellen
            };
            panel.Controls.Add(list);                                   //Liste zu Panel hinzufügen

            list.Items.Add("Hallo");                                    //Items zur Liste hinzufügen
            list.Items.Add("Welt");                                     //...

            //Combobox
            Combobox <string> combobox = new Combobox <string>(manager) //Neue Combobox erstellen
            {
                Height = 20,                                            //Höhe 20
                Width  = 100                                            //Breite 100
            };

            combobox.TemplateGenerator = (item) =>                      //Template Generator festlegen
            {
                return(new Label(manager)
                {
                    Text = item
                });                                                     //Control (Label) erstellen
            };
            panel.Controls.Add(combobox);                               //Combobox zu Panel  hinzufügen

            combobox.Items.Add("Combobox");                             //Items zu Combobox hinzufügen
            combobox.Items.Add("Item");
            combobox.Items.Add("Hallo");


            Button clearCombobox = Button.TextButton(manager, "Clear Combobox");

            clearCombobox.LeftMouseClick += (s, e) => {
                combobox.Items.Clear();
                list.Items.Clear();
            };
            panel.Controls.Add(clearCombobox);

            //Slider Value Label
            Label labelSliderHorizontal = new Label(manager);

            //Horizontaler Slider
            Slider sliderHorizontal = new Slider(manager)
            {
                Width  = 150,
                Height = 20,
            };

            sliderHorizontal.ValueChanged += (value) => { labelSliderHorizontal.Text = "Value: " + value; }; //Event on Value Changed
            panel.Controls.Add(sliderHorizontal);
            labelSliderHorizontal.Text = "Value: " + sliderHorizontal.Value;                                 //Set Text initially
            panel.Controls.Add(labelSliderHorizontal);

            //Slider Value Label
            Label labelSliderVertical = new Label(manager);

            //Vertikaler Slider
            Slider sliderVertical = new Slider(manager)
            {
                Range       = 100,
                Height      = 200,
                Width       = 20,
                Orientation = Orientation.Vertical
            };

            sliderVertical.ValueChanged += (value) => { labelSliderVertical.Text = "Value: " + value; };
            panel.Controls.Add(sliderVertical);
            labelSliderVertical.Text = "Value: " + sliderVertical.Value;
            panel.Controls.Add(labelSliderVertical);

            Checkbox checkbox = new Checkbox(manager);

            panel.Controls.Add(checkbox);

            //Textbox
            Textbox textbox = new Textbox(manager)                      //Neue TextBox erzeugen
            {
                Background        = new BorderBrush(Color.LightGray),   //Festlegen eines Backgrounds für ein Control
                VerticalAlignment = VerticalAlignment.Stretch,          //100% Breite
                Text     = "TEXTBOX!",                                  //Voreingestellter text
                MinWidth = 100                                          //Eine Textbox kann ihre Größe automatisch anpassen
            };

            panel.Controls.Add(textbox);                                //Textbox zu Panel hinzufügen
        }
Example #27
0
        public void PaintWorld(WorldLayer layer)
        {
            var w1           = Hud.Window.Size.Width * 0.00333f * b;
            var textLocust   = "虫群"; //"L"
            var layoutLocust = TextFontLocust.GetTextLayout(textLocust);
            var textHaunt    = "蚀魂"; //"H"
            var layoutHaunt  = TextFontHaunt.GetTextLayout(textHaunt);
            var h2           = Hud.Window.Size.Height * 0.017f;
            var x2           = Hud.Window.Size.Width * 0.001667f * b;
            var x3           = Hud.Window.Size.Width * 0.02f;


            var monsters = Hud.Game.AliveMonsters;

            foreach (var monster in monsters)
            {
                bool illusionist = false;
                if (monster.SummonerAcdDynamicId == 0)
                {
                    illusionist = false;
                }
                else
                {
                    illusionist = true;
                }
                if (monster.Rarity == ActorRarity.Champion)
                {
                    if (illusionist == false)
                    {
                        var hptext   = (monster.CurHealth * 100 / monster.MaxHealth).ToString("f0") + "%";
                        var layout   = TextFont.GetTextLayout(hptext);
                        var h        = Hud.Window.Size.Height * 0.00034f * 35;
                        var w        = monster.CurHealth * w1 / monster.MaxHealth;
                        var monsterX = monster.FloorCoordinate.ToScreenCoordinate().X; // - w1 / 2;
                        var monsterY = monster.FloorCoordinate.ToScreenCoordinate().Y; // + py * 14;
                        var locustX  = monsterX + x3 * 0.1f;
                        var hauntX   = monsterX - x3;
                        var buffY    = monsterY - h2 * 2f;
                        var hpX      = monsterX - 1.5f;
                        if (monster.Invulnerable)
                        {
                            BorderBrush.DrawRectangle(monsterX - x2, monsterY + h2, w1, h);
                        }
                        BackgroundBrush.DrawRectangle(monsterX - x2, monsterY + h2, w1, h);
                        if (monster.Rarity == ActorRarity.Champion)
                        {
                            ChampionBrush.DrawRectangle(monsterX - x2, monsterY + h2, (float)w, h);
                        }
                        if (monster.Locust)
                        {
                            TextFontLocust.DrawText(layoutLocust, locustX, buffY);
                        }
                        if (monster.Haunted)
                        {
                            TextFontHaunt.DrawText(layoutHaunt, hauntX, buffY);
                        }
                        TextFont.DrawText(layout, hpX, monsterY + h2 / 1.2f);
                    }
                }
                if (monster.Rarity == ActorRarity.Rare)
                {
                    if (illusionist == false)
                    {
                        var hptext   = (monster.CurHealth * 100 / monster.MaxHealth).ToString("f0") + "%";
                        var layout   = TextFont.GetTextLayout(hptext);
                        var h        = Hud.Window.Size.Height * 0.00034f * 35;
                        var w        = monster.CurHealth * w1 / monster.MaxHealth;
                        var monsterX = monster.FloorCoordinate.ToScreenCoordinate().X; // - w1 / 2;
                        var monsterY = monster.FloorCoordinate.ToScreenCoordinate().Y; // + py * 14;
                        var locustX  = monsterX + x3 * 0.1f;
                        var hauntX   = monsterX - x3;
                        var buffY    = monsterY - h2 * 2f;
                        var hpX      = monsterX - 1.5f;
                        if (monster.Invulnerable)
                        {
                            BorderBrush.DrawRectangle(monsterX - x2, monsterY + h2, w1, h);
                        }
                        BackgroundBrush.DrawRectangle(monsterX - x2, monsterY + h2, w1, h);
                        if (monster.Rarity == ActorRarity.Rare)
                        {
                            RareBrush.DrawRectangle(monsterX - x2, monsterY + h2, (float)w, h);
                        }
                        if (monster.Locust)
                        {
                            TextFontLocust.DrawText(layoutLocust, locustX, buffY);
                        }
                        if (monster.Haunted)
                        {
                            TextFontHaunt.DrawText(layoutHaunt, hauntX, buffY);
                        }
                        TextFont.DrawText(layout, hpX, monsterY + h2 / 1.2f);
                    }
                }
            }
        }
Example #28
0
        public void Paint(float x, float y, float w, float h, HorizontalAlign align)
        {
            if (!Enabled)
            {
                return;
            }
            if (TextFont == null)
            {
                return;
            }

            var text = TextFunc != null?TextFunc.Invoke() : null;

            var hint = HintFunc != null?HintFunc.Invoke() : null;

            if (string.IsNullOrEmpty(text) && HideBackgroundWhenTextIsEmpty)
            {
                return;
            }

            if (Hud.Window.CursorInsideRect(x, y, w, h))
            {
                var expanded = false;
                if (ExpandUpLabels != null && ExpandUpLabels.Count > 0)
                {
                    var ly = y - h;
                    foreach (var label in ExpandUpLabels)
                    {
                        label.Paint(x, ly, w, h, align);
                        label.PaintExpandedHint(x + w, ly, w * label.ExpandedHintWidthMultiplier, h, HorizontalAlign.Center);
                        ly      -= h;
                        expanded = true;
                    }
                    this.PaintExpandedHint(x + w, y, w * 3, h, HorizontalAlign.Center);
                }
                if (ExpandDownLabels != null && ExpandDownLabels.Count > 0)
                {
                    var ly = y + h;
                    foreach (var label in ExpandDownLabels)
                    {
                        label.Paint(x, ly, w, h, align);
                        label.PaintExpandedHint(x + w, ly, w * label.ExpandedHintWidthMultiplier, h, HorizontalAlign.Center);
                        ly      += h;
                        expanded = true;
                    }
                    this.PaintExpandedHint(x + w, y, w * 3, h, HorizontalAlign.Center);
                }
                if (ExpandRightLabels != null && ExpandRightLabels.Count > 0)
                {
                    var lx = x + w;
                    foreach (var label in ExpandRightLabels)
                    {
                        label.Paint(lx, y, w, h, align);
                        lx      += h;
                        expanded = true;
                    }
                }
                if (ExpandLeftLabels != null && ExpandLeftLabels.Count > 0)
                {
                    var lx = x - w;
                    foreach (var label in ExpandLeftLabels)
                    {
                        label.Paint(lx, y, w, h, align);
                        lx      -= h;
                        expanded = true;
                    }
                }

                if (!expanded)
                {
                    if (!string.IsNullOrEmpty(hint))
                    {
                        Hud.Render.SetHint(hint);
                    }
                }
            }

            if (BackgroundTexture1 != null)
            {
                BackgroundTexture1.Draw(x, y, w, h, BackgroundTextureOpacity1);
            }

            if (BackgroundTexture2 != null)
            {
                BackgroundTexture2.Draw(x, y, w, h, BackgroundTextureOpacity2);
            }

            if (BackgroundBrush != null)
            {
                BackgroundBrush.DrawRectangle(x, y, w, h);
            }

            if (!string.IsNullOrEmpty(text))
            {
                var layout = TextFont.GetTextLayout(text);
                switch (align)
                {
                case HorizontalAlign.Left:
                    TextFont.DrawText(layout, x, y + (h - layout.Metrics.Height) / 2);
                    break;

                case HorizontalAlign.Center:
                    TextFont.DrawText(layout, x + (w - layout.Metrics.Width) / 2, y + (h - layout.Metrics.Height) / 2);
                    break;

                case HorizontalAlign.Right:
                    TextFont.DrawText(layout, x + w - layout.Metrics.Width, y + (h - layout.Metrics.Height) / 2);
                    break;
                }
            }

            if (BorderBrush != null)
            {
                BorderBrush.DrawRectangle(x, y, w, h);
            }
        }
        public void PaintWorld(WorldLayer layer)
        {
            var             h             = 17;
            var             w1            = 30;
            var             textLocust    = "L";
            var             layoutLocust  = TextFontLocust.GetTextLayout(textLocust);
            var             textHaunt     = "H";
            var             layoutHaunt   = TextFontHaunt.GetTextLayout(textHaunt);
            var             py            = Hud.Window.Size.Height / 600;
            var             monsters      = Hud.Game.AliveMonsters.Where(x => x.IsAlive);
            List <IMonster> monstersElite = new List <IMonster>();

            foreach (var monster in monsters)
            {
                if (monster.SummonerAcdDynamicId == 0)
                {
                    if (monster.Rarity == ActorRarity.Champion || monster.Rarity == ActorRarity.Rare)
                    {
                        monstersElite.Add(monster);
                    }
                }
            }
            foreach (var monster in monstersElite)
            {
                var hptext   = ValueToString(monster.CurHealth * 100 / monster.MaxHealth, ValueFormat.NormalNumberNoDecimal);
                var layout   = TextFont.GetTextLayout(hptext);
                var w        = monster.CurHealth * w1 / monster.MaxHealth;
                var monsterX = monster.FloorCoordinate.ToScreenCoordinate().X - w1 / 2;
                var monsterY = monster.FloorCoordinate.ToScreenCoordinate().Y + py * 12;
                var locustX  = monsterX - w1 / 2;
                var hauntX   = monsterX + w1 + 5;
                var buffY    = monsterY - 1;
                var hpX      = monsterX + 7;

                BorderBrush.DrawRectangle(monsterX, monsterY, w1, h);
                BackgroundBrush.DrawRectangle(monsterX, monsterY, w1, h);
                if (monster.Rarity == ActorRarity.Champion)
                {
                    ChampionBrush.DrawRectangle(monsterX, monsterY, (float)w, h);
                }
                if (monster.Rarity == ActorRarity.Rare)
                {
                    bool flagJ = false;
                    foreach (var snoMonsterAffix in monster.AffixSnoList)
                    {
                        if (snoMonsterAffix.Affix == MonsterAffix.Juggernaut)
                        {
                            flagJ = true;
                            break;
                        }
                    }
                    if (flagJ)
                    {
                        RareJBrush.DrawRectangle(monsterX, monsterY, (float)w, h);
                    }
                    else
                    {
                        RareBrush.DrawRectangle(monsterX, monsterY, (float)w, h);
                    }
                }
                if (monster.Locust)
                {
                    TextFontLocust.DrawText(layoutLocust, locustX, buffY);
                }
                if (monster.Haunted)
                {
                    TextFontHaunt.DrawText(layoutHaunt, hauntX, buffY);
                }
                TextFont.DrawText(layout, hpX, buffY);
            }
            monstersElite.Clear();
        }
Example #30
0
        public void PaintWorld(WorldLayer layer)
        {
            var monsters = Hud.Game.AliveMonsters;
            Dictionary <IMonster, string> eliteGroup = new Dictionary <IMonster, string>();

            foreach (var monster in monsters)
            {
                if (monster.Rarity == ActorRarity.Champion || monster.Rarity == ActorRarity.Rare)
                {
                    if (eliteGroup.ContainsKey(monster))
                    {
                        eliteGroup[monster] = monster.SnoMonster.Priority.ToString() + monster.SnoMonster.Sno + monster.SnoMonster.NameEnglish + String.Join(", ", monster.AffixSnoList);
                    }
                    else
                    {
                        eliteGroup.Add(monster, monster.SnoMonster.Priority.ToString() + monster.SnoMonster.Sno + monster.SnoMonster.NameEnglish + String.Join(", ", monster.AffixSnoList));
                    }
                }
            }
            Dictionary <IMonster, string> eliteGroup1 = eliteGroup.OrderBy(p => p.Value).ToDictionary(p => p.Key, o => o.Value);
            var    px     = Hud.Window.Size.Width * 0.00125f;
            var    py     = Hud.Window.Size.Height * 0.001667f;
            var    h      = py * 5;
            var    w2     = py * 50;
            var    count  = 0;
            string preStr = null;

            //remove clone
            foreach (var elite in eliteGroup1)
            {
                if (elite.Key.Illusion)
                {
                    continue;
                }
                if (elite.Key.Rarity == ActorRarity.Champion)
                {
                    var x         = Hud.Window.Size.Width * 0.125f;
                    var w         = elite.Key.CurHealth * w2 / elite.Key.MaxHealth;
                    var affixlist = "";
                    foreach (var Affix in elite.Key.AffixSnoList)
                    {
                        affixlist = affixlist + " " + Affix.NameLocalized;
                    }
                    var text   = (elite.Key.CurHealth * 100 / elite.Key.MaxHealth).ToString("f1") + "% " + elite.Key.SnoMonster.NameLocalized + affixlist;
                    var layout = TextFont.GetTextLayout(text);
                    if (preStr != elite.Value || preStr == null)
                    {
                        count++;
                    }
                    var y = py * 8 * count;
                    if (elite.Key.Invulnerable)
                    {
                        BorderBrush.DrawRectangle(x, y, w2, h);
                    }
                    BackgroundBrush.DrawRectangle(x, y, w2, h);
                    TextFont.DrawText(layout, x + px + w2, y - py);
                    ChampionBrush.DrawRectangle(x, y, (float)w, h);
                    preStr = elite.Value;
                    count++;
                }
                if (elite.Key.Rarity == ActorRarity.Rare)
                {
                    var x         = Hud.Window.Size.Width * 0.125f;
                    var w         = elite.Key.CurHealth * w2 / elite.Key.MaxHealth;
                    var affixlist = "";
                    foreach (var Affix in elite.Key.AffixSnoList)
                    {
                        affixlist = affixlist + " " + Affix.NameLocalized;
                    }
                    var text   = (elite.Key.CurHealth * 100 / elite.Key.MaxHealth).ToString("f1") + "% " + elite.Key.SnoMonster.NameLocalized + affixlist;
                    var layout = TextFont.GetTextLayout(text);
                    if (preStr != elite.Value || preStr == null)
                    {
                        count++;
                    }
                    var y = py * 8 * count;
                    if (elite.Key.Invulnerable)
                    {
                        BorderBrush.DrawRectangle(x, y, w2, h);
                    }
                    BackgroundBrush.DrawRectangle(x, y, w2, h);
                    TextFont.DrawText(layout, x + px + w2, y - py);
                    RareBrush.DrawRectangle(x, y, (float)w, h);
                    preStr = elite.Value;
                    count++;
                }
            }
            eliteGroup.Clear();
            eliteGroup1.Clear();
        }