Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HudButton"/> class.
 /// </summary>
 /// <param name="text">The text of the button</param>
 /// <param name="x">The x.</param>
 /// <param name="y">The y.</param>
 /// <param name="Parent">The parent.</param>
 /// <param name="bitmap">The Bitmap for the button</param>
 public HudButton(string text, int x, int y, HudPanel Parent, Bitmap bitmap = null)
 {
     this.ButtonText   = text;
     this.Parent       = Parent;
     this.ButtonBitmap = bitmap ?? Resources.Button;
     this.X            = x;
     this.Y            = y;
 }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HudButton"/> class.
 /// </summary>
 /// <param name="text">The text of the button</param>
 /// <param name="position">The position.</param>
 /// <param name="Parent">The parent.</param>
 /// <param name="bitmap">The button bitmap</param>
 public HudButton(string text, Vector2 position, HudPanel Parent, Bitmap bitmap = null)
 {
     this.ButtonText   = text;
     this.Parent       = Parent;
     this.ButtonBitmap = bitmap ?? Resources.Button;
     this.X            = (int)position.X;
     this.Y            = (int)position.Y;
 }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HudButton"/> class.
 /// </summary>
 /// <param name="text">The text of the button</param>
 /// <param name="position">The position.</param>
 /// <param name="Parent">The parent.</param>
 /// <param name="bitmap">The button bitmap</param>
 public HudButton(string text, Vector2 position, HudPanel Parent, Bitmap bitmap = null)
 {
     this.ButtonText = text;
     this.Parent = Parent;
     this.ButtonBitmap = bitmap??Resources.Button;
     this.X = (int) position.X;
     this.Y = (int)position.Y;
 }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HudButton"/> class.
 /// </summary>
 /// <param name="text">The text of the button</param>
 /// <param name="x">The x.</param>
 /// <param name="y">The y.</param>
 /// <param name="Parent">The parent.</param>
 /// <param name="bitmap">The Bitmap for the button</param>
 public HudButton(string text, int x, int y, HudPanel Parent, Bitmap bitmap = null)
 {
     this.ButtonText = text;
     this.Parent = Parent;
     this.ButtonBitmap = bitmap ?? Resources.Button;
     this.X = x;
     this.Y = y;
 }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HudButton"/> class.
 /// </summary>
 /// <param name="position">The position.</param>
 /// <param name="Parent">The parent.</param>
 /// <param name="bitmap">The button bitmap</param>
 /// <param name="disanchor"></param>
 protected HudButton(Vector2 position, HudPanel Parent, Bitmap bitmap = null, bool disanchor = false)
 {
     this.Parent       = Parent;
     this.ButtonBitmap = bitmap;
     Position          = disanchor ?
                         new Vector2(HudVariables.CurrentPosition.X + position.X, HudVariables.CurrentPosition.Y + position.Y) :
                         new Vector2(Parent.Position.X + position.X, Parent.Position.Y + position.Y);
     HudVariables.HudElements.Add(this);
 }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HudButton"/> class.
 /// </summary>
 /// <param name="position">The position.</param>
 /// <param name="Parent">The parent.</param>
 /// <param name="bitmap">The button bitmap</param>
 /// <param name="disanchor"></param>
 protected HudButton(Vector2 position, HudPanel Parent, Bitmap bitmap = null, bool disanchor = false)
 {
     this.Parent = Parent;
     this.ButtonBitmap = bitmap;
     Position = disanchor ?
         new Vector2(HudVariables.CurrentPosition.X + position.X, HudVariables.CurrentPosition.Y + position.Y) :
         new Vector2(Parent.Position.X + position.X, Parent.Position.Y + position.Y);
     HudVariables.HudElements.Add(this);
 }
Пример #7
0
        /// <summary>
        /// Called when the module is loaded.
        /// </summary>
        public static void OnLoad()
        {
            try
            {
                var hudPanel = new HudPanel("Teamfight Helper", 10, 10, 250, 200);
                {
                    TFHelperVariables.AllyBarSprite = new Render.Sprite(Resources.AllyTeamStrength,
                        new Vector2(hudPanel.Position.X + 3, hudPanel.Position.Y + 15))
                    {
                        PositionUpdate = () => new Vector2(hudPanel.Position.X + 5, hudPanel.Position.Y + 18),
                        Visible = true,
                        Scale = new Vector2(0.95f, 0.95f),
                        VisibleCondition = delegate
                        {
                            return getCheckBoxItem(TFHelperBase.moduleMenu, "dz191.dza.tf.enabled") && HudVariables.ShouldBeVisible && HudVariables.CurrentStatus == SpriteStatus.Expanded;
                        }
                    };

                    TFHelperVariables.EnemyBarSprite = new Render.Sprite(Resources.EnemyTeamStength,
                        new Vector2(hudPanel.Position.X + 3, hudPanel.Position.Y + 36))
                    {
                        PositionUpdate = () => new Vector2(hudPanel.Position.X + 5, hudPanel.Position.Y + 48),
                        Visible = true,
                        Scale = new Vector2(0.95f, 0.95f),
                        VisibleCondition = delegate
                        {
                            return getCheckBoxItem(TFHelperBase.moduleMenu, "dz191.dza.tf.enabled") && HudVariables.ShouldBeVisible && HudVariables.CurrentStatus == SpriteStatus.Expanded;
                        }
                    };

                    TFHelperVariables.AllyStrengthText = new Render.Text(
                        "",
                        new Vector2(0, 0), 19, Color.White)
                    {
                        Centered = true,
                        PositionUpdate =
                            () =>
                                new Vector2(
                                    TFHelperVariables.AllyBarSprite.Position.X +
                                    TFHelperVariables.AllyBarSprite.Width/2f,
                                    TFHelperVariables.AllyBarSprite.Position.Y +
                                    TFHelperVariables.AllyBarSprite.Height/2f),
                        TextUpdate = () => $"{TFHelperCalculator.GetAllyStrength()*100} %",
                        VisibleCondition = delegate
                        {
                            return getCheckBoxItem(TFHelperBase.moduleMenu, "dz191.dza.tf.enabled") && HudVariables.ShouldBeVisible && HudVariables.CurrentStatus == SpriteStatus.Expanded;
                        }
                    };

                    TFHelperVariables.EnemyStrengthText = new Render.Text(
                        "",
                        new Vector2(0, 0), 19, Color.White)
                    {
                        Centered = true,
                        PositionUpdate =
                            () =>
                                new Vector2(
                                    TFHelperVariables.EnemyBarSprite.Position.X +
                                    TFHelperVariables.EnemyBarSprite.Width/2f,
                                    TFHelperVariables.EnemyBarSprite.Position.Y +
                                    TFHelperVariables.EnemyBarSprite.Height/2f),
                        TextUpdate = () => $"{TFHelperCalculator.GetEnemyStrength()*100} %",
                        VisibleCondition = delegate
                        {
                            return getCheckBoxItem(TFHelperBase.moduleMenu, "dz191.dza.tf.enabled") && HudVariables.ShouldBeVisible && HudVariables.CurrentStatus == SpriteStatus.Expanded;
                        }
                    };

                    TFHelperVariables.TeamsVSText = new Render.Text("", new Vector2(0, 0), 19, Color.White)
                    {
                        Centered = true,
                        TextUpdate = () => TFHelperCalculator.GetText(),
                        PositionUpdate =
                            () =>
                                new Vector2(hudPanel.Position.X + hudPanel.Width/2f,
                                    hudPanel.Position.Y + hudPanel.Height/2f - 12),
                        VisibleCondition = delegate
                        {
                            return getCheckBoxItem(TFHelperBase.moduleMenu, "dz191.dza.tf.enabled") && HudVariables.ShouldBeVisible && HudVariables.CurrentStatus == SpriteStatus.Expanded;
                        }
                    };

                    TFHelperVariables.AllyBarSprite.Add(3);
                    TFHelperVariables.EnemyBarSprite.Add(3);
                    TFHelperVariables.AllyStrengthText.Add(4);
                    TFHelperVariables.EnemyStrengthText.Add(4);
                    TFHelperVariables.TeamsVSText.Add(4);

                    Game.OnUpdate += OnUpdate;
                }
            }
            catch (Exception e)
            {
                LogHelper.AddToLog(new LogItem("TFHelper_Drawings", e, LogSeverity.Error));
            }
        }