diff --git a/Core/Constants.cs b/Core/Constants.cs index 8363b58..c8211a6 100644 --- a/Core/Constants.cs +++ b/Core/Constants.cs @@ -19,8 +19,10 @@ namespace LeagueSharp.SDK.Core { using System; using System.IO; + + using LeagueSharp.SDK.Core.Utils; + using SharpDX.Direct3D9; - using Utils; /// /// Constant values of LeagueSharp.SDK diff --git a/Core/Enumerations/CastTypes.cs b/Core/Enumerations/CastTypes.cs index 4b77a8e..dee742e 100644 --- a/Core/Enumerations/CastTypes.cs +++ b/Core/Enumerations/CastTypes.cs @@ -18,83 +18,83 @@ namespace LeagueSharp.SDK.Core.Enumerations { /// - /// Indicates how a spell can be casted + /// Indicates how a spell can be casted /// public enum CastType { /// - /// The spell can be casted on an enemy champion + /// The spell can be casted on an enemy champion /// EnemyChampions, /// - /// The spell can be casted on an enemy minion + /// The spell can be casted on an enemy minion /// EnemyMinions, /// - /// The spell can be casted on an enemy tower + /// The spell can be casted on an enemy tower /// EnemyTurrets, /// - /// The spell can be casted on an ally champion + /// The spell can be casted on an ally champion /// AllyChampions, /// - /// The spell can be casted on an ally minion + /// The spell can be casted on an ally minion /// AllyMinions, /// - /// The spell can be casted on an ally turret + /// The spell can be casted on an ally turret /// AllyTurrets, /// - /// The spell can be casted only on pets. + /// The spell can be casted only on pets. /// HeroPets, /// - /// The spell can be casted on a position + /// The spell can be casted on a position /// Position, /// - /// The spell can be casted in a direction + /// The spell can be casted in a direction /// Direction, /// - /// The spell can be casted on self + /// The spell can be casted on self /// Self, /// - /// The spell is a charging spell + /// The spell is a charging spell /// Charging, /// - /// The spell is a toggleable spell + /// The spell is a toggleable spell /// Toggle, /// - /// The spell is a channel + /// The spell is a channel /// Channel, /// - /// The spell is activable + /// The spell is activable /// Activate, /// - /// The spell can't be casted + /// The spell can't be casted /// ImpossibleToCast } -} +} \ No newline at end of file diff --git a/Core/Enumerations/CenteredFlags.cs b/Core/Enumerations/CenteredFlags.cs index f6dea4e..cf3d733 100644 --- a/Core/Enumerations/CenteredFlags.cs +++ b/Core/Enumerations/CenteredFlags.cs @@ -28,32 +28,32 @@ public enum CenteredFlags /// /// None Flag /// - None = 0, + None = 0, /// /// Center Horizontally Left. /// - HorizontalLeft = 1 << 0, + HorizontalLeft = 1 << 0, /// /// Center Horizontally. /// - HorizontalCenter = 1 << 1, + HorizontalCenter = 1 << 1, /// /// Center Horizontally Right. /// - HorizontalRight = 1 << 2, + HorizontalRight = 1 << 2, /// /// Center Vertically Up. /// - VerticalUp = 1 << 3, + VerticalUp = 1 << 3, /// /// Center Vertically. /// - VerticalCenter = 1 << 4, + VerticalCenter = 1 << 4, /// /// Center Vertically Down. diff --git a/Core/Enumerations/DangerLevel.cs b/Core/Enumerations/DangerLevel.cs index 365fe4b..3cc7768 100644 --- a/Core/Enumerations/DangerLevel.cs +++ b/Core/Enumerations/DangerLevel.cs @@ -25,12 +25,12 @@ public enum DangerLevel /// /// Low danger level /// - Low, + Low, /// /// Medium danger level, should be interrupted /// - Medium, + Medium, /// /// High danger level, definitely should be interrupted diff --git a/Core/Enumerations/DrawType.cs b/Core/Enumerations/DrawType.cs index fb3508e..248fbcf 100644 --- a/Core/Enumerations/DrawType.cs +++ b/Core/Enumerations/DrawType.cs @@ -28,12 +28,12 @@ public enum DrawType /// /// The OnBeginScene drawing type. /// - OnBeginScene, + OnBeginScene, /// /// The OnDraw drawing type. /// - OnDraw, + OnDraw, /// /// The OnEndScene drawing type. diff --git a/Core/Enumerations/GapcloserType.cs b/Core/Enumerations/GapcloserType.cs index e3f68a0..1496107 100644 --- a/Core/Enumerations/GapcloserType.cs +++ b/Core/Enumerations/GapcloserType.cs @@ -25,7 +25,7 @@ public enum GapcloserType /// /// Skillshot Spell /// - Skillshot, + Skillshot, /// /// Targeted Spell diff --git a/Core/Enumerations/HealthPredictionType.cs b/Core/Enumerations/HealthPredictionType.cs index a4f3630..7ca06c2 100644 --- a/Core/Enumerations/HealthPredictionType.cs +++ b/Core/Enumerations/HealthPredictionType.cs @@ -25,7 +25,7 @@ public enum HealthPredictionType /// /// Default Prediction /// - Default, + Default, /// /// Simulated Prediction diff --git a/Core/Enumerations/HitChance.cs b/Core/Enumerations/HitChance.cs index 1735d7c..45bb3ea 100644 --- a/Core/Enumerations/HitChance.cs +++ b/Core/Enumerations/HitChance.cs @@ -25,47 +25,47 @@ public enum HitChance /// /// Target is immobile, skillshot will hit. /// - Immobile = 8, + Immobile = 8, /// /// Target is dashing to a known location, skillshot will hit. /// - Dashing = 7, + Dashing = 7, /// /// Very High Prediction output, skillshot will probably hit. /// - VeryHigh = 6, + VeryHigh = 6, /// /// High Prediction output, skillshot will probably hit. /// - High = 5, + High = 5, /// /// Medium Prediction output, accuracy considered low. /// - Medium = 4, + Medium = 4, /// /// Low Prediction output, accuracy considered low. /// - Low = 3, + Low = 3, /// /// Impossible Hit. /// - Impossible = 2, + Impossible = 2, /// /// skillshot is out of range. /// - OutOfRange = 1, + OutOfRange = 1, /// /// Collision before hit onto target. /// - Collision = 0, + Collision = 0, /// /// No HitChance. diff --git a/Core/Enumerations/JungleType.cs b/Core/Enumerations/JungleType.cs index d813a2c..41d478e 100644 --- a/Core/Enumerations/JungleType.cs +++ b/Core/Enumerations/JungleType.cs @@ -25,17 +25,17 @@ public enum JungleType /// /// The unknown type. /// - Unknown, + Unknown, /// /// The small type. /// - Small, + Small, /// /// The large type. /// - Large, + Large, /// /// The legendary type. diff --git a/Core/Enumerations/KeyBindType.cs b/Core/Enumerations/KeyBindType.cs index 91df039..96c5891 100644 --- a/Core/Enumerations/KeyBindType.cs +++ b/Core/Enumerations/KeyBindType.cs @@ -25,7 +25,7 @@ public enum KeyBindType /// /// Toggle Key Bind. /// - Toggle, + Toggle, /// /// Press Key Bind diff --git a/Core/Enumerations/LogLevel.cs b/Core/Enumerations/LogLevel.cs index 2e5c803..e92c084 100644 --- a/Core/Enumerations/LogLevel.cs +++ b/Core/Enumerations/LogLevel.cs @@ -25,27 +25,27 @@ public enum LogLevel /// /// Debug Information /// - Debug = 2, + Debug = 2, /// /// An error occurred somewhere in the code (exception) /// - Error = 5, + Error = 5, /// /// An error occurred and the program is unable to proceed /// - Fatal = 6, + Fatal = 6, /// /// General information /// - Info = 1, + Info = 1, /// /// Current location of the program /// - Trace = 3, + Trace = 3, /// /// Warning level diff --git a/Core/Enumerations/NotificationIconType.cs b/Core/Enumerations/NotificationIconType.cs index a4767fb..bde6a17 100644 --- a/Core/Enumerations/NotificationIconType.cs +++ b/Core/Enumerations/NotificationIconType.cs @@ -25,22 +25,22 @@ public enum NotificationIconType /// /// No Icon. /// - None = 0, + None = 0, /// /// Error Icon. /// - Error = 1, + Error = 1, /// /// Warning Icon. /// - Warning = 2, + Warning = 2, /// /// Check Icon. /// - Check = 3, + Check = 3, /// /// Select Icon. diff --git a/Core/Enumerations/PerformanceType.cs b/Core/Enumerations/PerformanceType.cs index 010d91e..579dd25 100644 --- a/Core/Enumerations/PerformanceType.cs +++ b/Core/Enumerations/PerformanceType.cs @@ -25,12 +25,12 @@ public enum PerformanceType /// /// Logs the Tick Count(CPU Ticks). /// - TickCount, + TickCount, /// /// Logs the number of milliseconds. /// - Milliseconds, + Milliseconds, /// /// Logs the time spanned in TimeSpam format. diff --git a/Core/Enumerations/SkillshotType.cs b/Core/Enumerations/SkillshotType.cs index 2e7d9e2..3e9b2ff 100644 --- a/Core/Enumerations/SkillshotType.cs +++ b/Core/Enumerations/SkillshotType.cs @@ -25,12 +25,12 @@ public enum SkillshotType /// /// Determines that the skillshot is a linear skillshot. /// - SkillshotLine, + SkillshotLine, /// /// Determines that the skillshot is a circle skillshot. /// - SkillshotCircle, + SkillshotCircle, /// /// Determines that the skillshot is a cone skillshot. diff --git a/Core/Enumerations/TeleportStatus.cs b/Core/Enumerations/TeleportStatus.cs index 4bc9111..1dd5f9f 100644 --- a/Core/Enumerations/TeleportStatus.cs +++ b/Core/Enumerations/TeleportStatus.cs @@ -25,17 +25,17 @@ public enum TeleportStatus /// /// The start status. /// - Start, + Start, /// /// The abort status. /// - Abort, + Abort, /// /// The finish status. /// - Finish, + Finish, /// /// The unknown status. diff --git a/Core/Enumerations/TeleportType.cs b/Core/Enumerations/TeleportType.cs index 689c598..23fcd58 100644 --- a/Core/Enumerations/TeleportType.cs +++ b/Core/Enumerations/TeleportType.cs @@ -25,22 +25,22 @@ public enum TeleportType /// /// The recall type. /// - Recall, + Recall, /// /// The teleport type. /// - Teleport, + Teleport, /// /// The twisted fate type. /// - TwistedFate, + TwistedFate, /// /// The shen type. /// - Shen, + Shen, /// /// The unknown type. diff --git a/Core/Enumerations/TurretType.cs b/Core/Enumerations/TurretType.cs index 393431d..db50f1a 100644 --- a/Core/Enumerations/TurretType.cs +++ b/Core/Enumerations/TurretType.cs @@ -25,22 +25,22 @@ public enum TurretType /// /// The unknown tier. /// - Unknown, + Unknown, /// /// The tier one. /// - TierOne, + TierOne, /// /// The tier two. /// - TierTwo, + TierTwo, /// /// The tier three. /// - TierThree, + TierThree, /// /// The tier four. diff --git a/Core/Enumerations/WindowsMessages.cs b/Core/Enumerations/WindowsMessages.cs index 8366e7a..67ec869 100644 --- a/Core/Enumerations/WindowsMessages.cs +++ b/Core/Enumerations/WindowsMessages.cs @@ -25,7 +25,8 @@ namespace LeagueSharp.SDK.Core.Enumerations /// Defined in from Windows SDK v6.1 /// Documentation pulled from MSDN. /// - [SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Official names from the winuser.h of the Windows SDK v6.1")] + [SuppressMessage("ReSharper", "InconsistentNaming", + Justification = "Official names from the winuser.h of the Windows SDK v6.1")] public enum WindowsMessages : uint { /// diff --git a/Core/Events/Dash.cs b/Core/Events/Dash.cs index 696bef0..b2f125d 100644 --- a/Core/Events/Dash.cs +++ b/Core/Events/Dash.cs @@ -22,7 +22,7 @@ namespace LeagueSharp.SDK.Core.Events using System.Linq; using System.Reflection; - using Extensions.SharpDX; + using LeagueSharp.SDK.Core.Extensions.SharpDX; using SharpDX; @@ -137,8 +137,7 @@ private static void ObjAiHeroOnOnNewPath(Obj_AI_Base sender, GameObjectNewPathEv StartTick = Variables.TickCount - (Game.Ping / 2), Speed = args.Speed, StartPos = hero.ServerPosition.ToVector2(), Unit = sender, - Path = path, - EndPos = path.Last(), + Path = path, EndPos = path.Last(), EndTick = DetectedDashes[hero.NetworkId].StartTick + (int) @@ -217,4 +216,4 @@ public class DashArgs : EventArgs #endregion } } -} +} \ No newline at end of file diff --git a/Core/Events/Gapcloser.cs b/Core/Events/Gapcloser.cs index b52f848..e1ba330 100644 --- a/Core/Events/Gapcloser.cs +++ b/Core/Events/Gapcloser.cs @@ -22,11 +22,14 @@ namespace LeagueSharp.SDK.Core.Events using System.Linq; using System.Security.Permissions; using System.Text; - using Enumerations; - using Extensions; + + using LeagueSharp.SDK.Core.Enumerations; + using LeagueSharp.SDK.Core.Extensions; + using LeagueSharp.SDK.Properties; + using Newtonsoft.Json; using Newtonsoft.Json.Linq; - using Properties; + using SharpDX; /// @@ -142,14 +145,14 @@ private static void OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpel ActiveSpellsList.Add( new GapCloserEventArgs { - Start = args.Start, End = args.End, Sender = hero, TickCount = Variables.TickCount, + Start = args.Start, End = args.End, Sender = hero, TickCount = Variables.TickCount, SkillType = (args.Target != null && args.Target.IsValid) ? GapcloserType.Targeted - : GapcloserType.Skillshot, - Slot = hero.GetSpellSlot(args.SData.Name), + : GapcloserType.Skillshot, + Slot = hero.GetSpellSlot(args.SData.Name), IsDirectedToPlayer = - player.Distance(args.End) < player.Distance(args.Start) || sender.IsFacing(player), + player.Distance(args.End) < player.Distance(args.Start) || sender.IsFacing(player), SpellName = args.SData.Name }); } diff --git a/Core/Events/InterruptableSpell.cs b/Core/Events/InterruptableSpell.cs index 155cff0..46ed965 100644 --- a/Core/Events/InterruptableSpell.cs +++ b/Core/Events/InterruptableSpell.cs @@ -21,7 +21,7 @@ namespace LeagueSharp.SDK.Core.Events using System.Collections.Generic; using System.Linq; - using Enumerations; + using LeagueSharp.SDK.Core.Enumerations; /// /// Provides events for interrupting spells. @@ -91,12 +91,13 @@ public static IReadOnlyDictionary> Interrup /// private static Dictionary CastingInterruptableSpellDictionary { get; } + private static List GlobalInterruptableSpellsList { get; } + /// /// Gets or sets the interrupt-able spells. /// private static Dictionary> InterruptableSpellsDictionary { get; } - private static List GlobalInterruptableSpellsList { get; } #endregion #region Public Methods and Operators @@ -201,10 +202,11 @@ private static void InitializeSpells() RegisterSpell("Warwick", new InterruptableSpellData(SpellSlot.R, DangerLevel.High)); RegisterSpell("Xerath", new InterruptableSpellData(SpellSlot.R, DangerLevel.High)); RegisterSpell("Varus", new InterruptableSpellData(SpellSlot.Q, DangerLevel.Low, false)); - RegisterSpell("Zilean", new InterruptableSpellData((SpellSlot) 52, DangerLevel.Low)); + RegisterSpell("Zilean", new InterruptableSpellData((SpellSlot)52, DangerLevel.Low)); - GlobalInterruptableSpellsList.Add(new InterruptableSpellData("OdinChannel", DangerLevel.Low, (SpellSlot) 62)); - GlobalInterruptableSpellsList.Add(new InterruptableSpellData("OdinChannelBomb", DangerLevel.Low, (SpellSlot) 62)); + GlobalInterruptableSpellsList.Add(new InterruptableSpellData("OdinChannel", DangerLevel.Low, (SpellSlot)62)); + GlobalInterruptableSpellsList.Add( + new InterruptableSpellData("OdinChannelBomb", DangerLevel.Low, (SpellSlot)62)); GlobalInterruptableSpellsList.Add(new InterruptableSpellData("summonerteleport", DangerLevel.Medium)); } @@ -314,22 +316,22 @@ public InterruptableSpellData(SpellSlot slot, DangerLevel dangerLevel, bool move /// /// Initializes a new instance of the class. /// - /// - /// Spell Name - /// - /// - /// Danger Level - /// - /// - /// Does movement interrupt the spell - /// - public InterruptableSpellData(string name, DangerLevel dangerLevel, SpellSlot slot = SpellSlot.Unknown, bool movementInterrupts = true) + /// Spell Name + /// Danger Level + /// The slot. + /// Does movement interrupt the spell + public InterruptableSpellData( + string name, + DangerLevel dangerLevel, + SpellSlot slot = SpellSlot.Unknown, + bool movementInterrupts = true) { this.Name = name; this.DangerLevel = dangerLevel; this.Slot = slot; this.MovementInterrupts = movementInterrupts; } + #endregion #region Public Properties diff --git a/Core/Events/Load.cs b/Core/Events/Load.cs index 31796b2..f795788 100644 --- a/Core/Events/Load.cs +++ b/Core/Events/Load.cs @@ -22,8 +22,8 @@ namespace LeagueSharp.SDK.Core.Events using System.Linq; using System.Reflection; - using Enumerations; - using Utils; + using LeagueSharp.SDK.Core.Enumerations; + using LeagueSharp.SDK.Core.Utils; /// /// Provides an event for when the game starts. diff --git a/Core/Events/Stealth.cs b/Core/Events/Stealth.cs index 6cd173e..001fec1 100644 --- a/Core/Events/Stealth.cs +++ b/Core/Events/Stealth.cs @@ -66,10 +66,7 @@ static Stealth() /// OnStealthEventArgs private static void FireOnStealth(OnStealthEventArgs args) { - if (OnStealth != null) - { - OnStealth(MethodBase.GetCurrentMethod().DeclaringType, args); - } + OnStealth?.Invoke(MethodBase.GetCurrentMethod().DeclaringType, args); } /// diff --git a/Core/Events/Teleport.cs b/Core/Events/Teleport.cs index 5258310..9594b5b 100644 --- a/Core/Events/Teleport.cs +++ b/Core/Events/Teleport.cs @@ -20,7 +20,7 @@ namespace LeagueSharp.SDK.Core.Events using System; using System.Collections.Generic; - using Enumerations; + using LeagueSharp.SDK.Core.Enumerations; /// /// Teleport class, contains Teleport even which is triggered on recalls, teleports and shen or twisted fate diff --git a/Core/Events/Turret.cs b/Core/Events/Turret.cs index d823f49..de663b4 100644 --- a/Core/Events/Turret.cs +++ b/Core/Events/Turret.cs @@ -21,7 +21,7 @@ namespace LeagueSharp.SDK.Core.Events using System.Collections.Generic; using System.Linq; - using Extensions; + using LeagueSharp.SDK.Core.Extensions; /// /// Turret tracker and event handler. diff --git a/Core/Extensions/Enumerable.cs b/Core/Extensions/Enumerable.cs index aafff0b..a63f69b 100644 --- a/Core/Extensions/Enumerable.cs +++ b/Core/Extensions/Enumerable.cs @@ -21,9 +21,11 @@ namespace LeagueSharp.SDK.Core.Extensions using System.Collections.Generic; using System.ComponentModel; using System.Linq; - using Enumerations; + using global::SharpDX; - using Utils; + + using LeagueSharp.SDK.Core.Enumerations; + using LeagueSharp.SDK.Core.Utils; /// /// Enumerable Extensions. diff --git a/Core/Extensions/GameRuntime.cs b/Core/Extensions/GameRuntime.cs index 2ce6df5..74c1fbf 100644 --- a/Core/Extensions/GameRuntime.cs +++ b/Core/Extensions/GameRuntime.cs @@ -19,8 +19,6 @@ namespace LeagueSharp.SDK.Core.Extensions { using LeagueSharp.SDK.Core.Wrappers.Spells; - using Wrappers; - /// /// The game runtime extensions. /// diff --git a/Core/Extensions/SharpDX/Generic.cs b/Core/Extensions/SharpDX/Generic.cs index 67fece2..3f88520 100644 --- a/Core/Extensions/SharpDX/Generic.cs +++ b/Core/Extensions/SharpDX/Generic.cs @@ -51,7 +51,7 @@ public static int ToArgb(this Color color) /// /// The in 0xRRGGBBAA format. /// - public static int ToRgba(this System.Drawing.Color color) + public static int ToRgba(this global::System.Drawing.Color color) { var x = color.ToArgb(); return (int)((x & 0xFF000000) >> 0x18) | ((x & 0x00FF0000) << 0x8) | ((x & 0x0000FF00) << 0x8) @@ -67,7 +67,7 @@ public static int ToRgba(this System.Drawing.Color color) /// /// The SharpDX Color instance. /// - public static Color ToSharpDxColor(this System.Drawing.Color color) + public static Color ToSharpDxColor(this global::System.Drawing.Color color) { return new Color(color.R, color.G, color.B, color.A); } @@ -81,9 +81,9 @@ public static Color ToSharpDxColor(this System.Drawing.Color color) /// /// The System Color instance. /// - public static System.Drawing.Color ToSystemColor(this Color color) + public static global::System.Drawing.Color ToSystemColor(this Color color) { - return System.Drawing.Color.FromArgb(color.A, color.R, color.G, color.B); + return global::System.Drawing.Color.FromArgb(color.A, color.R, color.G, color.B); } /// @@ -95,9 +95,9 @@ public static System.Drawing.Color ToSystemColor(this Color color) /// /// The System Color instance. /// - public static System.Drawing.Color ToSystemColor(this ColorBGRA color) + public static global::System.Drawing.Color ToSystemColor(this ColorBGRA color) { - return System.Drawing.Color.FromArgb(color.A, color.R, color.G, color.B); + return global::System.Drawing.Color.FromArgb(color.A, color.R, color.G, color.B); } #endregion diff --git a/Core/Math/Collision.cs b/Core/Math/Collision.cs index 8f43f6d..a46c836 100644 --- a/Core/Math/Collision.cs +++ b/Core/Math/Collision.cs @@ -22,10 +22,10 @@ namespace LeagueSharp.SDK.Core.Math using System.Linq; using System.Text.RegularExpressions; - using Enumerations; - using Extensions; - using Extensions.SharpDX; - using Prediction; + using LeagueSharp.SDK.Core.Enumerations; + using LeagueSharp.SDK.Core.Extensions; + using LeagueSharp.SDK.Core.Extensions.SharpDX; + using LeagueSharp.SDK.Core.Math.Prediction; using SharpDX; @@ -87,8 +87,8 @@ public static List GetCollision(List positions, Prediction GameObjects.EnemyMinions.Where( minion => minion.IsValidTarget( - Math.Min(input.Range + input.Radius + 100, 2000), - true, + Math.Min(input.Range + input.Radius + 100, 2000), + true, input.RangeCheckFrom))) { input.Unit = minion; @@ -108,8 +108,8 @@ public static List GetCollision(List positions, Prediction GameObjects.EnemyHeroes.Where( hero => hero.IsValidTarget( - Math.Min(input.Range + input.Radius + 100, 2000), - true, + Math.Min(input.Range + input.Radius + 100, 2000), + true, input.RangeCheckFrom))) { input.Unit = hero; @@ -169,7 +169,7 @@ public static List GetCollision(List positions, Prediction { var t = Variables.TickCount + (((wallStart.Intersection(wallEnd, position.ToVector2(), input.From.ToVector2()) - .Point.Distance(input.From) / input.Speed) + input.Delay) * 1000); + .Point.Distance(input.From) / input.Speed) + input.Delay) * 1000); if (t < wallCastT + 4000) { result.Add(GameObjects.Player); diff --git a/Core/Math/ConvexHull.cs b/Core/Math/ConvexHull.cs index 258aace..8cb43e9 100644 --- a/Core/Math/ConvexHull.cs +++ b/Core/Math/ConvexHull.cs @@ -188,7 +188,7 @@ public static List MakeConvexHull(List points) // Start wrapping up the other points. float sweepAngle = 0; - for (; ;) + for (;;) { // If all of the points are on the hull, we're done. if (points.Count == 0) @@ -298,11 +298,11 @@ private static float AngleValue(float x1, float y1, float x2, float y2) /// Skip certain point 3 /// The private static bool CircleEnclosesPoints( - Vector2 center, - float radius2, - IEnumerable points, - int skip1, - int skip2, + Vector2 center, + float radius2, + IEnumerable points, + int skip1, + int skip2, int skip3) { return (from point in points.Where((t, i) => (i != skip1) && (i != skip2) && (i != skip3)) @@ -334,7 +334,8 @@ private static void FindCircle(Vector2 a, Vector2 b, Vector2 c, out Vector2 cent var dx2 = -(c.Y - b.Y); // See where the lines intersect. - var cx = ((y1 * dx1 * dx2) + (x2 * dx1 * dy2) - (x1 * dy1 * dx2) - (y2 * dx1 * dx2)) / ((dx1 * dy2) - (dy1 * dx2)); + var cx = ((y1 * dx1 * dx2) + (x2 * dx1 * dy2) - (x1 * dy1 * dx2) - (y2 * dx1 * dx2)) + / ((dx1 * dy2) - (dy1 * dx2)); var cy = ((cx - x1) * dy1 / dx1) + y1; center = new Vector2(cx, cy); @@ -414,10 +415,10 @@ private static RectangleF GetMinMaxBox(IEnumerable points) /// The list. /// private static MinMaxCornersInfo GetMinMaxCorners( - IEnumerable points, - Vector2 upperLeft, - Vector2 upperRight, - Vector2 lowerLeft, + IEnumerable points, + Vector2 upperLeft, + Vector2 upperRight, + Vector2 lowerLeft, Vector2 lowerRight) { // Search the other points. diff --git a/Core/Math/Geometry.cs b/Core/Math/Geometry.cs index 59bcee8..ece9e9e 100644 --- a/Core/Math/Geometry.cs +++ b/Core/Math/Geometry.cs @@ -17,7 +17,7 @@ namespace LeagueSharp.SDK.Core.Math { - using Enumerations; + using LeagueSharp.SDK.Core.Enumerations; using SharpDX; using SharpDX.Direct3D9; @@ -38,9 +38,9 @@ public static class Geometry /// Centered Flags /// Vector2 center position of the rendering object on the rectangle. public static Vector2 GetCenter( - this Rectangle rectangle, - Sprite sprite, - Rectangle dimensions, + this Rectangle rectangle, + Sprite sprite, + Rectangle dimensions, CenteredFlags flags) { var x = 0; @@ -98,10 +98,10 @@ public static Vector2 GetCenteredText(this Rectangle rectangle, Sprite sprite, s /// Centered Flags /// Returns the center position of the text on the rectangle. public static Vector2 GetCenteredText( - this Rectangle rectangle, - Sprite sprite, - Font font, - string text, + this Rectangle rectangle, + Sprite sprite, + Font font, + string text, CenteredFlags flags) { return font == null diff --git a/Core/Math/Polygons/Arc.cs b/Core/Math/Polygons/Arc.cs index d1140a9..c1c27e7 100644 --- a/Core/Math/Polygons/Arc.cs +++ b/Core/Math/Polygons/Arc.cs @@ -19,7 +19,7 @@ namespace LeagueSharp.SDK.Core.Math.Polygons { using System; - using Extensions.SharpDX; + using LeagueSharp.SDK.Core.Extensions.SharpDX; using SharpDX; @@ -134,7 +134,9 @@ public void UpdatePolygon(int offset = 0) { var cDirection = side1.Rotated(i * this.Angle / this.quality).Normalized(); this.Points.Add( - new Vector2(this.StartPos.X + (outRadius * cDirection.X), this.StartPos.Y + (outRadius * cDirection.Y))); + new Vector2( + this.StartPos.X + (outRadius * cDirection.X), + this.StartPos.Y + (outRadius * cDirection.Y))); } } diff --git a/Core/Math/Polygons/Circle.cs b/Core/Math/Polygons/Circle.cs index b90afc6..ad32881 100644 --- a/Core/Math/Polygons/Circle.cs +++ b/Core/Math/Polygons/Circle.cs @@ -19,7 +19,7 @@ namespace LeagueSharp.SDK.Core.Math.Polygons { using System; - using Extensions.SharpDX; + using LeagueSharp.SDK.Core.Extensions.SharpDX; using SharpDX; @@ -112,7 +112,7 @@ public void UpdatePolygon(int offset = 0, float overrideWidth = -1) { var angle = i * 2 * Math.PI / this.quality; var point = new Vector2( - this.Center.X + (outRadius * (float)Math.Cos(angle)), + this.Center.X + (outRadius * (float)Math.Cos(angle)), this.Center.Y + (outRadius * (float)Math.Sin(angle))); this.Points.Add(point); diff --git a/Core/Math/Polygons/Line.cs b/Core/Math/Polygons/Line.cs index c3016ae..0a789e8 100644 --- a/Core/Math/Polygons/Line.cs +++ b/Core/Math/Polygons/Line.cs @@ -17,7 +17,7 @@ namespace LeagueSharp.SDK.Core.Math.Polygons { - using Extensions.SharpDX; + using LeagueSharp.SDK.Core.Extensions.SharpDX; using SharpDX; diff --git a/Core/Math/Polygons/Polygon.cs b/Core/Math/Polygons/Polygon.cs index 95fb0b3..0c5bb99 100644 --- a/Core/Math/Polygons/Polygon.cs +++ b/Core/Math/Polygons/Polygon.cs @@ -20,8 +20,8 @@ namespace LeagueSharp.SDK.Core.Math.Polygons using System.Collections.Generic; using System.Linq; - using Clipper; - using Extensions.SharpDX; + using LeagueSharp.SDK.Clipper; + using LeagueSharp.SDK.Core.Extensions.SharpDX; using SharpDX; diff --git a/Core/Math/Polygons/Rectangle.cs b/Core/Math/Polygons/Rectangle.cs index 41fe735..e94918d 100644 --- a/Core/Math/Polygons/Rectangle.cs +++ b/Core/Math/Polygons/Rectangle.cs @@ -17,7 +17,7 @@ namespace LeagueSharp.SDK.Core.Math.Polygons { - using Extensions.SharpDX; + using LeagueSharp.SDK.Core.Extensions.SharpDX; using SharpDX; @@ -76,7 +76,7 @@ public Rectangle(Vector2 start, Vector2 end, float width) public Vector2 Direction => (this.End - this.Start).Normalized(); /// - /// Gets or sets the end. + /// Gets or sets the end. /// public Vector2 End { get; set; } @@ -86,12 +86,12 @@ public Rectangle(Vector2 start, Vector2 end, float width) public Vector2 Perpendicular => this.Direction.Perpendicular(); /// - /// Gets or sets the start. + /// Gets or sets the start. /// public Vector2 Start { get; set; } /// - /// Gets or sets the width. + /// Gets or sets the width. /// public float Width { get; set; } diff --git a/Core/Math/Polygons/Ring.cs b/Core/Math/Polygons/Ring.cs index a6045ab..b8df12b 100644 --- a/Core/Math/Polygons/Ring.cs +++ b/Core/Math/Polygons/Ring.cs @@ -19,7 +19,7 @@ namespace LeagueSharp.SDK.Core.Math.Polygons { using System; - using Extensions.SharpDX; + using LeagueSharp.SDK.Core.Extensions.SharpDX; using SharpDX; @@ -89,17 +89,17 @@ public Ring(Vector2 center, float innerRadius, float outerRadius, int quality = #region Public Properties /// - /// Gets or sets the center. + /// Gets or sets the center. /// public Vector2 Center { get; set; } /// - /// Gets or sets the inner radius. + /// Gets or sets the inner radius. /// public float InnerRadius { get; set; } /// - /// Gets or sets the outer radius. + /// Gets or sets the outer radius. /// public float OuterRadius { get; set; } @@ -122,7 +122,7 @@ public void UpdatePolygon(int offset = 0) { var angle = i * 2 * Math.PI / this.quality; var point = new Vector2( - this.Center.X - (outRadius * (float)Math.Cos(angle)), + this.Center.X - (outRadius * (float)Math.Cos(angle)), this.Center.Y - (outRadius * (float)Math.Sin(angle))); this.Points.Add(point); @@ -132,7 +132,7 @@ public void UpdatePolygon(int offset = 0) { var angle = i * 2 * Math.PI / this.quality; var point = new Vector2( - this.Center.X + (innerRadius * (float)Math.Cos(angle)), + this.Center.X + (innerRadius * (float)Math.Cos(angle)), this.Center.Y - (innerRadius * (float)Math.Sin(angle))); this.Points.Add(point); diff --git a/Core/Math/Polygons/Sector.cs b/Core/Math/Polygons/Sector.cs index 49203e1..27793b0 100644 --- a/Core/Math/Polygons/Sector.cs +++ b/Core/Math/Polygons/Sector.cs @@ -19,7 +19,7 @@ namespace LeagueSharp.SDK.Core.Math.Polygons { using System; - using Extensions.SharpDX; + using LeagueSharp.SDK.Core.Extensions.SharpDX; using SharpDX; @@ -96,22 +96,22 @@ public Sector(Vector2 center, Vector2 direction, float angle, float radius, int #region Public Properties /// - /// Gets or sets the angle. + /// Gets or sets the angle. /// public float Angle { get; set; } /// - /// Gets or sets the center. + /// Gets or sets the center. /// public Vector2 Center { get; set; } /// - /// Gets or sets the direction. + /// Gets or sets the direction. /// public Vector2 Direction { get; set; } /// - /// Gets or sets the radius. + /// Gets or sets the radius. /// public float Radius { get; set; } diff --git a/Core/Math/Prediction/Cluster.cs b/Core/Math/Prediction/Cluster.cs index 8057652..1a5fade 100644 --- a/Core/Math/Prediction/Cluster.cs +++ b/Core/Math/Prediction/Cluster.cs @@ -20,9 +20,9 @@ namespace LeagueSharp.SDK.Core.Math.Prediction using System.Collections.Generic; using System.Linq; - using Enumerations; - using Extensions; - using Extensions.SharpDX; + using LeagueSharp.SDK.Core.Enumerations; + using LeagueSharp.SDK.Core.Extensions; + using LeagueSharp.SDK.Core.Extensions.SharpDX; using SharpDX; @@ -423,9 +423,9 @@ internal static Vector2[] GetCandidates(Vector2 from, Vector2 to, float radius, /// Vector2 points /// Number of Hits internal static IEnumerable GetHits( - Vector2 start, - Vector2 end, - double radius, + Vector2 start, + Vector2 end, + double radius, List points) { return points.Where(p => p.DistanceSquared(start, end, true) <= radius * radius); diff --git a/Core/Math/Prediction/Movement.cs b/Core/Math/Prediction/Movement.cs index 41bfc9f..4d772c1 100644 --- a/Core/Math/Prediction/Movement.cs +++ b/Core/Math/Prediction/Movement.cs @@ -20,13 +20,16 @@ namespace LeagueSharp.SDK.Core.Math.Prediction using System; using System.Collections.Generic; using System.Linq; - using Enumerations; - using Events; - using Extensions; - using Extensions.SharpDX; + + using LeagueSharp.SDK.Core.Enumerations; + using LeagueSharp.SDK.Core.Events; + using LeagueSharp.SDK.Core.Extensions; + using LeagueSharp.SDK.Core.Extensions.SharpDX; + using LeagueSharp.SDK.Core.Utils; + using SharpDX; - using Utils; - using Collision = Collision; + + using Collision = LeagueSharp.SDK.Core.Math.Collision; /// /// Calculates a prediction based off data values given by the source input and converts it into a output prediction diff --git a/Core/Math/Prediction/Path.cs b/Core/Math/Prediction/Path.cs index d6d59be..201bf48 100644 --- a/Core/Math/Prediction/Path.cs +++ b/Core/Math/Prediction/Path.cs @@ -21,7 +21,7 @@ namespace LeagueSharp.SDK.Core.Math.Prediction using System.Collections.Generic; using System.Linq; - using Extensions.SharpDX; + using LeagueSharp.SDK.Core.Extensions.SharpDX; using SharpDX; @@ -104,7 +104,7 @@ public static double GetMeanSpeed(Obj_AI_Base unit, double maxT) if (currentPath.WaypointCount > 0) { distance += Math.Min( - (currentPath.Time - nextPath.Time) * unit.MoveSpeed, + (currentPath.Time - nextPath.Time) * unit.MoveSpeed, currentPath.Path.PathLength()); } } @@ -179,22 +179,22 @@ public class StoredPath #region Public Properties /// - /// Gets the end point. + /// Gets the end point. /// public Vector2 EndPoint => this.Path.LastOrDefault(); /// - /// Gets or sets the path. + /// Gets or sets the path. /// public List Path { get; set; } /// - /// Gets the start point. + /// Gets the start point. /// public Vector2 StartPoint => this.Path.FirstOrDefault(); /// - /// Gets or sets the tick. + /// Gets or sets the tick. /// public int Tick { get; set; } diff --git a/Core/Network/GamePacket.cs b/Core/Network/GamePacket.cs index cf57ef4..fa57005 100644 --- a/Core/Network/GamePacket.cs +++ b/Core/Network/GamePacket.cs @@ -22,7 +22,7 @@ namespace LeagueSharp.SDK.Core.Network using System.Linq; using System.Text; - using Utils; + using LeagueSharp.SDK.Core.Utils; /// /// This class makes easier to handle packets. diff --git a/Core/Network/Packet.cs b/Core/Network/Packet.cs index c896956..183bcd9 100644 --- a/Core/Network/Packet.cs +++ b/Core/Network/Packet.cs @@ -142,11 +142,13 @@ public Packet(short id, PacketChannel channel, PacketProtocolFlags flags = Packe /// /// Gets the Collection of all known packets. /// - public static PacketWrapper PacketList => new PacketWrapper - { - BuyItem, CastSpell, Chat, Emote, HeartBeat, IssueOrder, LevelSpell, LockCamera, PauseGame, - Ping, ResumeGame, ScoreScreen, SetTarget, UndoBuy, InteractObject - }; + public static PacketWrapper PacketList + => + new PacketWrapper + { + BuyItem, CastSpell, Chat, Emote, HeartBeat, IssueOrder, LevelSpell, LockCamera, PauseGame, Ping, + ResumeGame, ScoreScreen, SetTarget, UndoBuy, InteractObject + }; /// /// Gets or sets the channel of the packet. diff --git a/Core/Signals/Signal.cs b/Core/Signals/Signal.cs index b2b3067..ee4cc83 100644 --- a/Core/Signals/Signal.cs +++ b/Core/Signals/Signal.cs @@ -44,9 +44,9 @@ public class Signal : EventArgs /// The properties /// private Signal( - OnRaisedDelegate signalRaised, - SignalWaverDelegate signalWaver, - DateTimeOffset expiration, + OnRaisedDelegate signalRaised, + SignalWaverDelegate signalWaver, + DateTimeOffset expiration, IDictionary properties) { if (signalRaised != null) @@ -198,9 +198,9 @@ private Signal( /// A dictionary that contents will be dumped into /// The public static Signal Create( - OnRaisedDelegate onRaised = null, - SignalWaverDelegate signalWaver = null, - DateTimeOffset expiration = default(DateTimeOffset), + OnRaisedDelegate onRaised = null, + SignalWaverDelegate signalWaver = null, + DateTimeOffset expiration = default(DateTimeOffset), IDictionary defaultProperties = null) { if (expiration == default(DateTimeOffset)) @@ -209,9 +209,9 @@ public static Signal Create( } var signal = new Signal( - onRaised, - signalWaver, - expiration, + onRaised, + signalWaver, + expiration, defaultProperties ?? new Dictionary()); SignalManager.AddSignal(signal); diff --git a/Core/UI/IMenu/Abstracts/AMenuComponent.cs b/Core/UI/IMenu/Abstracts/AMenuComponent.cs index 1bef573..730915b 100644 --- a/Core/UI/IMenu/Abstracts/AMenuComponent.cs +++ b/Core/UI/IMenu/Abstracts/AMenuComponent.cs @@ -20,10 +20,12 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Abstracts using System; using System.Dynamic; using System.Linq; - using Core.Utils; + + using LeagueSharp.SDK.Core.UI.IMenu.Skins; + using LeagueSharp.SDK.Core.UI.IMenu.Values; + using LeagueSharp.SDK.Core.Utils; + using SharpDX; - using Skins; - using Values; /// /// Abstract build of a menu component. diff --git a/Core/UI/IMenu/ColorSpectrum.cs b/Core/UI/IMenu/ColorSpectrum.cs index 5253f39..56120a2 100644 --- a/Core/UI/IMenu/ColorSpectrum.cs +++ b/Core/UI/IMenu/ColorSpectrum.cs @@ -1,11 +1,23 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +// +// Copyright (c) 2015 LeagueSharp. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see http://www.gnu.org/licenses/ +// namespace LeagueSharp.SDK.Core.UI.IMenu { + using System; using System.Drawing; using LeagueSharp.SDK.Core.Enumerations; @@ -16,82 +28,82 @@ namespace LeagueSharp.SDK.Core.UI.IMenu using SharpDX.Direct3D9; using Color = System.Drawing.Color; - using Math = System.Math; internal class ColorSpectrum { } /// - /// The ColorBox + /// The ColorBox /// public class ColorBox { #region Fields /// - /// Is User dragging the slider + /// Colorbox disabled /// - private bool mDragging; + private readonly bool mDisabled; /// - /// Defines the Display Style + /// Height of the ColorBox /// - private EDrawStyle mEDrawStyle; + private readonly int mHeight; /// - /// Height of the ColorBox + /// Width of the ColorBox /// - private readonly int mHeight; + private readonly int mWidth; /// - /// Width of the ColorBox + /// Is User dragging the slider /// - private readonly int mWidth; + private bool mDragging; /// - /// Hue, Saturation, Lightness + /// Defines the Display Style /// - private Hsl mHsl; + private EDrawStyle mEDrawStyle; /// - /// Reg, Green, Blue + /// Hue, Saturation, Lightness /// - private Color mRgb; + private Hsl mHsl; /// - /// Marker X Position + /// Marker Color /// - private int mMarkerX; + private Color mMarkerColor; /// - /// Marker Y Position + /// Marker X Position /// - private int mMarkerY; + private int mMarkerX; /// - /// Marker Color + /// Marker Y Position /// - private Color mMarkerColor; + private int mMarkerY; /// - /// Position on the Screen + /// Position on the Screen /// private Vector2 mPos; /// - /// Colorbox disabled + /// Reg, Green, Blue /// - private bool mDisabled; + private Color mRgb; #endregion #region Constructors and Destructors /// - /// Init the ColorBox + /// Init the ColorBox /// /// The size of the new ColorBox + /// if set to true [disabled]. public ColorBox(Size size, bool disabled = false) { this.mHsl = new Hsl { H = 1, S = 1, L = 1 }; @@ -112,7 +124,7 @@ public ColorBox(Size size, bool disabled = false) #region Delegates /// - /// EventHandler for the event + /// EventHandler for the event /// public delegate void ColorBoxScrolledEventHandler(); @@ -121,7 +133,7 @@ public ColorBox(Size size, bool disabled = false) #region Public Events /// - /// The event which gets fired when the color get changed + /// The event which gets fired when the color get changed /// public event ColorBoxScrolledEventHandler ColorBoxScrolled; @@ -130,47 +142,53 @@ public ColorBox(Size size, bool disabled = false) #region Enums /// - /// The DrawStyle enum + /// The DrawStyle enum /// public enum EDrawStyle { /// - /// Hue Style + /// Hue Style /// Hue, + /// - /// Saturation Style + /// Saturation Style /// Saturation, + /// - /// Brightness Style + /// Brightness Style /// Brightness, + /// - /// Red Style + /// Red Style /// Red, + /// - /// Green Style + /// Green Style /// Green, + /// - /// Blue Style + /// Blue Style /// Blue } /// - /// The Orientation enum for the Gradient to draw + /// The Orientation enum for the Gradient to draw /// public enum Orientation { /// - /// Horizontal Orientation + /// Horizontal Orientation /// Horizontal, + /// - /// Vertical Orientation + /// Vertical Orientation /// Vertical }; @@ -180,70 +198,70 @@ public enum Orientation #region Public Properties /// - /// Hue, Saturation, Lightness Property + /// The DrawStyle Property /// - public Hsl Hsl + public EDrawStyle DrawStyle { get { - return this.mHsl; + return this.mEDrawStyle; } set { - this.mHsl = value; - this.mRgb = Utilities.HslToRgb(this.mHsl); + this.mEDrawStyle = value; this.ResetMarker(true); } } /// - /// Red, Green, Blue Property + /// Hue, Saturation, Lightness Property /// - public Color Rgb + public Hsl Hsl { get { - return this.mRgb; + return this.mHsl; } set { - this.mRgb = value; - this.mHsl = Utilities.RgbToHsl(this.mRgb); + this.mHsl = value; + this.mRgb = Utilities.HslToRgb(this.mHsl); this.ResetMarker(true); } } /// - /// The DrawStyle Property + /// The MarkerColor Property /// - public EDrawStyle DrawStyle + public Color MarkerColor { get { - return this.mEDrawStyle; + return this.mMarkerColor; } set { - this.mEDrawStyle = value; - - this.ResetMarker(true); + this.mMarkerColor = value; } } /// - /// The MarkerColor Property + /// Red, Green, Blue Property /// - public Color MarkerColor + public Color Rgb { get { - return this.mMarkerColor; + return this.mRgb; } set { - this.mMarkerColor = value; + this.mRgb = value; + this.mHsl = Utilities.RgbToHsl(this.mRgb); + + this.ResetMarker(true); } } @@ -252,7 +270,7 @@ public Color MarkerColor #region Public Methods and Operators /// - /// Gets fired when the left mouse button is pressed + /// Gets fired when the left mouse button is pressed /// /// Keys public void ColorBoxMouseDown(WindowsKeys args) @@ -289,15 +307,12 @@ public void ColorBoxMouseDown(WindowsKeys args) this.ResetHslrgb(); // Reset the color - if (this.ColorBoxScrolled != null) - { - this.ColorBoxScrolled(); - } + this.ColorBoxScrolled?.Invoke(); } } /// - /// Gets fired when the mouse is moved and pressed before + /// Gets fired when the mouse is moved and pressed before /// /// Keys public void ColorBoxMouseMove(WindowsKeys args) @@ -333,15 +348,12 @@ public void ColorBoxMouseMove(WindowsKeys args) this.ResetHslrgb(); // Reset the color - if (this.ColorBoxScrolled != null) - { - this.ColorBoxScrolled(); - } + this.ColorBoxScrolled?.Invoke(); } } /// - /// Gets fired when the mouse is released and pressed before + /// Gets fired when the mouse is released and pressed before /// /// Keys public void ColorBoxMouseUp(WindowsKeys args) @@ -378,15 +390,28 @@ public void ColorBoxMouseUp(WindowsKeys args) this.ResetHslrgb(); // Reset the color - if (this.ColorBoxScrolled != null) - { - this.ColorBoxScrolled(); - } + this.ColorBoxScrolled?.Invoke(); + } + } + + /// + /// Draws the ColorBox + /// + /// Sets a new Position + public void DrawControl(Vector2 newPos = new Vector2()) + { + if (!newPos.IsZero) + { + this.mPos = newPos; } + + this.DrawBorder(); + this.DrawContent(); + this.DrawMarker(this.mMarkerX, this.mMarkerY, true); } /// - /// Draws a Gradient. + /// Draws a Gradient. /// /// Position X /// Position Y @@ -454,28 +479,131 @@ public void GradientRect( vertices.Dispose(); } + #endregion + + #region Methods + /// - /// Draws the ColorBox + /// Draws the Border around the ColorBox /// - /// Sets a new Position - public void DrawControl(Vector2 newPos = new Vector2()) + private void DrawBorder() { - if (!newPos.IsZero) + ColorBGRA color = Color.FromArgb(37, 37, 37).ToSharpDxColor(); + + Utils.DrawLine(this.mPos.X - 1, this.mPos.Y - 1, this.mPos.X + this.mWidth - 4, this.mPos.Y - 1, 1, color); + //Top + Utils.DrawLine(this.mPos.X - 1, this.mPos.Y - 1, this.mPos.X - 1, this.mPos.Y + this.mHeight - 1, 1, color); + //Left + Utils.DrawLine( + this.mPos.X - 1, + this.mPos.Y + this.mHeight - 2, + this.mPos.X + this.mWidth - 3, + this.mPos.Y + this.mHeight - 2, + 1, + color); //Bot + Utils.DrawLine( + this.mPos.X + this.mWidth - 4, + this.mPos.Y - 1, + this.mPos.X + this.mWidth - 4, + this.mPos.Y + this.mHeight - 1, + 1, + color); //Right + } + + /// + /// Draws in Content of the ColorBox + /// + private void DrawContent() + { + switch (this.mEDrawStyle) { - this.mPos = newPos; - } + case EDrawStyle.Hue: + this.DrawStyleHue(); - this.DrawBorder(); - this.DrawContent(); - this.DrawMarker(this.mMarkerX, this.mMarkerY, true); + break; + case EDrawStyle.Saturation: + this.DrawStyleSaturation(); + + break; + case EDrawStyle.Brightness: + this.DrawStyleLuminance(); + + break; + case EDrawStyle.Red: + this.DrawStyleRed(); + + break; + case EDrawStyle.Green: + this.DrawStyleGreen(); + + break; + case EDrawStyle.Blue: + this.DrawStyleBlue(); + + break; + } } - #endregion + /// + /// Draws the Marker + /// + private void DrawMarker(int x, int y, bool unconditional) + { + if (x < 0) + { + x = 0; + } + if (x > (this.mWidth - 4)) + { + x = (this.mWidth - 4); + } - #region Methods + if (y < 0) + { + x = 0; + } + if (y > (this.mHeight - 4)) + { + y = (this.mHeight - 4); + } + + if (this.mMarkerY == y & this.mMarkerX == x & !unconditional) + { + return; + } + + this.mMarkerX = x; + this.mMarkerY = y; + + // The selected color will determine whether our marker is white or black + var hsl = this.GetColor(x, y); + + if (hsl.L < Convert.ToDouble(200d / 255d)) + { + this.mMarkerColor = Color.White; + } + else if ((hsl.H < Convert.ToDouble(26d / 360d)) | (hsl.H > Convert.ToDouble(200d / 360d))) + { + this.mMarkerColor = hsl.S > Convert.ToDouble(70d / 255d) ? Color.White : Color.Black; + } + else + { + this.mMarkerColor = Color.Black; + } + + Utils.DrawCircle( + this.mPos.X + x + 2, + this.mPos.Y + y + 2, + 5, + 0, + Utils.CircleType.Full, + false, + 16, + this.mMarkerColor.ToSharpDxColor()); + } /// - /// Draws in Blue Style + /// Draws in Blue Style /// private void DrawStyleBlue() { @@ -498,7 +626,7 @@ private void DrawStyleBlue() } /// - /// Draws in Green Style + /// Draws in Green Style /// private void DrawStyleGreen() { @@ -521,7 +649,7 @@ private void DrawStyleGreen() } /// - /// Draws in Hue Style + /// Draws in Hue Style /// private void DrawStyleHue() { @@ -529,10 +657,7 @@ private void DrawStyleHue() var hslEnd = new Hsl(); if ((this.mHsl == null)) { - this.mHsl = new Hsl(); - this.mHsl.H = 1; - this.mHsl.S = 1; - this.mHsl.L = 1; + this.mHsl = new Hsl { H = 1, S = 1, L = 1 }; this.mRgb = Utilities.HslToRgb(this.mHsl); } @@ -562,7 +687,7 @@ private void DrawStyleHue() } /// - /// Draws in Luminance Style + /// Draws in Luminance Style /// private void DrawStyleLuminance() { @@ -594,7 +719,7 @@ private void DrawStyleLuminance() } /// - /// Draws in Red Style + /// Draws in Red Style /// private void DrawStyleRed() { @@ -617,7 +742,7 @@ private void DrawStyleRed() } /// - /// Draws in Saturation Style + /// Draws in Saturation Style /// private void DrawStyleSaturation() { @@ -649,195 +774,125 @@ private void DrawStyleSaturation() } /// - /// Draws the Border around the ColorBox + /// Gets the Color of the given Position /// - private void DrawBorder() + /// Position X + /// Position Y + /// HSL Color + private Hsl GetColor(int x, int y) { - ColorBGRA color = Color.FromArgb(37, 37, 37).ToSharpDxColor(); - - Utils.DrawLine(this.mPos.X - 1, this.mPos.Y - 1, this.mPos.X + this.mWidth - 4, this.mPos.Y - 1, 1, color); - //Top - Utils.DrawLine(this.mPos.X - 1, this.mPos.Y - 1, this.mPos.X - 1, this.mPos.Y + this.mHeight - 1, 1, color); - //Left - Utils.DrawLine( - this.mPos.X - 1, - this.mPos.Y + this.mHeight - 2, - this.mPos.X + this.mWidth - 3, - this.mPos.Y + this.mHeight - 2, - 1, - color); //Bot - Utils.DrawLine( - this.mPos.X + this.mWidth - 4, - this.mPos.Y - 1, - this.mPos.X + this.mWidth - 4, - this.mPos.Y + this.mHeight - 1, - 1, - color); //Right - } + var hsl = new Hsl(); - /// - /// Draws in Content of the ColorBox - /// - private void DrawContent() - { switch (this.mEDrawStyle) { case EDrawStyle.Hue: - this.DrawStyleHue(); + hsl.H = this.mHsl.H; + hsl.S = Convert.ToDouble(x / (this.mWidth - 4d)); + hsl.L = 1.0 - Convert.ToDouble(y / (this.mHeight - 4d)); break; case EDrawStyle.Saturation: - this.DrawStyleSaturation(); + hsl.S = this.mHsl.S; + hsl.H = Convert.ToDouble(x / (this.mWidth - 4d)); + hsl.L = 1.0 - Convert.ToDouble(y / (this.mHeight - 4d)); break; case EDrawStyle.Brightness: - this.DrawStyleLuminance(); + hsl.L = this.mHsl.L; + hsl.H = Convert.ToDouble(x / (this.mWidth - 4d)); + hsl.S = 1.0 - Convert.ToDouble(y / (this.mHeight - 4d)); break; case EDrawStyle.Red: - this.DrawStyleRed(); + hsl = + Utilities.RgbToHsl( + Color.FromArgb( + this.mRgb.R, + Convert.ToInt32(Math.Round(255 * (1.0 - Convert.ToDouble(y / (this.mHeight - 4d))))), + Convert.ToInt32(Math.Round(255 * Convert.ToDouble(x / (this.mWidth - 4d)))))); break; case EDrawStyle.Green: - this.DrawStyleGreen(); + hsl = + Utilities.RgbToHsl( + Color.FromArgb( + Convert.ToInt32(Math.Round(255 * (1.0 - Convert.ToDouble(y / (this.mHeight - 4d))))), + this.mRgb.G, + Convert.ToInt32(Math.Round(255 * Convert.ToDouble(x / (this.mWidth - 4d)))))); break; case EDrawStyle.Blue: - this.DrawStyleBlue(); - - break; - } - } - - /// - /// Draws the Marker - /// - private void DrawMarker(int x, int y, bool unconditional) - { - if (x < 0) - { - x = 0; - } - if (x > (this.mWidth - 4)) - { - x = (this.mWidth - 4); - } - - if (y < 0) - { - x = 0; - } - if (y > (this.mHeight - 4)) - { - y = (this.mHeight - 4); - } - - if (this.mMarkerY == y & this.mMarkerX == x & !unconditional) - { - return; - } - - this.mMarkerX = x; - this.mMarkerY = y; - - // The selected color will determine whether our marker is white or black - var hsl = this.GetColor(x, y); + hsl = + Utilities.RgbToHsl( + Color.FromArgb( + Convert.ToInt32(Math.Round(255 * Convert.ToDouble(x / (this.mWidth - 4d)))), + Convert.ToInt32(Math.Round(255 * (1.0 - Convert.ToDouble(y / (this.mHeight - 4d))))), + this.mRgb.B)); - if (hsl.L < Convert.ToDouble(200d / 255d)) - { - this.mMarkerColor = Color.White; - } - else if ((hsl.H < Convert.ToDouble(26d / 360d)) | (hsl.H > Convert.ToDouble(200d / 360d))) - { - if (hsl.S > Convert.ToDouble(70d / 255d)) - { - this.mMarkerColor = Color.White; - } - else - { - this.mMarkerColor = Color.Black; - } - } - else - { - this.mMarkerColor = Color.Black; + break; } - Utils.DrawCircle( - this.mPos.X + x + 2, - this.mPos.Y + y + 2, - 5, - 0, - Utils.CircleType.Full, - false, - 16, - this.mMarkerColor.ToSharpDxColor()); + return hsl; } /// - /// Gets the Color of the given Position + /// Resets the Color /// - /// Position X - /// Position Y - /// HSL Color - private Hsl GetColor(int x, int y) + private void ResetHslrgb() { - var hsl = new Hsl(); + int red; + int green; + int blue; switch (this.mEDrawStyle) { case EDrawStyle.Hue: - hsl.H = this.mHsl.H; - hsl.S = Convert.ToDouble(x / (this.mWidth - 4d)); - hsl.L = 1.0 - Convert.ToDouble(y / (this.mHeight - 4d)); + this.mHsl.S = Convert.ToDouble(this.mMarkerX / (this.mWidth - 4d)); + this.mHsl.L = 1.0 - Convert.ToDouble(this.mMarkerY / (this.mHeight - 4d)); + this.mRgb = Utilities.HslToRgb(this.mHsl); break; case EDrawStyle.Saturation: - hsl.S = this.mHsl.S; - hsl.H = Convert.ToDouble(x / (this.mWidth - 4d)); - hsl.L = 1.0 - Convert.ToDouble(y / (this.mHeight - 4d)); + this.mHsl.H = Convert.ToDouble(this.mMarkerX / (this.mWidth - 4d)); + this.mHsl.L = 1.0 - Convert.ToDouble(this.mMarkerY / (this.mHeight - 4d)); + this.mRgb = Utilities.HslToRgb(this.mHsl); break; case EDrawStyle.Brightness: - hsl.L = this.mHsl.L; - hsl.H = Convert.ToDouble(x / (this.mWidth - 4d)); - hsl.S = 1.0 - Convert.ToDouble(y / (this.mHeight - 4d)); + this.mHsl.H = Convert.ToDouble(this.mMarkerX / (this.mWidth - 4d)); + this.mHsl.S = 1.0 - Convert.ToDouble(this.mMarkerY / (this.mHeight - 4d)); + this.mRgb = Utilities.HslToRgb(this.mHsl); break; case EDrawStyle.Red: - hsl = - Utilities.RgbToHsl( - Color.FromArgb( - this.mRgb.R, - Convert.ToInt32(Math.Round(255 * (1.0 - Convert.ToDouble(y / (this.mHeight - 4d))))), - Convert.ToInt32(Math.Round(255 * Convert.ToDouble(x / (this.mWidth - 4d)))))); + blue = Convert.ToInt32(Math.Round(255 * Convert.ToDouble(this.mMarkerX / (this.mWidth - 4d)))); + green = + Convert.ToInt32(Math.Round(255 * (1.0 - Convert.ToDouble(this.mMarkerY / (this.mHeight - 4d))))); + this.mRgb = Color.FromArgb(this.mRgb.R, green, blue); + this.mHsl = Utilities.RgbToHsl(this.mRgb); break; case EDrawStyle.Green: - hsl = - Utilities.RgbToHsl( - Color.FromArgb( - Convert.ToInt32(Math.Round(255 * (1.0 - Convert.ToDouble(y / (this.mHeight - 4d))))), - this.mRgb.G, - Convert.ToInt32(Math.Round(255 * Convert.ToDouble(x / (this.mWidth - 4d)))))); + blue = Convert.ToInt32(Math.Round(255 * Convert.ToDouble(this.mMarkerX / (this.mWidth - 4d)))); + red = + Convert.ToInt32(Math.Round(255 * (1.0 - Convert.ToDouble(this.mMarkerY / (this.mHeight - 4d))))); + this.mRgb = Color.FromArgb(red, this.mRgb.G, blue); + this.mHsl = Utilities.RgbToHsl(this.mRgb); break; case EDrawStyle.Blue: - hsl = - Utilities.RgbToHsl( - Color.FromArgb( - Convert.ToInt32(Math.Round(255 * Convert.ToDouble(x / (this.mWidth - 4d)))), - Convert.ToInt32(Math.Round(255 * (1.0 - Convert.ToDouble(y / (this.mHeight - 4d))))), - this.mRgb.B)); + red = Convert.ToInt32(Math.Round(255 * Convert.ToDouble(this.mMarkerX / (this.mWidth - 4d)))); + green = + Convert.ToInt32(Math.Round(255 * (1.0 - Convert.ToDouble(this.mMarkerY / (this.mHeight - 4d))))); + this.mRgb = Color.FromArgb(red, green, this.mRgb.B); + this.mHsl = Utilities.RgbToHsl(this.mRgb); break; } - - return hsl; } /// - /// Resets the Marker + /// Resets the Marker /// /// Force Redraw private void ResetMarker(bool redraw) @@ -883,67 +938,11 @@ private void ResetMarker(bool redraw) } } - /// - /// Resets the Color - /// - private void ResetHslrgb() - { - int red; - int green; - int blue; - - switch (this.mEDrawStyle) - { - case EDrawStyle.Hue: - this.mHsl.S = Convert.ToDouble(this.mMarkerX / (this.mWidth - 4d)); - this.mHsl.L = 1.0 - Convert.ToDouble(this.mMarkerY / (this.mHeight - 4d)); - this.mRgb = Utilities.HslToRgb(this.mHsl); - - break; - case EDrawStyle.Saturation: - this.mHsl.H = Convert.ToDouble(this.mMarkerX / (this.mWidth - 4d)); - this.mHsl.L = 1.0 - Convert.ToDouble(this.mMarkerY / (this.mHeight - 4d)); - this.mRgb = Utilities.HslToRgb(this.mHsl); - - break; - case EDrawStyle.Brightness: - this.mHsl.H = Convert.ToDouble(this.mMarkerX / (this.mWidth - 4d)); - this.mHsl.S = 1.0 - Convert.ToDouble(this.mMarkerY / (this.mHeight - 4d)); - this.mRgb = Utilities.HslToRgb(this.mHsl); - - break; - case EDrawStyle.Red: - blue = Convert.ToInt32(Math.Round(255 * Convert.ToDouble(this.mMarkerX / (this.mWidth - 4d)))); - green = - Convert.ToInt32(Math.Round(255 * (1.0 - Convert.ToDouble(this.mMarkerY / (this.mHeight - 4d))))); - this.mRgb = Color.FromArgb(this.mRgb.R, green, blue); - this.mHsl = Utilities.RgbToHsl(this.mRgb); - - break; - case EDrawStyle.Green: - blue = Convert.ToInt32(Math.Round(255 * Convert.ToDouble(this.mMarkerX / (this.mWidth - 4d)))); - red = - Convert.ToInt32(Math.Round(255 * (1.0 - Convert.ToDouble(this.mMarkerY / (this.mHeight - 4d))))); - this.mRgb = Color.FromArgb(red, this.mRgb.G, blue); - this.mHsl = Utilities.RgbToHsl(this.mRgb); - - break; - case EDrawStyle.Blue: - red = Convert.ToInt32(Math.Round(255 * Convert.ToDouble(this.mMarkerX / (this.mWidth - 4d)))); - green = - Convert.ToInt32(Math.Round(255 * (1.0 - Convert.ToDouble(this.mMarkerY / (this.mHeight - 4d))))); - this.mRgb = Color.FromArgb(red, green, this.mRgb.B); - this.mHsl = Utilities.RgbToHsl(this.mRgb); - - break; - } - } - #endregion } /// - /// The VerticalColorSlider + /// The VerticalColorSlider /// public class VerticalColorSlider { @@ -959,55 +958,52 @@ public class VerticalColorSlider #region Fields /// - /// Is User dragging the slider + /// VerticalColorSlider disabled /// - private bool mDragging; + private readonly bool mDisabled; /// - /// Defines the Display Style + /// Height of the ColorBox /// - private EDrawStyle mEDrawStyle; + private readonly int mHeight; /// - /// Height of the ColorBox + /// Width of the ColorBox /// - private readonly int mHeight; + private readonly int mWidth; /// - /// Width of the ColorBox + /// Is User dragging the slider /// - private readonly int mWidth; + private bool mDragging; /// - /// Hue, Saturation, Lightness + /// Defines the Display Style /// - private Hsl mHsl; + private EDrawStyle mEDrawStyle; /// - /// Reg, Green, Blue + /// Hue, Saturation, Lightness /// - private Color mRgb; + private Hsl mHsl; /// - /// VerticalColorSlider disabled + /// Reg, Green, Blue /// - private bool mDisabled; + private Color mRgb; #endregion #region Constructors and Destructors /// - /// Init the VerticalColorSlider + /// Init the VerticalColorSlider /// /// /// public VerticalColorSlider(Size size, bool disabled = false) { - this.mHsl = new Hsl(); - this.mHsl.H = 1; - this.mHsl.S = 1; - this.mHsl.L = 1; + this.mHsl = new Hsl { H = 1, S = 1, L = 1 }; this.mRgb = Utilities.HslToRgb(this.mHsl); this.mEDrawStyle = EDrawStyle.Hue; @@ -1025,15 +1021,16 @@ public VerticalColorSlider(Size size, bool disabled = false) #region Delegates /// - /// EventHandler for the event + /// EventHandler for the event /// public delegate void ColorSliderScrollEventHandler(); #endregion #region Public Events + /// - /// The event which gets fired when the color get changed + /// The event which gets fired when the color get changed /// public event ColorSliderScrollEventHandler ColorSliderScroll; @@ -1042,32 +1039,37 @@ public VerticalColorSlider(Size size, bool disabled = false) #region Enums /// - /// The DrawStyle enum + /// The DrawStyle enum /// public enum EDrawStyle { /// - /// Hue Style + /// Hue Style /// Hue, + /// - /// Saturation Style + /// Saturation Style /// Saturation, + /// - /// Brightness Style + /// Brightness Style /// Brightness, + /// - /// Red Style + /// Red Style /// Red, + /// - /// Green Style + /// Green Style /// Green, + /// - /// Blue Style + /// Blue Style /// Blue } @@ -1077,12 +1079,12 @@ public enum EDrawStyle #region Public Properties /// - /// Position of the two Arrows + /// Position of the two Arrows /// public int ArrowPos { get; private set; } /// - /// Hue, Saturation, Lightness Property + /// Hue, Saturation, Lightness Property /// public Hsl CbHsl { @@ -1101,7 +1103,7 @@ public Hsl CbHsl } /// - /// The DrawStyle Property + /// The DrawStyle Property /// public EDrawStyle DrawStyle { @@ -1119,12 +1121,12 @@ public EDrawStyle DrawStyle } /// - /// Position of the ColorSlider + /// Position of the ColorSlider /// public Vector2 Position { get; set; } /// - /// Red, Green, Blue Property + /// Red, Green, Blue Property /// public Color Rgb { @@ -1147,7 +1149,7 @@ public Color Rgb #region Public Methods and Operators /// - /// Draws the ColorSlider + /// Draws the ColorSlider /// /// Sets a new Position public void DrawControl(Vector2 newPos = new Vector2()) @@ -1160,10 +1162,10 @@ public Color Rgb } /// - /// Gets fired when the left mouse button is pressed + /// Gets fired when the left mouse button is pressed /// /// Keys - public void VerticalColorSlider_MouseDown(WindowsKeys args) + public void VerticalColorSliderMouseDown(WindowsKeys args) { if (args.Msg == WindowsMessages.LBUTTONDOWN && !this.mDisabled) { @@ -1184,18 +1186,15 @@ public void VerticalColorSlider_MouseDown(WindowsKeys args) this.DrawSlider(y, false); this.ResetHslrgb(); - if (this.ColorSliderScroll != null) - { - this.ColorSliderScroll(); - } + this.ColorSliderScroll?.Invoke(); } } /// - /// Gets fired when the mouse is moved and pressed before + /// Gets fired when the mouse is moved and pressed before /// /// Keys - public void VerticalColorSlider_MouseMove(WindowsKeys args) + public void VerticalColorSliderMouseMove(WindowsKeys args) { if (this.mDragging && args.Msg == WindowsMessages.MOUSEMOVE && !this.mDisabled) { @@ -1213,18 +1212,15 @@ public void VerticalColorSlider_MouseMove(WindowsKeys args) this.ArrowPos = y; this.DrawSlider(y, false); this.ResetHslrgb(); - if (this.ColorSliderScroll != null) - { - this.ColorSliderScroll(); - } + this.ColorSliderScroll?.Invoke(); } } /// - /// Gets fired when the mouse is released and pressed before + /// Gets fired when the mouse is released and pressed before /// /// Keys - public void VerticalColorSlider_MouseUp(WindowsKeys args) + public void VerticalColorSliderMouseUp(WindowsKeys args) { if (this.mDragging && args.Msg == WindowsMessages.LBUTTONUP && !this.mDisabled) { @@ -1244,10 +1240,7 @@ public void VerticalColorSlider_MouseUp(WindowsKeys args) this.ArrowPos = y; this.DrawSlider(y, false); this.ResetHslrgb(); - if (this.ColorSliderScroll != null) - { - this.ColorSliderScroll(); - } + this.ColorSliderScroll?.Invoke(); } } @@ -1256,155 +1249,11 @@ public void VerticalColorSlider_MouseUp(WindowsKeys args) #region Methods /// - /// Draws in Blue Style - /// - private void DrawStyleBlue() - { - Line.Begin(); - for (var iCx = 0; iCx <= this.mHeight - 9; iCx++) - { - var blue = Convert.ToInt32(255 - Math.Round(255 * Convert.ToDouble(iCx / (this.mHeight - 9d)))); - var col = Color.FromArgb(this.mRgb.R, this.mRgb.G, blue); - - Line.Draw( - new[] - { - new Vector2(this.Position.X + 11, this.Position.Y + iCx + 4), - new Vector2(this.Position.X + this.mWidth - 11, this.Position.Y + iCx + 4) - }, - col.ToSharpDxColor()); - } - Line.End(); - } - - /// - /// Draws in Green Style - /// - private void DrawStyleGreen() - { - Line.Begin(); - for (var iCx = 0; iCx <= this.mHeight - 9; iCx++) - { - var green = Convert.ToInt32(255 - Math.Round(255 * Convert.ToDouble(iCx / (this.mHeight - 9d)))); - var col = Color.FromArgb(this.mRgb.R, green, this.mRgb.B); - - Line.Draw( - new[] - { - new Vector2(this.Position.X + 11, this.Position.Y + iCx + 4), - new Vector2(this.Position.X + this.mWidth - 11, this.Position.Y + iCx + 4) - }, - col.ToSharpDxColor()); - } - Line.End(); - } - - /// - /// Draws in Hue Style + /// Draws the Border around the ColorSlider /// - private void DrawStyleHue() + private void DrawBorder() { - var hsl = new Hsl(); - - hsl.S = 1; - hsl.L = 1; - Line.Begin(); - for (var iCx = 0; iCx <= this.mHeight - 9; iCx++) - { - hsl.H = 1.0d - Convert.ToDouble(iCx / (this.mHeight - 9d)); - var col = Utilities.HslToRgb(hsl); - - Line.Draw( - new[] - { - new Vector2(this.Position.X + 11, this.Position.Y + iCx + 4), - new Vector2(this.Position.X + this.mWidth - 11, this.Position.Y + iCx + 4) - }, - col.ToSharpDxColor()); - } - Line.End(); - } - - /// - /// Draws in Luminance Style - /// - private void DrawStyleLuminance() - { - var hsl = new Hsl(); - - hsl.H = this.mHsl.H; - hsl.S = this.mHsl.S; - Line.Begin(); - for (var iCx = 0; iCx <= this.mHeight - 9; iCx++) - { - hsl.L = 1.0 - Convert.ToDouble(iCx / (this.mHeight - 9d)); - var col = Utilities.HslToRgb(hsl); - - Line.Draw( - new[] - { - new Vector2(this.Position.X + 11, this.Position.Y + iCx + 4), - new Vector2(this.Position.X + this.mWidth - 11, this.Position.Y + iCx + 4) - }, - col.ToSharpDxColor()); - } - Line.End(); - } - - /// - /// Draws in Red Style - /// - private void DrawStyleRed() - { - Line.Begin(); - for (var iCx = 0; iCx <= this.mHeight - 9; iCx++) - { - var red = Convert.ToInt32(255 - Math.Round(255 * Convert.ToDouble(iCx / (this.mHeight - 9d)))); - var col = Color.FromArgb(red, this.mRgb.G, this.mRgb.B); - - Line.Draw( - new[] - { - new Vector2(this.Position.X + 11, this.Position.Y + iCx + 4), - new Vector2(this.Position.X + this.mWidth - 11, this.Position.Y + iCx + 4) - }, - col.ToSharpDxColor()); - } - Line.End(); - } - - /// - /// Draws in Saturation Style - /// - private void DrawStyleSaturation() - { - var hsl = new Hsl(); - - hsl.H = this.mHsl.H; - hsl.L = this.mHsl.L; - Line.Begin(); - for (var iCx = 0; iCx <= this.mHeight - 9; iCx++) - { - hsl.S = 1.0 - Convert.ToDouble(iCx / (this.mHeight - 9d)); - var col = Utilities.HslToRgb(hsl); - - Line.Draw( - new[] - { - new Vector2(this.Position.X + 11, this.Position.Y + iCx + 4), - new Vector2(this.Position.X + this.mWidth - 11, this.Position.Y + iCx + 4) - }, - col.ToSharpDxColor()); - } - Line.End(); - } - - /// - /// Draws the Border around the ColorSlider - /// - private void DrawBorder() - { - ColorBGRA color = Color.FromArgb(37, 37, 37).ToSharpDxColor(); + ColorBGRA color = Color.FromArgb(37, 37, 37).ToSharpDxColor(); Utils.DrawLine( this.Position.X + 10, @@ -1439,7 +1288,7 @@ private void DrawBorder() } /// - /// Draws in Content of the ColorSlider + /// Draws in Content of the ColorSlider /// private void DrawContent() { @@ -1473,7 +1322,7 @@ private void DrawContent() } /// - /// Draws the Arrows + /// Draws the Arrows /// private void DrawSlider(int position, bool unconditional) { @@ -1507,53 +1356,142 @@ private void DrawSlider(int position, bool unconditional) } /// - /// Resets the Arrows + /// Draws in Blue Style /// - /// Force Redraw - private void ResetSlider(bool redraw) + private void DrawStyleBlue() { - switch (this.mEDrawStyle) + Line.Begin(); + for (var iCx = 0; iCx <= this.mHeight - 9; iCx++) { - case EDrawStyle.Hue: - this.ArrowPos = (this.mHeight - 8) - Convert.ToInt32(Math.Round((this.mHeight - 8d) * this.mHsl.H)); + var blue = Convert.ToInt32(255 - Math.Round(255 * Convert.ToDouble(iCx / (this.mHeight - 9d)))); + var col = Color.FromArgb(this.mRgb.R, this.mRgb.G, blue); - break; - case EDrawStyle.Saturation: - this.ArrowPos = (this.mHeight - 8) - Convert.ToInt32(Math.Round((this.mHeight - 8d) * this.mHsl.S)); + Line.Draw( + new[] + { + new Vector2(this.Position.X + 11, this.Position.Y + iCx + 4), + new Vector2(this.Position.X + this.mWidth - 11, this.Position.Y + iCx + 4) + }, + col.ToSharpDxColor()); + } + Line.End(); + } - break; - case EDrawStyle.Brightness: - this.ArrowPos = (this.mHeight - 8) - Convert.ToInt32(Math.Round((this.mHeight - 8d) * this.mHsl.L)); + /// + /// Draws in Green Style + /// + private void DrawStyleGreen() + { + Line.Begin(); + for (var iCx = 0; iCx <= this.mHeight - 9; iCx++) + { + var green = Convert.ToInt32(255 - Math.Round(255 * Convert.ToDouble(iCx / (this.mHeight - 9d)))); + var col = Color.FromArgb(this.mRgb.R, green, this.mRgb.B); - break; - case EDrawStyle.Red: - this.ArrowPos = (this.mHeight - 8) - - Convert.ToInt32( - Math.Round((this.mHeight - 8d) * Convert.ToDouble(this.mRgb.R / 255d))); + Line.Draw( + new[] + { + new Vector2(this.Position.X + 11, this.Position.Y + iCx + 4), + new Vector2(this.Position.X + this.mWidth - 11, this.Position.Y + iCx + 4) + }, + col.ToSharpDxColor()); + } + Line.End(); + } - break; - case EDrawStyle.Green: - this.ArrowPos = (this.mHeight - 8) - - Convert.ToInt32( - Math.Round((this.mHeight - 8d) * Convert.ToDouble(this.mRgb.G / 255d))); + /// + /// Draws in Hue Style + /// + private void DrawStyleHue() + { + var hsl = new Hsl { S = 1, L = 1 }; + Line.Begin(); + for (var iCx = 0; iCx <= this.mHeight - 9; iCx++) + { + hsl.H = 1.0d - Convert.ToDouble(iCx / (this.mHeight - 9d)); + var col = Utilities.HslToRgb(hsl); - break; - case EDrawStyle.Blue: - this.ArrowPos = (this.mHeight - 8) - - Convert.ToInt32( - Math.Round((this.mHeight - 8d) * Convert.ToDouble(this.mRgb.B / 255d))); + Line.Draw( + new[] + { + new Vector2(this.Position.X + 11, this.Position.Y + iCx + 4), + new Vector2(this.Position.X + this.mWidth - 11, this.Position.Y + iCx + 4) + }, + col.ToSharpDxColor()); + } + Line.End(); + } - break; + /// + /// Draws in Luminance Style + /// + private void DrawStyleLuminance() + { + var hsl = new Hsl { H = this.mHsl.H, S = this.mHsl.S }; + Line.Begin(); + for (var iCx = 0; iCx <= this.mHeight - 9; iCx++) + { + hsl.L = 1.0 - Convert.ToDouble(iCx / (this.mHeight - 9d)); + var col = Utilities.HslToRgb(hsl); + + Line.Draw( + new[] + { + new Vector2(this.Position.X + 11, this.Position.Y + iCx + 4), + new Vector2(this.Position.X + this.mWidth - 11, this.Position.Y + iCx + 4) + }, + col.ToSharpDxColor()); } + Line.End(); + } - if (redraw) + /// + /// Draws in Red Style + /// + private void DrawStyleRed() + { + Line.Begin(); + for (var iCx = 0; iCx <= this.mHeight - 9; iCx++) { - this.DrawSlider(this.ArrowPos, true); + var red = Convert.ToInt32(255 - Math.Round(255 * Convert.ToDouble(iCx / (this.mHeight - 9d)))); + var col = Color.FromArgb(red, this.mRgb.G, this.mRgb.B); + + Line.Draw( + new[] + { + new Vector2(this.Position.X + 11, this.Position.Y + iCx + 4), + new Vector2(this.Position.X + this.mWidth - 11, this.Position.Y + iCx + 4) + }, + col.ToSharpDxColor()); + } + Line.End(); + } + + /// + /// Draws in Saturation Style + /// + private void DrawStyleSaturation() + { + var hsl = new Hsl { H = this.mHsl.H, L = this.mHsl.L }; + Line.Begin(); + for (var iCx = 0; iCx <= this.mHeight - 9; iCx++) + { + hsl.S = 1.0 - Convert.ToDouble(iCx / (this.mHeight - 9d)); + var col = Utilities.HslToRgb(hsl); + + Line.Draw( + new[] + { + new Vector2(this.Position.X + 11, this.Position.Y + iCx + 4), + new Vector2(this.Position.X + this.mWidth - 11, this.Position.Y + iCx + 4) + }, + col.ToSharpDxColor()); } + Line.End(); } /// - /// Resets the Color + /// Resets the Color /// private void ResetHslrgb() { @@ -1602,11 +1540,57 @@ private void ResetHslrgb() } } + /// + /// Resets the Arrows + /// + /// Force Redraw + private void ResetSlider(bool redraw) + { + switch (this.mEDrawStyle) + { + case EDrawStyle.Hue: + this.ArrowPos = (this.mHeight - 8) - Convert.ToInt32(Math.Round((this.mHeight - 8d) * this.mHsl.H)); + + break; + case EDrawStyle.Saturation: + this.ArrowPos = (this.mHeight - 8) - Convert.ToInt32(Math.Round((this.mHeight - 8d) * this.mHsl.S)); + + break; + case EDrawStyle.Brightness: + this.ArrowPos = (this.mHeight - 8) - Convert.ToInt32(Math.Round((this.mHeight - 8d) * this.mHsl.L)); + + break; + case EDrawStyle.Red: + this.ArrowPos = (this.mHeight - 8) + - Convert.ToInt32( + Math.Round((this.mHeight - 8d) * Convert.ToDouble(this.mRgb.R / 255d))); + + break; + case EDrawStyle.Green: + this.ArrowPos = (this.mHeight - 8) + - Convert.ToInt32( + Math.Round((this.mHeight - 8d) * Convert.ToDouble(this.mRgb.G / 255d))); + + break; + case EDrawStyle.Blue: + this.ArrowPos = (this.mHeight - 8) + - Convert.ToInt32( + Math.Round((this.mHeight - 8d) * Convert.ToDouble(this.mRgb.B / 255d))); + + break; + } + + if (redraw) + { + this.DrawSlider(this.ArrowPos, true); + } + } + #endregion } /// - /// The VerticalAlphaSlider + /// The VerticalAlphaSlider /// public class VerticalAlphaSlider { @@ -1622,54 +1606,52 @@ public class VerticalAlphaSlider #region Fields /// - /// Is User dragging the slider + /// VerticalAlphaSlider disabled /// - private bool mBDragging; + private readonly bool mDisabled; /// - /// Defines the Display Style + /// Height of the ColorBox /// - private EDrawStyle mEDrawStyle = EDrawStyle.Brightness; + private readonly int mHeight; /// - /// Height of the ColorBox + /// Width of the ColorBox /// - private int mHeight; + private readonly int mWidth; /// - /// Width of the ColorBox + /// Is User dragging the slider /// - private int mWidth; + private bool mBDragging; /// - /// Hue, Saturation, Lightness + /// Defines the Display Style /// - private Hsl mHsl; + private EDrawStyle mEDrawStyle; /// - /// Reg, Green, Blue + /// Hue, Saturation, Lightness /// - private Color mRgb; + private Hsl mHsl; /// - /// VerticalAlphaSlider disabled + /// Reg, Green, Blue /// - private bool mDisabled; + private Color mRgb; #endregion #region Constructors and Destructors /// - /// Init the VerticalAlphaSlider + /// Init the VerticalAlphaSlider /// - /// + /// The size. + /// if set to true [disabled]. public VerticalAlphaSlider(Size size, bool disabled = false) { - this.mHsl = new Hsl(); - this.mHsl.H = 1; - this.mHsl.S = 0; - this.mHsl.L = 1; + this.mHsl = new Hsl { H = 1, S = 0, L = 1 }; this.mRgb = Utilities.HslToRgb(this.mHsl); this.mEDrawStyle = EDrawStyle.Brightness; @@ -1687,7 +1669,7 @@ public VerticalAlphaSlider(Size size, bool disabled = false) #region Delegates /// - /// EventHandler for the event + /// EventHandler for the event /// public delegate void AlphaSliderScrollEventHandler(); @@ -1696,7 +1678,7 @@ public VerticalAlphaSlider(Size size, bool disabled = false) #region Public Events /// - /// The event which gets fired when the color get changed + /// The event which gets fired when the color get changed /// public event AlphaSliderScrollEventHandler AlphaSliderScroll; @@ -1705,32 +1687,37 @@ public VerticalAlphaSlider(Size size, bool disabled = false) #region Enums /// - /// The DrawStyle enum + /// The DrawStyle enum /// public enum EDrawStyle { /// - /// Hue Style + /// Hue Style /// Hue, + /// - /// Saturation Style + /// Saturation Style /// Saturation, + /// - /// Brightness Style + /// Brightness Style /// Brightness, + /// - /// Red Style + /// Red Style /// Red, + /// - /// Green Style + /// Green Style /// Green, + /// - /// Blue Style + /// Blue Style /// Blue } @@ -1740,12 +1727,12 @@ public enum EDrawStyle #region Public Properties /// - /// Position of the two Arrows + /// Position of the two Arrows /// public int ArrowPos { get; private set; } /// - /// Hue, Saturation, Lightness Property + /// Hue, Saturation, Lightness Property /// public Hsl CbHsl { @@ -1764,7 +1751,7 @@ public Hsl CbHsl } /// - /// The DrawStyle Property + /// The DrawStyle Property /// public EDrawStyle DrawStyle { @@ -1782,12 +1769,12 @@ public EDrawStyle DrawStyle } /// - /// Position of the ColorSlider + /// Position of the ColorSlider /// public Vector2 Position { get; set; } /// - /// Red, Green, Blue Property + /// Red, Green, Blue Property /// public Color Rgb { @@ -1810,7 +1797,7 @@ public Color Rgb #region Public Methods and Operators /// - /// Draws the AlphaSlider + /// Draws the AlphaSlider /// /// Sets a new Position public void DrawControl(Vector2 newPos = new Vector2()) @@ -1823,12 +1810,12 @@ public Color Rgb } /// - /// Gets fired when the left mouse button is pressed + /// Gets fired when the left mouse button is pressed /// /// Keys - public void VerticalAlphaSlider_MouseDown(WindowsKeys args) + public void VerticalAlphaSliderMouseDown(WindowsKeys args) { - if (args.Msg == WindowsMessages.LBUTTONDOWN && !mDisabled) + if (args.Msg == WindowsMessages.LBUTTONDOWN && !this.mDisabled) { this.mBDragging = true; @@ -1843,83 +1830,181 @@ public void VerticalAlphaSlider_MouseDown(WindowsKeys args) y = (this.mHeight - 9); } - this.ArrowPos = y; + this.ArrowPos = y; + + this.DrawSlider(y, false); + this.ResetHslrgb(); + this.AlphaSliderScroll?.Invoke(); + } + } + + /// + /// Gets fired when the mouse is moved and pressed before + /// + /// Keys + public void VerticalAlphaSliderMouseMove(WindowsKeys args) + { + if (this.mBDragging && args.Msg == WindowsMessages.MOUSEMOVE && !this.mDisabled) + { + var y = (int)args.Cursor.Y - (int)this.Position.Y; + y -= 4; + if (y < 0) + { + y = 0; + } + if (y > (this.mHeight - 9)) + { + y = (this.mHeight - 9); + } + + this.ArrowPos = y; + this.DrawSlider(y, false); + this.ResetHslrgb(); + this.AlphaSliderScroll?.Invoke(); + } + } + + /// + /// Gets fired when the mouse is released and pressed before + /// + /// Keys + public void VerticalAlphaSliderMouseUp(WindowsKeys args) + { + if (this.mBDragging && args.Msg == WindowsMessages.LBUTTONUP && !this.mDisabled) + { + this.mBDragging = false; + + var y = (int)args.Cursor.Y - (int)this.Position.Y; + y -= 4; + if (y < 0) + { + y = 0; + } + if (y > (this.mHeight - 9)) + { + y = (this.mHeight - 9); + } + + this.ArrowPos = y; + this.DrawSlider(y, false); + this.ResetHslrgb(); + this.AlphaSliderScroll?.Invoke(); + } + } + + #endregion + + #region Methods + + /// + /// Draws the Border around the AlphaSlider + /// + private void DrawBorder() + { + ColorBGRA color = Color.FromArgb(37, 37, 37).ToSharpDxColor(); + + Utils.DrawLine( + this.Position.X + 10, + this.Position.Y + 3, + this.Position.X + this.mWidth - 10, + this.Position.Y + 3, + 1, + color); //Top + Utils.DrawLine( + this.Position.X + 10, + this.Position.Y + 3, + this.Position.X + 10, + this.Position.Y + this.mHeight - 3, + 1, + color); //Left + Utils.DrawLine( + this.Position.X + 10, + this.Position.Y + this.mHeight - 4, + this.Position.X + this.mWidth - 10, + this.Position.Y + this.mHeight - 4, + 1, + color); + //Bot + Utils.DrawLine( + this.Position.X + this.mWidth - 11, + this.Position.Y + 3, + this.Position.X + this.mWidth - 11, + this.Position.Y + this.mHeight - 3, + 1, + color); + //Right + } + + /// + /// Draws in Content of the AlphaSlider + /// + private void DrawContent() + { + switch (this.mEDrawStyle) + { + case EDrawStyle.Hue: + this.DrawStyleHue(); + + break; + case EDrawStyle.Saturation: + this.DrawStyleSaturation(); + + break; + case EDrawStyle.Brightness: + this.DrawStyleLuminance(); + + break; + case EDrawStyle.Red: + this.DrawStyleRed(); - this.DrawSlider(y, false); - this.ResetHslrgb(); - if (this.AlphaSliderScroll != null) - { - this.AlphaSliderScroll(); - } + break; + case EDrawStyle.Green: + this.DrawStyleGreen(); + + break; + case EDrawStyle.Blue: + this.DrawStyleBlue(); + + break; } } /// - /// Gets fired when the mouse is moved and pressed before + /// Draws the Arrows /// - /// Keys - public void VerticalAlphaSlider_MouseMove(WindowsKeys args) + private void DrawSlider(int position, bool unconditional) { - if (this.mBDragging && args.Msg == WindowsMessages.MOUSEMOVE && !mDisabled) + if (position < 0) { - var y = (int)args.Cursor.Y - (int)this.Position.Y; - y -= 4; - if (y < 0) - { - y = 0; - } - if (y > (this.mHeight - 9)) - { - y = (this.mHeight - 9); - } - - this.ArrowPos = y; - this.DrawSlider(y, false); - this.ResetHslrgb(); - if (this.AlphaSliderScroll != null) - { - this.AlphaSliderScroll(); - } + position = 0; + } + if (position > (this.mHeight - 9)) + { + position = (this.mHeight - 9); } - } - /// - /// Gets fired when the mouse is released and pressed before - /// - /// Keys - public void VerticalAlphaSlider_MouseUp(WindowsKeys args) - { - if (this.mBDragging && args.Msg == WindowsMessages.LBUTTONUP && !mDisabled) + if (this.ArrowPos == position & !unconditional) { - this.mBDragging = false; + return; + } - var y = (int)args.Cursor.Y - (int)this.Position.Y; - y -= 4; - if (y < 0) - { - y = 0; - } - if (y > (this.mHeight - 9)) - { - y = (this.mHeight - 9); - } + this.ArrowPos = position; - this.ArrowPos = y; - this.DrawSlider(y, false); - this.ResetHslrgb(); - if (this.AlphaSliderScroll != null) - { - this.AlphaSliderScroll(); - } - } - } + ColorBGRA color = Color.FromArgb(4, 188, 252).ToSharpDxColor(); - #endregion + Utils.DrawBoxFilled(this.Position.X, this.Position.Y + position, 2, 7, color); + Utils.DrawBoxFilled(this.Position.X + 2, this.Position.Y + position + 1, 2, 5, color); + Utils.DrawBoxFilled(this.Position.X + 4, this.Position.Y + position + 2, 2, 3, color); + Utils.DrawBoxFilled(this.Position.X + 6, this.Position.Y + position + 3, 2, 1, color); - #region Methods + Utils.DrawBoxFilled(this.Position.X + this.mWidth - 2, this.Position.Y + position, 2, 7, color); + Utils.DrawBoxFilled(this.Position.X + this.mWidth - 2 - 2, this.Position.Y + position + 1, 2, 5, color); + Utils.DrawBoxFilled(this.Position.X + this.mWidth - 2 - 4, this.Position.Y + position + 2, 2, 3, color); + Utils.DrawBoxFilled(this.Position.X + this.mWidth - 2 - 6, this.Position.Y + position + 3, 2, 1, color); + } /// - /// Draws in Blue Style + /// Draws in Blue Style /// private void DrawStyleBlue() { @@ -1941,7 +2026,7 @@ private void DrawStyleBlue() } /// - /// Draws in Green Style + /// Draws in Green Style /// private void DrawStyleGreen() { @@ -1963,14 +2048,11 @@ private void DrawStyleGreen() } /// - /// Draws in Hue Style + /// Draws in Hue Style /// private void DrawStyleHue() { - var hsl = new Hsl(); - - hsl.S = 1; - hsl.L = 1; + var hsl = new Hsl { S = 1, L = 1 }; Line.Begin(); for (var iCx = 0; iCx <= this.mHeight - 9; iCx++) { @@ -1989,14 +2071,11 @@ private void DrawStyleHue() } /// - /// Draws in Luminance Style + /// Draws in Luminance Style /// private void DrawStyleLuminance() { - var hsl = new Hsl(); - - hsl.H = this.mHsl.H; - hsl.S = this.mHsl.S; + var hsl = new Hsl { H = this.mHsl.H, S = this.mHsl.S }; Line.Begin(); for (var iCx = 0; iCx <= this.mHeight - 9; iCx++) { @@ -2015,7 +2094,7 @@ private void DrawStyleLuminance() } /// - /// Draws in Red Style + /// Draws in Red Style /// private void DrawStyleRed() { @@ -2037,14 +2116,11 @@ private void DrawStyleRed() } /// - /// Draws in Saturation Style + /// Draws in Saturation Style /// private void DrawStyleSaturation() { - var hsl = new Hsl(); - - hsl.H = this.mHsl.H; - hsl.L = this.mHsl.L; + var hsl = new Hsl { H = this.mHsl.H, L = this.mHsl.L }; Line.Begin(); for (var iCx = 0; iCx <= this.mHeight - 9; iCx++) { @@ -2063,114 +2139,57 @@ private void DrawStyleSaturation() } /// - /// Draws the Border around the AlphaSlider - /// - private void DrawBorder() - { - ColorBGRA color = Color.FromArgb(37, 37, 37).ToSharpDxColor(); - - Utils.DrawLine( - this.Position.X + 10, - this.Position.Y + 3, - this.Position.X + this.mWidth - 10, - this.Position.Y + 3, - 1, - color); //Top - Utils.DrawLine( - this.Position.X + 10, - this.Position.Y + 3, - this.Position.X + 10, - this.Position.Y + this.mHeight - 3, - 1, - color); //Left - Utils.DrawLine( - this.Position.X + 10, - this.Position.Y + this.mHeight - 4, - this.Position.X + this.mWidth - 10, - this.Position.Y + this.mHeight - 4, - 1, - color); - //Bot - Utils.DrawLine( - this.Position.X + this.mWidth - 11, - this.Position.Y + 3, - this.Position.X + this.mWidth - 11, - this.Position.Y + this.mHeight - 3, - 1, - color); - //Right - } - - /// - /// Draws in Content of the AlphaSlider + /// Resets the Color /// - private void DrawContent() + private void ResetHslrgb() { switch (this.mEDrawStyle) { case EDrawStyle.Hue: - this.DrawStyleHue(); + this.mHsl.H = 1.0 - Convert.ToDouble(this.ArrowPos / (this.mHeight - 9d)); + this.mRgb = Utilities.HslToRgb(this.mHsl); break; case EDrawStyle.Saturation: - this.DrawStyleSaturation(); + this.mHsl.S = 1.0 - Convert.ToDouble(this.ArrowPos / (this.mHeight - 9d)); + this.mRgb = Utilities.HslToRgb(this.mHsl); break; case EDrawStyle.Brightness: - this.DrawStyleLuminance(); + this.mHsl.L = 1.0 - Convert.ToDouble(this.ArrowPos / (this.mHeight - 9d)); + this.mRgb = Utilities.HslToRgb(this.mHsl); break; case EDrawStyle.Red: - this.DrawStyleRed(); + this.mRgb = + Color.FromArgb( + 255 + - Convert.ToInt32(Math.Round(255d * Convert.ToDouble(this.ArrowPos / (this.mHeight - 9d)))), + this.mRgb.G, + this.mRgb.B); + this.mHsl = Utilities.RgbToHsl(this.mRgb); break; case EDrawStyle.Green: - this.DrawStyleGreen(); + this.mRgb = Color.FromArgb( + this.mRgb.R, + 255 - Convert.ToInt32(Math.Round(255d * Convert.ToDouble(this.ArrowPos / (this.mHeight - 9d)))), + this.mRgb.B); + this.mHsl = Utilities.RgbToHsl(this.mRgb); break; case EDrawStyle.Blue: - this.DrawStyleBlue(); - + this.mRgb = Color.FromArgb( + this.mRgb.R, + this.mRgb.G, + 255 - Convert.ToInt32(Math.Round(255d * Convert.ToDouble(this.ArrowPos / (this.mHeight - 9d))))); + this.mHsl = Utilities.RgbToHsl(this.mRgb); break; } } /// - /// Draws the Arrows - /// - private void DrawSlider(int position, bool unconditional) - { - if (position < 0) - { - position = 0; - } - if (position > (this.mHeight - 9)) - { - position = (this.mHeight - 9); - } - - if (this.ArrowPos == position & !unconditional) - { - return; - } - - this.ArrowPos = position; - - ColorBGRA color = Color.FromArgb(4, 188, 252).ToSharpDxColor(); - - Utils.DrawBoxFilled(this.Position.X, this.Position.Y + position, 2, 7, color); - Utils.DrawBoxFilled(this.Position.X + 2, this.Position.Y + position + 1, 2, 5, color); - Utils.DrawBoxFilled(this.Position.X + 4, this.Position.Y + position + 2, 2, 3, color); - Utils.DrawBoxFilled(this.Position.X + 6, this.Position.Y + position + 3, 2, 1, color); - - Utils.DrawBoxFilled(this.Position.X + this.mWidth - 2, this.Position.Y + position, 2, 7, color); - Utils.DrawBoxFilled(this.Position.X + this.mWidth - 2 - 2, this.Position.Y + position + 1, 2, 5, color); - Utils.DrawBoxFilled(this.Position.X + this.mWidth - 2 - 4, this.Position.Y + position + 2, 2, 3, color); - Utils.DrawBoxFilled(this.Position.X + this.mWidth - 2 - 6, this.Position.Y + position + 3, 2, 1, color); - } - - /// - /// Resets the Arrows + /// Resets the Arrows /// /// Force Redraw private void ResetSlider(bool redraw) @@ -2215,68 +2234,18 @@ private void ResetSlider(bool redraw) } } - /// - /// Resets the Color - /// - private void ResetHslrgb() - { - switch (this.mEDrawStyle) - { - case EDrawStyle.Hue: - this.mHsl.H = 1.0 - Convert.ToDouble(this.ArrowPos / (this.mHeight - 9d)); - this.mRgb = Utilities.HslToRgb(this.mHsl); - - break; - case EDrawStyle.Saturation: - this.mHsl.S = 1.0 - Convert.ToDouble(this.ArrowPos / (this.mHeight - 9d)); - this.mRgb = Utilities.HslToRgb(this.mHsl); - - break; - case EDrawStyle.Brightness: - this.mHsl.L = 1.0 - Convert.ToDouble(this.ArrowPos / (this.mHeight - 9d)); - this.mRgb = Utilities.HslToRgb(this.mHsl); - - break; - case EDrawStyle.Red: - this.mRgb = - Color.FromArgb( - 255 - - Convert.ToInt32(Math.Round(255d * Convert.ToDouble(this.ArrowPos / (this.mHeight - 9d)))), - this.mRgb.G, - this.mRgb.B); - this.mHsl = Utilities.RgbToHsl(this.mRgb); - - break; - case EDrawStyle.Green: - this.mRgb = Color.FromArgb( - this.mRgb.R, - 255 - Convert.ToInt32(Math.Round(255d * Convert.ToDouble(this.ArrowPos / (this.mHeight - 9d)))), - this.mRgb.B); - this.mHsl = Utilities.RgbToHsl(this.mRgb); - - break; - case EDrawStyle.Blue: - this.mRgb = Color.FromArgb( - this.mRgb.R, - this.mRgb.G, - 255 - Convert.ToInt32(Math.Round(255d * Convert.ToDouble(this.ArrowPos / (this.mHeight - 9d))))); - this.mHsl = Utilities.RgbToHsl(this.mRgb); - break; - } - } - #endregion } /// - /// Adobe Color Utitlies for HSL + /// Adobe Color Utitlies for HSL /// public class AdobeColors { #region Public Methods and Operators /// - /// Modifies brightness of c by brightness + /// Modifies brightness of c by brightness /// /// /// @@ -2289,7 +2258,7 @@ public Color ModifyBrightness(Color c, double brightness) } /// - /// Modifies hue of c by hue + /// Modifies hue of c by hue /// /// /// @@ -2302,7 +2271,7 @@ public Color ModifyHue(Color c, double hue) } /// - /// Modifies saturation of c by saturation + /// Modifies saturation of c by saturation /// /// /// @@ -2315,41 +2284,38 @@ public Color ModifySaturation(Color c, double saturation) } /// - /// Sets brightness of c by brightness + /// Sets brightness of c by brightness /// /// /// /// New color public Color SetBrightness(Color c, double brightness) { - var hsl = new Hsl(); - hsl.L = brightness; + var hsl = new Hsl { L = brightness }; return Utilities.HslToRgb(hsl); } /// - /// Sets hue of c by hue + /// Sets hue of c by hue /// /// /// /// New color public Color SetHue(Color c, double hue) { - var hsl = new Hsl(); - hsl.H = hue; + var hsl = new Hsl { H = hue }; return Utilities.HslToRgb(hsl); } /// - /// Sets saturation of c by saturation + /// Sets saturation of c by saturation /// /// /// /// New color public Color SetSaturation(Color c, double saturation) { - var hsl = new Hsl(); - hsl.S = saturation; + var hsl = new Hsl { S = saturation }; return Utilities.HslToRgb(hsl); } @@ -2357,29 +2323,29 @@ public Color SetSaturation(Color c, double saturation) } /// - /// Color spectrum CMYK + /// Color spectrum CMYK /// public class Cmyk { #region Fields /// - /// Cyan + /// Cyan /// private double c; /// - /// Key plate (black) + /// Key plate (black) /// private double k; /// - /// Magenta + /// Magenta /// private double m; /// - /// Yellow + /// Yellow /// private double y; @@ -2388,7 +2354,7 @@ public class Cmyk #region Public Properties /// - /// Cyan + /// Cyan /// public double C { @@ -2411,7 +2377,7 @@ public double C } /// - /// Key plate (black) + /// Key plate (black) /// public double K { @@ -2434,7 +2400,7 @@ public double K } /// - /// Magenta + /// Magenta /// public double M { @@ -2457,7 +2423,7 @@ public double M } /// - /// Yellow + /// Yellow /// public double Y { @@ -2483,24 +2449,24 @@ public double Y } /// - /// Color spectrum HSL + /// Color spectrum HSL /// public class Hsl { #region Fields /// - /// Hue + /// Hue /// private double h; /// - /// Lightness + /// Lightness /// private double l; /// - /// Saturation + /// Saturation /// private double s; @@ -2509,7 +2475,7 @@ public class Hsl #region Public Properties /// - /// Hue + /// Hue /// public double H { @@ -2532,7 +2498,7 @@ public double H } /// - /// Lightness + /// Lightness /// public double L { @@ -2555,7 +2521,7 @@ public double L } /// - /// Saturation + /// Saturation /// public double S { @@ -2581,50 +2547,42 @@ public double S } /// - /// Color Utilities + /// Color Utilities /// internal static class Utilities { #region Public Methods and Operators /// - /// Converts the CMYK color format to RGB + /// Converts the CMYK color format to RGB /// /// /// Converted color public static Color CmykToRgb(Cmyk cmyk) { - var red = 0; - var green = 0; - var blue = 0; - // To convert CMYK to RGB we first have to convert CMYK to CMY var cyan = (cmyk.C * (1 - cmyk.K)) + cmyk.K; var magenta = (cmyk.M * (1 - cmyk.K)) + cmyk.K; var yellow = (cmyk.Y * (1 - cmyk.K)) + cmyk.K; - red = Convert.ToInt32(Math.Round(cyan * 255d)); - green = Convert.ToInt32(Math.Round(magenta * 255d)); - blue = Convert.ToInt32(Math.Round(yellow * 255d)); + var red = Convert.ToInt32(Math.Round(cyan * 255d)); + var green = Convert.ToInt32(Math.Round(magenta * 255d)); + var blue = Convert.ToInt32(Math.Round(yellow * 255d)); return Color.FromArgb(red, green, blue); } /// - /// Converts the HSL color format to RGB + /// Converts the HSL color format to RGB /// /// /// Converted color public static Color HslToRgb(Hsl hsl) { - var max = 0; - var min = 0; - var mid = 0; - double q = 0; - - max = Convert.ToInt32(Math.Round(hsl.L * 255d)); - min = Convert.ToInt32(Math.Round((1.0d - hsl.S) * (hsl.L / 1.0d) * 255d)); - q = Convert.ToDouble((max - min) / 255d); + int mid; + var max = Convert.ToInt32(Math.Round(hsl.L * 255d)); + var min = Convert.ToInt32(Math.Round((1.0d - hsl.S) * (hsl.L / 1.0d) * 255d)); + var q = Convert.ToDouble((max - min) / 255d); if (hsl.H >= 0 & hsl.H <= (1d / 6d)) { @@ -2660,7 +2618,7 @@ public static Color HslToRgb(Hsl hsl) } /// - /// Converts the RGB color format to CMYK + /// Converts the RGB color format to CMYK /// /// /// Converted color @@ -2696,7 +2654,7 @@ public static Cmyk RgbToCmyk(Color c) } /// - /// Converts the RGB color format to HSL + /// Converts the RGB color format to HSL /// /// /// Converted color @@ -2704,10 +2662,8 @@ public static Hsl RgbToHsl(Color c) { var hsl = new Hsl(); - var max = 0; - var min = 0; - var diff = 0; - var sum = 0; + int max; + int min; // Of the RBG Values - assign the highest value to _Max and the lowest to _min if (c.R > c.G) @@ -2729,35 +2685,19 @@ public static Hsl RgbToHsl(Color c) min = c.B; } - diff = max - min; - sum = max + min; + var diff = max - min; // Luminance (aka Brightness) hsl.L = Convert.ToDouble(max / 255d); // Saturation - if (max == 0) - { - hsl.S = 0; - } - else - { - hsl.S = Convert.ToDouble(diff / (double)max); - } + hsl.S = max == 0 ? 0 : Convert.ToDouble(diff / (double)max); // Hue // R is situated at the angle of 360 eller noll degrees // G vid 120 degrees // B vid 240 degrees - double q = 0; - if (diff == 0) - { - q = 0; - } - else - { - q = Convert.ToDouble(60d / diff); - } + var q = diff == 0 ? 0 : Convert.ToDouble(60d / diff); if (max == Convert.ToInt32(c.R)) { @@ -2784,4 +2724,4 @@ public static Hsl RgbToHsl(Color c) #endregion } -} +} \ No newline at end of file diff --git a/Core/UI/IMenu/Customizer/MenuCustomizer.cs b/Core/UI/IMenu/Customizer/MenuCustomizer.cs index 1753040..0918c53 100644 --- a/Core/UI/IMenu/Customizer/MenuCustomizer.cs +++ b/Core/UI/IMenu/Customizer/MenuCustomizer.cs @@ -17,10 +17,11 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Customizer { + using LeagueSharp.SDK.Core.UI.IMenu.Skins; + using LeagueSharp.SDK.Core.UI.IMenu.Values; + using SharpDX; using SharpDX.Direct3D9; - using Skins; - using Values; /// /// This menu allows the user to modify several properties in . diff --git a/Core/UI/IMenu/Menu.cs b/Core/UI/IMenu/Menu.cs index 70526d8..b31291b 100644 --- a/Core/UI/IMenu/Menu.cs +++ b/Core/UI/IMenu/Menu.cs @@ -22,10 +22,12 @@ namespace LeagueSharp.SDK.Core.UI.IMenu using System.IO; using System.Linq; using System.Reflection; - using Abstracts; - using Core.Utils; + + using LeagueSharp.SDK.Core.UI.IMenu.Abstracts; + using LeagueSharp.SDK.Core.UI.IMenu.Skins; + using LeagueSharp.SDK.Core.Utils; + using SharpDX; - using Skins; /// /// Menu Value Changed delegate @@ -136,7 +138,7 @@ public override string Path /// /// Returns if the menu has been toggled. /// - public override sealed bool Toggled + public sealed override bool Toggled { get { @@ -162,7 +164,7 @@ public override sealed bool Toggled /// /// Returns the menu visibility. /// - public override sealed bool Visible + public sealed override bool Visible { get { diff --git a/Core/UI/IMenu/MenuItem.cs b/Core/UI/IMenu/MenuItem.cs index 8faeb87..214505b 100644 --- a/Core/UI/IMenu/MenuItem.cs +++ b/Core/UI/IMenu/MenuItem.cs @@ -24,8 +24,8 @@ namespace LeagueSharp.SDK.Core.UI.IMenu using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; - using Abstracts; - using Core.Utils; + using LeagueSharp.SDK.Core.UI.IMenu.Abstracts; + using LeagueSharp.SDK.Core.Utils; using SharpDX; @@ -101,7 +101,7 @@ public override string Path { return System.IO.Path.Combine( - MenuManager.ConfigFolder.CreateSubdirectory(this.AssemblyName).FullName, + MenuManager.ConfigFolder.CreateSubdirectory(this.AssemblyName).FullName, fileName); } @@ -122,7 +122,7 @@ public override string Path /// /// Returns the item visibility. /// - public override sealed bool Visible { get; set; } + public sealed override bool Visible { get; set; } #endregion diff --git a/Core/UI/IMenu/MenuManager.cs b/Core/UI/IMenu/MenuManager.cs index 1dd1160..8ee387e 100644 --- a/Core/UI/IMenu/MenuManager.cs +++ b/Core/UI/IMenu/MenuManager.cs @@ -22,10 +22,12 @@ namespace LeagueSharp.SDK.Core.UI.IMenu using System.IO; using System.Linq; using System.Windows.Forms; - using Core.Utils; - using Enumerations; + + using LeagueSharp.SDK.Core.Enumerations; + using LeagueSharp.SDK.Core.UI.IMenu.Skins; + using LeagueSharp.SDK.Core.Utils; + using SharpDX.Direct3D9; - using Skins; /// /// Menu Interface class, used to control the menu. diff --git a/Core/UI/IMenu/RadioMenu.cs b/Core/UI/IMenu/RadioMenu.cs index 437602c..50f65e4 100644 --- a/Core/UI/IMenu/RadioMenu.cs +++ b/Core/UI/IMenu/RadioMenu.cs @@ -19,7 +19,7 @@ namespace LeagueSharp.SDK.Core.UI.IMenu { using System; - using Values; + using LeagueSharp.SDK.Core.UI.IMenu.Values; /// /// RadioMenu Item. diff --git a/Core/UI/IMenu/Skins/ADrawable.cs b/Core/UI/IMenu/Skins/ADrawable.cs index c9f3549..26049ea 100644 --- a/Core/UI/IMenu/Skins/ADrawable.cs +++ b/Core/UI/IMenu/Skins/ADrawable.cs @@ -17,8 +17,8 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins { - using Abstracts; - using Core.Utils; + using LeagueSharp.SDK.Core.UI.IMenu.Abstracts; + using LeagueSharp.SDK.Core.Utils; /// /// Defines a handler which is responsible for the drawing and interactions of an . diff --git a/Core/UI/IMenu/Skins/ADrawableAdapter.cs b/Core/UI/IMenu/Skins/ADrawableAdapter.cs index ce82691..6c347f5 100644 --- a/Core/UI/IMenu/Skins/ADrawableAdapter.cs +++ b/Core/UI/IMenu/Skins/ADrawableAdapter.cs @@ -17,8 +17,8 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins { - using Abstracts; - using Core.Utils; + using LeagueSharp.SDK.Core.UI.IMenu.Abstracts; + using LeagueSharp.SDK.Core.Utils; /// /// Provides an implementation of that does nothing. This is used to prevent exceptions when diff --git a/Core/UI/IMenu/Skins/Blue/BlueBool.cs b/Core/UI/IMenu/Skins/Blue/BlueBool.cs index 5fbf97f..d9e13c2 100644 --- a/Core/UI/IMenu/Skins/Blue/BlueBool.cs +++ b/Core/UI/IMenu/Skins/Blue/BlueBool.cs @@ -19,6 +19,7 @@ // A custom implementation of a // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue { using LeagueSharp.SDK.Core.Enumerations; @@ -69,7 +70,7 @@ public BlueBool(MenuBool component) public Rectangle ButtonBoundaries(MenuBool component) { return new Rectangle( - (int)(component.Position.X + component.MenuWidth - MenuSettings.ContainerHeight), + (int)(component.Position.X + component.MenuWidth - MenuSettings.ContainerHeight), (int)component.Position.Y, MenuSettings.ContainerHeight, MenuSettings.ContainerHeight); @@ -95,9 +96,9 @@ public override void Draw() .Y; MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(this.Component.Position.X + MenuSettings.ContainerTextOffset), + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(this.Component.Position.X + MenuSettings.ContainerTextOffset), centerY, MenuSettings.TextColor); @@ -108,31 +109,31 @@ public override void Draw() { new Vector2( (this.Component.Position.X + this.Component.MenuWidth - MenuSettings.ContainerHeight - 1) - + MenuSettings.ContainerHeight / 2f, - this.Component.Position.Y + 1 + 3), + + MenuSettings.ContainerHeight / 2f, + this.Component.Position.Y + 1 + 3), new Vector2( (this.Component.Position.X + this.Component.MenuWidth - MenuSettings.ContainerHeight - 1) - + MenuSettings.ContainerHeight / 2f, + + MenuSettings.ContainerHeight / 2f, this.Component.Position.Y + MenuSettings.ContainerHeight - 3) - }, + }, this.Component.Value ? new ColorBGRA(0, 186, 255, 255) : new ColorBGRA(36, 36, 36, 255)); Line.End(); var centerX = (int) new Rectangle( - (int)(this.Component.Position.X + this.Component.MenuWidth - MenuSettings.ContainerHeight), + (int)(this.Component.Position.X + this.Component.MenuWidth - MenuSettings.ContainerHeight), (int)this.Component.Position.Y, MenuSettings.ContainerHeight, MenuSettings.ContainerHeight).GetCenteredText( - null, - MenuSettings.Font, - this.Component.Value ? "On" : "Off", + null, + MenuSettings.Font, + this.Component.Value ? "On" : "Off", CenteredFlags.HorizontalCenter).X; MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.Value ? "On" : "Off", - centerX, + MenuManager.Instance.Sprite, + this.Component.Value ? "On" : "Off", + centerX, centerY, this.Component.Value ? new ColorBGRA(0, 27, 41, 255) : MenuSettings.TextColor); } diff --git a/Core/UI/IMenu/Skins/Blue/BlueButton.cs b/Core/UI/IMenu/Skins/Blue/BlueButton.cs index 5337b42..52b7a87 100644 --- a/Core/UI/IMenu/Skins/Blue/BlueButton.cs +++ b/Core/UI/IMenu/Skins/Blue/BlueButton.cs @@ -19,6 +19,7 @@ // A custom implementation of // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue { using LeagueSharp.SDK.Core.Enumerations; @@ -96,8 +97,8 @@ public Rectangle ButtonBoundaries(MenuButton component) var buttonTextWidth = MenuSettings.Font.MeasureText(MenuManager.Instance.Sprite, component.ButtonText, 0).Width; return new Rectangle( - (int)(component.Position.X + component.MenuWidth - buttonTextWidth - (2 * TextGap)), - (int)component.Position.Y, + (int)(component.Position.X + component.MenuWidth - buttonTextWidth - (2 * TextGap)), + (int)component.Position.Y, (2 * TextGap) + buttonTextWidth, MenuSettings.ContainerHeight); } @@ -119,9 +120,9 @@ public override void Draw() .GetCenteredText(null, MenuSettings.Font, this.Component.DisplayName, CenteredFlags.VerticalCenter); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(this.Component.Position.X + MenuSettings.ContainerTextOffset), + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(this.Component.Position.X + MenuSettings.ContainerTextOffset), (int)rectangleName.Y, MenuSettings.TextColor); @@ -148,19 +149,19 @@ public override void Draw() new[] { new Vector2( - this.Component.Position.X + this.Component.MenuWidth - buttonTextWidth - (2 * TextGap) + 2, - this.Component.Position.Y + (MenuSettings.ContainerHeight / 2f)), + this.Component.Position.X + this.Component.MenuWidth - buttonTextWidth - (2 * TextGap) + 2, + this.Component.Position.Y + (MenuSettings.ContainerHeight / 2f)), new Vector2( - this.Component.Position.X + this.Component.MenuWidth - 2, - this.Component.Position.Y + (MenuSettings.ContainerHeight / 2f)), - }, + this.Component.Position.X + this.Component.MenuWidth - 2, + this.Component.Position.Y + (MenuSettings.ContainerHeight / 2f)), + }, this.Component.Hovering ? this.buttonHoverColor : this.buttonColor); Line.End(); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.ButtonText, - (int)(this.Component.Position.X + this.Component.MenuWidth - buttonTextWidth - TextGap), + MenuManager.Instance.Sprite, + this.Component.ButtonText, + (int)(this.Component.Position.X + this.Component.MenuWidth - buttonTextWidth - TextGap), (int)rectangleName.Y, MenuSettings.TextColor); } diff --git a/Core/UI/IMenu/Skins/Blue/BlueColorPicker.cs b/Core/UI/IMenu/Skins/Blue/BlueColorPicker.cs index ef19f30..4051c0e 100644 --- a/Core/UI/IMenu/Skins/Blue/BlueColorPicker.cs +++ b/Core/UI/IMenu/Skins/Blue/BlueColorPicker.cs @@ -19,6 +19,7 @@ // A custom implementation of // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue { using System.Drawing; @@ -249,11 +250,11 @@ public override void Draw() new[] { new Vector2( - this.Component.Position.X + this.Component.MenuWidth - (Line.Width / 2f) - 4, - this.Component.Position.Y + 1 + 3), - new Vector2( - this.Component.Position.X + this.Component.MenuWidth - (Line.Width / 2f) - 4, - this.Component.Position.Y + Line.Width + 3) + this.Component.Position.X + this.Component.MenuWidth - (Line.Width / 2f) - 4, + this.Component.Position.Y + 1 + 3), + new Vector2( + this.Component.Position.X + this.Component.MenuWidth - (Line.Width / 2f) - 4, + this.Component.Position.Y + Line.Width + 3) }, MenuSettings.HoverColor); Line.End(); @@ -264,53 +265,58 @@ public override void Draw() MenuManager.Instance.DrawDelayed( delegate { - Line.Width = ColorPickerBoundaries().Width; + Line.Width = this.ColorPickerBoundaries().Width; Line.Begin(); Line.Draw( new[] { - new Vector2(ColorPickerBoundaries().X + 165, ColorPickerBoundaries().Y), + new Vector2(this.ColorPickerBoundaries().X + 165, this.ColorPickerBoundaries().Y), new Vector2( - ColorPickerBoundaries().X + 165, - ColorPickerBoundaries().Y + ColorPickerBoundaries().Height) + this.ColorPickerBoundaries().X + 165, + this.ColorPickerBoundaries().Y + this.ColorPickerBoundaries().Height) }, MenuSettings.RootContainerColor); Line.End(); - colorBox.DrawControl(new Vector2(ColorBoxBoundaries().X, ColorBoxBoundaries().Y)); - verticalColorSlider.DrawControl( - new Vector2(VerticalColorSliderBoundaries().X, VerticalColorSliderBoundaries().Y)); - verticalAlphaSlider.DrawControl( - new Vector2(VerticalAlphaSliderBoundaries().X, VerticalAlphaSliderBoundaries().Y)); + this.colorBox.DrawControl( + new Vector2(this.ColorBoxBoundaries().X, this.ColorBoxBoundaries().Y)); + this.verticalColorSlider.DrawControl( + new Vector2( + this.VerticalColorSliderBoundaries().X, + this.VerticalColorSliderBoundaries().Y)); + this.verticalAlphaSlider.DrawControl( + new Vector2( + this.VerticalAlphaSliderBoundaries().X, + this.VerticalAlphaSliderBoundaries().Y)); Utils.DrawBoxFilled( - PreviewBoundaries().X, - PreviewBoundaries().Y, - PreviewBoundaries().Width, - PreviewBoundaries().Height, + this.PreviewBoundaries().X, + this.PreviewBoundaries().Y, + this.PreviewBoundaries().Width, + this.PreviewBoundaries().Height, Color.Black); Utils.DrawBoxFilled( - PreviewBoundaries().X, - PreviewBoundaries().Y, - PreviewBoundaries().Width, - PreviewBoundaries().Height, - colorBox.Rgb.ToSharpDxColor()); + this.PreviewBoundaries().X, + this.PreviewBoundaries().Y, + this.PreviewBoundaries().Width, + this.PreviewBoundaries().Height, + this.colorBox.Rgb.ToSharpDxColor()); var applyButtonTextWidth = MenuSettings.Font.MeasureText(MenuManager.Instance.Sprite, "Apply", 0).Width; var cancelButtonTextWidth = MenuSettings.Font.MeasureText(MenuManager.Instance.Sprite, "Cancel", 0).Width; - Line.Width = ApplyButtonBoundaries().Width; + Line.Width = this.ApplyButtonBoundaries().Width; Line.Begin(); Line.Draw( new[] { - new Vector2(ApplyButtonBoundaries().X + 25, ApplyButtonBoundaries().Y), + new Vector2(this.ApplyButtonBoundaries().X + 25, this.ApplyButtonBoundaries().Y), new Vector2( - ApplyButtonBoundaries().X + 25, - ApplyButtonBoundaries().Y + ApplyButtonBoundaries().Height) + this.ApplyButtonBoundaries().X + 25, + this.ApplyButtonBoundaries().Y + this.ApplyButtonBoundaries().Height) }, new ColorBGRA(4, 187, 255, 255)); Line.End(); @@ -318,22 +324,22 @@ public override void Draw() MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, "Apply", - ApplyButtonBoundaries().X - applyButtonTextWidth / 2 + 25, + this.ApplyButtonBoundaries().X - applyButtonTextWidth / 2 + 25, (int) - CancelButtonBoundaries() + this.CancelButtonBoundaries() .GetCenteredText(null, MenuSettings.Font, "Apply", CenteredFlags.VerticalCenter) .Y, new ColorBGRA(0, 27, 41, 255)); - Line.Width = CancelButtonBoundaries().Width; + Line.Width = this.CancelButtonBoundaries().Width; Line.Begin(); Line.Draw( new[] { - new Vector2(CancelButtonBoundaries().X + 25, CancelButtonBoundaries().Y), + new Vector2(this.CancelButtonBoundaries().X + 25, this.CancelButtonBoundaries().Y), new Vector2( - CancelButtonBoundaries().X + 25, - CancelButtonBoundaries().Y + CancelButtonBoundaries().Height) + this.CancelButtonBoundaries().X + 25, + this.CancelButtonBoundaries().Y + this.CancelButtonBoundaries().Height) }, new ColorBGRA(4, 187, 255, 255)); Line.End(); @@ -341,9 +347,9 @@ public override void Draw() MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, "Cancel", - CancelButtonBoundaries().X - cancelButtonTextWidth / 2 + 25, + this.CancelButtonBoundaries().X - cancelButtonTextWidth / 2 + 25, (int) - CancelButtonBoundaries() + this.CancelButtonBoundaries() .GetCenteredText(null, MenuSettings.Font, "Cancel", CenteredFlags.VerticalCenter) .Y, new ColorBGRA(0, 27, 41, 255)); @@ -382,11 +388,11 @@ public override void OnWndProc(WindowsKeys args) } else if (this.InteractingVerticalColorSlider) { - this.verticalColorSlider.VerticalColorSlider_MouseMove(args); + this.verticalColorSlider.VerticalColorSliderMouseMove(args); } else if (this.InteractingVerticalAlphaSlider) { - this.verticalAlphaSlider.VerticalAlphaSlider_MouseMove(args); + this.verticalAlphaSlider.VerticalAlphaSliderMouseMove(args); } } } @@ -401,12 +407,12 @@ public override void OnWndProc(WindowsKeys args) if (this.InteractingVerticalColorSlider) { this.InteractingVerticalColorSlider = false; - this.verticalColorSlider.VerticalColorSlider_MouseUp(args); + this.verticalColorSlider.VerticalColorSliderMouseUp(args); } if (this.InteractingVerticalAlphaSlider) { this.InteractingVerticalAlphaSlider = false; - this.verticalAlphaSlider.VerticalAlphaSlider_MouseUp(args); + this.verticalAlphaSlider.VerticalAlphaSliderMouseUp(args); } } @@ -435,7 +441,7 @@ public override void OnWndProc(WindowsKeys args) this.VerticalColorSliderBoundaries().Height)) { this.InteractingVerticalColorSlider = true; - this.verticalColorSlider.VerticalColorSlider_MouseDown(args); + this.verticalColorSlider.VerticalColorSliderMouseDown(args); } else if (args.Cursor.IsUnderRectangle( this.VerticalAlphaSliderBoundaries().X, @@ -444,7 +450,7 @@ public override void OnWndProc(WindowsKeys args) this.VerticalAlphaSliderBoundaries().Height)) { this.InteractingVerticalAlphaSlider = true; - this.verticalAlphaSlider.VerticalAlphaSlider_MouseDown(args); + this.verticalAlphaSlider.VerticalAlphaSliderMouseDown(args); } else if (args.Cursor.IsUnderRectangle( this.ApplyButtonBoundaries().X, diff --git a/Core/UI/IMenu/Skins/Blue/BlueList.cs b/Core/UI/IMenu/Skins/Blue/BlueList.cs index 54a76a4..f4f5e16 100644 --- a/Core/UI/IMenu/Skins/Blue/BlueList.cs +++ b/Core/UI/IMenu/Skins/Blue/BlueList.cs @@ -19,6 +19,7 @@ // A custom implementation of a // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue { using System.Collections.Generic; @@ -107,24 +108,24 @@ public override void Draw() .GetCenteredText(null, MenuSettings.Font, this.Component.DisplayName, CenteredFlags.VerticalCenter); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(position.X + MenuSettings.ContainerTextOffset), + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(position.X + MenuSettings.ContainerTextOffset), (int)rectangleName.Y, MenuSettings.TextColor); MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, - "\u23EC", - (int)(position.X + this.Component.MenuWidth - this.dropDownButtonWidth + ArrowSpacing), + "\u23EC", + (int)(position.X + this.Component.MenuWidth - this.dropDownButtonWidth + ArrowSpacing), (int)rectangleName.Y, MenuSettings.TextColor); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.SelectedValueAsObject.ToString(), + MenuManager.Instance.Sprite, + this.Component.SelectedValueAsObject.ToString(), (int)position.X + this.Component.MenuWidth - this.dropDownButtonWidth - TextSpacing - - this.Component.MaxStringWidth, + - this.Component.MaxStringWidth, (int)rectangleName.Y, this.Component.Active ? new ColorBGRA(0, 186, 255, 255) : MenuSettings.TextColor); Line.Width = 1f; @@ -159,22 +160,23 @@ public override void Draw() new[] { new Vector2( - position.X + Component.MenuWidth - (Line.Width / 2), - position.Y + MenuSettings.ContainerHeight), + position.X + this.Component.MenuWidth - (Line.Width / 2), + position.Y + MenuSettings.ContainerHeight), new Vector2( - position.X + Component.MenuWidth - (Line.Width / 2), + position.X + this.Component.MenuWidth - (Line.Width / 2), position.Y + MenuSettings.ContainerHeight + dropdownMenuHeight) - }, dropdownColor); + }, + dropdownColor); Line.End(); var x = (int) - (position.X + Component.MenuWidth - dropDownButtonWidth - TextSpacing - - Component.MaxStringWidth); + (position.X + this.Component.MenuWidth - this.dropDownButtonWidth - TextSpacing + - this.Component.MaxStringWidth); var y = (int)rectangleName.Y; for (var i = 0; i < valueStrings.Length; i++) { - if (i == Component.HoveringIndex) + if (i == this.Component.HoveringIndex) { Line.Width = MenuSettings.ContainerHeight; Line.Begin(); @@ -182,11 +184,11 @@ public override void Draw() new[] { new Vector2( - position.X + Component.MenuWidth - dropdownMenuWidth, + position.X + this.Component.MenuWidth - dropdownMenuWidth, position.Y + ((i + 1) * MenuSettings.ContainerHeight) - + MenuSettings.ContainerHeight / 2f), + + MenuSettings.ContainerHeight / 2f), new Vector2( - position.X + Component.MenuWidth, + position.X + this.Component.MenuWidth, position.Y + ((i + 1) * MenuSettings.ContainerHeight) + MenuSettings.ContainerHeight / 2f) }, @@ -200,49 +202,49 @@ public override void Draw() new[] { new Vector2( - position.X + Component.MenuWidth - dropdownMenuWidth + 10, - position.Y + (MenuSettings.ContainerHeight * (i + 1))), + position.X + this.Component.MenuWidth - dropdownMenuWidth + 10, + position.Y + (MenuSettings.ContainerHeight * (i + 1))), new Vector2( - position.X + Component.MenuWidth - 10, + position.X + this.Component.MenuWidth - 10, position.Y + (MenuSettings.ContainerHeight * (i + 1))) }, MenuSettings.ContainerSeparatorColor); Line.End(); y += MenuSettings.ContainerHeight; MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - valueStrings[i], - x, + MenuManager.Instance.Sprite, + valueStrings[i], + x, y, MenuSettings.TextColor); - if (Component.Index == i) + if (this.Component.Index == i) { var checkmarkWidth = MenuSettings.Font.MeasureText(null, "\u2713", 0).Width; MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, - "\u2713", - (int)(position.X + Component.MenuWidth - checkmarkWidth - TextSpacing), + "\u2713", + (int)(position.X + this.Component.MenuWidth - checkmarkWidth - TextSpacing), y, new ColorBGRA(1, 165, 226, 255)); } } - Line.Width = 1f; - Line.Begin(); - Line.Draw( + Line.Width = 1f; + Line.Begin(); + Line.Draw( new[] { new Vector2( - position.X + Component.MenuWidth - dropdownMenuWidth, - position.Y + MenuSettings.ContainerHeight), + position.X + this.Component.MenuWidth - dropdownMenuWidth, + position.Y + MenuSettings.ContainerHeight), new Vector2( - position.X + Component.MenuWidth - dropdownMenuWidth, - position.Y + MenuSettings.ContainerHeight * (valueStrings.Length + 1)), + position.X + this.Component.MenuWidth - dropdownMenuWidth, + position.Y + MenuSettings.ContainerHeight * (valueStrings.Length + 1)), new Vector2( - position.X + Component.MenuWidth, - position.Y + MenuSettings.ContainerHeight * (valueStrings.Length + 1)), + position.X + this.Component.MenuWidth, + position.Y + MenuSettings.ContainerHeight * (valueStrings.Length + 1)), new Vector2( - position.X + Component.MenuWidth, + position.X + this.Component.MenuWidth, position.Y + MenuSettings.ContainerHeight) }, MenuSettings.ContainerSeparatorColor); @@ -262,8 +264,8 @@ public Rectangle DropDownBoundaries(MenuList component) new Rectangle( (int) (component.Position.X + component.MenuWidth - this.dropDownButtonWidth - (2 * TextSpacing) - - component.MaxStringWidth), - (int)component.Position.Y, + - component.MaxStringWidth), + (int)component.Position.Y, this.dropDownButtonWidth + (2 * TextSpacing) + component.MaxStringWidth, MenuSettings.ContainerHeight); } @@ -279,9 +281,9 @@ public Rectangle DropDownExpandedBoundaries(MenuList component) new Rectangle( (int) (component.Position.X + component.MenuWidth - this.dropDownButtonWidth - (2 * TextSpacing) - - component.MaxStringWidth), - (int)component.Position.Y, - this.dropDownButtonWidth + (2 * TextSpacing) + component.MaxStringWidth, + - component.MaxStringWidth), + (int)component.Position.Y, + this.dropDownButtonWidth + (2 * TextSpacing) + component.MaxStringWidth, (component.Count + 1) * MenuSettings.ContainerHeight); } @@ -299,8 +301,8 @@ public List DropDownListBoundaries(MenuList component) new Rectangle( (int) (component.Position.X + component.MenuWidth - this.dropDownButtonWidth - (2 * TextSpacing) - - component.MaxStringWidth), - (int)(component.Position.Y + ((i + 1) * MenuSettings.ContainerHeight)), + - component.MaxStringWidth), + (int)(component.Position.Y + ((i + 1) * MenuSettings.ContainerHeight)), this.dropDownButtonWidth + (2 * TextSpacing) + component.MaxStringWidth, MenuSettings.ContainerHeight + 1)); } @@ -339,9 +341,9 @@ public override void OnWndProc(WindowsKeys args) const int Buffer = 20; if (this.Component.Active && !args.Cursor.IsUnderRectangle( - entireDropdownRect.X - Buffer, - entireDropdownRect.Y - Buffer, - entireDropdownRect.Width + (2 * Buffer), + entireDropdownRect.X - Buffer, + entireDropdownRect.Y - Buffer, + entireDropdownRect.Width + (2 * Buffer), entireDropdownRect.Height + (2 * Buffer))) { this.Component.Active = false; @@ -354,9 +356,9 @@ public override void OnWndProc(WindowsKeys args) for (var i = 0; i < dropdownRectangles.Count; i++) { if (args.Cursor.IsUnderRectangle( - dropdownRectangles[i].X, - dropdownRectangles[i].Y, - dropdownRectangles[i].Width, + dropdownRectangles[i].X, + dropdownRectangles[i].Y, + dropdownRectangles[i].Width, dropdownRectangles[i].Height)) { this.Component.HoveringIndex = i; diff --git a/Core/UI/IMenu/Skins/Blue/BlueMenu.cs b/Core/UI/IMenu/Skins/Blue/BlueMenu.cs index 3c05af9..6797349 100644 --- a/Core/UI/IMenu/Skins/Blue/BlueMenu.cs +++ b/Core/UI/IMenu/Skins/Blue/BlueMenu.cs @@ -19,10 +19,9 @@ // Provides a custom implementation of // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue { - using System; - using System.Drawing; using System.Linq; using LeagueSharp.SDK.Core.Enumerations; @@ -30,22 +29,15 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue using LeagueSharp.SDK.Core.Math; using LeagueSharp.SDK.Core.UI.IMenu.Customizer; using LeagueSharp.SDK.Core.Utils; - using LeagueSharp.SDK.Properties; using SharpDX; using SharpDX.Direct3D9; - using Color = SharpDX.Color; - /// /// Provides a default implementation of /// public class BlueMenu : ADrawable { - #region Constants - - #endregion - #region Static Fields /// @@ -56,7 +48,7 @@ public class BlueMenu : ADrawable #endregion #region Fields - + /// /// Gets or sets a value indicating whether the user is dragging the menu. /// @@ -98,7 +90,6 @@ public class BlueMenu : ADrawable public BlueMenu(Menu component) : base(component) { - } #endregion @@ -125,9 +116,9 @@ public override void Draw() Line.Draw( new[] { - new Vector2(position.X, position.Y + MenuSettings.ContainerHeight / 2f), + new Vector2(position.X, position.Y + MenuSettings.ContainerHeight / 2f), new Vector2( - position.X + this.Component.MenuWidth, + position.X + this.Component.MenuWidth, position.Y + MenuSettings.ContainerHeight / 2f) }, MenuSettings.HoverColor); @@ -141,19 +132,19 @@ public override void Draw() .Y; MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(position.X + MenuSettings.ContainerTextOffset), + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(position.X + MenuSettings.ContainerTextOffset), centerY, MenuSettings.TextColor); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - "»", + MenuManager.Instance.Sprite, + "»", (int) (position.X + this.Component.MenuWidth - MenuSettings.ContainerTextMarkWidth - - MenuSettings.ContainerTextMarkOffset), - centerY, + - MenuSettings.ContainerTextMarkOffset), + centerY, this.Component.Components.Count > 0 ? MenuSettings.TextColor : MenuSettings.ContainerSeparatorColor); if (this.Component.Toggled) @@ -163,9 +154,9 @@ public override void Draw() Line.Draw( new[] { - new Vector2(position.X + this.Component.MenuWidth / 2f, position.Y), + new Vector2(position.X + this.Component.MenuWidth / 2f, position.Y), new Vector2( - position.X + this.Component.MenuWidth / 2f, + position.X + this.Component.MenuWidth / 2f, position.Y + MenuSettings.ContainerHeight) }, MenuSettings.ContainerSelectedColor); @@ -183,21 +174,19 @@ public override void Draw() Line.Draw( new[] { - new Vector2((position.X + this.Component.MenuWidth) + width / 2, position.Y), + new Vector2((position.X + this.Component.MenuWidth) + width / 2, position.Y), new Vector2((position.X + this.Component.MenuWidth) + width / 2, position.Y + height) }, MenuSettings.RootContainerColor); Line.End(); - - for (var i = 0; i < this.Component.Components.Count; ++i) { var childComponent = this.Component.Components.Values.ToList()[i]; if (childComponent != null) { var childPos = new Vector2( - position.X + this.Component.MenuWidth, + position.X + this.Component.MenuWidth, position.Y + i * MenuSettings.ContainerHeight); if (i < this.Component.Components.Count - 1) @@ -207,9 +196,9 @@ public override void Draw() Line.Draw( new[] { - new Vector2(childPos.X + 15, childPos.Y + MenuSettings.ContainerHeight), + new Vector2(childPos.X + 15, childPos.Y + MenuSettings.ContainerHeight), new Vector2( - childPos.X - 15 + childComponent.MenuWidth, + childPos.X - 15 + childComponent.MenuWidth, childPos.Y + MenuSettings.ContainerHeight) }, MenuSettings.ContainerSeparatorColor); @@ -227,33 +216,32 @@ public override void Draw() Line.Draw( new[] { - new Vector2(position.X + this.Component.MenuWidth, position.Y), + new Vector2(position.X + this.Component.MenuWidth, position.Y), new Vector2(position.X + this.Component.MenuWidth + width, position.Y) }, contourColor); Line.Draw( new[] { - new Vector2(position.X + this.Component.MenuWidth, position.Y + height), + new Vector2(position.X + this.Component.MenuWidth, position.Y + height), new Vector2(position.X + this.Component.MenuWidth + width, position.Y + height) }, contourColor); Line.Draw( new[] { - new Vector2(position.X + this.Component.MenuWidth, position.Y), + new Vector2(position.X + this.Component.MenuWidth, position.Y), new Vector2(position.X + this.Component.MenuWidth, position.Y + height) }, contourColor); Line.Draw( new[] { - new Vector2(position.X + this.Component.MenuWidth + width, position.Y), + new Vector2(position.X + this.Component.MenuWidth + width, position.Y), new Vector2(position.X + this.Component.MenuWidth + width, position.Y + height) }, contourColor); Line.End(); - } if (this.hasDragged && !MenuCustomizer.Instance.LockPosition.Value) @@ -273,9 +261,9 @@ public override void Draw() Line.Draw( new[] { - new Vector2(x - 1, y + 1), new Vector2(x - 1 + dragTexture.Width, y + 1), - new Vector2(x - 1 + dragTexture.Width, y + dragTexture.Width + 2), - new Vector2(x - 2, y + dragTexture.Width + 2), new Vector2(x - 2, y), + new Vector2(x - 1, y + 1), new Vector2(x - 1 + dragTexture.Width, y + 1), + new Vector2(x - 1 + dragTexture.Width, y + dragTexture.Width + 2), + new Vector2(x - 2, y + dragTexture.Width + 2), new Vector2(x - 2, y), }, MenuSettings.ContainerSeparatorColor); Line.End(); @@ -292,13 +280,17 @@ public override void OnWndProc(WindowsKeys args) { if (this.Component.Visible) { - if (args.Msg == WindowsMessages.MOUSEMOVE && this.dragging && !MenuCustomizer.Instance.LockPosition.Value) + if (args.Msg == WindowsMessages.MOUSEMOVE && this.dragging + && !MenuCustomizer.Instance.LockPosition.Value) { MenuSettings.Position = new Vector2(args.Cursor.X - this.xd, args.Cursor.Y - this.yd); this.hasDragged = true; } - if (args.Cursor.IsUnderRectangle(this.Component.Position.X, this.Component.Position.Y, this.Component.MenuWidth, + if (args.Cursor.IsUnderRectangle( + this.Component.Position.X, + this.Component.Position.Y, + this.Component.MenuWidth, MenuSettings.ContainerHeight)) { if (args.Msg == WindowsMessages.LBUTTONDOWN && this.Component.Root) diff --git a/Core/UI/IMenu/Skins/Blue/BlueMenuSettings.cs b/Core/UI/IMenu/Skins/Blue/BlueMenuSettings.cs index aee4d40..38c22d3 100644 --- a/Core/UI/IMenu/Skins/Blue/BlueMenuSettings.cs +++ b/Core/UI/IMenu/Skins/Blue/BlueMenuSettings.cs @@ -24,12 +24,6 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue { - using System.Collections.Generic; - using System.ComponentModel; - using System.Runtime.CompilerServices; - - using LeagueSharp.SDK.Core.UI.IMenu.Customizer; - using SharpDX; using SharpDX.Direct3D9; @@ -71,7 +65,7 @@ static BlueMenuSettings() FontQuality.ClearType, FontPitchAndFamily.DontCare | FontPitchAndFamily.Decorative | FontPitchAndFamily.Modern, "Tahoma"); - + TextCaptionColor = new ColorBGRA(0, 185, 252, 255); KeyBindColor = new ColorBGRA(5, 168, 235, 255); SliderColor = new ColorBGRA(0, 75, 101, 255); @@ -98,11 +92,6 @@ public static Font FontCaption } } - /// - /// Gets or sets the Global Text Caption Color. - /// - public static ColorBGRA TextCaptionColor { get; set; } - /// /// Gets or sets the Global KeyBind Color. /// @@ -113,6 +102,11 @@ public static Font FontCaption /// public static ColorBGRA SliderColor { get; set; } + /// + /// Gets or sets the Global Text Caption Color. + /// + public static ColorBGRA TextCaptionColor { get; set; } + #endregion #region Public Methods and Operators @@ -122,10 +116,8 @@ public static Font FontCaption /// public static void LoadSettings() { - } #endregion - } } \ No newline at end of file diff --git a/Core/UI/IMenu/Skins/Blue/BlueSeparator.cs b/Core/UI/IMenu/Skins/Blue/BlueSeparator.cs index 331f4b1..20ae956 100644 --- a/Core/UI/IMenu/Skins/Blue/BlueSeparator.cs +++ b/Core/UI/IMenu/Skins/Blue/BlueSeparator.cs @@ -19,6 +19,7 @@ // Implements as a custom skin. // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue { using LeagueSharp.SDK.Core.Enumerations; diff --git a/Core/UI/IMenu/Skins/Blue/BlueSlider.cs b/Core/UI/IMenu/Skins/Blue/BlueSlider.cs index f2175bc..554bdf5 100644 --- a/Core/UI/IMenu/Skins/Blue/BlueSlider.cs +++ b/Core/UI/IMenu/Skins/Blue/BlueSlider.cs @@ -19,6 +19,7 @@ // A custom implementation of an // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue { using System; @@ -115,25 +116,25 @@ public override void Draw() Line.Width = 3; Line.Begin(); Line.Draw( - new[] { new Vector2(x, position.Y + 1), new Vector2(x, position.Y + MenuSettings.ContainerHeight) }, + new[] { new Vector2(x, position.Y + 1), new Vector2(x, position.Y + MenuSettings.ContainerHeight) }, this.Component.Interacting ? new ColorBGRA(90, 129, 144, 255) : new ColorBGRA(0, 39, 54, 255)); Line.End(); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(position.X + MenuSettings.ContainerTextOffset), + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(position.X + MenuSettings.ContainerTextOffset), centeredY, MenuSettings.TextColor); var measureText = MenuSettings.Font.MeasureText( - null, - this.Component.Value.ToString(CultureInfo.InvariantCulture), + null, + this.Component.Value.ToString(CultureInfo.InvariantCulture), 0); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.Value.ToString(CultureInfo.InvariantCulture), - (int)(position.X + this.Component.MenuWidth - 5 - measureText.Width), + MenuManager.Instance.Sprite, + this.Component.Value.ToString(CultureInfo.InvariantCulture), + (int)(position.X + this.Component.MenuWidth - 5 - measureText.Width), centeredY, MenuSettings.TextColor); diff --git a/Core/UI/IMenu/Skins/Blue/BlueSliderButton.cs b/Core/UI/IMenu/Skins/Blue/BlueSliderBool.cs similarity index 80% rename from Core/UI/IMenu/Skins/Blue/BlueSliderButton.cs rename to Core/UI/IMenu/Skins/Blue/BlueSliderBool.cs index 82677a4..5ffb561 100644 --- a/Core/UI/IMenu/Skins/Blue/BlueSliderButton.cs +++ b/Core/UI/IMenu/Skins/Blue/BlueSliderBool.cs @@ -19,6 +19,7 @@ // A custom implementation of an // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue { using System; @@ -36,7 +37,7 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue /// /// A default implementation of an /// - public class BlueSliderButton : ADrawable + public class BlueSliderBool : ADrawable { #region Static Fields @@ -55,12 +56,12 @@ public class BlueSliderButton : ADrawable #region Constructors and Destructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// The menu component /// - public BlueSliderButton(MenuSliderButton component) + public BlueSliderBool(MenuSliderBool component) : base(component) { } @@ -69,26 +70,12 @@ public BlueSliderButton(MenuSliderButton component) #region Public Methods and Operators - /// - /// Returns the Rectangle that defines the Slider - /// - /// The - /// The - public Rectangle SliderBoundaries(MenuSliderButton component) - { - return new Rectangle( - (int)component.Position.X + Offset, - (int)component.Position.Y, - component.MenuWidth - MenuSettings.ContainerHeight - Offset, - MenuSettings.ContainerHeight); - } - /// /// Returns the Rectangle that defines the on/off Button /// - /// The + /// The /// The - public Rectangle ButtonBoundaries(MenuSliderButton component) + public Rectangle ButtonBoundaries(MenuSliderBool component) { return new Rectangle( (int)(component.Position.X + component.MenuWidth - MenuSettings.ContainerHeight), @@ -106,7 +93,7 @@ public override void Dispose() } /// - /// Draws a + /// Draws a /// public override void Draw() { @@ -118,32 +105,33 @@ public override void Draw() BlueUtilities.GetContainerRectangle(this.Component) .GetCenteredText(null, MenuSettings.Font, this.Component.DisplayName, CenteredFlags.VerticalCenter) .Y; - var percent = (this.Component.SValue - this.Component.MinValue) - / (float)(this.Component.MaxValue - this.Component.MinValue); - var x = position.X + Offset + (percent * (this.Component.MenuWidth - Offset * 2 - MenuSettings.ContainerHeight / 2)); + var percent = (this.Component.SliderValue - this.Component.SliderMinValue) + / (float)(this.Component.SliderMaxValue - this.Component.SliderMinValue); + var x = position.X + Offset + + (percent * (this.Component.MenuWidth - Offset * 2 - MenuSettings.ContainerHeight / 2)); Line.Width = 3; Line.Begin(); Line.Draw( - new[] { new Vector2(x, position.Y + 1), new Vector2(x, position.Y + MenuSettings.ContainerHeight) }, + new[] { new Vector2(x, position.Y + 1), new Vector2(x, position.Y + MenuSettings.ContainerHeight) }, this.Component.Interacting ? new ColorBGRA(90, 129, 144, 255) : new ColorBGRA(0, 39, 54, 255)); Line.End(); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(position.X + MenuSettings.ContainerTextOffset), + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(position.X + MenuSettings.ContainerTextOffset), centeredY, MenuSettings.TextColor); var measureText = MenuSettings.Font.MeasureText( - null, - this.Component.SValue.ToString(CultureInfo.InvariantCulture), + null, + this.Component.SliderValue.ToString(CultureInfo.InvariantCulture), 0); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.SValue.ToString(CultureInfo.InvariantCulture), - (int)(position.X + this.Component.MenuWidth - 5 - measureText.Width - MenuSettings.ContainerHeight), + MenuManager.Instance.Sprite, + this.Component.SliderValue.ToString(CultureInfo.InvariantCulture), + (int)(position.X + this.Component.MenuWidth - 5 - measureText.Width - MenuSettings.ContainerHeight), centeredY, MenuSettings.TextColor); @@ -174,7 +162,7 @@ public override void Draw() + MenuSettings.ContainerHeight / 2f, this.Component.Position.Y + MenuSettings.ContainerHeight - 3) }, - this.Component.BValue ? new ColorBGRA(0, 186, 255, 255) : new ColorBGRA(36, 36, 36, 255)); + this.Component.BoolValue ? new ColorBGRA(0, 186, 255, 255) : new ColorBGRA(36, 36, 36, 255)); Line.End(); var centerX = @@ -186,14 +174,14 @@ public override void Draw() MenuSettings.ContainerHeight).GetCenteredText( null, MenuSettings.Font, - this.Component.BValue ? "On" : "Off", + this.Component.BoolValue ? "On" : "Off", CenteredFlags.HorizontalCenter).X; MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, - this.Component.BValue ? "On" : "Off", + this.Component.BoolValue ? "On" : "Off", centerX, centeredY, - this.Component.BValue ? new ColorBGRA(0, 27, 41, 255) : MenuSettings.TextColor); + this.Component.BoolValue ? new ColorBGRA(0, 27, 41, 255) : MenuSettings.TextColor); } /// @@ -217,7 +205,7 @@ public override void OnWndProc(WindowsKeys args) if (args.Cursor.IsUnderRectangle(rect.X, rect.Y, rect.Width, rect.Height)) { - this.Component.BValue = !this.Component.BValue; + this.Component.BoolValue = !this.Component.BoolValue; this.Component.FireEvent(); } @@ -238,6 +226,20 @@ public override void OnWndProc(WindowsKeys args) } } + /// + /// Returns the Rectangle that defines the Slider + /// + /// The + /// The + public Rectangle SliderBoundaries(MenuSliderBool component) + { + return new Rectangle( + (int)component.Position.X + Offset, + (int)component.Position.Y, + component.MenuWidth - MenuSettings.ContainerHeight - Offset, + MenuSettings.ContainerHeight); + } + /// /// Calculates the width of this component /// @@ -260,26 +262,27 @@ public override int Width() /// /// data /// - private void CalculateNewValue(MenuSliderButton component, WindowsKeys args) + private void CalculateNewValue(MenuSliderBool component, WindowsKeys args) { var newValue = (int) Math.Round( - component.MinValue - + ((args.Cursor.X - component.Position.X - Offset) * (component.MaxValue - component.MinValue)) + component.SliderMinValue + + ((args.Cursor.X - component.Position.X - Offset) + * (component.SliderMaxValue - component.SliderMinValue)) / (component.MenuWidth - Offset * 2 - MenuSettings.ContainerHeight / 2)); - if (newValue < component.MinValue) + if (newValue < component.SliderMinValue) { - newValue = component.MinValue; + newValue = component.SliderMinValue; } - else if (newValue > component.MaxValue) + else if (newValue > component.SliderMaxValue) { - newValue = component.MaxValue; + newValue = component.SliderMaxValue; } - if (newValue != component.Value) + if (newValue != component.SliderValue) { - component.SValue = newValue; + component.SliderValue = newValue; component.FireEvent(); } } diff --git a/Core/UI/IMenu/Skins/Blue/BlueTextures.cs b/Core/UI/IMenu/Skins/Blue/BlueTextures.cs index 2c68316..a87dd8c 100644 --- a/Core/UI/IMenu/Skins/Blue/BlueTextures.cs +++ b/Core/UI/IMenu/Skins/Blue/BlueTextures.cs @@ -19,19 +19,15 @@ // A custom implementation of // // -------------------------------------------------------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue { + using System.Collections.Generic; using System.Drawing; + using System.Linq; using LeagueSharp.SDK.Properties; - using SharpDX; using SharpDX.Direct3D9; internal enum BlueTexture @@ -41,23 +37,38 @@ internal enum BlueTexture internal class BlueTextures { - - private readonly Dictionary textures = new Dictionary(); + #region Static Fields public static readonly BlueTextures Instance = new BlueTextures(); + #endregion + + #region Fields + + private readonly Dictionary textures = + new Dictionary(); + + #endregion + + #region Constructors and Destructors + private BlueTextures() { - this.textures[BlueTexture.Dragging] = BuildTexture(Resources.cursor_drag, 16, 16); + this.textures[BlueTexture.Dragging] = this.BuildTexture(Resources.cursor_drag, 16, 16); } ~BlueTextures() { - foreach (var entry in this.textures.Where(entry => !entry.Value.Texture.IsDisposed)) { + foreach (var entry in this.textures.Where(entry => !entry.Value.Texture.IsDisposed)) + { entry.Value.Texture.Dispose(); } } + #endregion + + #region Public Indexers + public BlueTextureWrapper this[BlueTexture textureType] { get @@ -66,10 +77,24 @@ public BlueTextureWrapper this[BlueTexture textureType] } } + #endregion + + #region Public Methods and Operators + + public BlueTextureWrapper AddTexture(Image bmp, int width, int height, BlueTexture textureType) + { + this.textures[textureType] = this.BuildTexture(bmp, height, width); + return this.textures[textureType]; + } + + #endregion + + #region Methods + private BlueTextureWrapper BuildTexture(Image bmp, int height, int width) { var resized = new Bitmap(bmp, width, height); - var texture = Texture.FromMemory( + var texture = Texture.FromMemory( Drawing.Direct3DDevice, (byte[])new ImageConverter().ConvertTo(resized, typeof(byte[])), resized.Width, @@ -86,19 +111,12 @@ private BlueTextureWrapper BuildTexture(Image bmp, int height, int width) return new BlueTextureWrapper(texture, width, height); } - public BlueTextureWrapper AddTexture(Image bmp, int width, int height, BlueTexture textureType) - { - this.textures[textureType] = BuildTexture(bmp, height, width); - return this.textures[textureType]; - } - + #endregion } internal class BlueTextureWrapper { - public Texture Texture { get; private set; } - public int Width { get; private set; } - public int Height { get; private set; } + #region Constructors and Destructors public BlueTextureWrapper(Texture texture, int width, int height) { @@ -106,6 +124,17 @@ public BlueTextureWrapper(Texture texture, int width, int height) this.Width = width; this.Height = height; } - + + #endregion + + #region Public Properties + + public int Height { get; private set; } + + public Texture Texture { get; private set; } + + public int Width { get; private set; } + + #endregion } -} +} \ No newline at end of file diff --git a/Core/UI/IMenu/Skins/Blue/BlueTheme.cs b/Core/UI/IMenu/Skins/Blue/BlueTheme.cs index 4fd8025..b25f7ad 100644 --- a/Core/UI/IMenu/Skins/Blue/BlueTheme.cs +++ b/Core/UI/IMenu/Skins/Blue/BlueTheme.cs @@ -19,6 +19,7 @@ // Implements a custom ITheme. // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue { using System.Linq; @@ -128,23 +129,23 @@ public ADrawable BuildSeparatorHandler(MenuSeparator component) } /// - /// Builds a new handler for the given . + /// Builds a new handler for the given . /// - /// The where this handler is responsible for. + /// The where this handler is responsible for. /// The handler - public ADrawable BuildSliderHandler(MenuSlider component) + public ADrawable BuildSliderBoolHandler(MenuSliderBool component) { - return new BlueSlider(component); + return new BlueSliderBool(component); } /// - /// Builds a new handler for the given . + /// Builds a new handler for the given . /// - /// The where this handler is responsible for. + /// The where this handler is responsible for. /// The handler - public ADrawable BuildSliderButtonHandler(MenuSliderButton component) + public ADrawable BuildSliderHandler(MenuSlider component) { - return new BlueSliderButton(component); + return new BlueSlider(component); } /// @@ -166,7 +167,7 @@ public void Draw() Line.Draw( new[] { - new Vector2(position.X + (width / 2f), position.Y), + new Vector2(position.X + (width / 2f), position.Y), new Vector2(position.X + (width / 2), position.Y + height) }, MenuSettings.RootContainerColor); @@ -200,13 +201,12 @@ public void Draw() Line.Draw( new[] { - new Vector2(position.X, position.Y), new Vector2(position.X + width, position.Y), - new Vector2(position.X + width, position.Y + height), new Vector2(position.X, position.Y + height), + new Vector2(position.X, position.Y), new Vector2(position.X + width, position.Y), + new Vector2(position.X + width, position.Y + height), new Vector2(position.X, position.Y + height), new Vector2(position.X, position.Y) }, new ColorBGRA(21, 26, 45, 255)); Line.End(); - } #endregion diff --git a/Core/UI/IMenu/Skins/Blue/BlueUtilities.cs b/Core/UI/IMenu/Skins/Blue/BlueUtilities.cs index 509be98..2d9d2c7 100644 --- a/Core/UI/IMenu/Skins/Blue/BlueUtilities.cs +++ b/Core/UI/IMenu/Skins/Blue/BlueUtilities.cs @@ -65,9 +65,9 @@ public static int CalcWidthText(string text) public static Rectangle GetContainerRectangle(AMenuComponent component) { return new Rectangle( - (int)component.Position.X, - (int)component.Position.Y, - component.MenuWidth, + (int)component.Position.X, + (int)component.Position.Y, + component.MenuWidth, MenuSettings.ContainerHeight); } diff --git a/Core/UI/IMenu/Skins/Blue2/BlueBool2.cs b/Core/UI/IMenu/Skins/Blue2/BlueBool2.cs index 7fe6147..6d23cde 100644 --- a/Core/UI/IMenu/Skins/Blue2/BlueBool2.cs +++ b/Core/UI/IMenu/Skins/Blue2/BlueBool2.cs @@ -19,16 +19,12 @@ // A custom implementation of a // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue2 { - using LeagueSharp.SDK.Core.Enumerations; - using LeagueSharp.SDK.Core.Extensions.SharpDX; - using LeagueSharp.SDK.Core.Math; using LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue; using LeagueSharp.SDK.Core.UI.IMenu.Values; - using LeagueSharp.SDK.Core.Utils; - using SharpDX; using SharpDX.Direct3D9; /// diff --git a/Core/UI/IMenu/Skins/Blue2/BlueButton2.cs b/Core/UI/IMenu/Skins/Blue2/BlueButton2.cs index 7b089c3..4704352 100644 --- a/Core/UI/IMenu/Skins/Blue2/BlueButton2.cs +++ b/Core/UI/IMenu/Skins/Blue2/BlueButton2.cs @@ -19,17 +19,11 @@ // A custom implementation of // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue2 { - using LeagueSharp.SDK.Core.Enumerations; - using LeagueSharp.SDK.Core.Extensions.SharpDX; - using LeagueSharp.SDK.Core.Math; using LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue; using LeagueSharp.SDK.Core.UI.IMenu.Values; - using LeagueSharp.SDK.Core.Utils; - - using SharpDX; - using SharpDX.Direct3D9; /// /// A default implementation of diff --git a/Core/UI/IMenu/Skins/Blue2/BlueColorPicker2.cs b/Core/UI/IMenu/Skins/Blue2/BlueColorPicker2.cs index 86ccd77..f20c6af 100644 --- a/Core/UI/IMenu/Skins/Blue2/BlueColorPicker2.cs +++ b/Core/UI/IMenu/Skins/Blue2/BlueColorPicker2.cs @@ -19,24 +19,11 @@ // A custom implementation of // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue2 { - using System.Drawing; - - using LeagueSharp.SDK.Core.Enumerations; - using LeagueSharp.SDK.Core.Extensions.SharpDX; - using LeagueSharp.SDK.Core.Math; - using LeagueSharp.SDK.Core.UI.IMenu.Abstracts; using LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue; using LeagueSharp.SDK.Core.UI.IMenu.Values; - using LeagueSharp.SDK.Core.Utils; - - using SharpDX; - using SharpDX.Direct3D9; - - using Color = SharpDX.Color; - using Rectangle = SharpDX.Rectangle; - using Utilities = LeagueSharp.SDK.Core.UI.IMenu.Utilities; internal class BlueColorPicker2 : BlueColorPicker { @@ -51,7 +38,6 @@ internal class BlueColorPicker2 : BlueColorPicker public BlueColorPicker2(MenuColor component) : base(component) { - } #endregion diff --git a/Core/UI/IMenu/Skins/Blue2/BlueKeyBind2.cs b/Core/UI/IMenu/Skins/Blue2/BlueKeyBind2.cs index b388f2a..d6abc2d 100644 --- a/Core/UI/IMenu/Skins/Blue2/BlueKeyBind2.cs +++ b/Core/UI/IMenu/Skins/Blue2/BlueKeyBind2.cs @@ -22,17 +22,8 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue2 { - using System.Windows.Forms; - - using LeagueSharp.SDK.Core.Enumerations; - using LeagueSharp.SDK.Core.Extensions.SharpDX; - using LeagueSharp.SDK.Core.Math; using LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue; using LeagueSharp.SDK.Core.UI.IMenu.Values; - using LeagueSharp.SDK.Core.Utils; - - using SharpDX; - using SharpDX.Direct3D9; /// /// A default implementation of diff --git a/Core/UI/IMenu/Skins/Blue2/BlueList2.cs b/Core/UI/IMenu/Skins/Blue2/BlueList2.cs index ba71f2d..0af74bc 100644 --- a/Core/UI/IMenu/Skins/Blue2/BlueList2.cs +++ b/Core/UI/IMenu/Skins/Blue2/BlueList2.cs @@ -19,6 +19,7 @@ // A custom implementation of a // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue2 { using System.Collections.Generic; @@ -108,24 +109,24 @@ public override void Draw() .GetCenteredText(null, MenuSettings.Font, this.Component.DisplayName, CenteredFlags.VerticalCenter); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(position.X + MenuSettings.ContainerTextOffset), + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(position.X + MenuSettings.ContainerTextOffset), (int)rectangleName.Y, MenuSettings.TextColor); MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, - "\u23EC", - (int)(position.X + this.Component.MenuWidth - this.dropDownButtonWidth + ArrowSpacing), + "\u23EC", + (int)(position.X + this.Component.MenuWidth - this.dropDownButtonWidth + ArrowSpacing), (int)rectangleName.Y, MenuSettings.TextColor); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.SelectedValueAsObject.ToString(), + MenuManager.Instance.Sprite, + this.Component.SelectedValueAsObject.ToString(), (int)position.X + this.Component.MenuWidth - this.dropDownButtonWidth - TextSpacing - - this.Component.MaxStringWidth, + - this.Component.MaxStringWidth, (int)rectangleName.Y, this.Component.Active ? new ColorBGRA(0, 186, 255, 255) : MenuSettings.TextColor); Line.Width = 1f; @@ -160,22 +161,23 @@ public override void Draw() new[] { new Vector2( - position.X + Component.MenuWidth - (Line.Width / 2), - position.Y + MenuSettings.ContainerHeight), + position.X + this.Component.MenuWidth - (Line.Width / 2), + position.Y + MenuSettings.ContainerHeight), new Vector2( - position.X + Component.MenuWidth - (Line.Width / 2), + position.X + this.Component.MenuWidth - (Line.Width / 2), position.Y + MenuSettings.ContainerHeight + dropdownMenuHeight) - }, dropdownColor); + }, + dropdownColor); Line.End(); var x = (int) - (position.X + Component.MenuWidth - dropDownButtonWidth - TextSpacing - - Component.MaxStringWidth); + (position.X + this.Component.MenuWidth - this.dropDownButtonWidth - TextSpacing + - this.Component.MaxStringWidth); var y = (int)rectangleName.Y; for (var i = 0; i < valueStrings.Length; i++) { - if (i == Component.HoveringIndex) + if (i == this.Component.HoveringIndex) { Line.Width = MenuSettings.ContainerHeight; Line.Begin(); @@ -183,11 +185,11 @@ public override void Draw() new[] { new Vector2( - position.X + Component.MenuWidth - dropdownMenuWidth, + position.X + this.Component.MenuWidth - dropdownMenuWidth, position.Y + ((i + 1) * MenuSettings.ContainerHeight) - + MenuSettings.ContainerHeight / 2f), + + MenuSettings.ContainerHeight / 2f), new Vector2( - position.X + Component.MenuWidth, + position.X + this.Component.MenuWidth, position.Y + ((i + 1) * MenuSettings.ContainerHeight) + MenuSettings.ContainerHeight / 2f) }, @@ -201,49 +203,49 @@ public override void Draw() new[] { new Vector2( - position.X + Component.MenuWidth - dropdownMenuWidth + 10, - position.Y + (MenuSettings.ContainerHeight * (i + 1))), + position.X + this.Component.MenuWidth - dropdownMenuWidth + 10, + position.Y + (MenuSettings.ContainerHeight * (i + 1))), new Vector2( - position.X + Component.MenuWidth - 10, + position.X + this.Component.MenuWidth - 10, position.Y + (MenuSettings.ContainerHeight * (i + 1))) }, MenuSettings.ContainerSeparatorColor); Line.End(); y += MenuSettings.ContainerHeight; MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - valueStrings[i], - x, + MenuManager.Instance.Sprite, + valueStrings[i], + x, y, MenuSettings.TextColor); - if (Component.Index == i) + if (this.Component.Index == i) { var checkmarkWidth = MenuSettings.Font.MeasureText(null, "\u2713", 0).Width; MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, - "\u2713", - (int)(position.X + Component.MenuWidth - checkmarkWidth - TextSpacing), + "\u2713", + (int)(position.X + this.Component.MenuWidth - checkmarkWidth - TextSpacing), y, new ColorBGRA(1, 165, 226, 255)); } } - Line.Width = 1f; - Line.Begin(); - Line.Draw( + Line.Width = 1f; + Line.Begin(); + Line.Draw( new[] { new Vector2( - position.X + Component.MenuWidth - dropdownMenuWidth, - position.Y + MenuSettings.ContainerHeight), + position.X + this.Component.MenuWidth - dropdownMenuWidth, + position.Y + MenuSettings.ContainerHeight), new Vector2( - position.X + Component.MenuWidth - dropdownMenuWidth, - position.Y + MenuSettings.ContainerHeight * (valueStrings.Length + 1)), + position.X + this.Component.MenuWidth - dropdownMenuWidth, + position.Y + MenuSettings.ContainerHeight * (valueStrings.Length + 1)), new Vector2( - position.X + Component.MenuWidth, - position.Y + MenuSettings.ContainerHeight * (valueStrings.Length + 1)), + position.X + this.Component.MenuWidth, + position.Y + MenuSettings.ContainerHeight * (valueStrings.Length + 1)), new Vector2( - position.X + Component.MenuWidth, + position.X + this.Component.MenuWidth, position.Y + MenuSettings.ContainerHeight) }, MenuSettings.ContainerSeparatorColor); @@ -257,14 +259,14 @@ public override void Draw() /// /// The /// The - public Rectangle DropDownBoundaries(MenuList component) + public new Rectangle DropDownBoundaries(MenuList component) { return new Rectangle( (int) (component.Position.X + component.MenuWidth - this.dropDownButtonWidth - (2 * TextSpacing) - - component.MaxStringWidth), - (int)component.Position.Y, + - component.MaxStringWidth), + (int)component.Position.Y, this.dropDownButtonWidth + (2 * TextSpacing) + component.MaxStringWidth, MenuSettings.ContainerHeight); } @@ -274,15 +276,15 @@ public Rectangle DropDownBoundaries(MenuList component) /// /// The /// The - public Rectangle DropDownExpandedBoundaries(MenuList component) + public new Rectangle DropDownExpandedBoundaries(MenuList component) { return new Rectangle( (int) (component.Position.X + component.MenuWidth - this.dropDownButtonWidth - (2 * TextSpacing) - - component.MaxStringWidth), - (int)component.Position.Y, - this.dropDownButtonWidth + (2 * TextSpacing) + component.MaxStringWidth, + - component.MaxStringWidth), + (int)component.Position.Y, + this.dropDownButtonWidth + (2 * TextSpacing) + component.MaxStringWidth, (component.Count + 1) * MenuSettings.ContainerHeight); } @@ -291,7 +293,7 @@ public Rectangle DropDownExpandedBoundaries(MenuList component) /// /// The /// List of - public List DropDownListBoundaries(MenuList component) + public new List DropDownListBoundaries(MenuList component) { var rectangles = new List(); for (var i = 0; i < component.Count; i++) @@ -300,8 +302,8 @@ public List DropDownListBoundaries(MenuList component) new Rectangle( (int) (component.Position.X + component.MenuWidth - this.dropDownButtonWidth - (2 * TextSpacing) - - component.MaxStringWidth), - (int)(component.Position.Y + ((i + 1) * MenuSettings.ContainerHeight)), + - component.MaxStringWidth), + (int)(component.Position.Y + ((i + 1) * MenuSettings.ContainerHeight)), this.dropDownButtonWidth + (2 * TextSpacing) + component.MaxStringWidth, MenuSettings.ContainerHeight + 1)); } @@ -340,9 +342,9 @@ public override void OnWndProc(WindowsKeys args) const int Buffer = 20; if (this.Component.Active && !args.Cursor.IsUnderRectangle( - entireDropdownRect.X - Buffer, - entireDropdownRect.Y - Buffer, - entireDropdownRect.Width + (2 * Buffer), + entireDropdownRect.X - Buffer, + entireDropdownRect.Y - Buffer, + entireDropdownRect.Width + (2 * Buffer), entireDropdownRect.Height + (2 * Buffer))) { this.Component.Active = false; @@ -355,9 +357,9 @@ public override void OnWndProc(WindowsKeys args) for (var i = 0; i < dropdownRectangles.Count; i++) { if (args.Cursor.IsUnderRectangle( - dropdownRectangles[i].X, - dropdownRectangles[i].Y, - dropdownRectangles[i].Width, + dropdownRectangles[i].X, + dropdownRectangles[i].Y, + dropdownRectangles[i].Width, dropdownRectangles[i].Height)) { this.Component.HoveringIndex = i; diff --git a/Core/UI/IMenu/Skins/Blue2/BlueMenu2.cs b/Core/UI/IMenu/Skins/Blue2/BlueMenu2.cs index c1b5654..a193f63 100644 --- a/Core/UI/IMenu/Skins/Blue2/BlueMenu2.cs +++ b/Core/UI/IMenu/Skins/Blue2/BlueMenu2.cs @@ -19,10 +19,9 @@ // Provides a custom implementation of // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue2 { - using System; - using System.Drawing; using System.Linq; using LeagueSharp.SDK.Core.Enumerations; @@ -31,22 +30,15 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue2 using LeagueSharp.SDK.Core.UI.IMenu.Customizer; using LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue; using LeagueSharp.SDK.Core.Utils; - using LeagueSharp.SDK.Properties; using SharpDX; using SharpDX.Direct3D9; - using Color = SharpDX.Color; - /// /// Provides a default implementation of /// public class BlueMenu2 : BlueMenu { - #region Constants - - #endregion - #region Static Fields /// @@ -57,7 +49,7 @@ public class BlueMenu2 : BlueMenu #endregion #region Fields - + /// /// Gets or sets a value indicating whether the user is dragging the menu. /// @@ -99,7 +91,6 @@ public class BlueMenu2 : BlueMenu public BlueMenu2(Menu component) : base(component) { - } #endregion @@ -126,9 +117,9 @@ public override void Draw() Line.Draw( new[] { - new Vector2(position.X, position.Y + MenuSettings.ContainerHeight / 2f), + new Vector2(position.X, position.Y + MenuSettings.ContainerHeight / 2f), new Vector2( - position.X + this.Component.MenuWidth, + position.X + this.Component.MenuWidth, position.Y + MenuSettings.ContainerHeight / 2f) }, MenuSettings.HoverColor); @@ -142,19 +133,19 @@ public override void Draw() .Y; MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(position.X + MenuSettings.ContainerTextOffset), + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(position.X + MenuSettings.ContainerTextOffset), centerY, MenuSettings.TextColor); MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, - "\u25B6", + "\u25B6", (int) (position.X + this.Component.MenuWidth - MenuSettings.ContainerTextMarkWidth - - MenuSettings.ContainerTextMarkOffset), - centerY, + - MenuSettings.ContainerTextMarkOffset), + centerY, this.Component.Components.Count > 0 ? MenuSettings.TextColor : MenuSettings.ContainerSeparatorColor); if (this.Component.Toggled) @@ -164,9 +155,9 @@ public override void Draw() Line.Draw( new[] { - new Vector2(position.X + this.Component.MenuWidth / 2f, position.Y), + new Vector2(position.X + this.Component.MenuWidth / 2f, position.Y), new Vector2( - position.X + this.Component.MenuWidth / 2f, + position.X + this.Component.MenuWidth / 2f, position.Y + MenuSettings.ContainerHeight) }, BlueMenuSettings2.ContainerSelectedColor); @@ -184,21 +175,19 @@ public override void Draw() Line.Draw( new[] { - new Vector2((position.X + this.Component.MenuWidth) + width / 2, position.Y), + new Vector2((position.X + this.Component.MenuWidth) + width / 2, position.Y), new Vector2((position.X + this.Component.MenuWidth) + width / 2, position.Y + height) }, MenuSettings.RootContainerColor); Line.End(); - - for (var i = 0; i < this.Component.Components.Count; ++i) { var childComponent = this.Component.Components.Values.ToList()[i]; if (childComponent != null) { var childPos = new Vector2( - position.X + this.Component.MenuWidth, + position.X + this.Component.MenuWidth, position.Y + i * MenuSettings.ContainerHeight); childComponent.OnDraw(childPos); @@ -212,33 +201,32 @@ public override void Draw() Line.Draw( new[] { - new Vector2(position.X + this.Component.MenuWidth, position.Y), + new Vector2(position.X + this.Component.MenuWidth, position.Y), new Vector2(position.X + this.Component.MenuWidth + width, position.Y) }, contourColor); Line.Draw( new[] { - new Vector2(position.X + this.Component.MenuWidth, position.Y + height), + new Vector2(position.X + this.Component.MenuWidth, position.Y + height), new Vector2(position.X + this.Component.MenuWidth + width, position.Y + height) }, contourColor); Line.Draw( new[] { - new Vector2(position.X + this.Component.MenuWidth, position.Y), + new Vector2(position.X + this.Component.MenuWidth, position.Y), new Vector2(position.X + this.Component.MenuWidth, position.Y + height) }, contourColor); Line.Draw( new[] { - new Vector2(position.X + this.Component.MenuWidth + width, position.Y), + new Vector2(position.X + this.Component.MenuWidth + width, position.Y), new Vector2(position.X + this.Component.MenuWidth + width, position.Y + height) }, contourColor); Line.End(); - } if (this.hasDragged && !MenuCustomizer.Instance.LockPosition.Value) @@ -258,9 +246,9 @@ public override void Draw() Line.Draw( new[] { - new Vector2(x - 1, y + 1), new Vector2(x - 1 + dragTexture.Width, y + 1), - new Vector2(x - 1 + dragTexture.Width, y + dragTexture.Width + 2), - new Vector2(x - 2, y + dragTexture.Width + 2), new Vector2(x - 2, y), + new Vector2(x - 1, y + 1), new Vector2(x - 1 + dragTexture.Width, y + 1), + new Vector2(x - 1 + dragTexture.Width, y + dragTexture.Width + 2), + new Vector2(x - 2, y + dragTexture.Width + 2), new Vector2(x - 2, y), }, MenuSettings.ContainerSeparatorColor); Line.End(); @@ -277,13 +265,17 @@ public override void OnWndProc(WindowsKeys args) { if (this.Component.Visible) { - if (args.Msg == WindowsMessages.MOUSEMOVE && this.dragging && !MenuCustomizer.Instance.LockPosition.Value) + if (args.Msg == WindowsMessages.MOUSEMOVE && this.dragging + && !MenuCustomizer.Instance.LockPosition.Value) { MenuSettings.Position = new Vector2(args.Cursor.X - this.xd, args.Cursor.Y - this.yd); this.hasDragged = true; } - if (args.Cursor.IsUnderRectangle(this.Component.Position.X, this.Component.Position.Y, this.Component.MenuWidth, + if (args.Cursor.IsUnderRectangle( + this.Component.Position.X, + this.Component.Position.Y, + this.Component.MenuWidth, MenuSettings.ContainerHeight)) { if (args.Msg == WindowsMessages.LBUTTONDOWN && this.Component.Root) diff --git a/Core/UI/IMenu/Skins/Blue2/BlueMenuSettings2.cs b/Core/UI/IMenu/Skins/Blue2/BlueMenuSettings2.cs index 4c936b7..c5167f0 100644 --- a/Core/UI/IMenu/Skins/Blue2/BlueMenuSettings2.cs +++ b/Core/UI/IMenu/Skins/Blue2/BlueMenuSettings2.cs @@ -24,15 +24,9 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue2 { - using System.Collections.Generic; - using System.ComponentModel; - using System.Runtime.CompilerServices; - - using LeagueSharp.SDK.Core.UI.IMenu.Customizer; using LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue; using SharpDX; - using SharpDX.Direct3D9; /// /// Default Skin Settings. @@ -52,22 +46,25 @@ static BlueMenuSettings2() #endregion + #region Public Properties + /// /// Gets or sets the Global Container Selected Color. /// - public static ColorBGRA ContainerSelectedColor { get; set; } + public new static ColorBGRA ContainerSelectedColor { get; set; } + + #endregion #region Public Methods and Operators /// /// Used to load the menu settings. /// - public static void LoadSettings() + public new static void LoadSettings() { BlueMenuSettings.LoadSettings(); } #endregion - } } \ No newline at end of file diff --git a/Core/UI/IMenu/Skins/Blue2/BlueSeparator2.cs b/Core/UI/IMenu/Skins/Blue2/BlueSeparator2.cs index 8ec5291..2d4c71b 100644 --- a/Core/UI/IMenu/Skins/Blue2/BlueSeparator2.cs +++ b/Core/UI/IMenu/Skins/Blue2/BlueSeparator2.cs @@ -19,13 +19,13 @@ // Implements as a custom skin. // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue2 { using LeagueSharp.SDK.Core.Enumerations; using LeagueSharp.SDK.Core.Math; using LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue; using LeagueSharp.SDK.Core.UI.IMenu.Values; - using LeagueSharp.SDK.Core.Utils; /// /// Implements as a default skin. @@ -57,15 +57,15 @@ public override void Draw() var centerY = BlueUtilities.GetContainerRectangle(this.Component) .GetCenteredText( null, - BlueMenuSettings.FontCaption, - this.Component.DisplayName.ToUpper(), + BlueMenuSettings.FontCaption, + this.Component.DisplayName.ToUpper(), CenteredFlags.VerticalCenter | CenteredFlags.HorizontalCenter); BlueMenuSettings.FontCaption.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName.ToUpper(), - (int)centerY.X, - (int)centerY.Y, + MenuManager.Instance.Sprite, + this.Component.DisplayName.ToUpper(), + (int)centerY.X, + (int)centerY.Y, BlueMenuSettings.TextCaptionColor); } diff --git a/Core/UI/IMenu/Skins/Blue2/BlueSlider2.cs b/Core/UI/IMenu/Skins/Blue2/BlueSlider2.cs index 85a7d73..ff7c9b7 100644 --- a/Core/UI/IMenu/Skins/Blue2/BlueSlider2.cs +++ b/Core/UI/IMenu/Skins/Blue2/BlueSlider2.cs @@ -19,17 +19,15 @@ // A custom implementation of an // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue2 { - using System; using System.Globalization; using LeagueSharp.SDK.Core.Enumerations; - using LeagueSharp.SDK.Core.Extensions.SharpDX; using LeagueSharp.SDK.Core.Math; using LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue; using LeagueSharp.SDK.Core.UI.IMenu.Values; - using LeagueSharp.SDK.Core.Utils; using SharpDX; using SharpDX.Direct3D9; @@ -88,25 +86,25 @@ public override void Draw() Line.Width = 3; Line.Begin(); Line.Draw( - new[] { new Vector2(x, position.Y + 1), new Vector2(x, position.Y + MenuSettings.ContainerHeight) }, + new[] { new Vector2(x, position.Y + 1), new Vector2(x, position.Y + MenuSettings.ContainerHeight) }, this.Component.Interacting ? new ColorBGRA(90, 129, 144, 255) : new ColorBGRA(0, 74, 103, 255)); Line.End(); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(position.X + MenuSettings.ContainerTextOffset), + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(position.X + MenuSettings.ContainerTextOffset), centeredY, MenuSettings.TextColor); var measureText = MenuSettings.Font.MeasureText( - null, - this.Component.Value.ToString(CultureInfo.InvariantCulture), + null, + this.Component.Value.ToString(CultureInfo.InvariantCulture), 0); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.Value.ToString(CultureInfo.InvariantCulture), - (int)(position.X + this.Component.MenuWidth - 5 - measureText.Width), + MenuManager.Instance.Sprite, + this.Component.Value.ToString(CultureInfo.InvariantCulture), + (int)(position.X + this.Component.MenuWidth - 5 - measureText.Width), centeredY, MenuSettings.TextColor); diff --git a/Core/UI/IMenu/Skins/Blue2/BlueSliderButton2.cs b/Core/UI/IMenu/Skins/Blue2/BlueSliderBool2.cs similarity index 80% rename from Core/UI/IMenu/Skins/Blue2/BlueSliderButton2.cs rename to Core/UI/IMenu/Skins/Blue2/BlueSliderBool2.cs index f0c2e07..98ec90c 100644 --- a/Core/UI/IMenu/Skins/Blue2/BlueSliderButton2.cs +++ b/Core/UI/IMenu/Skins/Blue2/BlueSliderBool2.cs @@ -19,17 +19,15 @@ // A custom implementation of an // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue2 { - using System; using System.Globalization; using LeagueSharp.SDK.Core.Enumerations; - using LeagueSharp.SDK.Core.Extensions.SharpDX; using LeagueSharp.SDK.Core.Math; using LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue; using LeagueSharp.SDK.Core.UI.IMenu.Values; - using LeagueSharp.SDK.Core.Utils; using SharpDX; using SharpDX.Direct3D9; @@ -37,7 +35,7 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue2 /// /// A default implementation of an /// - public class BlueSliderButton2 : BlueSliderButton + public class BlueSliderBool2 : BlueSliderBool { #region Static Fields @@ -61,7 +59,7 @@ public class BlueSliderButton2 : BlueSliderButton /// /// The menu component /// - public BlueSliderButton2(MenuSliderButton component) + public BlueSliderBool2(MenuSliderBool component) : base(component) { } @@ -71,7 +69,7 @@ public BlueSliderButton2(MenuSliderButton component) #region Public Methods and Operators /// - /// Draws a + /// Draws a /// public override void Draw() { @@ -83,32 +81,33 @@ public override void Draw() BlueUtilities.GetContainerRectangle(this.Component) .GetCenteredText(null, MenuSettings.Font, this.Component.DisplayName, CenteredFlags.VerticalCenter) .Y; - var percent = (this.Component.SValue - this.Component.MinValue) - / (float)(this.Component.MaxValue - this.Component.MinValue); - var x = position.X + Offset + (percent * (this.Component.MenuWidth - Offset * 2 - MenuSettings.ContainerHeight / 2)); + var percent = (this.Component.SliderValue - this.Component.SliderMinValue) + / (float)(this.Component.SliderMaxValue - this.Component.SliderMinValue); + var x = position.X + Offset + + (percent * (this.Component.MenuWidth - Offset * 2 - MenuSettings.ContainerHeight / 2)); Line.Width = 3; Line.Begin(); Line.Draw( - new[] { new Vector2(x, position.Y + 1), new Vector2(x, position.Y + MenuSettings.ContainerHeight) }, + new[] { new Vector2(x, position.Y + 1), new Vector2(x, position.Y + MenuSettings.ContainerHeight) }, this.Component.Interacting ? new ColorBGRA(90, 129, 144, 255) : new ColorBGRA(0, 74, 103, 255)); Line.End(); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(position.X + MenuSettings.ContainerTextOffset), + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(position.X + MenuSettings.ContainerTextOffset), centeredY, MenuSettings.TextColor); var measureText = MenuSettings.Font.MeasureText( - null, - this.Component.SValue.ToString(CultureInfo.InvariantCulture), + null, + this.Component.SliderValue.ToString(CultureInfo.InvariantCulture), 0); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.SValue.ToString(CultureInfo.InvariantCulture), - (int)(position.X + this.Component.MenuWidth - 5 - measureText.Width - MenuSettings.ContainerHeight), + MenuManager.Instance.Sprite, + this.Component.SliderValue.ToString(CultureInfo.InvariantCulture), + (int)(position.X + this.Component.MenuWidth - 5 - measureText.Width - MenuSettings.ContainerHeight), centeredY, MenuSettings.TextColor); @@ -139,7 +138,7 @@ public override void Draw() + MenuSettings.ContainerHeight / 2f, this.Component.Position.Y + MenuSettings.ContainerHeight - 3) }, - this.Component.BValue ? new ColorBGRA(0, 186, 255, 255) : new ColorBGRA(36, 36, 36, 255)); + this.Component.BoolValue ? new ColorBGRA(0, 186, 255, 255) : new ColorBGRA(36, 36, 36, 255)); Line.End(); var centerX = @@ -151,14 +150,14 @@ public override void Draw() MenuSettings.ContainerHeight).GetCenteredText( null, MenuSettings.Font, - this.Component.BValue ? "On" : "Off", + this.Component.BoolValue ? "On" : "Off", CenteredFlags.HorizontalCenter).X; MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, - this.Component.BValue ? "On" : "Off", + this.Component.BoolValue ? "On" : "Off", centerX, centeredY, - this.Component.BValue ? new ColorBGRA(0, 27, 41, 255) : MenuSettings.TextColor); + this.Component.BoolValue ? new ColorBGRA(0, 27, 41, 255) : MenuSettings.TextColor); } #endregion diff --git a/Core/UI/IMenu/Skins/Blue2/BlueTextures2.cs b/Core/UI/IMenu/Skins/Blue2/BlueTextures2.cs index 486a874..e3213f0 100644 --- a/Core/UI/IMenu/Skins/Blue2/BlueTextures2.cs +++ b/Core/UI/IMenu/Skins/Blue2/BlueTextures2.cs @@ -20,19 +20,14 @@ // // -------------------------------------------------------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue2 { + using System.Collections.Generic; using System.Drawing; + using System.Linq; using LeagueSharp.SDK.Properties; - using SharpDX; using SharpDX.Direct3D9; internal enum BlueTexture2 @@ -42,23 +37,38 @@ internal enum BlueTexture2 internal class BlueTextures2 { - - private readonly Dictionary textures = new Dictionary(); + #region Static Fields public static readonly BlueTextures2 Instance = new BlueTextures2(); + #endregion + + #region Fields + + private readonly Dictionary textures = + new Dictionary(); + + #endregion + + #region Constructors and Destructors + private BlueTextures2() { - this.textures[BlueTexture2.Dragging] = BuildTexture(Resources.cursor_drag, 16, 16); + this.textures[BlueTexture2.Dragging] = this.BuildTexture(Resources.cursor_drag, 16, 16); } ~BlueTextures2() { - foreach (var entry in this.textures.Where(entry => !entry.Value.Texture.IsDisposed)) { + foreach (var entry in this.textures.Where(entry => !entry.Value.Texture.IsDisposed)) + { entry.Value.Texture.Dispose(); } } + #endregion + + #region Public Indexers + public BlueTextureWrapper this[BlueTexture2 textureType] { get @@ -67,10 +77,24 @@ public BlueTextureWrapper this[BlueTexture2 textureType] } } + #endregion + + #region Public Methods and Operators + + public BlueTextureWrapper AddTexture(Image bmp, int width, int height, BlueTexture2 textureType) + { + this.textures[textureType] = this.BuildTexture(bmp, height, width); + return this.textures[textureType]; + } + + #endregion + + #region Methods + private BlueTextureWrapper BuildTexture(Image bmp, int height, int width) { var resized = new Bitmap(bmp, width, height); - var texture = Texture.FromMemory( + var texture = Texture.FromMemory( Drawing.Direct3DDevice, (byte[])new ImageConverter().ConvertTo(resized, typeof(byte[])), resized.Width, @@ -87,19 +111,12 @@ private BlueTextureWrapper BuildTexture(Image bmp, int height, int width) return new BlueTextureWrapper(texture, width, height); } - public BlueTextureWrapper AddTexture(Image bmp, int width, int height, BlueTexture2 textureType) - { - this.textures[textureType] = BuildTexture(bmp, height, width); - return this.textures[textureType]; - } - + #endregion } internal class BlueTextureWrapper { - public Texture Texture { get; private set; } - public int Width { get; private set; } - public int Height { get; private set; } + #region Constructors and Destructors public BlueTextureWrapper(Texture texture, int width, int height) { @@ -107,6 +124,17 @@ public BlueTextureWrapper(Texture texture, int width, int height) this.Width = width; this.Height = height; } - + + #endregion + + #region Public Properties + + public int Height { get; private set; } + + public Texture Texture { get; private set; } + + public int Width { get; private set; } + + #endregion } -} +} \ No newline at end of file diff --git a/Core/UI/IMenu/Skins/Blue2/BlueTheme2.cs b/Core/UI/IMenu/Skins/Blue2/BlueTheme2.cs index cf385ae..d78a50d 100644 --- a/Core/UI/IMenu/Skins/Blue2/BlueTheme2.cs +++ b/Core/UI/IMenu/Skins/Blue2/BlueTheme2.cs @@ -19,6 +19,7 @@ // Implements a custom ITheme. // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Blue2 { using System.Linq; @@ -128,23 +129,23 @@ public ADrawable BuildSeparatorHandler(MenuSeparator component) } /// - /// Builds a new handler for the given . + /// Builds a new handler for the given . /// - /// The where this handler is responsible for. + /// The where this handler is responsible for. /// The handler - public ADrawable BuildSliderHandler(MenuSlider component) + public ADrawable BuildSliderBoolHandler(MenuSliderBool component) { - return new BlueSlider2(component); + return new BlueSliderBool2(component); } /// - /// Builds a new handler for the given . + /// Builds a new handler for the given . /// - /// The where this handler is responsible for. + /// The where this handler is responsible for. /// The handler - public ADrawable BuildSliderButtonHandler(MenuSliderButton component) + public ADrawable BuildSliderHandler(MenuSlider component) { - return new BlueSliderButton2(component); + return new BlueSlider2(component); } /// @@ -166,7 +167,7 @@ public void Draw() Line.Draw( new[] { - new Vector2(position.X + (width / 2f), position.Y), + new Vector2(position.X + (width / 2f), position.Y), new Vector2(position.X + (width / 2), position.Y + height) }, MenuSettings.RootContainerColor); @@ -200,13 +201,12 @@ public void Draw() Line.Draw( new[] { - new Vector2(position.X, position.Y), new Vector2(position.X + width, position.Y), - new Vector2(position.X + width, position.Y + height), new Vector2(position.X, position.Y + height), + new Vector2(position.X, position.Y), new Vector2(position.X + width, position.Y), + new Vector2(position.X + width, position.Y + height), new Vector2(position.X, position.Y + height), new Vector2(position.X, position.Y) }, new ColorBGRA(21, 26, 45, 255)); Line.End(); - } #endregion diff --git a/Core/UI/IMenu/Skins/Blue2/BlueUtilities2.cs b/Core/UI/IMenu/Skins/Blue2/BlueUtilities2.cs index 19e9c78..2ebb587 100644 --- a/Core/UI/IMenu/Skins/Blue2/BlueUtilities2.cs +++ b/Core/UI/IMenu/Skins/Blue2/BlueUtilities2.cs @@ -65,9 +65,9 @@ public static int CalcWidthText(string text) public static Rectangle GetContainerRectangle(AMenuComponent component) { return new Rectangle( - (int)component.Position.X, - (int)component.Position.Y, - component.MenuWidth, + (int)component.Position.X, + (int)component.Position.Y, + component.MenuWidth, MenuSettings.ContainerHeight); } diff --git a/Core/UI/IMenu/Skins/Colored/ColoredBool.cs b/Core/UI/IMenu/Skins/Colored/ColoredBool.cs index c05d524..20058a3 100644 --- a/Core/UI/IMenu/Skins/Colored/ColoredBool.cs +++ b/Core/UI/IMenu/Skins/Colored/ColoredBool.cs @@ -19,6 +19,7 @@ // A custom implementation of a // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Colored { using LeagueSharp.SDK.Core.Enumerations; @@ -69,7 +70,7 @@ public ColoredBool(MenuBool component) public Rectangle ButtonBoundaries(MenuBool component) { return new Rectangle( - (int)(component.Position.X + component.MenuWidth - MenuSettings.ContainerHeight), + (int)(component.Position.X + component.MenuWidth - MenuSettings.ContainerHeight), (int)component.Position.Y, MenuSettings.ContainerHeight, MenuSettings.ContainerHeight); @@ -95,29 +96,45 @@ public override void Draw() .Y; MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(this.Component.Position.X + MenuSettings.ContainerTextOffset), + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(this.Component.Position.X + MenuSettings.ContainerTextOffset), centerY, MenuSettings.TextColor); var centerX = (int) new Rectangle( - (int)(this.Component.Position.X + this.Component.MenuWidth - MenuSettings.ContainerHeight), + (int)(this.Component.Position.X + this.Component.MenuWidth - MenuSettings.ContainerHeight), (int)this.Component.Position.Y, MenuSettings.ContainerHeight, MenuSettings.ContainerHeight).GetCenteredText( - null, - MenuSettings.Font, - this.Component.Value ? "On" : "Off", + null, + MenuSettings.Font, + this.Component.Value ? "On" : "Off", CenteredFlags.HorizontalCenter).X - 5; //Left - Utils.DrawCircle(centerX, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, 7, 270, Utils.CircleType.Half, true, 32, MenuSettings.TextColor); + Utils.DrawCircle( + centerX, + this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, + 7, + 270, + Utils.CircleType.Half, + true, + 32, + MenuSettings.TextColor); //Right - Utils.DrawCircle(centerX + 15, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, 7, 90, Utils.CircleType.Half, true, 32, MenuSettings.TextColor); + Utils.DrawCircle( + centerX + 15, + this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, + 7, + 90, + Utils.CircleType.Half, + true, + 32, + MenuSettings.TextColor); //Top Line.Width = 1; @@ -144,8 +161,14 @@ public override void Draw() Line.End(); //FullCircle - Utils.DrawCircleFilled(this.Component.Value ? centerX + 14 : centerX + 1, - this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, 6, 0, Utils.CircleType.Full, true, 32, + Utils.DrawCircleFilled( + this.Component.Value ? centerX + 14 : centerX + 1, + this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, + 6, + 0, + Utils.CircleType.Full, + true, + 32, this.Component.Value ? MenuSettings.ContainerSelectedColor : MenuSettings.TextColor); } diff --git a/Core/UI/IMenu/Skins/Colored/ColoredButton.cs b/Core/UI/IMenu/Skins/Colored/ColoredButton.cs index 2661a64..0a30969 100644 --- a/Core/UI/IMenu/Skins/Colored/ColoredButton.cs +++ b/Core/UI/IMenu/Skins/Colored/ColoredButton.cs @@ -19,6 +19,7 @@ // A custom implementation of // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Colored { using LeagueSharp.SDK.Core.Enumerations; @@ -96,8 +97,8 @@ public Rectangle ButtonBoundaries(MenuButton component) var buttonTextWidth = MenuSettings.Font.MeasureText(MenuManager.Instance.Sprite, component.ButtonText, 0).Width; return new Rectangle( - (int)(component.Position.X + component.MenuWidth - buttonTextWidth - (2 * TextGap)), - (int)component.Position.Y, + (int)(component.Position.X + component.MenuWidth - buttonTextWidth - (2 * TextGap)), + (int)component.Position.Y, (2 * TextGap) + buttonTextWidth, MenuSettings.ContainerHeight); } @@ -119,26 +120,30 @@ public override void Draw() .GetCenteredText(null, MenuSettings.Font, this.Component.DisplayName, CenteredFlags.VerticalCenter); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(this.Component.Position.X + MenuSettings.ContainerTextOffset), + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(this.Component.Position.X + MenuSettings.ContainerTextOffset), (int)rectangleName.Y, MenuSettings.TextColor); var buttonTextWidth = MenuSettings.Font.MeasureText(MenuManager.Instance.Sprite, this.Component.ButtonText, 0).Width; - Utils.DrawBoxRounded(this.Component.Position.X + this.Component.MenuWidth - buttonTextWidth - (2 * TextGap) + 2, + Utils.DrawBoxRounded( + this.Component.Position.X + this.Component.MenuWidth - buttonTextWidth - (2 * TextGap) + 2, this.Component.Position.Y + (MenuSettings.ContainerHeight / 8f), - (this.Component.Position.X + this.Component.MenuWidth - 2) - (this.Component.Position.X + this.Component.MenuWidth - buttonTextWidth - (2 * TextGap) + 2), - MenuSettings.ContainerHeight - 5, 8, true, - this.Component.Hovering ? MenuSettings.ContainerSelectedColor : this.buttonColor, + (this.Component.Position.X + this.Component.MenuWidth - 2) + - (this.Component.Position.X + this.Component.MenuWidth - buttonTextWidth - (2 * TextGap) + 2), + MenuSettings.ContainerHeight - 5, + 8, + true, + this.Component.Hovering ? MenuSettings.ContainerSelectedColor : this.buttonColor, this.Component.Hovering ? MenuSettings.ContainerSelectedColor : this.buttonColor); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.ButtonText, - (int)(this.Component.Position.X + this.Component.MenuWidth - buttonTextWidth - TextGap), + MenuManager.Instance.Sprite, + this.Component.ButtonText, + (int)(this.Component.Position.X + this.Component.MenuWidth - buttonTextWidth - TextGap), (int)rectangleName.Y, MenuSettings.TextColor); } diff --git a/Core/UI/IMenu/Skins/Colored/ColoredColorPicker.cs b/Core/UI/IMenu/Skins/Colored/ColoredColorPicker.cs index 75caa1d..cdcb3d7 100644 --- a/Core/UI/IMenu/Skins/Colored/ColoredColorPicker.cs +++ b/Core/UI/IMenu/Skins/Colored/ColoredColorPicker.cs @@ -19,6 +19,7 @@ // A custom implementation of // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Colored { using System.Drawing; @@ -249,11 +250,11 @@ public override void Draw() new[] { new Vector2( - this.Component.Position.X + this.Component.MenuWidth - (Line.Width / 2f) - 4, - this.Component.Position.Y + 1 + 3), - new Vector2( - this.Component.Position.X + this.Component.MenuWidth - (Line.Width / 2f) - 4, - this.Component.Position.Y + Line.Width + 3) + this.Component.Position.X + this.Component.MenuWidth - (Line.Width / 2f) - 4, + this.Component.Position.Y + 1 + 3), + new Vector2( + this.Component.Position.X + this.Component.MenuWidth - (Line.Width / 2f) - 4, + this.Component.Position.Y + Line.Width + 3) }, MenuSettings.HoverColor); Line.End(); @@ -264,53 +265,58 @@ public override void Draw() MenuManager.Instance.DrawDelayed( delegate { - Line.Width = ColorPickerBoundaries().Width; + Line.Width = this.ColorPickerBoundaries().Width; Line.Begin(); Line.Draw( new[] { - new Vector2(ColorPickerBoundaries().X + 165, ColorPickerBoundaries().Y), + new Vector2(this.ColorPickerBoundaries().X + 165, this.ColorPickerBoundaries().Y), new Vector2( - ColorPickerBoundaries().X + 165, - ColorPickerBoundaries().Y + ColorPickerBoundaries().Height) + this.ColorPickerBoundaries().X + 165, + this.ColorPickerBoundaries().Y + this.ColorPickerBoundaries().Height) }, MenuSettings.RootContainerColor); Line.End(); - colorBox.DrawControl(new Vector2(ColorBoxBoundaries().X, ColorBoxBoundaries().Y)); - verticalColorSlider.DrawControl( - new Vector2(VerticalColorSliderBoundaries().X, VerticalColorSliderBoundaries().Y)); - verticalAlphaSlider.DrawControl( - new Vector2(VerticalAlphaSliderBoundaries().X, VerticalAlphaSliderBoundaries().Y)); + this.colorBox.DrawControl( + new Vector2(this.ColorBoxBoundaries().X, this.ColorBoxBoundaries().Y)); + this.verticalColorSlider.DrawControl( + new Vector2( + this.VerticalColorSliderBoundaries().X, + this.VerticalColorSliderBoundaries().Y)); + this.verticalAlphaSlider.DrawControl( + new Vector2( + this.VerticalAlphaSliderBoundaries().X, + this.VerticalAlphaSliderBoundaries().Y)); Utils.DrawBoxFilled( - PreviewBoundaries().X, - PreviewBoundaries().Y, - PreviewBoundaries().Width, - PreviewBoundaries().Height, + this.PreviewBoundaries().X, + this.PreviewBoundaries().Y, + this.PreviewBoundaries().Width, + this.PreviewBoundaries().Height, Color.Black); Utils.DrawBoxFilled( - PreviewBoundaries().X, - PreviewBoundaries().Y, - PreviewBoundaries().Width, - PreviewBoundaries().Height, - colorBox.Rgb.ToSharpDxColor()); + this.PreviewBoundaries().X, + this.PreviewBoundaries().Y, + this.PreviewBoundaries().Width, + this.PreviewBoundaries().Height, + this.colorBox.Rgb.ToSharpDxColor()); var applyButtonTextWidth = MenuSettings.Font.MeasureText(MenuManager.Instance.Sprite, "Apply", 0).Width; var cancelButtonTextWidth = MenuSettings.Font.MeasureText(MenuManager.Instance.Sprite, "Cancel", 0).Width; - Line.Width = ApplyButtonBoundaries().Width; + Line.Width = this.ApplyButtonBoundaries().Width; Line.Begin(); Line.Draw( new[] { - new Vector2(ApplyButtonBoundaries().X + 25, ApplyButtonBoundaries().Y), + new Vector2(this.ApplyButtonBoundaries().X + 25, this.ApplyButtonBoundaries().Y), new Vector2( - ApplyButtonBoundaries().X + 25, - ApplyButtonBoundaries().Y + ApplyButtonBoundaries().Height) + this.ApplyButtonBoundaries().X + 25, + this.ApplyButtonBoundaries().Y + this.ApplyButtonBoundaries().Height) }, new ColorBGRA(68, 160, 255, 255)); Line.End(); @@ -318,22 +324,22 @@ public override void Draw() MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, "Apply", - ApplyButtonBoundaries().X - applyButtonTextWidth / 2 + 25, + this.ApplyButtonBoundaries().X - applyButtonTextWidth / 2 + 25, (int) - CancelButtonBoundaries() + this.CancelButtonBoundaries() .GetCenteredText(null, MenuSettings.Font, "Apply", CenteredFlags.VerticalCenter) .Y, new ColorBGRA(221, 233, 255, 255)); - Line.Width = CancelButtonBoundaries().Width; + Line.Width = this.CancelButtonBoundaries().Width; Line.Begin(); Line.Draw( new[] { - new Vector2(CancelButtonBoundaries().X + 25, CancelButtonBoundaries().Y), + new Vector2(this.CancelButtonBoundaries().X + 25, this.CancelButtonBoundaries().Y), new Vector2( - CancelButtonBoundaries().X + 25, - CancelButtonBoundaries().Y + CancelButtonBoundaries().Height) + this.CancelButtonBoundaries().X + 25, + this.CancelButtonBoundaries().Y + this.CancelButtonBoundaries().Height) }, new ColorBGRA(68, 160, 255, 255)); Line.End(); @@ -341,9 +347,9 @@ public override void Draw() MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, "Cancel", - CancelButtonBoundaries().X - cancelButtonTextWidth / 2 + 25, + this.CancelButtonBoundaries().X - cancelButtonTextWidth / 2 + 25, (int) - CancelButtonBoundaries() + this.CancelButtonBoundaries() .GetCenteredText(null, MenuSettings.Font, "Cancel", CenteredFlags.VerticalCenter) .Y, new ColorBGRA(221, 233, 255, 255)); @@ -382,11 +388,11 @@ public override void OnWndProc(WindowsKeys args) } else if (this.InteractingVerticalColorSlider) { - this.verticalColorSlider.VerticalColorSlider_MouseMove(args); + this.verticalColorSlider.VerticalColorSliderMouseMove(args); } else if (this.InteractingVerticalAlphaSlider) { - this.verticalAlphaSlider.VerticalAlphaSlider_MouseMove(args); + this.verticalAlphaSlider.VerticalAlphaSliderMouseMove(args); } } } @@ -401,12 +407,12 @@ public override void OnWndProc(WindowsKeys args) if (this.InteractingVerticalColorSlider) { this.InteractingVerticalColorSlider = false; - this.verticalColorSlider.VerticalColorSlider_MouseUp(args); + this.verticalColorSlider.VerticalColorSliderMouseUp(args); } if (this.InteractingVerticalAlphaSlider) { this.InteractingVerticalAlphaSlider = false; - this.verticalAlphaSlider.VerticalAlphaSlider_MouseUp(args); + this.verticalAlphaSlider.VerticalAlphaSliderMouseUp(args); } } @@ -435,7 +441,7 @@ public override void OnWndProc(WindowsKeys args) this.VerticalColorSliderBoundaries().Height)) { this.InteractingVerticalColorSlider = true; - this.verticalColorSlider.VerticalColorSlider_MouseDown(args); + this.verticalColorSlider.VerticalColorSliderMouseDown(args); } else if (args.Cursor.IsUnderRectangle( this.VerticalAlphaSliderBoundaries().X, @@ -444,7 +450,7 @@ public override void OnWndProc(WindowsKeys args) this.VerticalAlphaSliderBoundaries().Height)) { this.InteractingVerticalAlphaSlider = true; - this.verticalAlphaSlider.VerticalAlphaSlider_MouseDown(args); + this.verticalAlphaSlider.VerticalAlphaSliderMouseDown(args); } else if (args.Cursor.IsUnderRectangle( this.ApplyButtonBoundaries().X, diff --git a/Core/UI/IMenu/Skins/Colored/ColoredKeyBind.cs b/Core/UI/IMenu/Skins/Colored/ColoredKeyBind.cs index 1d5e723..6c218d7 100644 --- a/Core/UI/IMenu/Skins/Colored/ColoredKeyBind.cs +++ b/Core/UI/IMenu/Skins/Colored/ColoredKeyBind.cs @@ -129,10 +129,26 @@ public override void Draw() CenteredFlags.HorizontalCenter).X - 5; //Left - Utils.DrawCircle(centerX, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, 7, 270, Utils.CircleType.Half, true, 32, MenuSettings.TextColor); + Utils.DrawCircle( + centerX, + this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, + 7, + 270, + Utils.CircleType.Half, + true, + 32, + MenuSettings.TextColor); //Right - Utils.DrawCircle(centerX + 15, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, 7, 90, Utils.CircleType.Half, true, 32, MenuSettings.TextColor); + Utils.DrawCircle( + centerX + 15, + this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, + 7, + 90, + Utils.CircleType.Half, + true, + 32, + MenuSettings.TextColor); //Top Line.Width = 1; @@ -159,8 +175,14 @@ public override void Draw() Line.End(); //FullCircle - Utils.DrawCircleFilled(this.Component.Active ? centerX + 14 : centerX + 1, - this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, 6, 0, Utils.CircleType.Full, true, 32, + Utils.DrawCircleFilled( + this.Component.Active ? centerX + 14 : centerX + 1, + this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, + 6, + 0, + Utils.CircleType.Full, + true, + 32, this.Component.Active ? MenuSettings.ContainerSelectedColor : MenuSettings.TextColor); } diff --git a/Core/UI/IMenu/Skins/Colored/ColoredList.cs b/Core/UI/IMenu/Skins/Colored/ColoredList.cs index f106d4d..3754e57 100644 --- a/Core/UI/IMenu/Skins/Colored/ColoredList.cs +++ b/Core/UI/IMenu/Skins/Colored/ColoredList.cs @@ -19,6 +19,7 @@ // A custom implementation of a // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Colored { using System.Collections.Generic; @@ -107,24 +108,24 @@ public override void Draw() .GetCenteredText(null, MenuSettings.Font, this.Component.DisplayName, CenteredFlags.VerticalCenter); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(position.X + MenuSettings.ContainerTextOffset), + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(position.X + MenuSettings.ContainerTextOffset), (int)rectangleName.Y, MenuSettings.TextColor); MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, - "\u23EC", - (int)(position.X + this.Component.MenuWidth - this.dropDownButtonWidth + ArrowSpacing), + "\u23EC", + (int)(position.X + this.Component.MenuWidth - this.dropDownButtonWidth + ArrowSpacing), (int)rectangleName.Y, MenuSettings.TextColor); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.SelectedValueAsObject.ToString(), + MenuManager.Instance.Sprite, + this.Component.SelectedValueAsObject.ToString(), (int)position.X + this.Component.MenuWidth - this.dropDownButtonWidth - TextSpacing - - this.Component.MaxStringWidth, + - this.Component.MaxStringWidth, (int)rectangleName.Y, this.Component.Active ? MenuSettings.ContainerSelectedColor : MenuSettings.TextColor); @@ -137,18 +138,24 @@ public override void Draw() { var color = MenuSettings.RootContainerColor; - Utils.DrawBoxRounded(position.X + Component.MenuWidth - dropdownMenuWidth, position.Y + MenuSettings.ContainerHeight, - dropdownMenuWidth, dropdownMenuHeight, 4, true, - MenuSettings.RootContainerColor, new ColorBGRA(55, 76, 95, 255)); + Utils.DrawBoxRounded( + position.X + this.Component.MenuWidth - dropdownMenuWidth, + position.Y + MenuSettings.ContainerHeight, + dropdownMenuWidth, + dropdownMenuHeight, + 4, + true, + MenuSettings.RootContainerColor, + new ColorBGRA(55, 76, 95, 255)); var x = (int) - (position.X + Component.MenuWidth - dropDownButtonWidth - TextSpacing - - Component.MaxStringWidth); + (position.X + this.Component.MenuWidth - this.dropDownButtonWidth - TextSpacing + - this.Component.MaxStringWidth); var y = (int)rectangleName.Y; for (var i = 0; i < valueStrings.Length; i++) { - if (i == Component.HoveringIndex) + if (i == this.Component.HoveringIndex) { Line.Width = MenuSettings.ContainerHeight; Line.Begin(); @@ -156,11 +163,11 @@ public override void Draw() new[] { new Vector2( - position.X + Component.MenuWidth - dropdownMenuWidth, + position.X + this.Component.MenuWidth - dropdownMenuWidth, position.Y + ((i + 1) * MenuSettings.ContainerHeight) - + MenuSettings.ContainerHeight / 2f), + + MenuSettings.ContainerHeight / 2f), new Vector2( - position.X + Component.MenuWidth, + position.X + this.Component.MenuWidth, position.Y + ((i + 1) * MenuSettings.ContainerHeight) + MenuSettings.ContainerHeight / 2f) }, @@ -168,37 +175,38 @@ public override void Draw() Line.End(); } - if (i != 0) { + if (i != 0) + { Line.Width = 1f; Line.Begin(); Line.Draw( new[] { - new Vector2( - position.X + Component.MenuWidth - dropdownMenuWidth + 10, - position.Y + (MenuSettings.ContainerHeight * (i + 1))), - new Vector2( - position.X + Component.MenuWidth - 10, - position.Y + (MenuSettings.ContainerHeight * (i + 1))) + new Vector2( + position.X + this.Component.MenuWidth - dropdownMenuWidth + 10, + position.Y + (MenuSettings.ContainerHeight * (i + 1))), + new Vector2( + position.X + this.Component.MenuWidth - 10, + position.Y + (MenuSettings.ContainerHeight * (i + 1))) }, MenuSettings.ContainerSeparatorColor); Line.End(); } - + y += MenuSettings.ContainerHeight; MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - valueStrings[i], - x, + MenuManager.Instance.Sprite, + valueStrings[i], + x, y, MenuSettings.TextColor); - if (Component.Index == i) + if (this.Component.Index == i) { var checkmarkWidth = MenuSettings.Font.MeasureText(null, "\u2713", 0).Width; MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, - "\u2713", - (int)(position.X + Component.MenuWidth - checkmarkWidth - TextSpacing), + "\u2713", + (int)(position.X + this.Component.MenuWidth - checkmarkWidth - TextSpacing), y, new ColorBGRA(1, 165, 226, 255)); } @@ -218,8 +226,8 @@ public Rectangle DropDownBoundaries(MenuList component) new Rectangle( (int) (component.Position.X + component.MenuWidth - this.dropDownButtonWidth - (2 * TextSpacing) - - component.MaxStringWidth), - (int)component.Position.Y, + - component.MaxStringWidth), + (int)component.Position.Y, this.dropDownButtonWidth + (2 * TextSpacing) + component.MaxStringWidth, MenuSettings.ContainerHeight); } @@ -235,9 +243,9 @@ public Rectangle DropDownExpandedBoundaries(MenuList component) new Rectangle( (int) (component.Position.X + component.MenuWidth - this.dropDownButtonWidth - (2 * TextSpacing) - - component.MaxStringWidth), - (int)component.Position.Y, - this.dropDownButtonWidth + (2 * TextSpacing) + component.MaxStringWidth, + - component.MaxStringWidth), + (int)component.Position.Y, + this.dropDownButtonWidth + (2 * TextSpacing) + component.MaxStringWidth, (component.Count + 1) * MenuSettings.ContainerHeight); } @@ -255,8 +263,8 @@ public List DropDownListBoundaries(MenuList component) new Rectangle( (int) (component.Position.X + component.MenuWidth - this.dropDownButtonWidth - (2 * TextSpacing) - - component.MaxStringWidth), - (int)(component.Position.Y + ((i + 1) * MenuSettings.ContainerHeight)), + - component.MaxStringWidth), + (int)(component.Position.Y + ((i + 1) * MenuSettings.ContainerHeight)), this.dropDownButtonWidth + (2 * TextSpacing) + component.MaxStringWidth, MenuSettings.ContainerHeight + 1)); } @@ -295,9 +303,9 @@ public override void OnWndProc(WindowsKeys args) const int Buffer = 20; if (this.Component.Active && !args.Cursor.IsUnderRectangle( - entireDropdownRect.X - Buffer, - entireDropdownRect.Y - Buffer, - entireDropdownRect.Width + (2 * Buffer), + entireDropdownRect.X - Buffer, + entireDropdownRect.Y - Buffer, + entireDropdownRect.Width + (2 * Buffer), entireDropdownRect.Height + (2 * Buffer))) { this.Component.Active = false; @@ -310,9 +318,9 @@ public override void OnWndProc(WindowsKeys args) for (var i = 0; i < dropdownRectangles.Count; i++) { if (args.Cursor.IsUnderRectangle( - dropdownRectangles[i].X, - dropdownRectangles[i].Y, - dropdownRectangles[i].Width, + dropdownRectangles[i].X, + dropdownRectangles[i].Y, + dropdownRectangles[i].Width, dropdownRectangles[i].Height)) { this.Component.HoveringIndex = i; diff --git a/Core/UI/IMenu/Skins/Colored/ColoredMenu.cs b/Core/UI/IMenu/Skins/Colored/ColoredMenu.cs index 6b4cdd4..f4a9e85 100644 --- a/Core/UI/IMenu/Skins/Colored/ColoredMenu.cs +++ b/Core/UI/IMenu/Skins/Colored/ColoredMenu.cs @@ -19,10 +19,9 @@ // Provides a custom implementation of // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Colored { - using System; - using System.Drawing; using System.Linq; using LeagueSharp.SDK.Core.Enumerations; @@ -30,22 +29,15 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Colored using LeagueSharp.SDK.Core.Math; using LeagueSharp.SDK.Core.UI.IMenu.Customizer; using LeagueSharp.SDK.Core.Utils; - using LeagueSharp.SDK.Properties; using SharpDX; using SharpDX.Direct3D9; - using Color = SharpDX.Color; - /// /// Provides a default implementation of /// public class ColoredMenu : ADrawable { - #region Constants - - #endregion - #region Static Fields /// @@ -56,7 +48,7 @@ public class ColoredMenu : ADrawable #endregion #region Fields - + /// /// Gets or sets a value indicating whether the user is dragging the menu. /// @@ -98,13 +90,180 @@ public class ColoredMenu : ADrawable public ColoredMenu(Menu component) : base(component) { - } #endregion #region Public Methods and Operators + /// + /// Draws a rounded Box. If Smoothing is true it will draw also a border. + /// + /// Position X + /// Position Y + /// Width + /// Height + /// Radius + /// Color + /// Border Color + public static void DrawBoxBotRounded( + float x, + float y, + float w, + float h, + float radius, + Color color, + Color bcolor) + { + Utils.DrawBoxFilled(x + radius, y + radius, w - 2 * radius - 1, h - 2 * radius - 1, color); // Center rect. + Utils.DrawBoxFilled(x + radius, y + 1, w - 2 * radius - 1, radius - 1, color); // Top rect. + Utils.DrawBoxFilled(x + radius, y + h - radius - 1, w - 2 * radius - 1, radius, color); // Bottom rect. + Utils.DrawBoxFilled(x + 1, y + radius, radius - 1, h - 2 * radius - 1, color); // Left rect. + Utils.DrawBoxFilled(x + w - radius - 1, y + radius, radius, h - 2 * radius - 1, color); // Right rect. + + Utils.DrawCircleFilled(x + radius, y + radius, radius - 1, 0, Utils.CircleType.Quarter, true, 16, color); + // Top-left corner + Utils.DrawCircleFilled( + x + w - radius - 1, + y + radius, + radius - 1, + 90, + Utils.CircleType.Quarter, + true, + 16, + color); // Top-right corner + Utils.DrawCircleFilled( + x + w - radius - 1, + y + h - radius - 1, + radius - 1, + 180, + Utils.CircleType.Quarter, + true, + 16, + color); // Bottom-right corner + Utils.DrawCircleFilled( + x + radius, + y + h - radius - 1, + radius - 1, + 270, + Utils.CircleType.Quarter, + true, + 16, + color); // Bottom-left corner + + Utils.DrawCircle(x + radius + 1, y + radius + 1, radius, 0, Utils.CircleType.Quarter, true, 16, bcolor); + // Top-left corner + Utils.DrawCircle(x + w - radius - 1, y + radius + 1, radius, 90, Utils.CircleType.Quarter, true, 16, bcolor); + // Top-right corner + Utils.DrawCircle( + x + w - radius - 1, + y + h - radius - 1, + radius, + 180, + Utils.CircleType.Quarter, + true, + 16, + bcolor); // Bottom-right corner + Utils.DrawCircle( + x + radius + 1, + y + h - radius - 1, + radius, + 270, + Utils.CircleType.Quarter, + true, + 16, + bcolor); // Bottom-left corner + + Utils.DrawLine(x + radius, y + 1, x + w - radius - 1, y + 1, 1, bcolor); // Top line + Utils.DrawLine(x + radius, y + h - 2, x + w - radius - 1, y + h - 2, 1, bcolor); // Bottom line + Utils.DrawLine(x + 1, y + radius, x + 1, y + h - radius - 1, 1, bcolor); // Left line + Utils.DrawLine(x + w - 2, y + radius, x + w - 2, y + h - radius - 1, 1, bcolor); // Right line + } + + /// + /// Draws a rounded Box. If Smoothing is true it will draw also a border. + /// + /// Position X + /// Position Y + /// Width + /// Height + /// Radius + /// Color + /// Border Color + public static void DrawBoxTopRounded( + float x, + float y, + float w, + float h, + float radius, + Color color, + Color bcolor) + { + Utils.DrawBoxFilled(x + radius, y + radius, w - 2 * radius - 1, h - 2 * radius - 1, color); // Center rect. + Utils.DrawBoxFilled(x + radius, y + 1, w - 2 * radius - 1, radius - 1, color); // Top rect. + Utils.DrawBoxFilled(x + radius, y + h - radius - 1, w - 2 * radius - 1, radius, color); // Bottom rect. + Utils.DrawBoxFilled(x + 1, y + radius, radius - 1, h - 2 * radius - 1, color); // Left rect. + Utils.DrawBoxFilled(x + w - radius - 1, y + radius, radius, h - 2 * radius - 1, color); // Right rect. + + Utils.DrawCircleFilled(x + radius, y + radius, radius - 1, 0, Utils.CircleType.Quarter, true, 16, color); + // Top-left corner + Utils.DrawCircleFilled( + x + w - radius - 1, + y + radius, + radius - 1, + 90, + Utils.CircleType.Quarter, + true, + 16, + color); // Top-right corner + Utils.DrawCircleFilled( + x + w - radius - 1, + y + h - radius - 1, + radius - 1, + 180, + Utils.CircleType.Quarter, + true, + 16, + color); // Bottom-right corner + Utils.DrawCircleFilled( + x + radius, + y + h - radius - 1, + radius - 1, + 270, + Utils.CircleType.Quarter, + true, + 16, + color); // Bottom-left corner + + Utils.DrawCircle(x + radius + 1, y + radius + 1, radius, 0, Utils.CircleType.Quarter, true, 16, bcolor); + // Top-left corner + Utils.DrawCircle(x + w - radius - 1, y + radius + 1, radius, 90, Utils.CircleType.Quarter, true, 16, bcolor); + // Top-right corner + Utils.DrawCircle( + x + w - radius - 1, + y + h - radius - 1, + radius, + 180, + Utils.CircleType.Quarter, + true, + 16, + bcolor); // Bottom-right corner + Utils.DrawCircle( + x + radius + 1, + y + h - radius - 1, + radius, + 270, + Utils.CircleType.Quarter, + true, + 16, + bcolor); // Bottom-left corner + + Utils.DrawLine(x + radius, y + 1, x + w - radius - 1, y + 1, 1, bcolor); // Top line + Utils.DrawLine(x + radius, y + h - 2, x + w - radius - 1, y + h - 2, 1, bcolor); // Bottom line + Utils.DrawLine(x + 1, y + radius, x + 1, y + h - radius - 1, 1, bcolor); // Left line + Utils.DrawLine(x + w - 2, y + radius, x + w - 2, y + h - radius - 1, 1, bcolor); // Right line + } + /// /// Disposes any resources used in this handler. /// @@ -125,9 +284,9 @@ public override void Draw() Line.Draw( new[] { - new Vector2(position.X, position.Y + MenuSettings.ContainerHeight / 2f), + new Vector2(position.X, position.Y + MenuSettings.ContainerHeight / 2f), new Vector2( - position.X + this.Component.MenuWidth, + position.X + this.Component.MenuWidth, position.Y + MenuSettings.ContainerHeight / 2f) }, MenuSettings.HoverColor); @@ -163,14 +322,18 @@ public override void Draw() delegate { var symbolCenterY = - (int) - ColoredUtilities.GetContainerRectangle(this.Component) - .GetCenteredText(null, ColoredMenuSettings.FontMenuSymbol, this.Component.DisplayName, CenteredFlags.VerticalCenter) - .Y; + (int) + ColoredUtilities.GetContainerRectangle(this.Component) + .GetCenteredText( + null, + ColoredMenuSettings.FontMenuSymbol, + this.Component.DisplayName, + CenteredFlags.VerticalCenter) + .Y; Utils.DrawCircleFilled( (position.X + this.Component.MenuWidth - MenuSettings.ContainerTextMarkWidth - - MenuSettings.ContainerTextMarkOffset) + 4, + - MenuSettings.ContainerTextMarkOffset) + 4, symbolCenterY + 11, 6, 0, @@ -183,9 +346,11 @@ public override void Draw() "›", (int) (position.X + this.Component.MenuWidth - MenuSettings.ContainerTextMarkWidth - - MenuSettings.ContainerTextMarkOffset) + 1, + - MenuSettings.ContainerTextMarkOffset) + 1, symbolCenterY, - this.Component.Components.Count > 0 ? ColoredMenuSettings.TextCaptionColor : MenuSettings.ContainerSeparatorColor); + this.Component.Components.Count > 0 + ? ColoredMenuSettings.TextCaptionColor + : MenuSettings.ContainerSeparatorColor); }); if (this.Component.Toggled) @@ -195,9 +360,9 @@ public override void Draw() Line.Draw( new[] { - new Vector2(position.X + this.Component.MenuWidth / 2f - 1, position.Y + 1), + new Vector2(position.X + this.Component.MenuWidth / 2f - 1, position.Y + 1), new Vector2( - position.X + this.Component.MenuWidth / 2f - 1, + position.X + this.Component.MenuWidth / 2f - 1, position.Y + MenuSettings.ContainerHeight - 1) }, MenuSettings.ContainerSelectedColor); @@ -210,8 +375,15 @@ public override void Draw() width = this.Component.Components.First().Value.MenuWidth; } - Utils.DrawBoxRounded(position.X + this.Component.MenuWidth, position.Y, width, height, 4, true, - MenuSettings.RootContainerColor, new ColorBGRA(55, 76, 95, 255)); + Utils.DrawBoxRounded( + position.X + this.Component.MenuWidth, + position.Y, + width, + height, + 4, + true, + MenuSettings.RootContainerColor, + new ColorBGRA(55, 76, 95, 255)); for (var i = 0; i < this.Component.Components.Count; ++i) { @@ -219,7 +391,7 @@ public override void Draw() if (childComponent != null) { var childPos = new Vector2( - position.X + this.Component.MenuWidth, + position.X + this.Component.MenuWidth, position.Y + i * MenuSettings.ContainerHeight); childComponent.OnDraw(childPos); @@ -244,9 +416,9 @@ public override void Draw() Line.Draw( new[] { - new Vector2(x - 1, y + 1), new Vector2(x - 1 + dragTexture.Width, y + 1), - new Vector2(x - 1 + dragTexture.Width, y + dragTexture.Width + 2), - new Vector2(x - 2, y + dragTexture.Width + 2), new Vector2(x - 2, y), + new Vector2(x - 1, y + 1), new Vector2(x - 1 + dragTexture.Width, y + 1), + new Vector2(x - 1 + dragTexture.Width, y + dragTexture.Width + 2), + new Vector2(x - 2, y + dragTexture.Width + 2), new Vector2(x - 2, y), }, MenuSettings.ContainerSeparatorColor); Line.End(); @@ -263,13 +435,17 @@ public override void OnWndProc(WindowsKeys args) { if (this.Component.Visible) { - if (args.Msg == WindowsMessages.MOUSEMOVE && this.dragging && !MenuCustomizer.Instance.LockPosition.Value) + if (args.Msg == WindowsMessages.MOUSEMOVE && this.dragging + && !MenuCustomizer.Instance.LockPosition.Value) { MenuSettings.Position = new Vector2(args.Cursor.X - this.xd, args.Cursor.Y - this.yd); this.hasDragged = true; } - if (args.Cursor.IsUnderRectangle(this.Component.Position.X, this.Component.Position.Y, this.Component.MenuWidth, + if (args.Cursor.IsUnderRectangle( + this.Component.Position.X, + this.Component.Position.Y, + this.Component.MenuWidth, MenuSettings.ContainerHeight)) { if (args.Msg == WindowsMessages.LBUTTONDOWN && this.Component.Root) @@ -299,74 +475,6 @@ public override void OnWndProc(WindowsKeys args) } } - /// - /// Draws a rounded Box. If Smoothing is true it will draw also a border. - /// - /// Position X - /// Position Y - /// Width - /// Height - /// Radius - /// Color - /// Border Color - public static void DrawBoxTopRounded(float x, float y, float w, float h, float radius, Color color, Color bcolor) - { - Utils.DrawBoxFilled(x + radius, y + radius, w - 2 * radius - 1, h - 2 * radius - 1, color); // Center rect. - Utils.DrawBoxFilled(x + radius, y + 1, w - 2 * radius - 1, radius - 1, color); // Top rect. - Utils.DrawBoxFilled(x + radius, y + h - radius - 1, w - 2 * radius - 1, radius, color); // Bottom rect. - Utils.DrawBoxFilled(x + 1, y + radius, radius - 1, h - 2 * radius - 1, color); // Left rect. - Utils.DrawBoxFilled(x + w - radius - 1, y + radius, radius, h - 2 * radius - 1, color); // Right rect. - - Utils.DrawCircleFilled(x + radius, y + radius, radius - 1, 0, Utils.CircleType.Quarter, true, 16, color); // Top-left corner - Utils.DrawCircleFilled(x + w - radius - 1, y + radius, radius - 1, 90, Utils.CircleType.Quarter, true, 16, color); // Top-right corner - Utils.DrawCircleFilled(x + w - radius - 1, y + h - radius - 1, radius - 1, 180, Utils.CircleType.Quarter, true, 16, color); // Bottom-right corner - Utils.DrawCircleFilled(x + radius, y + h - radius - 1, radius - 1, 270, Utils.CircleType.Quarter, true, 16, color); // Bottom-left corner - - Utils.DrawCircle(x + radius + 1, y + radius + 1, radius, 0, Utils.CircleType.Quarter, true, 16, bcolor); // Top-left corner - Utils.DrawCircle(x + w - radius - 1, y + radius + 1, radius, 90, Utils.CircleType.Quarter, true, 16, bcolor); // Top-right corner - Utils.DrawCircle(x + w - radius - 1, y + h - radius - 1, radius, 180, Utils.CircleType.Quarter, true, 16, bcolor); // Bottom-right corner - Utils.DrawCircle(x + radius + 1, y + h - radius - 1, radius, 270, Utils.CircleType.Quarter, true, 16, bcolor); // Bottom-left corner - - Utils.DrawLine(x + radius, y + 1, x + w - radius - 1, y + 1, 1, bcolor); // Top line - Utils.DrawLine(x + radius, y + h - 2, x + w - radius - 1, y + h - 2, 1, bcolor); // Bottom line - Utils.DrawLine(x + 1, y + radius, x + 1, y + h - radius - 1, 1, bcolor); // Left line - Utils.DrawLine(x + w - 2, y + radius, x + w - 2, y + h - radius - 1, 1, bcolor); // Right line - } - - /// - /// Draws a rounded Box. If Smoothing is true it will draw also a border. - /// - /// Position X - /// Position Y - /// Width - /// Height - /// Radius - /// Color - /// Border Color - public static void DrawBoxBotRounded(float x, float y, float w, float h, float radius, Color color, Color bcolor) - { - Utils.DrawBoxFilled(x + radius, y + radius, w - 2 * radius - 1, h - 2 * radius - 1, color); // Center rect. - Utils.DrawBoxFilled(x + radius, y + 1, w - 2 * radius - 1, radius - 1, color); // Top rect. - Utils.DrawBoxFilled(x + radius, y + h - radius - 1, w - 2 * radius - 1, radius, color); // Bottom rect. - Utils.DrawBoxFilled(x + 1, y + radius, radius - 1, h - 2 * radius - 1, color); // Left rect. - Utils.DrawBoxFilled(x + w - radius - 1, y + radius, radius, h - 2 * radius - 1, color); // Right rect. - - Utils.DrawCircleFilled(x + radius, y + radius, radius - 1, 0, Utils.CircleType.Quarter, true, 16, color); // Top-left corner - Utils.DrawCircleFilled(x + w - radius - 1, y + radius, radius - 1, 90, Utils.CircleType.Quarter, true, 16, color); // Top-right corner - Utils.DrawCircleFilled(x + w - radius - 1, y + h - radius - 1, radius - 1, 180, Utils.CircleType.Quarter, true, 16, color); // Bottom-right corner - Utils.DrawCircleFilled(x + radius, y + h - radius - 1, radius - 1, 270, Utils.CircleType.Quarter, true, 16, color); // Bottom-left corner - - Utils.DrawCircle(x + radius + 1, y + radius + 1, radius, 0, Utils.CircleType.Quarter, true, 16, bcolor); // Top-left corner - Utils.DrawCircle(x + w - radius - 1, y + radius + 1, radius, 90, Utils.CircleType.Quarter, true, 16, bcolor); // Top-right corner - Utils.DrawCircle(x + w - radius - 1, y + h - radius - 1, radius, 180, Utils.CircleType.Quarter, true, 16, bcolor); // Bottom-right corner - Utils.DrawCircle(x + radius + 1, y + h - radius - 1, radius, 270, Utils.CircleType.Quarter, true, 16, bcolor); // Bottom-left corner - - Utils.DrawLine(x + radius, y + 1, x + w - radius - 1, y + 1, 1, bcolor); // Top line - Utils.DrawLine(x + radius, y + h - 2, x + w - radius - 1, y + h - 2, 1, bcolor); // Bottom line - Utils.DrawLine(x + 1, y + radius, x + 1, y + h - radius - 1, 1, bcolor); // Left line - Utils.DrawLine(x + w - 2, y + radius, x + w - 2, y + h - radius - 1, 1, bcolor); // Right line - } - /// /// Calculates the Width of an AMenuComponent /// diff --git a/Core/UI/IMenu/Skins/Colored/ColoredMenuSettings.cs b/Core/UI/IMenu/Skins/Colored/ColoredMenuSettings.cs index 8e1c181..5755538 100644 --- a/Core/UI/IMenu/Skins/Colored/ColoredMenuSettings.cs +++ b/Core/UI/IMenu/Skins/Colored/ColoredMenuSettings.cs @@ -24,12 +24,6 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Colored { - using System.Collections.Generic; - using System.ComponentModel; - using System.Runtime.CompilerServices; - - using LeagueSharp.SDK.Core.UI.IMenu.Customizer; - using SharpDX; using SharpDX.Direct3D9; @@ -131,11 +125,6 @@ public static Font FontMenuSymbol } } - /// - /// Gets or sets the Global Text Caption Color. - /// - public static ColorBGRA TextCaptionColor { get; set; } - /// /// Gets or sets the Global KeyBind Color. /// @@ -146,6 +135,11 @@ public static Font FontMenuSymbol /// public static ColorBGRA SliderColor { get; set; } + /// + /// Gets or sets the Global Text Caption Color. + /// + public static ColorBGRA TextCaptionColor { get; set; } + #endregion #region Public Methods and Operators @@ -155,7 +149,6 @@ public static Font FontMenuSymbol /// public static void LoadSettings() { - } #endregion diff --git a/Core/UI/IMenu/Skins/Colored/ColoredSeparator.cs b/Core/UI/IMenu/Skins/Colored/ColoredSeparator.cs index bdd7a00..771ed2e 100644 --- a/Core/UI/IMenu/Skins/Colored/ColoredSeparator.cs +++ b/Core/UI/IMenu/Skins/Colored/ColoredSeparator.cs @@ -19,6 +19,7 @@ // Implements as a custom skin. // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Colored { using System; @@ -27,6 +28,7 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Colored using LeagueSharp.SDK.Core.Math; using LeagueSharp.SDK.Core.UI.IMenu.Values; using LeagueSharp.SDK.Core.Utils; + using SharpDX; using SharpDX.Direct3D9; @@ -35,7 +37,6 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Colored /// public class ColoredSeparator : ADrawable { - #region Static Fields /// @@ -99,16 +100,28 @@ public override void Draw() Line.Draw( new[] { - new Vector2(this.Component.Position.X + Offset, ColoredUtilities.GetContainerRectangle(this.Component).Center.Y), - new Vector2(Math.Max(this.Component.Position.X + Offset, centerY.X - 5), ColoredUtilities.GetContainerRectangle(this.Component).Center.Y) + new Vector2( + this.Component.Position.X + Offset, + ColoredUtilities.GetContainerRectangle(this.Component).Center.Y), + new Vector2( + Math.Max(this.Component.Position.X + Offset, centerY.X - 5), + ColoredUtilities.GetContainerRectangle(this.Component).Center.Y) }, MenuSettings.ContainerSelectedColor); - int newX = ColoredMenuSettings.FontCaption.MeasureText(MenuManager.Instance.Sprite, this.Component.DisplayName.ToUpper(), 0).Width; + var newX = + ColoredMenuSettings.FontCaption.MeasureText( + MenuManager.Instance.Sprite, + this.Component.DisplayName.ToUpper(), + 0).Width; Line.Draw( new[] { - new Vector2(centerY.X + newX + 5, ColoredUtilities.GetContainerRectangle(this.Component).Center.Y), - new Vector2(Math.Max(centerY.X + newX + 5, ColoredUtilities.GetContainerRectangle(this.Component).Right - Offset), ColoredUtilities.GetContainerRectangle(this.Component).Center.Y) + new Vector2(centerY.X + newX + 5, ColoredUtilities.GetContainerRectangle(this.Component).Center.Y), + new Vector2( + Math.Max( + centerY.X + newX + 5, + ColoredUtilities.GetContainerRectangle(this.Component).Right - Offset), + ColoredUtilities.GetContainerRectangle(this.Component).Center.Y) }, MenuSettings.ContainerSelectedColor); Line.End(); diff --git a/Core/UI/IMenu/Skins/Colored/ColoredSlider.cs b/Core/UI/IMenu/Skins/Colored/ColoredSlider.cs index 04f5961..c8930e0 100644 --- a/Core/UI/IMenu/Skins/Colored/ColoredSlider.cs +++ b/Core/UI/IMenu/Skins/Colored/ColoredSlider.cs @@ -19,6 +19,7 @@ // A custom implementation of an // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Colored { using System; @@ -128,20 +129,20 @@ public override void Draw() }); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, + MenuManager.Instance.Sprite, + this.Component.DisplayName, (int)(position.X + MenuSettings.ContainerTextOffset), (int)(position.Y + (centeredY - position.Y) / 2), MenuSettings.TextColor); var measureText = MenuSettings.Font.MeasureText( - null, - this.Component.Value.ToString(CultureInfo.InvariantCulture), + null, + this.Component.Value.ToString(CultureInfo.InvariantCulture), 0); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.Value.ToString(CultureInfo.InvariantCulture), - (int)(position.X + this.Component.MenuWidth - measureText.Width - Offset), + MenuManager.Instance.Sprite, + this.Component.Value.ToString(CultureInfo.InvariantCulture), + (int)(position.X + this.Component.MenuWidth - measureText.Width - Offset), (int)(position.Y + (centeredY - position.Y) / 2), MenuSettings.TextColor); diff --git a/Core/UI/IMenu/Skins/Colored/ColoredSliderButton.cs b/Core/UI/IMenu/Skins/Colored/ColoredSliderBool.cs similarity index 77% rename from Core/UI/IMenu/Skins/Colored/ColoredSliderButton.cs rename to Core/UI/IMenu/Skins/Colored/ColoredSliderBool.cs index d43c715..ff3a780 100644 --- a/Core/UI/IMenu/Skins/Colored/ColoredSliderButton.cs +++ b/Core/UI/IMenu/Skins/Colored/ColoredSliderBool.cs @@ -19,6 +19,7 @@ // A custom implementation of an // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Colored { using System; @@ -36,7 +37,7 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Colored /// /// A default implementation of an /// - public class ColoredSliderButton : ADrawable + public class ColoredSliderBool : ADrawable { #region Static Fields @@ -55,12 +56,12 @@ public class ColoredSliderButton : ADrawable #region Constructors and Destructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// The menu component /// - public ColoredSliderButton(MenuSliderButton component) + public ColoredSliderBool(MenuSliderBool component) : base(component) { } @@ -69,26 +70,12 @@ public ColoredSliderButton(MenuSliderButton component) #region Public Methods and Operators - /// - /// Returns the Rectangle that defines the Slider - /// - /// The - /// The - public Rectangle SliderBoundaries(MenuSliderButton component) - { - return new Rectangle( - (int)component.Position.X + Offset, - (int)component.Position.Y, - component.MenuWidth - MenuSettings.ContainerHeight - Offset, - MenuSettings.ContainerHeight); - } - /// /// Returns the Rectangle that defines the on/off Button /// - /// The + /// The /// The - public Rectangle ButtonBoundaries(MenuSliderButton component) + public Rectangle ButtonBoundaries(MenuSliderBool component) { return new Rectangle( (int)(component.Position.X + component.MenuWidth - MenuSettings.ContainerHeight * 1.2), @@ -118,9 +105,10 @@ public override void Draw() ColoredUtilities.GetContainerRectangle(this.Component) .GetCenteredText(null, MenuSettings.Font, this.Component.DisplayName, CenteredFlags.VerticalCenter) .Y; - var percent = (this.Component.SValue - this.Component.MinValue) - / (float)(this.Component.MaxValue - this.Component.MinValue); - var x = position.X + Offset + (percent * (this.Component.MenuWidth - Offset * 2 - MenuSettings.ContainerHeight)); + var percent = (this.Component.SliderValue - this.Component.SliderMinValue) + / (float)(this.Component.SliderMaxValue - this.Component.SliderMinValue); + var x = position.X + Offset + + (percent * (this.Component.MenuWidth - Offset * 2 - MenuSettings.ContainerHeight)); var maxX = position.X + Offset + ((this.Component.MenuWidth - Offset * 2 - MenuSettings.ContainerHeight)); MenuManager.Instance.DrawDelayed( @@ -138,20 +126,20 @@ public override void Draw() }); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, + MenuManager.Instance.Sprite, + this.Component.DisplayName, (int)(position.X + MenuSettings.ContainerTextOffset), (int)(position.Y + (centeredY - position.Y) / 2), MenuSettings.TextColor); var measureText = MenuSettings.Font.MeasureText( - null, - this.Component.SValue.ToString(CultureInfo.InvariantCulture), + null, + this.Component.SliderValue.ToString(CultureInfo.InvariantCulture), 0); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.SValue.ToString(CultureInfo.InvariantCulture), - (int)(position.X + this.Component.MenuWidth - measureText.Width - Offset - MenuSettings.ContainerHeight), + MenuManager.Instance.Sprite, + this.Component.SliderValue.ToString(CultureInfo.InvariantCulture), + (int)(position.X + this.Component.MenuWidth - measureText.Width - Offset - MenuSettings.ContainerHeight), (int)(position.Y + (centeredY - position.Y) / 2), MenuSettings.TextColor); @@ -188,14 +176,30 @@ public override void Draw() MenuSettings.ContainerHeight).GetCenteredText( null, MenuSettings.Font, - this.Component.BValue ? "On" : "Off", + this.Component.BoolValue ? "On" : "Off", CenteredFlags.HorizontalCenter).X - 5; //Left - Utils.DrawCircle(centerX, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, 7, 270, Utils.CircleType.Half, true, 32, MenuSettings.TextColor); + Utils.DrawCircle( + centerX, + this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, + 7, + 270, + Utils.CircleType.Half, + true, + 32, + MenuSettings.TextColor); //Right - Utils.DrawCircle(centerX + 15, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, 7, 90, Utils.CircleType.Half, true, 32, MenuSettings.TextColor); + Utils.DrawCircle( + centerX + 15, + this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, + 7, + 90, + Utils.CircleType.Half, + true, + 32, + MenuSettings.TextColor); //Top Line.Width = 1; @@ -222,9 +226,15 @@ public override void Draw() Line.End(); //FullCircle - Utils.DrawCircleFilled(this.Component.BValue ? centerX + 14 : centerX + 1, - this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, 6, 0, Utils.CircleType.Full, true, 32, - this.Component.BValue ? MenuSettings.ContainerSelectedColor : MenuSettings.TextColor); + Utils.DrawCircleFilled( + this.Component.BoolValue ? centerX + 14 : centerX + 1, + this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, + 6, + 0, + Utils.CircleType.Full, + true, + 32, + this.Component.BoolValue ? MenuSettings.ContainerSelectedColor : MenuSettings.TextColor); } /// @@ -248,7 +258,7 @@ public override void OnWndProc(WindowsKeys args) if (args.Cursor.IsUnderRectangle(rect.X, rect.Y, rect.Width, rect.Height)) { - this.Component.BValue = !this.Component.BValue; + this.Component.BoolValue = !this.Component.BoolValue; this.Component.FireEvent(); } @@ -269,6 +279,20 @@ public override void OnWndProc(WindowsKeys args) } } + /// + /// Returns the Rectangle that defines the Slider + /// + /// The + /// The + public Rectangle SliderBoundaries(MenuSliderBool component) + { + return new Rectangle( + (int)component.Position.X + Offset, + (int)component.Position.Y, + component.MenuWidth - MenuSettings.ContainerHeight - Offset, + MenuSettings.ContainerHeight); + } + /// /// Calculates the width of this component /// @@ -291,26 +315,27 @@ public override int Width() /// /// data /// - private void CalculateNewValue(MenuSliderButton component, WindowsKeys args) + private void CalculateNewValue(MenuSliderBool component, WindowsKeys args) { var newValue = (int) Math.Round( - component.MinValue - + ((args.Cursor.X - component.Position.X - Offset) * (component.MaxValue - component.MinValue)) + component.SliderMinValue + + ((args.Cursor.X - component.Position.X - Offset) + * (component.SliderMaxValue - component.SliderMinValue)) / (component.MenuWidth - Offset * 2 - MenuSettings.ContainerHeight)); - if (newValue < component.MinValue) + if (newValue < component.SliderMinValue) { - newValue = component.MinValue; + newValue = component.SliderMinValue; } - else if (newValue > component.MaxValue) + else if (newValue > component.SliderMaxValue) { - newValue = component.MaxValue; + newValue = component.SliderMaxValue; } - if (newValue != component.Value) + if (newValue != component.SliderValue) { - component.SValue = newValue; + component.SliderValue = newValue; component.FireEvent(); } } diff --git a/Core/UI/IMenu/Skins/Colored/ColoredTextures.cs b/Core/UI/IMenu/Skins/Colored/ColoredTextures.cs index 594bc6d..9b47033 100644 --- a/Core/UI/IMenu/Skins/Colored/ColoredTextures.cs +++ b/Core/UI/IMenu/Skins/Colored/ColoredTextures.cs @@ -19,19 +19,15 @@ // A custom implementation of // // -------------------------------------------------------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Colored { + using System.Collections.Generic; using System.Drawing; + using System.Linq; using LeagueSharp.SDK.Properties; - using SharpDX; using SharpDX.Direct3D9; internal enum ColoredTexture @@ -41,23 +37,38 @@ internal enum ColoredTexture internal class ColoredTextures { - - private readonly Dictionary textures = new Dictionary(); + #region Static Fields public static readonly ColoredTextures Instance = new ColoredTextures(); + #endregion + + #region Fields + + private readonly Dictionary textures = + new Dictionary(); + + #endregion + + #region Constructors and Destructors + private ColoredTextures() { - this.textures[ColoredTexture.Dragging] = BuildTexture(Resources.cursor_drag, 16, 16); + this.textures[ColoredTexture.Dragging] = this.BuildTexture(Resources.cursor_drag, 16, 16); } ~ColoredTextures() { - foreach (var entry in this.textures.Where(entry => !entry.Value.Texture.IsDisposed)) { + foreach (var entry in this.textures.Where(entry => !entry.Value.Texture.IsDisposed)) + { entry.Value.Texture.Dispose(); } } + #endregion + + #region Public Indexers + public ColoredTextureWrapper this[ColoredTexture textureType] { get @@ -66,10 +77,24 @@ public ColoredTextureWrapper this[ColoredTexture textureType] } } + #endregion + + #region Public Methods and Operators + + public ColoredTextureWrapper AddTexture(Image bmp, int width, int height, ColoredTexture textureType) + { + this.textures[textureType] = this.BuildTexture(bmp, height, width); + return this.textures[textureType]; + } + + #endregion + + #region Methods + private ColoredTextureWrapper BuildTexture(Image bmp, int height, int width) { var resized = new Bitmap(bmp, width, height); - var texture = Texture.FromMemory( + var texture = Texture.FromMemory( Drawing.Direct3DDevice, (byte[])new ImageConverter().ConvertTo(resized, typeof(byte[])), resized.Width, @@ -86,19 +111,12 @@ private ColoredTextureWrapper BuildTexture(Image bmp, int height, int width) return new ColoredTextureWrapper(texture, width, height); } - public ColoredTextureWrapper AddTexture(Image bmp, int width, int height, ColoredTexture textureType) - { - this.textures[textureType] = BuildTexture(bmp, height, width); - return this.textures[textureType]; - } - + #endregion } internal class ColoredTextureWrapper { - public Texture Texture { get; private set; } - public int Width { get; private set; } - public int Height { get; private set; } + #region Constructors and Destructors public ColoredTextureWrapper(Texture texture, int width, int height) { @@ -106,6 +124,17 @@ public ColoredTextureWrapper(Texture texture, int width, int height) this.Width = width; this.Height = height; } - + + #endregion + + #region Public Properties + + public int Height { get; private set; } + + public Texture Texture { get; private set; } + + public int Width { get; private set; } + + #endregion } -} +} \ No newline at end of file diff --git a/Core/UI/IMenu/Skins/Colored/ColoredTheme.cs b/Core/UI/IMenu/Skins/Colored/ColoredTheme.cs index 1f39d5d..a4fa322 100644 --- a/Core/UI/IMenu/Skins/Colored/ColoredTheme.cs +++ b/Core/UI/IMenu/Skins/Colored/ColoredTheme.cs @@ -19,6 +19,7 @@ // Implements a custom ITheme. // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Colored { using System.Linq; @@ -128,23 +129,23 @@ public ADrawable BuildSeparatorHandler(MenuSeparator component) } /// - /// Builds a new handler for the given . + /// Builds a new handler for the given . /// - /// The where this handler is responsible for. + /// The where this handler is responsible for. /// The handler - public ADrawable BuildSliderHandler(MenuSlider component) + public ADrawable BuildSliderBoolHandler(MenuSliderBool component) { - return new ColoredSlider(component); + return new ColoredSliderBool(component); } /// - /// Builds a new handler for the given . + /// Builds a new handler for the given . /// - /// The where this handler is responsible for. + /// The where this handler is responsible for. /// The handler - public ADrawable BuildSliderButtonHandler(MenuSliderButton component) + public ADrawable BuildSliderHandler(MenuSlider component) { - return new ColoredSliderButton(component); + return new ColoredSlider(component); } /// @@ -161,8 +162,15 @@ public void Draw() width = menuManager.Menus.First().MenuWidth; } - Utils.DrawBoxRounded(position.X, position.Y, width, height, 4, true, - MenuSettings.RootContainerColor, new ColorBGRA(55, 76, 95, 255)); + Utils.DrawBoxRounded( + position.X, + position.Y, + width, + height, + 4, + true, + MenuSettings.RootContainerColor, + new ColorBGRA(55, 76, 95, 255)); for (var i = 0; i < menuManager.Menus.Count; ++i) { diff --git a/Core/UI/IMenu/Skins/Colored/ColoredUtilities.cs b/Core/UI/IMenu/Skins/Colored/ColoredUtilities.cs index 72f682d..c655867 100644 --- a/Core/UI/IMenu/Skins/Colored/ColoredUtilities.cs +++ b/Core/UI/IMenu/Skins/Colored/ColoredUtilities.cs @@ -65,9 +65,9 @@ public static int CalcWidthText(string text) public static Rectangle GetContainerRectangle(AMenuComponent component) { return new Rectangle( - (int)component.Position.X, - (int)component.Position.Y, - component.MenuWidth, + (int)component.Position.X, + (int)component.Position.Y, + component.MenuWidth, MenuSettings.ContainerHeight); } diff --git a/Core/UI/IMenu/Skins/Default/DefaultBool.cs b/Core/UI/IMenu/Skins/Default/DefaultBool.cs index 3276f80..205d812 100644 --- a/Core/UI/IMenu/Skins/Default/DefaultBool.cs +++ b/Core/UI/IMenu/Skins/Default/DefaultBool.cs @@ -17,13 +17,14 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Default { - using Core.Utils; - using Enumerations; - using Extensions.SharpDX; - using Math; + using LeagueSharp.SDK.Core.Enumerations; + using LeagueSharp.SDK.Core.Extensions.SharpDX; + using LeagueSharp.SDK.Core.Math; + using LeagueSharp.SDK.Core.UI.IMenu.Values; + using LeagueSharp.SDK.Core.Utils; + using SharpDX; using SharpDX.Direct3D9; - using Values; /// /// A default implementation of a @@ -64,9 +65,9 @@ public DefaultBool(MenuBool component) public Rectangle ButtonBoundaries(MenuBool component) { return new Rectangle( - (int)(component.Position.X + component.MenuWidth - MenuSettings.ContainerHeight), - (int)component.Position.Y, - MenuSettings.ContainerHeight, + (int)(component.Position.X + component.MenuWidth - MenuSettings.ContainerHeight), + (int)component.Position.Y, + MenuSettings.ContainerHeight, MenuSettings.ContainerHeight); } @@ -90,10 +91,10 @@ public override void Draw() .Y; MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(this.Component.Position.X + MenuSettings.ContainerTextOffset), - centerY, + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(this.Component.Position.X + MenuSettings.ContainerTextOffset), + centerY, MenuSettings.TextColor); Line.Width = MenuSettings.ContainerHeight; @@ -103,32 +104,32 @@ public override void Draw() { new Vector2( (this.Component.Position.X + this.Component.MenuWidth - MenuSettings.ContainerHeight) - + (MenuSettings.ContainerHeight / 2f), - this.Component.Position.Y + 1), + + (MenuSettings.ContainerHeight / 2f), + this.Component.Position.Y + 1), new Vector2( (this.Component.Position.X + this.Component.MenuWidth - MenuSettings.ContainerHeight) - + (MenuSettings.ContainerHeight / 2f), + + (MenuSettings.ContainerHeight / 2f), this.Component.Position.Y + MenuSettings.ContainerHeight) - }, + }, this.Component.Value ? new ColorBGRA(0, 100, 0, 255) : new ColorBGRA(255, 0, 0, 255)); Line.End(); var centerX = (int) new Rectangle( - (int)(this.Component.Position.X + this.Component.MenuWidth - MenuSettings.ContainerHeight), - (int)this.Component.Position.Y, - MenuSettings.ContainerHeight, + (int)(this.Component.Position.X + this.Component.MenuWidth - MenuSettings.ContainerHeight), + (int)this.Component.Position.Y, + MenuSettings.ContainerHeight, MenuSettings.ContainerHeight).GetCenteredText( - null, - MenuSettings.Font, - this.Component.Value ? "ON" : "OFF", + null, + MenuSettings.Font, + this.Component.Value ? "ON" : "OFF", CenteredFlags.HorizontalCenter).X; MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.Value ? "ON" : "OFF", - centerX, - centerY, + MenuManager.Instance.Sprite, + this.Component.Value ? "ON" : "OFF", + centerX, + centerY, MenuSettings.TextColor); } diff --git a/Core/UI/IMenu/Skins/Default/DefaultButton.cs b/Core/UI/IMenu/Skins/Default/DefaultButton.cs index 48e0021..5c74e65 100644 --- a/Core/UI/IMenu/Skins/Default/DefaultButton.cs +++ b/Core/UI/IMenu/Skins/Default/DefaultButton.cs @@ -17,13 +17,14 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Default { - using Core.Utils; - using Enumerations; - using Extensions.SharpDX; - using Math; + using LeagueSharp.SDK.Core.Enumerations; + using LeagueSharp.SDK.Core.Extensions.SharpDX; + using LeagueSharp.SDK.Core.Math; + using LeagueSharp.SDK.Core.UI.IMenu.Values; + using LeagueSharp.SDK.Core.Utils; + using SharpDX; using SharpDX.Direct3D9; - using Values; /// /// A default implementation of @@ -91,9 +92,9 @@ public Rectangle ButtonBoundaries(MenuButton component) var buttonTextWidth = MenuSettings.Font.MeasureText(MenuManager.Instance.Sprite, component.ButtonText, 0).Width; return new Rectangle( - (int)(component.Position.X + component.MenuWidth - buttonTextWidth - (2 * TextGap)), - (int)component.Position.Y, - (2 * TextGap) + buttonTextWidth, + (int)(component.Position.X + component.MenuWidth - buttonTextWidth - (2 * TextGap)), + (int)component.Position.Y, + (2 * TextGap) + buttonTextWidth, MenuSettings.ContainerHeight); } @@ -114,10 +115,10 @@ public override void Draw() .GetCenteredText(null, MenuSettings.Font, this.Component.DisplayName, CenteredFlags.VerticalCenter); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(this.Component.Position.X + MenuSettings.ContainerTextOffset), - (int)rectangleName.Y, + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(this.Component.Position.X + MenuSettings.ContainerTextOffset), + (int)rectangleName.Y, MenuSettings.TextColor); var buttonTextWidth = @@ -129,12 +130,12 @@ public override void Draw() new[] { new Vector2( - this.Component.Position.X + this.Component.MenuWidth - buttonTextWidth - (2 * TextGap), - this.Component.Position.Y + (MenuSettings.ContainerHeight / 2f)), + this.Component.Position.X + this.Component.MenuWidth - buttonTextWidth - (2 * TextGap), + this.Component.Position.Y + (MenuSettings.ContainerHeight / 2f)), new Vector2( - this.Component.Position.X + this.Component.MenuWidth, - this.Component.Position.Y + (MenuSettings.ContainerHeight / 2f)), - }, + this.Component.Position.X + this.Component.MenuWidth, + this.Component.Position.Y + (MenuSettings.ContainerHeight / 2f)), + }, MenuSettings.HoverColor); Line.End(); Line.Width = MenuSettings.ContainerHeight - 5; @@ -143,20 +144,20 @@ public override void Draw() new[] { new Vector2( - this.Component.Position.X + this.Component.MenuWidth - buttonTextWidth - (2 * TextGap) + 2, - this.Component.Position.Y + (MenuSettings.ContainerHeight / 2f)), + this.Component.Position.X + this.Component.MenuWidth - buttonTextWidth - (2 * TextGap) + 2, + this.Component.Position.Y + (MenuSettings.ContainerHeight / 2f)), new Vector2( - this.Component.Position.X + this.Component.MenuWidth - 2, - this.Component.Position.Y + (MenuSettings.ContainerHeight / 2f)), - }, + this.Component.Position.X + this.Component.MenuWidth - 2, + this.Component.Position.Y + (MenuSettings.ContainerHeight / 2f)), + }, this.Component.Hovering ? this.buttonHoverColor : this.buttonColor); Line.End(); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.ButtonText, - (int)(this.Component.Position.X + this.Component.MenuWidth - buttonTextWidth - TextGap), - (int)rectangleName.Y, + MenuManager.Instance.Sprite, + this.Component.ButtonText, + (int)(this.Component.Position.X + this.Component.MenuWidth - buttonTextWidth - TextGap), + (int)rectangleName.Y, MenuSettings.TextColor); } diff --git a/Core/UI/IMenu/Skins/Default/DefaultColorPicker.cs b/Core/UI/IMenu/Skins/Default/DefaultColorPicker.cs index aa7a917..fdb13b3 100644 --- a/Core/UI/IMenu/Skins/Default/DefaultColorPicker.cs +++ b/Core/UI/IMenu/Skins/Default/DefaultColorPicker.cs @@ -17,14 +17,15 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Default { - using Abstracts; - using Core.Utils; - using Enumerations; - using Extensions.SharpDX; - using Math; + using LeagueSharp.SDK.Core.Enumerations; + using LeagueSharp.SDK.Core.Extensions.SharpDX; + using LeagueSharp.SDK.Core.Math; + using LeagueSharp.SDK.Core.UI.IMenu.Abstracts; + using LeagueSharp.SDK.Core.UI.IMenu.Values; + using LeagueSharp.SDK.Core.Utils; + using SharpDX; using SharpDX.Direct3D9; - using Values; /// /// A default implementation of an diff --git a/Core/UI/IMenu/Skins/Default/DefaultKeyBind.cs b/Core/UI/IMenu/Skins/Default/DefaultKeyBind.cs index 264afea..07fa44f 100644 --- a/Core/UI/IMenu/Skins/Default/DefaultKeyBind.cs +++ b/Core/UI/IMenu/Skins/Default/DefaultKeyBind.cs @@ -18,13 +18,15 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Default { using System.Windows.Forms; - using Core.Utils; - using Enumerations; - using Extensions.SharpDX; - using Math; + + using LeagueSharp.SDK.Core.Enumerations; + using LeagueSharp.SDK.Core.Extensions.SharpDX; + using LeagueSharp.SDK.Core.Math; + using LeagueSharp.SDK.Core.UI.IMenu.Values; + using LeagueSharp.SDK.Core.Utils; + using SharpDX; using SharpDX.Direct3D9; - using Values; /// /// A default implementation of diff --git a/Core/UI/IMenu/Skins/Default/DefaultList.cs b/Core/UI/IMenu/Skins/Default/DefaultList.cs index 7cf8104..44035ba 100644 --- a/Core/UI/IMenu/Skins/Default/DefaultList.cs +++ b/Core/UI/IMenu/Skins/Default/DefaultList.cs @@ -18,13 +18,15 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Default { using System.Collections.Generic; - using Core.Utils; - using Enumerations; - using Extensions.SharpDX; - using Math; + + using LeagueSharp.SDK.Core.Enumerations; + using LeagueSharp.SDK.Core.Extensions.SharpDX; + using LeagueSharp.SDK.Core.Math; + using LeagueSharp.SDK.Core.UI.IMenu.Values; + using LeagueSharp.SDK.Core.Utils; + using SharpDX; using SharpDX.Direct3D9; - using Values; /// /// A default implementation of a diff --git a/Core/UI/IMenu/Skins/Default/DefaultMenu.cs b/Core/UI/IMenu/Skins/Default/DefaultMenu.cs index d634399..aec828f 100644 --- a/Core/UI/IMenu/Skins/Default/DefaultMenu.cs +++ b/Core/UI/IMenu/Skins/Default/DefaultMenu.cs @@ -18,11 +18,13 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Default { using System.Linq; - using Core.Utils; - using Customizer; - using Enumerations; - using Extensions.SharpDX; - using Math; + + using LeagueSharp.SDK.Core.Enumerations; + using LeagueSharp.SDK.Core.Extensions.SharpDX; + using LeagueSharp.SDK.Core.Math; + using LeagueSharp.SDK.Core.UI.IMenu.Customizer; + using LeagueSharp.SDK.Core.Utils; + using SharpDX; using SharpDX.Direct3D9; diff --git a/Core/UI/IMenu/Skins/Default/DefaultSeparator.cs b/Core/UI/IMenu/Skins/Default/DefaultSeparator.cs index 1b6e727..f56e062 100644 --- a/Core/UI/IMenu/Skins/Default/DefaultSeparator.cs +++ b/Core/UI/IMenu/Skins/Default/DefaultSeparator.cs @@ -17,10 +17,10 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Default { - using Core.Utils; - using Enumerations; - using Math; - using Values; + using LeagueSharp.SDK.Core.Enumerations; + using LeagueSharp.SDK.Core.Math; + using LeagueSharp.SDK.Core.UI.IMenu.Values; + using LeagueSharp.SDK.Core.Utils; /// /// Implements as a default skin. @@ -59,16 +59,16 @@ public override void Draw() { var centerY = DefaultUtilities.GetContainerRectangle(this.Component) .GetCenteredText( - null, - MenuSettings.Font, - this.Component.DisplayName, + null, + MenuSettings.Font, + this.Component.DisplayName, CenteredFlags.VerticalCenter | CenteredFlags.HorizontalCenter); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)centerY.X, - (int)centerY.Y, + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)centerY.X, + (int)centerY.Y, MenuSettings.TextColor); } diff --git a/Core/UI/IMenu/Skins/Default/DefaultSlider.cs b/Core/UI/IMenu/Skins/Default/DefaultSlider.cs index e2d12c0..8d54338 100644 --- a/Core/UI/IMenu/Skins/Default/DefaultSlider.cs +++ b/Core/UI/IMenu/Skins/Default/DefaultSlider.cs @@ -19,13 +19,15 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Default { using System; using System.Globalization; - using Core.Utils; - using Enumerations; - using Extensions.SharpDX; - using Math; + + using LeagueSharp.SDK.Core.Enumerations; + using LeagueSharp.SDK.Core.Extensions.SharpDX; + using LeagueSharp.SDK.Core.Math; + using LeagueSharp.SDK.Core.UI.IMenu.Values; + using LeagueSharp.SDK.Core.Utils; + using SharpDX; using SharpDX.Direct3D9; - using Values; /// /// A default implementation of an @@ -104,26 +106,26 @@ public override void Draw() Line.Width = 2; Line.Begin(); Line.Draw( - new[] { new Vector2(x, position.Y + 1), new Vector2(x, position.Y + MenuSettings.ContainerHeight) }, + new[] { new Vector2(x, position.Y + 1), new Vector2(x, position.Y + MenuSettings.ContainerHeight) }, this.Component.Interacting ? new ColorBGRA(255, 0, 0, 255) : new ColorBGRA(50, 154, 205, 255)); Line.End(); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(position.X + MenuSettings.ContainerTextOffset), - centeredY, + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(position.X + MenuSettings.ContainerTextOffset), + centeredY, MenuSettings.TextColor); var measureText = MenuSettings.Font.MeasureText( - null, - this.Component.Value.ToString(CultureInfo.InvariantCulture), + null, + this.Component.Value.ToString(CultureInfo.InvariantCulture), 0); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.Value.ToString(CultureInfo.InvariantCulture), - (int)(position.X + this.Component.MenuWidth - 5 - measureText.Width), - centeredY, + MenuManager.Instance.Sprite, + this.Component.Value.ToString(CultureInfo.InvariantCulture), + (int)(position.X + this.Component.MenuWidth - 5 - measureText.Width), + centeredY, MenuSettings.TextColor); Line.Width = MenuSettings.ContainerHeight; @@ -131,9 +133,9 @@ public override void Draw() Line.Draw( new[] { - new Vector2(position.X, position.Y + (MenuSettings.ContainerHeight / 2f)), + new Vector2(position.X, position.Y + (MenuSettings.ContainerHeight / 2f)), new Vector2(x, position.Y + (MenuSettings.ContainerHeight / 2f)) - }, + }, MenuSettings.HoverColor); Line.End(); } @@ -198,7 +200,7 @@ private void CalculateNewValue(MenuSlider component, WindowsKeys args) Math.Round( component.MinValue + (((args.Cursor.X - component.Position.X) * (component.MaxValue - component.MinValue)) - / component.MenuWidth)); + / component.MenuWidth)); if (newValue < component.MinValue) { newValue = component.MinValue; diff --git a/Core/UI/IMenu/Skins/Default/DefaultSliderButton.cs b/Core/UI/IMenu/Skins/Default/DefaultSliderBool.cs similarity index 77% rename from Core/UI/IMenu/Skins/Default/DefaultSliderButton.cs rename to Core/UI/IMenu/Skins/Default/DefaultSliderBool.cs index e42ec40..acdf55a 100644 --- a/Core/UI/IMenu/Skins/Default/DefaultSliderButton.cs +++ b/Core/UI/IMenu/Skins/Default/DefaultSliderBool.cs @@ -19,18 +19,20 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Default { using System; using System.Globalization; - using Core.Utils; - using Enumerations; - using Extensions.SharpDX; - using Math; + + using LeagueSharp.SDK.Core.Enumerations; + using LeagueSharp.SDK.Core.Extensions.SharpDX; + using LeagueSharp.SDK.Core.Math; + using LeagueSharp.SDK.Core.UI.IMenu.Values; + using LeagueSharp.SDK.Core.Utils; + using SharpDX; using SharpDX.Direct3D9; - using Values; /// /// A default implementation of an /// - public class DefaultSliderButton : ADrawable + public class DefaultSliderBool : ADrawable { #region Static Fields @@ -44,12 +46,12 @@ public class DefaultSliderButton : ADrawable #region Constructors and Destructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// The menu component /// - public DefaultSliderButton(MenuSliderButton component) + public DefaultSliderBool(MenuSliderBool component) : base(component) { } @@ -58,26 +60,12 @@ public DefaultSliderButton(MenuSliderButton component) #region Public Methods and Operators - /// - /// Returns the Rectangle that defines the Slider - /// - /// The - /// The - public Rectangle SliderBoundaries(MenuSliderButton component) - { - return new Rectangle( - (int)component.Position.X, - (int)component.Position.Y, - component.MenuWidth - MenuSettings.ContainerHeight, - MenuSettings.ContainerHeight); - } - /// /// Returns the Rectangle that defines the on/off Button /// - /// The + /// The /// The - public Rectangle ButtonBoundaries(MenuSliderButton component) + public Rectangle ButtonBoundaries(MenuSliderBool component) { return new Rectangle( (int)(component.Position.X + component.MenuWidth - MenuSettings.ContainerHeight), @@ -95,7 +83,7 @@ public override void Dispose() } /// - /// Draws a + /// Draws a /// public override void Draw() { @@ -107,33 +95,33 @@ public override void Draw() DefaultUtilities.GetContainerRectangle(this.Component) .GetCenteredText(null, MenuSettings.Font, this.Component.DisplayName, CenteredFlags.VerticalCenter) .Y; - var percent = (this.Component.SValue - this.Component.MinValue) - / (float)(this.Component.MaxValue - this.Component.MinValue); + var percent = (this.Component.SliderValue - this.Component.SliderMinValue) + / (float)(this.Component.SliderMaxValue - this.Component.SliderMinValue); var x = position.X + (percent * (this.Component.MenuWidth - MenuSettings.ContainerHeight)); Line.Width = 2; Line.Begin(); Line.Draw( - new[] { new Vector2(x, position.Y + 1), new Vector2(x, position.Y + MenuSettings.ContainerHeight) }, + new[] { new Vector2(x, position.Y + 1), new Vector2(x, position.Y + MenuSettings.ContainerHeight) }, this.Component.Interacting ? new ColorBGRA(255, 0, 0, 255) : new ColorBGRA(50, 154, 205, 255)); Line.End(); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(position.X + MenuSettings.ContainerTextOffset), - centeredY, + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(position.X + MenuSettings.ContainerTextOffset), + centeredY, MenuSettings.TextColor); var measureText = MenuSettings.Font.MeasureText( - null, - this.Component.SValue.ToString(CultureInfo.InvariantCulture), + null, + this.Component.SliderValue.ToString(CultureInfo.InvariantCulture), 0); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.SValue.ToString(CultureInfo.InvariantCulture), - (int)(position.X + this.Component.MenuWidth - 5 - measureText.Width - MenuSettings.ContainerHeight), - centeredY, + MenuManager.Instance.Sprite, + this.Component.SliderValue.ToString(CultureInfo.InvariantCulture), + (int)(position.X + this.Component.MenuWidth - 5 - measureText.Width - MenuSettings.ContainerHeight), + centeredY, MenuSettings.TextColor); Line.Width = MenuSettings.ContainerHeight; @@ -141,9 +129,9 @@ public override void Draw() Line.Draw( new[] { - new Vector2(position.X, position.Y + (MenuSettings.ContainerHeight / 2f)), + new Vector2(position.X, position.Y + (MenuSettings.ContainerHeight / 2f)), new Vector2(x, position.Y + (MenuSettings.ContainerHeight / 2f)) - }, + }, MenuSettings.HoverColor); Line.End(); @@ -163,7 +151,7 @@ public override void Draw() + (MenuSettings.ContainerHeight / 2f), this.Component.Position.Y + MenuSettings.ContainerHeight) }, - this.Component.BValue ? new ColorBGRA(0, 100, 0, 255) : new ColorBGRA(255, 0, 0, 255)); + this.Component.BoolValue ? new ColorBGRA(0, 100, 0, 255) : new ColorBGRA(255, 0, 0, 255)); Line.End(); var centerX = @@ -175,11 +163,11 @@ public override void Draw() MenuSettings.ContainerHeight).GetCenteredText( null, MenuSettings.Font, - this.Component.BValue ? "ON" : "OFF", + this.Component.BoolValue ? "ON" : "OFF", CenteredFlags.HorizontalCenter).X; MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, - this.Component.BValue ? "ON" : "OFF", + this.Component.BoolValue ? "ON" : "OFF", centerX, centeredY, MenuSettings.TextColor); @@ -206,7 +194,7 @@ public override void OnWndProc(WindowsKeys args) if (args.Cursor.IsUnderRectangle(rect.X, rect.Y, rect.Width, rect.Height)) { - this.Component.BValue = !this.Component.BValue; + this.Component.BoolValue = !this.Component.BoolValue; this.Component.FireEvent(); } @@ -227,6 +215,20 @@ public override void OnWndProc(WindowsKeys args) } } + /// + /// Returns the Rectangle that defines the Slider + /// + /// The + /// The + public Rectangle SliderBoundaries(MenuSliderBool component) + { + return new Rectangle( + (int)component.Position.X, + (int)component.Position.Y, + component.MenuWidth - MenuSettings.ContainerHeight, + MenuSettings.ContainerHeight); + } + /// /// Calculates the width of this component /// @@ -249,26 +251,26 @@ public override int Width() /// /// data /// - private void CalculateNewValue(MenuSliderButton component, WindowsKeys args) + private void CalculateNewValue(MenuSliderBool component, WindowsKeys args) { var newValue = (int) Math.Round( - component.MinValue - + (((args.Cursor.X - component.Position.X) * (component.MaxValue - component.MinValue)) - / (component.MenuWidth - MenuSettings.ContainerHeight))); - if (newValue < component.MinValue) + component.SliderMinValue + + (((args.Cursor.X - component.Position.X) * (component.SliderMaxValue - component.SliderMinValue)) + / (component.MenuWidth - MenuSettings.ContainerHeight))); + if (newValue < component.SliderMinValue) { - newValue = component.MinValue; + newValue = component.SliderMinValue; } - else if (newValue > component.MaxValue) + else if (newValue > component.SliderMaxValue) { - newValue = component.MaxValue; + newValue = component.SliderMaxValue; } - if (newValue != component.Value) + if (newValue != component.SliderValue) { - component.SValue = newValue; + component.SliderValue = newValue; component.FireEvent(); } } diff --git a/Core/UI/IMenu/Skins/Default/DefaultTextures.cs b/Core/UI/IMenu/Skins/Default/DefaultTextures.cs index 5f49f02..efaeb91 100644 --- a/Core/UI/IMenu/Skins/Default/DefaultTextures.cs +++ b/Core/UI/IMenu/Skins/Default/DefaultTextures.cs @@ -21,7 +21,7 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Default using System.Drawing; using System.Linq; - using Properties; + using LeagueSharp.SDK.Properties; using SharpDX.Direct3D9; diff --git a/Core/UI/IMenu/Skins/Default/DefaultTheme.cs b/Core/UI/IMenu/Skins/Default/DefaultTheme.cs index 943c095..f7957e6 100644 --- a/Core/UI/IMenu/Skins/Default/DefaultTheme.cs +++ b/Core/UI/IMenu/Skins/Default/DefaultTheme.cs @@ -18,9 +18,11 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Default { using System.Linq; + + using LeagueSharp.SDK.Core.UI.IMenu.Values; + using SharpDX; using SharpDX.Direct3D9; - using Values; /// /// Implements a default ITheme. @@ -109,23 +111,23 @@ public ADrawable BuildSeparatorHandler(MenuSeparator component) } /// - /// Builds a new handler for the given . + /// Builds a new handler for the given . /// - /// The where this handler is responsible for. + /// The where this handler is responsible for. /// The handler - public ADrawable BuildSliderHandler(MenuSlider component) + public ADrawable BuildSliderBoolHandler(MenuSliderBool component) { - return new DefaultSlider(component); + return new DefaultSliderBool(component); } /// - /// Builds a new handler for the given . + /// Builds a new handler for the given . /// - /// The where this handler is responsible for. + /// The where this handler is responsible for. /// The handler - public ADrawable BuildSliderButtonHandler(MenuSliderButton component) + public ADrawable BuildSliderHandler(MenuSlider component) { - return new DefaultSliderButton(component); + return new DefaultSlider(component); } /// diff --git a/Core/UI/IMenu/Skins/Default/DefaultUtilities.cs b/Core/UI/IMenu/Skins/Default/DefaultUtilities.cs index 86292d7..f720e2e 100644 --- a/Core/UI/IMenu/Skins/Default/DefaultUtilities.cs +++ b/Core/UI/IMenu/Skins/Default/DefaultUtilities.cs @@ -17,7 +17,7 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Default { - using Abstracts; + using LeagueSharp.SDK.Core.UI.IMenu.Abstracts; using SharpDX; @@ -60,9 +60,9 @@ public static int CalcWidthText(string text) public static Rectangle GetContainerRectangle(AMenuComponent component) { return new Rectangle( - (int)component.Position.X, - (int)component.Position.Y, - component.MenuWidth, + (int)component.Position.X, + (int)component.Position.Y, + component.MenuWidth, MenuSettings.ContainerHeight); } diff --git a/Core/UI/IMenu/Skins/ITheme.cs b/Core/UI/IMenu/Skins/ITheme.cs index 601cc79..3c0697c 100644 --- a/Core/UI/IMenu/Skins/ITheme.cs +++ b/Core/UI/IMenu/Skins/ITheme.cs @@ -17,7 +17,7 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins { - using Values; + using LeagueSharp.SDK.Core.UI.IMenu.Values; /// /// Defines a Theme used to draw components of the menu. @@ -76,18 +76,18 @@ public interface ITheme ADrawable BuildSeparatorHandler(MenuSeparator component); /// - /// Builds a new handler for the given . + /// Builds a new handler for the given . /// - /// The where this handler is responsible for. + /// The where this handler is responsible for. /// The handler - ADrawable BuildSliderHandler(MenuSlider component); + ADrawable BuildSliderBoolHandler(MenuSliderBool component); /// /// Builds a new handler for the given . /// /// The where this handler is responsible for. /// The handler - ADrawable BuildSliderButtonHandler(MenuSliderButton component); + ADrawable BuildSliderHandler(MenuSlider component); /// /// Draws the list of root menus on the given position. diff --git a/Core/UI/IMenu/Skins/Light/LightBool.cs b/Core/UI/IMenu/Skins/Light/LightBool.cs index 2b1f602..f6058ed 100644 --- a/Core/UI/IMenu/Skins/Light/LightBool.cs +++ b/Core/UI/IMenu/Skins/Light/LightBool.cs @@ -19,6 +19,7 @@ // A custom implementation of a // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light { using LeagueSharp.SDK.Core.Enumerations; @@ -69,7 +70,7 @@ public LightBool(MenuBool component) public Rectangle ButtonBoundaries(MenuBool component) { return new Rectangle( - (int)(component.Position.X + component.MenuWidth - MenuSettings.ContainerHeight), + (int)(component.Position.X + component.MenuWidth - MenuSettings.ContainerHeight), (int)component.Position.Y, MenuSettings.ContainerHeight, MenuSettings.ContainerHeight); @@ -95,9 +96,9 @@ public override void Draw() .Y; MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(this.Component.Position.X + MenuSettings.ContainerTextOffset), + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(this.Component.Position.X + MenuSettings.ContainerTextOffset), centerY, MenuSettings.TextColor); @@ -108,31 +109,31 @@ public override void Draw() { new Vector2( (this.Component.Position.X + this.Component.MenuWidth - MenuSettings.ContainerHeight - 1) - + MenuSettings.ContainerHeight / 2f, - this.Component.Position.Y + 1 + 3), + + MenuSettings.ContainerHeight / 2f, + this.Component.Position.Y + 1 + 3), new Vector2( (this.Component.Position.X + this.Component.MenuWidth - MenuSettings.ContainerHeight - 1) - + MenuSettings.ContainerHeight / 2f, + + MenuSettings.ContainerHeight / 2f, this.Component.Position.Y + MenuSettings.ContainerHeight - 3) - }, + }, this.Component.Value ? new ColorBGRA(68, 160, 255, 255) : new ColorBGRA(151, 151, 151, 255)); Line.End(); var centerX = (int) new Rectangle( - (int)(this.Component.Position.X + this.Component.MenuWidth - MenuSettings.ContainerHeight), + (int)(this.Component.Position.X + this.Component.MenuWidth - MenuSettings.ContainerHeight), (int)this.Component.Position.Y, MenuSettings.ContainerHeight, MenuSettings.ContainerHeight).GetCenteredText( - null, - MenuSettings.Font, - this.Component.Value ? "On" : "Off", + null, + MenuSettings.Font, + this.Component.Value ? "On" : "Off", CenteredFlags.HorizontalCenter).X; MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.Value ? "On" : "Off", - centerX, + MenuManager.Instance.Sprite, + this.Component.Value ? "On" : "Off", + centerX, centerY, new ColorBGRA(221, 233, 255, 255)); } diff --git a/Core/UI/IMenu/Skins/Light/LightButton.cs b/Core/UI/IMenu/Skins/Light/LightButton.cs index 9c7ca82..656268f 100644 --- a/Core/UI/IMenu/Skins/Light/LightButton.cs +++ b/Core/UI/IMenu/Skins/Light/LightButton.cs @@ -19,6 +19,7 @@ // A custom implementation of // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light { using LeagueSharp.SDK.Core.Enumerations; @@ -96,8 +97,8 @@ public Rectangle ButtonBoundaries(MenuButton component) var buttonTextWidth = MenuSettings.Font.MeasureText(MenuManager.Instance.Sprite, component.ButtonText, 0).Width; return new Rectangle( - (int)(component.Position.X + component.MenuWidth - buttonTextWidth - (2 * TextGap)), - (int)component.Position.Y, + (int)(component.Position.X + component.MenuWidth - buttonTextWidth - (2 * TextGap)), + (int)component.Position.Y, (2 * TextGap) + buttonTextWidth, MenuSettings.ContainerHeight); } @@ -119,9 +120,9 @@ public override void Draw() .GetCenteredText(null, MenuSettings.Font, this.Component.DisplayName, CenteredFlags.VerticalCenter); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(this.Component.Position.X + MenuSettings.ContainerTextOffset), + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(this.Component.Position.X + MenuSettings.ContainerTextOffset), (int)rectangleName.Y, MenuSettings.TextColor); @@ -134,19 +135,19 @@ public override void Draw() new[] { new Vector2( - this.Component.Position.X + this.Component.MenuWidth - buttonTextWidth - (2 * TextGap) + 2, - this.Component.Position.Y + (MenuSettings.ContainerHeight / 2f)), + this.Component.Position.X + this.Component.MenuWidth - buttonTextWidth - (2 * TextGap) + 2, + this.Component.Position.Y + (MenuSettings.ContainerHeight / 2f)), new Vector2( - this.Component.Position.X + this.Component.MenuWidth - 2, - this.Component.Position.Y + (MenuSettings.ContainerHeight / 2f)), - }, + this.Component.Position.X + this.Component.MenuWidth - 2, + this.Component.Position.Y + (MenuSettings.ContainerHeight / 2f)), + }, this.Component.Hovering ? this.buttonHoverColor : this.buttonColor); Line.End(); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.ButtonText, - (int)(this.Component.Position.X + this.Component.MenuWidth - buttonTextWidth - TextGap), + MenuManager.Instance.Sprite, + this.Component.ButtonText, + (int)(this.Component.Position.X + this.Component.MenuWidth - buttonTextWidth - TextGap), (int)rectangleName.Y, new ColorBGRA(221, 233, 255, 255)); } diff --git a/Core/UI/IMenu/Skins/Light/LightColorPicker.cs b/Core/UI/IMenu/Skins/Light/LightColorPicker.cs index 3cb875f..c112cda 100644 --- a/Core/UI/IMenu/Skins/Light/LightColorPicker.cs +++ b/Core/UI/IMenu/Skins/Light/LightColorPicker.cs @@ -19,6 +19,7 @@ // A custom implementation of // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light { using System.Drawing; @@ -249,11 +250,11 @@ public override void Draw() new[] { new Vector2( - this.Component.Position.X + this.Component.MenuWidth - (Line.Width / 2f) - 4, - this.Component.Position.Y + 1 + 3), - new Vector2( - this.Component.Position.X + this.Component.MenuWidth - (Line.Width / 2f) - 4, - this.Component.Position.Y + Line.Width + 3) + this.Component.Position.X + this.Component.MenuWidth - (Line.Width / 2f) - 4, + this.Component.Position.Y + 1 + 3), + new Vector2( + this.Component.Position.X + this.Component.MenuWidth - (Line.Width / 2f) - 4, + this.Component.Position.Y + Line.Width + 3) }, MenuSettings.HoverColor); Line.End(); @@ -264,53 +265,58 @@ public override void Draw() MenuManager.Instance.DrawDelayed( delegate { - Line.Width = ColorPickerBoundaries().Width; + Line.Width = this.ColorPickerBoundaries().Width; Line.Begin(); Line.Draw( new[] { - new Vector2(ColorPickerBoundaries().X + 165, ColorPickerBoundaries().Y), + new Vector2(this.ColorPickerBoundaries().X + 165, this.ColorPickerBoundaries().Y), new Vector2( - ColorPickerBoundaries().X + 165, - ColorPickerBoundaries().Y + ColorPickerBoundaries().Height) + this.ColorPickerBoundaries().X + 165, + this.ColorPickerBoundaries().Y + this.ColorPickerBoundaries().Height) }, MenuSettings.RootContainerColor); Line.End(); - colorBox.DrawControl(new Vector2(ColorBoxBoundaries().X, ColorBoxBoundaries().Y)); - verticalColorSlider.DrawControl( - new Vector2(VerticalColorSliderBoundaries().X, VerticalColorSliderBoundaries().Y)); - verticalAlphaSlider.DrawControl( - new Vector2(VerticalAlphaSliderBoundaries().X, VerticalAlphaSliderBoundaries().Y)); + this.colorBox.DrawControl( + new Vector2(this.ColorBoxBoundaries().X, this.ColorBoxBoundaries().Y)); + this.verticalColorSlider.DrawControl( + new Vector2( + this.VerticalColorSliderBoundaries().X, + this.VerticalColorSliderBoundaries().Y)); + this.verticalAlphaSlider.DrawControl( + new Vector2( + this.VerticalAlphaSliderBoundaries().X, + this.VerticalAlphaSliderBoundaries().Y)); Utils.DrawBoxFilled( - PreviewBoundaries().X, - PreviewBoundaries().Y, - PreviewBoundaries().Width, - PreviewBoundaries().Height, + this.PreviewBoundaries().X, + this.PreviewBoundaries().Y, + this.PreviewBoundaries().Width, + this.PreviewBoundaries().Height, Color.Black); Utils.DrawBoxFilled( - PreviewBoundaries().X, - PreviewBoundaries().Y, - PreviewBoundaries().Width, - PreviewBoundaries().Height, - colorBox.Rgb.ToSharpDxColor()); + this.PreviewBoundaries().X, + this.PreviewBoundaries().Y, + this.PreviewBoundaries().Width, + this.PreviewBoundaries().Height, + this.colorBox.Rgb.ToSharpDxColor()); var applyButtonTextWidth = MenuSettings.Font.MeasureText(MenuManager.Instance.Sprite, "Apply", 0).Width; var cancelButtonTextWidth = MenuSettings.Font.MeasureText(MenuManager.Instance.Sprite, "Cancel", 0).Width; - Line.Width = ApplyButtonBoundaries().Width; + Line.Width = this.ApplyButtonBoundaries().Width; Line.Begin(); Line.Draw( new[] { - new Vector2(ApplyButtonBoundaries().X + 25, ApplyButtonBoundaries().Y), + new Vector2(this.ApplyButtonBoundaries().X + 25, this.ApplyButtonBoundaries().Y), new Vector2( - ApplyButtonBoundaries().X + 25, - ApplyButtonBoundaries().Y + ApplyButtonBoundaries().Height) + this.ApplyButtonBoundaries().X + 25, + this.ApplyButtonBoundaries().Y + this.ApplyButtonBoundaries().Height) }, new ColorBGRA(68, 160, 255, 255)); Line.End(); @@ -318,22 +324,22 @@ public override void Draw() MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, "Apply", - ApplyButtonBoundaries().X - applyButtonTextWidth / 2 + 25, + this.ApplyButtonBoundaries().X - applyButtonTextWidth / 2 + 25, (int) - CancelButtonBoundaries() + this.CancelButtonBoundaries() .GetCenteredText(null, MenuSettings.Font, "Apply", CenteredFlags.VerticalCenter) .Y, new ColorBGRA(221, 233, 255, 255)); - Line.Width = CancelButtonBoundaries().Width; + Line.Width = this.CancelButtonBoundaries().Width; Line.Begin(); Line.Draw( new[] { - new Vector2(CancelButtonBoundaries().X + 25, CancelButtonBoundaries().Y), + new Vector2(this.CancelButtonBoundaries().X + 25, this.CancelButtonBoundaries().Y), new Vector2( - CancelButtonBoundaries().X + 25, - CancelButtonBoundaries().Y + CancelButtonBoundaries().Height) + this.CancelButtonBoundaries().X + 25, + this.CancelButtonBoundaries().Y + this.CancelButtonBoundaries().Height) }, new ColorBGRA(68, 160, 255, 255)); Line.End(); @@ -341,9 +347,9 @@ public override void Draw() MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, "Cancel", - CancelButtonBoundaries().X - cancelButtonTextWidth / 2 + 25, + this.CancelButtonBoundaries().X - cancelButtonTextWidth / 2 + 25, (int) - CancelButtonBoundaries() + this.CancelButtonBoundaries() .GetCenteredText(null, MenuSettings.Font, "Cancel", CenteredFlags.VerticalCenter) .Y, new ColorBGRA(221, 233, 255, 255)); @@ -382,11 +388,11 @@ public override void OnWndProc(WindowsKeys args) } else if (this.InteractingVerticalColorSlider) { - this.verticalColorSlider.VerticalColorSlider_MouseMove(args); + this.verticalColorSlider.VerticalColorSliderMouseMove(args); } else if (this.InteractingVerticalAlphaSlider) { - this.verticalAlphaSlider.VerticalAlphaSlider_MouseMove(args); + this.verticalAlphaSlider.VerticalAlphaSliderMouseMove(args); } } } @@ -401,12 +407,12 @@ public override void OnWndProc(WindowsKeys args) if (this.InteractingVerticalColorSlider) { this.InteractingVerticalColorSlider = false; - this.verticalColorSlider.VerticalColorSlider_MouseUp(args); + this.verticalColorSlider.VerticalColorSliderMouseUp(args); } if (this.InteractingVerticalAlphaSlider) { this.InteractingVerticalAlphaSlider = false; - this.verticalAlphaSlider.VerticalAlphaSlider_MouseUp(args); + this.verticalAlphaSlider.VerticalAlphaSliderMouseUp(args); } } @@ -435,7 +441,7 @@ public override void OnWndProc(WindowsKeys args) this.VerticalColorSliderBoundaries().Height)) { this.InteractingVerticalColorSlider = true; - this.verticalColorSlider.VerticalColorSlider_MouseDown(args); + this.verticalColorSlider.VerticalColorSliderMouseDown(args); } else if (args.Cursor.IsUnderRectangle( this.VerticalAlphaSliderBoundaries().X, @@ -444,7 +450,7 @@ public override void OnWndProc(WindowsKeys args) this.VerticalAlphaSliderBoundaries().Height)) { this.InteractingVerticalAlphaSlider = true; - this.verticalAlphaSlider.VerticalAlphaSlider_MouseDown(args); + this.verticalAlphaSlider.VerticalAlphaSliderMouseDown(args); } else if (args.Cursor.IsUnderRectangle( this.ApplyButtonBoundaries().X, diff --git a/Core/UI/IMenu/Skins/Light/LightList.cs b/Core/UI/IMenu/Skins/Light/LightList.cs index d9e7352..3999fcf 100644 --- a/Core/UI/IMenu/Skins/Light/LightList.cs +++ b/Core/UI/IMenu/Skins/Light/LightList.cs @@ -19,6 +19,7 @@ // A custom implementation of a // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light { using System.Collections.Generic; @@ -107,24 +108,24 @@ public override void Draw() .GetCenteredText(null, MenuSettings.Font, this.Component.DisplayName, CenteredFlags.VerticalCenter); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(position.X + MenuSettings.ContainerTextOffset), + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(position.X + MenuSettings.ContainerTextOffset), (int)rectangleName.Y, MenuSettings.TextColor); MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, - "\u23EC", - (int)(position.X + this.Component.MenuWidth - this.dropDownButtonWidth + ArrowSpacing), + "\u23EC", + (int)(position.X + this.Component.MenuWidth - this.dropDownButtonWidth + ArrowSpacing), (int)rectangleName.Y, MenuSettings.TextColor); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.SelectedValueAsObject.ToString(), + MenuManager.Instance.Sprite, + this.Component.SelectedValueAsObject.ToString(), (int)position.X + this.Component.MenuWidth - this.dropDownButtonWidth - TextSpacing - - this.Component.MaxStringWidth, + - this.Component.MaxStringWidth, (int)rectangleName.Y, this.Component.Active ? new ColorBGRA(0, 186, 255, 255) : MenuSettings.TextColor); Line.Width = 1f; @@ -159,22 +160,23 @@ public override void Draw() new[] { new Vector2( - position.X + Component.MenuWidth - (Line.Width / 2), - position.Y + MenuSettings.ContainerHeight), + position.X + this.Component.MenuWidth - (Line.Width / 2), + position.Y + MenuSettings.ContainerHeight), new Vector2( - position.X + Component.MenuWidth - (Line.Width / 2), + position.X + this.Component.MenuWidth - (Line.Width / 2), position.Y + MenuSettings.ContainerHeight + dropdownMenuHeight) - }, dropdownColor); + }, + dropdownColor); Line.End(); var x = (int) - (position.X + Component.MenuWidth - dropDownButtonWidth - TextSpacing - - Component.MaxStringWidth); + (position.X + this.Component.MenuWidth - this.dropDownButtonWidth - TextSpacing + - this.Component.MaxStringWidth); var y = (int)rectangleName.Y; for (var i = 0; i < valueStrings.Length; i++) { - if (i == Component.HoveringIndex) + if (i == this.Component.HoveringIndex) { Line.Width = MenuSettings.ContainerHeight; Line.Begin(); @@ -182,11 +184,11 @@ public override void Draw() new[] { new Vector2( - position.X + Component.MenuWidth - dropdownMenuWidth, + position.X + this.Component.MenuWidth - dropdownMenuWidth, position.Y + ((i + 1) * MenuSettings.ContainerHeight) - + MenuSettings.ContainerHeight / 2f), + + MenuSettings.ContainerHeight / 2f), new Vector2( - position.X + Component.MenuWidth, + position.X + this.Component.MenuWidth, position.Y + ((i + 1) * MenuSettings.ContainerHeight) + MenuSettings.ContainerHeight / 2f) }, @@ -200,49 +202,49 @@ public override void Draw() new[] { new Vector2( - position.X + Component.MenuWidth - dropdownMenuWidth + 10, - position.Y + (MenuSettings.ContainerHeight * (i + 1))), + position.X + this.Component.MenuWidth - dropdownMenuWidth + 10, + position.Y + (MenuSettings.ContainerHeight * (i + 1))), new Vector2( - position.X + Component.MenuWidth - 10, + position.X + this.Component.MenuWidth - 10, position.Y + (MenuSettings.ContainerHeight * (i + 1))) }, MenuSettings.ContainerSeparatorColor); Line.End(); y += MenuSettings.ContainerHeight; MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - valueStrings[i], - x, + MenuManager.Instance.Sprite, + valueStrings[i], + x, y, MenuSettings.TextColor); - if (Component.Index == i) + if (this.Component.Index == i) { var checkmarkWidth = MenuSettings.Font.MeasureText(null, "\u2713", 0).Width; MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, - "\u2713", - (int)(position.X + Component.MenuWidth - checkmarkWidth - TextSpacing), + "\u2713", + (int)(position.X + this.Component.MenuWidth - checkmarkWidth - TextSpacing), y, new ColorBGRA(1, 165, 226, 255)); } } - Line.Width = 1f; - Line.Begin(); - Line.Draw( + Line.Width = 1f; + Line.Begin(); + Line.Draw( new[] { new Vector2( - position.X + Component.MenuWidth - dropdownMenuWidth, - position.Y + MenuSettings.ContainerHeight), + position.X + this.Component.MenuWidth - dropdownMenuWidth, + position.Y + MenuSettings.ContainerHeight), new Vector2( - position.X + Component.MenuWidth - dropdownMenuWidth, - position.Y + MenuSettings.ContainerHeight * (valueStrings.Length + 1)), + position.X + this.Component.MenuWidth - dropdownMenuWidth, + position.Y + MenuSettings.ContainerHeight * (valueStrings.Length + 1)), new Vector2( - position.X + Component.MenuWidth, - position.Y + MenuSettings.ContainerHeight * (valueStrings.Length + 1)), + position.X + this.Component.MenuWidth, + position.Y + MenuSettings.ContainerHeight * (valueStrings.Length + 1)), new Vector2( - position.X + Component.MenuWidth, + position.X + this.Component.MenuWidth, position.Y + MenuSettings.ContainerHeight) }, MenuSettings.ContainerSeparatorColor); @@ -262,8 +264,8 @@ public Rectangle DropDownBoundaries(MenuList component) new Rectangle( (int) (component.Position.X + component.MenuWidth - this.dropDownButtonWidth - (2 * TextSpacing) - - component.MaxStringWidth), - (int)component.Position.Y, + - component.MaxStringWidth), + (int)component.Position.Y, this.dropDownButtonWidth + (2 * TextSpacing) + component.MaxStringWidth, MenuSettings.ContainerHeight); } @@ -279,9 +281,9 @@ public Rectangle DropDownExpandedBoundaries(MenuList component) new Rectangle( (int) (component.Position.X + component.MenuWidth - this.dropDownButtonWidth - (2 * TextSpacing) - - component.MaxStringWidth), - (int)component.Position.Y, - this.dropDownButtonWidth + (2 * TextSpacing) + component.MaxStringWidth, + - component.MaxStringWidth), + (int)component.Position.Y, + this.dropDownButtonWidth + (2 * TextSpacing) + component.MaxStringWidth, (component.Count + 1) * MenuSettings.ContainerHeight); } @@ -299,8 +301,8 @@ public List DropDownListBoundaries(MenuList component) new Rectangle( (int) (component.Position.X + component.MenuWidth - this.dropDownButtonWidth - (2 * TextSpacing) - - component.MaxStringWidth), - (int)(component.Position.Y + ((i + 1) * MenuSettings.ContainerHeight)), + - component.MaxStringWidth), + (int)(component.Position.Y + ((i + 1) * MenuSettings.ContainerHeight)), this.dropDownButtonWidth + (2 * TextSpacing) + component.MaxStringWidth, MenuSettings.ContainerHeight + 1)); } @@ -339,9 +341,9 @@ public override void OnWndProc(WindowsKeys args) const int Buffer = 20; if (this.Component.Active && !args.Cursor.IsUnderRectangle( - entireDropdownRect.X - Buffer, - entireDropdownRect.Y - Buffer, - entireDropdownRect.Width + (2 * Buffer), + entireDropdownRect.X - Buffer, + entireDropdownRect.Y - Buffer, + entireDropdownRect.Width + (2 * Buffer), entireDropdownRect.Height + (2 * Buffer))) { this.Component.Active = false; @@ -354,9 +356,9 @@ public override void OnWndProc(WindowsKeys args) for (var i = 0; i < dropdownRectangles.Count; i++) { if (args.Cursor.IsUnderRectangle( - dropdownRectangles[i].X, - dropdownRectangles[i].Y, - dropdownRectangles[i].Width, + dropdownRectangles[i].X, + dropdownRectangles[i].Y, + dropdownRectangles[i].Width, dropdownRectangles[i].Height)) { this.Component.HoveringIndex = i; diff --git a/Core/UI/IMenu/Skins/Light/LightMenu.cs b/Core/UI/IMenu/Skins/Light/LightMenu.cs index c25a080..84f66ee 100644 --- a/Core/UI/IMenu/Skins/Light/LightMenu.cs +++ b/Core/UI/IMenu/Skins/Light/LightMenu.cs @@ -19,10 +19,9 @@ // Provides a custom implementation of // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light { - using System; - using System.Drawing; using System.Linq; using LeagueSharp.SDK.Core.Enumerations; @@ -30,22 +29,15 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light using LeagueSharp.SDK.Core.Math; using LeagueSharp.SDK.Core.UI.IMenu.Customizer; using LeagueSharp.SDK.Core.Utils; - using LeagueSharp.SDK.Properties; using SharpDX; using SharpDX.Direct3D9; - using Color = SharpDX.Color; - /// /// Provides a default implementation of /// public class LightMenu : ADrawable { - #region Constants - - #endregion - #region Static Fields /// @@ -56,7 +48,7 @@ public class LightMenu : ADrawable #endregion #region Fields - + /// /// Gets or sets a value indicating whether the user is dragging the menu. /// @@ -98,7 +90,6 @@ public class LightMenu : ADrawable public LightMenu(Menu component) : base(component) { - } #endregion @@ -125,9 +116,9 @@ public override void Draw() Line.Draw( new[] { - new Vector2(position.X, position.Y + MenuSettings.ContainerHeight / 2f), + new Vector2(position.X, position.Y + MenuSettings.ContainerHeight / 2f), new Vector2( - position.X + this.Component.MenuWidth, + position.X + this.Component.MenuWidth, position.Y + MenuSettings.ContainerHeight / 2f) }, MenuSettings.HoverColor); @@ -156,7 +147,9 @@ public override void Draw() (position.X + this.Component.MenuWidth - MenuSettings.ContainerTextMarkWidth - MenuSettings.ContainerTextMarkOffset), centerY, - this.Component.Components.Count > 0 ? new ColorBGRA(237, 245, 254, 255) : MenuSettings.ContainerSeparatorColor); + this.Component.Components.Count > 0 + ? new ColorBGRA(237, 245, 254, 255) + : MenuSettings.ContainerSeparatorColor); } else { @@ -184,9 +177,9 @@ public override void Draw() Line.Draw( new[] { - new Vector2(position.X + this.Component.MenuWidth / 2f, position.Y), + new Vector2(position.X + this.Component.MenuWidth / 2f, position.Y), new Vector2( - position.X + this.Component.MenuWidth / 2f, + position.X + this.Component.MenuWidth / 2f, position.Y + MenuSettings.ContainerHeight) }, MenuSettings.ContainerSelectedColor); @@ -204,21 +197,19 @@ public override void Draw() Line.Draw( new[] { - new Vector2((position.X + this.Component.MenuWidth) + width / 2, position.Y), + new Vector2((position.X + this.Component.MenuWidth) + width / 2, position.Y), new Vector2((position.X + this.Component.MenuWidth) + width / 2, position.Y + height) }, MenuSettings.RootContainerColor); Line.End(); - - for (var i = 0; i < this.Component.Components.Count; ++i) { var childComponent = this.Component.Components.Values.ToList()[i]; if (childComponent != null) { var childPos = new Vector2( - position.X + this.Component.MenuWidth, + position.X + this.Component.MenuWidth, position.Y + i * MenuSettings.ContainerHeight); if (i < this.Component.Components.Count - 1) @@ -228,9 +219,9 @@ public override void Draw() Line.Draw( new[] { - new Vector2(childPos.X + 15, childPos.Y + MenuSettings.ContainerHeight), + new Vector2(childPos.X + 15, childPos.Y + MenuSettings.ContainerHeight), new Vector2( - childPos.X - 15 + childComponent.MenuWidth, + childPos.X - 15 + childComponent.MenuWidth, childPos.Y + MenuSettings.ContainerHeight) }, MenuSettings.ContainerSeparatorColor); @@ -248,33 +239,32 @@ public override void Draw() Line.Draw( new[] { - new Vector2(position.X + this.Component.MenuWidth, position.Y), + new Vector2(position.X + this.Component.MenuWidth, position.Y), new Vector2(position.X + this.Component.MenuWidth + width, position.Y) }, contourColor); Line.Draw( new[] { - new Vector2(position.X + this.Component.MenuWidth, position.Y + height), + new Vector2(position.X + this.Component.MenuWidth, position.Y + height), new Vector2(position.X + this.Component.MenuWidth + width, position.Y + height) }, contourColor); Line.Draw( new[] { - new Vector2(position.X + this.Component.MenuWidth, position.Y), + new Vector2(position.X + this.Component.MenuWidth, position.Y), new Vector2(position.X + this.Component.MenuWidth, position.Y + height) }, contourColor); Line.Draw( new[] { - new Vector2(position.X + this.Component.MenuWidth + width, position.Y), + new Vector2(position.X + this.Component.MenuWidth + width, position.Y), new Vector2(position.X + this.Component.MenuWidth + width, position.Y + height) }, contourColor); Line.End(); - } if (this.hasDragged && !MenuCustomizer.Instance.LockPosition.Value) @@ -294,9 +284,9 @@ public override void Draw() Line.Draw( new[] { - new Vector2(x - 1, y + 1), new Vector2(x - 1 + dragTexture.Width, y + 1), - new Vector2(x - 1 + dragTexture.Width, y + dragTexture.Width + 2), - new Vector2(x - 2, y + dragTexture.Width + 2), new Vector2(x - 2, y), + new Vector2(x - 1, y + 1), new Vector2(x - 1 + dragTexture.Width, y + 1), + new Vector2(x - 1 + dragTexture.Width, y + dragTexture.Width + 2), + new Vector2(x - 2, y + dragTexture.Width + 2), new Vector2(x - 2, y), }, MenuSettings.ContainerSeparatorColor); Line.End(); @@ -313,13 +303,17 @@ public override void OnWndProc(WindowsKeys args) { if (this.Component.Visible) { - if (args.Msg == WindowsMessages.MOUSEMOVE && this.dragging && !MenuCustomizer.Instance.LockPosition.Value) + if (args.Msg == WindowsMessages.MOUSEMOVE && this.dragging + && !MenuCustomizer.Instance.LockPosition.Value) { MenuSettings.Position = new Vector2(args.Cursor.X - this.xd, args.Cursor.Y - this.yd); this.hasDragged = true; } - if (args.Cursor.IsUnderRectangle(this.Component.Position.X, this.Component.Position.Y, this.Component.MenuWidth, + if (args.Cursor.IsUnderRectangle( + this.Component.Position.X, + this.Component.Position.Y, + this.Component.MenuWidth, MenuSettings.ContainerHeight)) { if (args.Msg == WindowsMessages.LBUTTONDOWN && this.Component.Root) diff --git a/Core/UI/IMenu/Skins/Light/LightMenuSettings.cs b/Core/UI/IMenu/Skins/Light/LightMenuSettings.cs index f26bada..231e678 100644 --- a/Core/UI/IMenu/Skins/Light/LightMenuSettings.cs +++ b/Core/UI/IMenu/Skins/Light/LightMenuSettings.cs @@ -24,12 +24,6 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light { - using System.Collections.Generic; - using System.ComponentModel; - using System.Runtime.CompilerServices; - - using LeagueSharp.SDK.Core.UI.IMenu.Customizer; - using SharpDX; using SharpDX.Direct3D9; @@ -71,7 +65,7 @@ static LightMenuSettings() FontQuality.ClearType, FontPitchAndFamily.DontCare | FontPitchAndFamily.Decorative | FontPitchAndFamily.Modern, "Tahoma"); - + TextColor = new ColorBGRA(17, 17, 17, 255); TextCaptionColor = new ColorBGRA(72, 157, 248, 255); KeyBindColor = new ColorBGRA(67, 159, 255, 255); @@ -98,11 +92,6 @@ public static Font FontCaption } } - /// - /// Gets or sets the Global Text Caption Color. - /// - public static ColorBGRA TextCaptionColor { get; set; } - /// /// Gets or sets the Global KeyBind Color. /// @@ -113,6 +102,11 @@ public static Font FontCaption /// public static ColorBGRA SliderColor { get; set; } + /// + /// Gets or sets the Global Text Caption Color. + /// + public static ColorBGRA TextCaptionColor { get; set; } + #endregion #region Public Methods and Operators @@ -122,7 +116,6 @@ public static Font FontCaption /// public static void LoadSettings() { - } #endregion diff --git a/Core/UI/IMenu/Skins/Light/LightSeparator.cs b/Core/UI/IMenu/Skins/Light/LightSeparator.cs index 5f4d1c7..d500085 100644 --- a/Core/UI/IMenu/Skins/Light/LightSeparator.cs +++ b/Core/UI/IMenu/Skins/Light/LightSeparator.cs @@ -19,6 +19,7 @@ // Implements as a custom skin. // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light { using LeagueSharp.SDK.Core.Enumerations; diff --git a/Core/UI/IMenu/Skins/Light/LightSlider.cs b/Core/UI/IMenu/Skins/Light/LightSlider.cs index b6214ce..7f5b178 100644 --- a/Core/UI/IMenu/Skins/Light/LightSlider.cs +++ b/Core/UI/IMenu/Skins/Light/LightSlider.cs @@ -19,6 +19,7 @@ // A custom implementation of an // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light { using System; @@ -115,25 +116,25 @@ public override void Draw() Line.Width = 3; Line.Begin(); Line.Draw( - new[] { new Vector2(x, position.Y + 1), new Vector2(x, position.Y + MenuSettings.ContainerHeight) }, + new[] { new Vector2(x, position.Y + 1), new Vector2(x, position.Y + MenuSettings.ContainerHeight) }, this.Component.Interacting ? new ColorBGRA(90, 129, 144, 255) : new ColorBGRA(94, 170, 246, 255)); Line.End(); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(position.X + MenuSettings.ContainerTextOffset), + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(position.X + MenuSettings.ContainerTextOffset), centeredY, MenuSettings.TextColor); var measureText = MenuSettings.Font.MeasureText( - null, - this.Component.Value.ToString(CultureInfo.InvariantCulture), + null, + this.Component.Value.ToString(CultureInfo.InvariantCulture), 0); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.Value.ToString(CultureInfo.InvariantCulture), - (int)(position.X + this.Component.MenuWidth - 5 - measureText.Width), + MenuManager.Instance.Sprite, + this.Component.Value.ToString(CultureInfo.InvariantCulture), + (int)(position.X + this.Component.MenuWidth - 5 - measureText.Width), centeredY, MenuSettings.TextColor); diff --git a/Core/UI/IMenu/Skins/Light/LightSliderButton.cs b/Core/UI/IMenu/Skins/Light/LightSliderBool.cs similarity index 81% rename from Core/UI/IMenu/Skins/Light/LightSliderButton.cs rename to Core/UI/IMenu/Skins/Light/LightSliderBool.cs index 90425d6..6180f6a 100644 --- a/Core/UI/IMenu/Skins/Light/LightSliderButton.cs +++ b/Core/UI/IMenu/Skins/Light/LightSliderBool.cs @@ -19,6 +19,7 @@ // A custom implementation of an // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light { using System; @@ -36,7 +37,7 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light /// /// A default implementation of an /// - public class LightSliderButton : ADrawable + public class LightSliderBool : ADrawable { #region Static Fields @@ -55,12 +56,12 @@ public class LightSliderButton : ADrawable #region Constructors and Destructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// The menu component /// - public LightSliderButton(MenuSliderButton component) + public LightSliderBool(MenuSliderBool component) : base(component) { } @@ -69,26 +70,12 @@ public LightSliderButton(MenuSliderButton component) #region Public Methods and Operators - /// - /// Returns the Rectangle that defines the Slider - /// - /// The - /// The - public Rectangle SliderBoundaries(MenuSliderButton component) - { - return new Rectangle( - (int)component.Position.X + Offset, - (int)component.Position.Y, - component.MenuWidth - MenuSettings.ContainerHeight - Offset, - MenuSettings.ContainerHeight); - } - /// /// Returns the Rectangle that defines the on/off Button /// - /// The + /// The /// The - public Rectangle ButtonBoundaries(MenuSliderButton component) + public Rectangle ButtonBoundaries(MenuSliderBool component) { return new Rectangle( (int)(component.Position.X + component.MenuWidth - MenuSettings.ContainerHeight), @@ -106,7 +93,7 @@ public override void Dispose() } /// - /// Draws a + /// Draws a /// public override void Draw() { @@ -118,32 +105,33 @@ public override void Draw() LightUtilities.GetContainerRectangle(this.Component) .GetCenteredText(null, MenuSettings.Font, this.Component.DisplayName, CenteredFlags.VerticalCenter) .Y; - var percent = (this.Component.SValue - this.Component.MinValue) - / (float)(this.Component.MaxValue - this.Component.MinValue); - var x = position.X + Offset + (percent * (this.Component.MenuWidth - Offset * 2 - MenuSettings.ContainerHeight / 2)); + var percent = (this.Component.SliderValue - this.Component.SliderMinValue) + / (float)(this.Component.SliderMaxValue - this.Component.SliderMinValue); + var x = position.X + Offset + + (percent * (this.Component.MenuWidth - Offset * 2 - MenuSettings.ContainerHeight / 2)); Line.Width = 3; Line.Begin(); Line.Draw( - new[] { new Vector2(x, position.Y + 1), new Vector2(x, position.Y + MenuSettings.ContainerHeight) }, + new[] { new Vector2(x, position.Y + 1), new Vector2(x, position.Y + MenuSettings.ContainerHeight) }, this.Component.Interacting ? new ColorBGRA(90, 129, 144, 255) : new ColorBGRA(94, 170, 246, 255)); Line.End(); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(position.X + MenuSettings.ContainerTextOffset), + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(position.X + MenuSettings.ContainerTextOffset), centeredY, MenuSettings.TextColor); var measureText = MenuSettings.Font.MeasureText( - null, - this.Component.SValue.ToString(CultureInfo.InvariantCulture), + null, + this.Component.SliderValue.ToString(CultureInfo.InvariantCulture), 0); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.SValue.ToString(CultureInfo.InvariantCulture), - (int)(position.X + this.Component.MenuWidth - 5 - measureText.Width - MenuSettings.ContainerHeight), + MenuManager.Instance.Sprite, + this.Component.SliderValue.ToString(CultureInfo.InvariantCulture), + (int)(position.X + this.Component.MenuWidth - 5 - measureText.Width - MenuSettings.ContainerHeight), centeredY, MenuSettings.TextColor); @@ -174,7 +162,7 @@ public override void Draw() + MenuSettings.ContainerHeight / 2f, this.Component.Position.Y + MenuSettings.ContainerHeight - 3) }, - this.Component.BValue ? new ColorBGRA(68, 160, 255, 255) : new ColorBGRA(151, 151, 151, 255)); + this.Component.BoolValue ? new ColorBGRA(68, 160, 255, 255) : new ColorBGRA(151, 151, 151, 255)); Line.End(); var centerX = @@ -186,11 +174,11 @@ public override void Draw() MenuSettings.ContainerHeight).GetCenteredText( null, MenuSettings.Font, - this.Component.BValue ? "On" : "Off", + this.Component.BoolValue ? "On" : "Off", CenteredFlags.HorizontalCenter).X; MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, - this.Component.BValue ? "On" : "Off", + this.Component.BoolValue ? "On" : "Off", centerX, centeredY, new ColorBGRA(221, 233, 255, 255)); @@ -217,7 +205,7 @@ public override void OnWndProc(WindowsKeys args) if (args.Cursor.IsUnderRectangle(rect.X, rect.Y, rect.Width, rect.Height)) { - this.Component.BValue = !this.Component.BValue; + this.Component.BoolValue = !this.Component.BoolValue; this.Component.FireEvent(); } @@ -238,6 +226,20 @@ public override void OnWndProc(WindowsKeys args) } } + /// + /// Returns the Rectangle that defines the Slider + /// + /// The + /// The + public Rectangle SliderBoundaries(MenuSliderBool component) + { + return new Rectangle( + (int)component.Position.X + Offset, + (int)component.Position.Y, + component.MenuWidth - MenuSettings.ContainerHeight - Offset, + MenuSettings.ContainerHeight); + } + /// /// Calculates the width of this component /// @@ -260,26 +262,27 @@ public override int Width() /// /// data /// - private void CalculateNewValue(MenuSliderButton component, WindowsKeys args) + private void CalculateNewValue(MenuSliderBool component, WindowsKeys args) { var newValue = (int) Math.Round( - component.MinValue - + ((args.Cursor.X - component.Position.X - Offset) * (component.MaxValue - component.MinValue)) + component.SliderMinValue + + ((args.Cursor.X - component.Position.X - Offset) + * (component.SliderMaxValue - component.SliderMinValue)) / (component.MenuWidth - Offset * 2 - MenuSettings.ContainerHeight / 2)); - if (newValue < component.MinValue) + if (newValue < component.SliderMinValue) { - newValue = component.MinValue; + newValue = component.SliderMinValue; } - else if (newValue > component.MaxValue) + else if (newValue > component.SliderMaxValue) { - newValue = component.MaxValue; + newValue = component.SliderMaxValue; } - if (newValue != component.Value) + if (newValue != component.SliderValue) { - component.SValue = newValue; + component.SliderValue = newValue; component.FireEvent(); } } diff --git a/Core/UI/IMenu/Skins/Light/LightTextures.cs b/Core/UI/IMenu/Skins/Light/LightTextures.cs index 46fc38e..b59ccdf 100644 --- a/Core/UI/IMenu/Skins/Light/LightTextures.cs +++ b/Core/UI/IMenu/Skins/Light/LightTextures.cs @@ -19,19 +19,15 @@ // A custom implementation of // // -------------------------------------------------------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light { + using System.Collections.Generic; using System.Drawing; + using System.Linq; using LeagueSharp.SDK.Properties; - using SharpDX; using SharpDX.Direct3D9; internal enum LightTexture @@ -41,23 +37,38 @@ internal enum LightTexture internal class LightTextures { - - private readonly Dictionary textures = new Dictionary(); + #region Static Fields public static readonly LightTextures Instance = new LightTextures(); + #endregion + + #region Fields + + private readonly Dictionary textures = + new Dictionary(); + + #endregion + + #region Constructors and Destructors + private LightTextures() { - this.textures[LightTexture.Dragging] = BuildTexture(Resources.cursor_drag, 16, 16); + this.textures[LightTexture.Dragging] = this.BuildTexture(Resources.cursor_drag, 16, 16); } ~LightTextures() { - foreach (var entry in this.textures.Where(entry => !entry.Value.Texture.IsDisposed)) { + foreach (var entry in this.textures.Where(entry => !entry.Value.Texture.IsDisposed)) + { entry.Value.Texture.Dispose(); } } + #endregion + + #region Public Indexers + public BlueTextureWrapper this[LightTexture textureType] { get @@ -66,10 +77,24 @@ public BlueTextureWrapper this[LightTexture textureType] } } + #endregion + + #region Public Methods and Operators + + public BlueTextureWrapper AddTexture(Image bmp, int width, int height, LightTexture textureType) + { + this.textures[textureType] = this.BuildTexture(bmp, height, width); + return this.textures[textureType]; + } + + #endregion + + #region Methods + private BlueTextureWrapper BuildTexture(Image bmp, int height, int width) { var resized = new Bitmap(bmp, width, height); - var texture = Texture.FromMemory( + var texture = Texture.FromMemory( Drawing.Direct3DDevice, (byte[])new ImageConverter().ConvertTo(resized, typeof(byte[])), resized.Width, @@ -86,19 +111,12 @@ private BlueTextureWrapper BuildTexture(Image bmp, int height, int width) return new BlueTextureWrapper(texture, width, height); } - public BlueTextureWrapper AddTexture(Image bmp, int width, int height, LightTexture textureType) - { - this.textures[textureType] = BuildTexture(bmp, height, width); - return this.textures[textureType]; - } - + #endregion } internal class BlueTextureWrapper { - public Texture Texture { get; private set; } - public int Width { get; private set; } - public int Height { get; private set; } + #region Constructors and Destructors public BlueTextureWrapper(Texture texture, int width, int height) { @@ -106,6 +124,17 @@ public BlueTextureWrapper(Texture texture, int width, int height) this.Width = width; this.Height = height; } - + + #endregion + + #region Public Properties + + public int Height { get; private set; } + + public Texture Texture { get; private set; } + + public int Width { get; private set; } + + #endregion } -} +} \ No newline at end of file diff --git a/Core/UI/IMenu/Skins/Light/LightTheme.cs b/Core/UI/IMenu/Skins/Light/LightTheme.cs index df00d1d..bce1fc3 100644 --- a/Core/UI/IMenu/Skins/Light/LightTheme.cs +++ b/Core/UI/IMenu/Skins/Light/LightTheme.cs @@ -19,6 +19,7 @@ // Implements a custom ITheme. // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light { using System.Linq; @@ -128,23 +129,23 @@ public ADrawable BuildSeparatorHandler(MenuSeparator component) } /// - /// Builds a new handler for the given . + /// Builds a new handler for the given . /// - /// The where this handler is responsible for. + /// The where this handler is responsible for. /// The handler - public ADrawable BuildSliderHandler(MenuSlider component) + public ADrawable BuildSliderBoolHandler(MenuSliderBool component) { - return new LightSlider(component); + return new LightSliderBool(component); } /// - /// Builds a new handler for the given . + /// Builds a new handler for the given . /// - /// The where this handler is responsible for. + /// The where this handler is responsible for. /// The handler - public ADrawable BuildSliderButtonHandler(MenuSliderButton component) + public ADrawable BuildSliderHandler(MenuSlider component) { - return new LightSliderButton(component); + return new LightSlider(component); } /// @@ -166,7 +167,7 @@ public void Draw() Line.Draw( new[] { - new Vector2(position.X + (width / 2f), position.Y), + new Vector2(position.X + (width / 2f), position.Y), new Vector2(position.X + (width / 2), position.Y + height) }, MenuSettings.RootContainerColor); @@ -200,13 +201,12 @@ public void Draw() Line.Draw( new[] { - new Vector2(position.X, position.Y), new Vector2(position.X + width, position.Y), - new Vector2(position.X + width, position.Y + height), new Vector2(position.X, position.Y + height), + new Vector2(position.X, position.Y), new Vector2(position.X + width, position.Y), + new Vector2(position.X + width, position.Y + height), new Vector2(position.X, position.Y + height), new Vector2(position.X, position.Y) }, new ColorBGRA(254, 255, 255, 255)); Line.End(); - } #endregion diff --git a/Core/UI/IMenu/Skins/Light/LightUtilities.cs b/Core/UI/IMenu/Skins/Light/LightUtilities.cs index 44be311..f67095a 100644 --- a/Core/UI/IMenu/Skins/Light/LightUtilities.cs +++ b/Core/UI/IMenu/Skins/Light/LightUtilities.cs @@ -65,9 +65,9 @@ public static int CalcWidthText(string text) public static Rectangle GetContainerRectangle(AMenuComponent component) { return new Rectangle( - (int)component.Position.X, - (int)component.Position.Y, - component.MenuWidth, + (int)component.Position.X, + (int)component.Position.Y, + component.MenuWidth, MenuSettings.ContainerHeight); } diff --git a/Core/UI/IMenu/Skins/Light2/LightBool2.cs b/Core/UI/IMenu/Skins/Light2/LightBool2.cs index e97f878..4fbae95 100644 --- a/Core/UI/IMenu/Skins/Light2/LightBool2.cs +++ b/Core/UI/IMenu/Skins/Light2/LightBool2.cs @@ -19,16 +19,12 @@ // A custom implementation of a // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light2 { - using LeagueSharp.SDK.Core.Enumerations; - using LeagueSharp.SDK.Core.Extensions.SharpDX; - using LeagueSharp.SDK.Core.Math; using LeagueSharp.SDK.Core.UI.IMenu.Skins.Light; using LeagueSharp.SDK.Core.UI.IMenu.Values; - using LeagueSharp.SDK.Core.Utils; - using SharpDX; using SharpDX.Direct3D9; /// diff --git a/Core/UI/IMenu/Skins/Light2/LightButton2.cs b/Core/UI/IMenu/Skins/Light2/LightButton2.cs index de2c531..22f5b57 100644 --- a/Core/UI/IMenu/Skins/Light2/LightButton2.cs +++ b/Core/UI/IMenu/Skins/Light2/LightButton2.cs @@ -19,17 +19,11 @@ // A custom implementation of // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light2 { - using LeagueSharp.SDK.Core.Enumerations; - using LeagueSharp.SDK.Core.Extensions.SharpDX; - using LeagueSharp.SDK.Core.Math; using LeagueSharp.SDK.Core.UI.IMenu.Skins.Light; using LeagueSharp.SDK.Core.UI.IMenu.Values; - using LeagueSharp.SDK.Core.Utils; - - using SharpDX; - using SharpDX.Direct3D9; /// /// A default implementation of diff --git a/Core/UI/IMenu/Skins/Light2/LightColorPicker2.cs b/Core/UI/IMenu/Skins/Light2/LightColorPicker2.cs index e683ad8..c74c220 100644 --- a/Core/UI/IMenu/Skins/Light2/LightColorPicker2.cs +++ b/Core/UI/IMenu/Skins/Light2/LightColorPicker2.cs @@ -19,6 +19,7 @@ // A custom implementation of // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light2 { using System.Drawing; @@ -133,17 +134,17 @@ internal class LightColorPicker2 : LightColorPicker /// /// The ColorBox to display the color spectrum. /// - protected ColorBox colorBox; + protected ColorBox ColorBox; /// /// The VerticalAlphaSlider to change the opacity. /// - protected VerticalAlphaSlider verticalAlphaSlider; + protected VerticalAlphaSlider VerticalAlphaSlider; /// /// The VerticalColorSlider to change the color spectrum. /// - protected VerticalColorSlider verticalColorSlider; + protected VerticalColorSlider VerticalColorSlider; #endregion @@ -159,28 +160,28 @@ public LightColorPicker2(MenuColor component) : base(component) { Hsl tempHsl; - this.colorBox = new ColorBox(new Size(200, 200)) - { Hsl = Utilities.RgbToHsl(this.Component.Color.ToSystemColor()) }; + this.ColorBox = new ColorBox(new Size(200, 200)) + { Hsl = Utilities.RgbToHsl(this.Component.Color.ToSystemColor()) }; - this.verticalColorSlider = new VerticalColorSlider(new Size(40, 200)) - { CbHsl = Utilities.RgbToHsl(this.Component.Color.ToSystemColor()) }; - this.verticalColorSlider.ColorSliderScroll += () => - { - tempHsl = this.colorBox.Hsl; - tempHsl.H = this.verticalColorSlider.CbHsl.H; - this.colorBox.Hsl = tempHsl; - }; - - this.verticalAlphaSlider = new VerticalAlphaSlider(new Size(40, 200)); - tempHsl = this.verticalAlphaSlider.CbHsl; - tempHsl.L = this.colorBox.Hsl.L; - this.verticalAlphaSlider.CbHsl = tempHsl; - this.verticalAlphaSlider.AlphaSliderScroll += () => - { - tempHsl = this.colorBox.Hsl; - tempHsl.L = this.verticalAlphaSlider.CbHsl.L; - this.colorBox.Hsl = tempHsl; - }; + this.VerticalColorSlider = new VerticalColorSlider(new Size(40, 200)) + { CbHsl = Utilities.RgbToHsl(this.Component.Color.ToSystemColor()) }; + this.VerticalColorSlider.ColorSliderScroll += () => + { + tempHsl = this.ColorBox.Hsl; + tempHsl.H = this.VerticalColorSlider.CbHsl.H; + this.ColorBox.Hsl = tempHsl; + }; + + this.VerticalAlphaSlider = new VerticalAlphaSlider(new Size(40, 200)); + tempHsl = this.VerticalAlphaSlider.CbHsl; + tempHsl.L = this.ColorBox.Hsl.L; + this.VerticalAlphaSlider.CbHsl = tempHsl; + this.VerticalAlphaSlider.AlphaSliderScroll += () => + { + tempHsl = this.ColorBox.Hsl; + tempHsl.L = this.VerticalAlphaSlider.CbHsl.L; + this.ColorBox.Hsl = tempHsl; + }; } #endregion @@ -250,11 +251,11 @@ public override void Draw() new[] { new Vector2( - this.Component.Position.X + this.Component.MenuWidth - (Line.Width / 2f) - 4, - this.Component.Position.Y + 1 + 3), - new Vector2( - this.Component.Position.X + this.Component.MenuWidth - (Line.Width / 2f) - 4, - this.Component.Position.Y + Line.Width + 3) + this.Component.Position.X + this.Component.MenuWidth - (Line.Width / 2f) - 4, + this.Component.Position.Y + 1 + 3), + new Vector2( + this.Component.Position.X + this.Component.MenuWidth - (Line.Width / 2f) - 4, + this.Component.Position.Y + Line.Width + 3) }, MenuSettings.HoverColor); Line.End(); @@ -264,91 +265,96 @@ public override void Draw() { MenuManager.Instance.DrawDelayed( delegate - { - Line.Width = ColorPickerBoundaries().Width; - Line.Begin(); - Line.Draw( - new[] - { - new Vector2(ColorPickerBoundaries().X + 165, ColorPickerBoundaries().Y), + { + Line.Width = this.ColorPickerBoundaries().Width; + Line.Begin(); + Line.Draw( + new[] + { + new Vector2(this.ColorPickerBoundaries().X + 165, this.ColorPickerBoundaries().Y), new Vector2( - ColorPickerBoundaries().X + 165, - ColorPickerBoundaries().Y + ColorPickerBoundaries().Height) - }, - new ColorBGRA(254, 255, 255, 255)); - Line.End(); - - colorBox.DrawControl(new Vector2(ColorBoxBoundaries().X, ColorBoxBoundaries().Y)); - verticalColorSlider.DrawControl( - new Vector2(VerticalColorSliderBoundaries().X, VerticalColorSliderBoundaries().Y)); - verticalAlphaSlider.DrawControl( - new Vector2(VerticalAlphaSliderBoundaries().X, VerticalAlphaSliderBoundaries().Y)); - - Utils.DrawBoxFilled( - PreviewBoundaries().X, - PreviewBoundaries().Y, - PreviewBoundaries().Width, - PreviewBoundaries().Height, - Color.Black); - - Utils.DrawBoxFilled( - PreviewBoundaries().X, - PreviewBoundaries().Y, - PreviewBoundaries().Width, - PreviewBoundaries().Height, - colorBox.Rgb.ToSharpDxColor()); - - var applyButtonTextWidth = - MenuSettings.Font.MeasureText(MenuManager.Instance.Sprite, "Apply", 0).Width; - var cancelButtonTextWidth = - MenuSettings.Font.MeasureText(MenuManager.Instance.Sprite, "Cancel", 0).Width; - - Line.Width = ApplyButtonBoundaries().Width; - Line.Begin(); - Line.Draw( - new[] - { - new Vector2(ApplyButtonBoundaries().X + 25, ApplyButtonBoundaries().Y), + this.ColorPickerBoundaries().X + 165, + this.ColorPickerBoundaries().Y + this.ColorPickerBoundaries().Height) + }, + new ColorBGRA(254, 255, 255, 255)); + Line.End(); + + this.ColorBox.DrawControl( + new Vector2(this.ColorBoxBoundaries().X, this.ColorBoxBoundaries().Y)); + this.VerticalColorSlider.DrawControl( + new Vector2( + this.VerticalColorSliderBoundaries().X, + this.VerticalColorSliderBoundaries().Y)); + this.VerticalAlphaSlider.DrawControl( + new Vector2( + this.VerticalAlphaSliderBoundaries().X, + this.VerticalAlphaSliderBoundaries().Y)); + + Utils.DrawBoxFilled( + this.PreviewBoundaries().X, + this.PreviewBoundaries().Y, + this.PreviewBoundaries().Width, + this.PreviewBoundaries().Height, + Color.Black); + + Utils.DrawBoxFilled( + this.PreviewBoundaries().X, + this.PreviewBoundaries().Y, + this.PreviewBoundaries().Width, + this.PreviewBoundaries().Height, + this.ColorBox.Rgb.ToSharpDxColor()); + + var applyButtonTextWidth = + MenuSettings.Font.MeasureText(MenuManager.Instance.Sprite, "Apply", 0).Width; + var cancelButtonTextWidth = + MenuSettings.Font.MeasureText(MenuManager.Instance.Sprite, "Cancel", 0).Width; + + Line.Width = this.ApplyButtonBoundaries().Width; + Line.Begin(); + Line.Draw( + new[] + { + new Vector2(this.ApplyButtonBoundaries().X + 25, this.ApplyButtonBoundaries().Y), new Vector2( - ApplyButtonBoundaries().X + 25, - ApplyButtonBoundaries().Y + ApplyButtonBoundaries().Height) - }, - new ColorBGRA(68, 160, 255, 255)); - Line.End(); - - MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - "Apply", - ApplyButtonBoundaries().X - applyButtonTextWidth / 2 + 25, - (int) - CancelButtonBoundaries() - .GetCenteredText(null, MenuSettings.Font, "Apply", CenteredFlags.VerticalCenter) - .Y, - new ColorBGRA(221, 233, 255, 255)); - - Line.Width = CancelButtonBoundaries().Width; - Line.Begin(); - Line.Draw( - new[] - { - new Vector2(CancelButtonBoundaries().X + 25, CancelButtonBoundaries().Y), + this.ApplyButtonBoundaries().X + 25, + this.ApplyButtonBoundaries().Y + this.ApplyButtonBoundaries().Height) + }, + new ColorBGRA(68, 160, 255, 255)); + Line.End(); + + MenuSettings.Font.DrawText( + MenuManager.Instance.Sprite, + "Apply", + this.ApplyButtonBoundaries().X - applyButtonTextWidth / 2 + 25, + (int) + this.CancelButtonBoundaries() + .GetCenteredText(null, MenuSettings.Font, "Apply", CenteredFlags.VerticalCenter) + .Y, + new ColorBGRA(221, 233, 255, 255)); + + Line.Width = this.CancelButtonBoundaries().Width; + Line.Begin(); + Line.Draw( + new[] + { + new Vector2(this.CancelButtonBoundaries().X + 25, this.CancelButtonBoundaries().Y), new Vector2( - CancelButtonBoundaries().X + 25, - CancelButtonBoundaries().Y + CancelButtonBoundaries().Height) - }, - new ColorBGRA(68, 160, 255, 255)); - Line.End(); - - MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - "Cancel", - CancelButtonBoundaries().X - cancelButtonTextWidth / 2 + 25, - (int) - CancelButtonBoundaries() - .GetCenteredText(null, MenuSettings.Font, "Cancel", CenteredFlags.VerticalCenter) - .Y, - new ColorBGRA(221, 233, 255, 255)); - }); + this.CancelButtonBoundaries().X + 25, + this.CancelButtonBoundaries().Y + this.CancelButtonBoundaries().Height) + }, + new ColorBGRA(68, 160, 255, 255)); + Line.End(); + + MenuSettings.Font.DrawText( + MenuManager.Instance.Sprite, + "Cancel", + this.CancelButtonBoundaries().X - cancelButtonTextWidth / 2 + 25, + (int) + this.CancelButtonBoundaries() + .GetCenteredText(null, MenuSettings.Font, "Cancel", CenteredFlags.VerticalCenter) + .Y, + new ColorBGRA(221, 233, 255, 255)); + }); } } @@ -379,15 +385,15 @@ public override void OnWndProc(WindowsKeys args) { if (this.InteractingColorBox) { - this.colorBox.ColorBoxMouseMove(args); + this.ColorBox.ColorBoxMouseMove(args); } else if (this.InteractingVerticalColorSlider) { - this.verticalColorSlider.VerticalColorSlider_MouseMove(args); + this.VerticalColorSlider.VerticalColorSliderMouseMove(args); } else if (this.InteractingVerticalAlphaSlider) { - this.verticalAlphaSlider.VerticalAlphaSlider_MouseMove(args); + this.VerticalAlphaSlider.VerticalAlphaSliderMouseMove(args); } } } @@ -397,17 +403,17 @@ public override void OnWndProc(WindowsKeys args) if (this.InteractingColorBox) { this.InteractingColorBox = false; - this.colorBox.ColorBoxMouseUp(args); + this.ColorBox.ColorBoxMouseUp(args); } if (this.InteractingVerticalColorSlider) { this.InteractingVerticalColorSlider = false; - this.verticalColorSlider.VerticalColorSlider_MouseUp(args); + this.VerticalColorSlider.VerticalColorSliderMouseUp(args); } if (this.InteractingVerticalAlphaSlider) { this.InteractingVerticalAlphaSlider = false; - this.verticalAlphaSlider.VerticalAlphaSlider_MouseUp(args); + this.VerticalAlphaSlider.VerticalAlphaSliderMouseUp(args); } } @@ -427,7 +433,7 @@ public override void OnWndProc(WindowsKeys args) this.ColorBoxBoundaries().Height)) { this.InteractingColorBox = true; - this.colorBox.ColorBoxMouseDown(args); + this.ColorBox.ColorBoxMouseDown(args); } else if (args.Cursor.IsUnderRectangle( this.VerticalColorSliderBoundaries().X, @@ -436,7 +442,7 @@ public override void OnWndProc(WindowsKeys args) this.VerticalColorSliderBoundaries().Height)) { this.InteractingVerticalColorSlider = true; - this.verticalColorSlider.VerticalColorSlider_MouseDown(args); + this.VerticalColorSlider.VerticalColorSliderMouseDown(args); } else if (args.Cursor.IsUnderRectangle( this.VerticalAlphaSliderBoundaries().X, @@ -445,7 +451,7 @@ public override void OnWndProc(WindowsKeys args) this.VerticalAlphaSliderBoundaries().Height)) { this.InteractingVerticalAlphaSlider = true; - this.verticalAlphaSlider.VerticalAlphaSlider_MouseDown(args); + this.VerticalAlphaSlider.VerticalAlphaSliderMouseDown(args); } else if (args.Cursor.IsUnderRectangle( this.ApplyButtonBoundaries().X, @@ -454,7 +460,7 @@ public override void OnWndProc(WindowsKeys args) this.ApplyButtonBoundaries().Height)) { this.Component.Active = false; - this.Component.Color = this.colorBox.Rgb.ToSharpDxColor(); + this.Component.Color = this.ColorBox.Rgb.ToSharpDxColor(); } else if (args.Cursor.IsUnderRectangle( this.CancelButtonBoundaries().X, @@ -463,9 +469,9 @@ public override void OnWndProc(WindowsKeys args) this.CancelButtonBoundaries().Height)) { this.Component.Active = false; - this.colorBox.Rgb = this.Component.Color.ToSystemColor(); - this.verticalColorSlider.Rgb = this.Component.Color.ToSystemColor(); - this.verticalAlphaSlider.Rgb = this.Component.Color.ToSystemColor(); + this.ColorBox.Rgb = this.Component.Color.ToSystemColor(); + this.VerticalColorSlider.Rgb = this.Component.Color.ToSystemColor(); + this.VerticalAlphaSlider.Rgb = this.Component.Color.ToSystemColor(); } } else if (args.Cursor.IsUnderRectangle( diff --git a/Core/UI/IMenu/Skins/Light2/LightKeyBind2.cs b/Core/UI/IMenu/Skins/Light2/LightKeyBind2.cs index 32081e6..401fcc2 100644 --- a/Core/UI/IMenu/Skins/Light2/LightKeyBind2.cs +++ b/Core/UI/IMenu/Skins/Light2/LightKeyBind2.cs @@ -22,17 +22,8 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light2 { - using System.Windows.Forms; - - using LeagueSharp.SDK.Core.Enumerations; - using LeagueSharp.SDK.Core.Extensions.SharpDX; - using LeagueSharp.SDK.Core.Math; using LeagueSharp.SDK.Core.UI.IMenu.Skins.Light; using LeagueSharp.SDK.Core.UI.IMenu.Values; - using LeagueSharp.SDK.Core.Utils; - - using SharpDX; - using SharpDX.Direct3D9; /// /// A default implementation of diff --git a/Core/UI/IMenu/Skins/Light2/LightList2.cs b/Core/UI/IMenu/Skins/Light2/LightList2.cs index 2ea27ae..e4cb648 100644 --- a/Core/UI/IMenu/Skins/Light2/LightList2.cs +++ b/Core/UI/IMenu/Skins/Light2/LightList2.cs @@ -19,6 +19,7 @@ // A custom implementation of a // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light2 { using System.Collections.Generic; @@ -108,24 +109,24 @@ public override void Draw() .GetCenteredText(null, MenuSettings.Font, this.Component.DisplayName, CenteredFlags.VerticalCenter); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(position.X + MenuSettings.ContainerTextOffset), + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(position.X + MenuSettings.ContainerTextOffset), (int)rectangleName.Y, MenuSettings.TextColor); MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, - "\u23EC", - (int)(position.X + this.Component.MenuWidth - this.dropDownButtonWidth + ArrowSpacing), + "\u23EC", + (int)(position.X + this.Component.MenuWidth - this.dropDownButtonWidth + ArrowSpacing), (int)rectangleName.Y, MenuSettings.TextColor); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.SelectedValueAsObject.ToString(), + MenuManager.Instance.Sprite, + this.Component.SelectedValueAsObject.ToString(), (int)position.X + this.Component.MenuWidth - this.dropDownButtonWidth - TextSpacing - - this.Component.MaxStringWidth, + - this.Component.MaxStringWidth, (int)rectangleName.Y, this.Component.Active ? new ColorBGRA(0, 186, 255, 255) : MenuSettings.TextColor); Line.Width = 1f; @@ -160,22 +161,23 @@ public override void Draw() new[] { new Vector2( - position.X + Component.MenuWidth - (Line.Width / 2), - position.Y + MenuSettings.ContainerHeight), + position.X + this.Component.MenuWidth - (Line.Width / 2), + position.Y + MenuSettings.ContainerHeight), new Vector2( - position.X + Component.MenuWidth - (Line.Width / 2), + position.X + this.Component.MenuWidth - (Line.Width / 2), position.Y + MenuSettings.ContainerHeight + dropdownMenuHeight) - }, dropdownColor); + }, + dropdownColor); Line.End(); var x = (int) - (position.X + Component.MenuWidth - dropDownButtonWidth - TextSpacing - - Component.MaxStringWidth); + (position.X + this.Component.MenuWidth - this.dropDownButtonWidth - TextSpacing + - this.Component.MaxStringWidth); var y = (int)rectangleName.Y; for (var i = 0; i < valueStrings.Length; i++) { - if (i == Component.HoveringIndex) + if (i == this.Component.HoveringIndex) { Line.Width = MenuSettings.ContainerHeight; Line.Begin(); @@ -183,11 +185,11 @@ public override void Draw() new[] { new Vector2( - position.X + Component.MenuWidth - dropdownMenuWidth, + position.X + this.Component.MenuWidth - dropdownMenuWidth, position.Y + ((i + 1) * MenuSettings.ContainerHeight) - + MenuSettings.ContainerHeight / 2f), + + MenuSettings.ContainerHeight / 2f), new Vector2( - position.X + Component.MenuWidth, + position.X + this.Component.MenuWidth, position.Y + ((i + 1) * MenuSettings.ContainerHeight) + MenuSettings.ContainerHeight / 2f) }, @@ -201,49 +203,49 @@ public override void Draw() new[] { new Vector2( - position.X + Component.MenuWidth - dropdownMenuWidth + 10, - position.Y + (MenuSettings.ContainerHeight * (i + 1))), + position.X + this.Component.MenuWidth - dropdownMenuWidth + 10, + position.Y + (MenuSettings.ContainerHeight * (i + 1))), new Vector2( - position.X + Component.MenuWidth - 10, + position.X + this.Component.MenuWidth - 10, position.Y + (MenuSettings.ContainerHeight * (i + 1))) }, MenuSettings.ContainerSeparatorColor); Line.End(); y += MenuSettings.ContainerHeight; MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - valueStrings[i], - x, + MenuManager.Instance.Sprite, + valueStrings[i], + x, y, MenuSettings.TextColor); - if (Component.Index == i) + if (this.Component.Index == i) { var checkmarkWidth = MenuSettings.Font.MeasureText(null, "\u2713", 0).Width; MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, - "\u2713", - (int)(position.X + Component.MenuWidth - checkmarkWidth - TextSpacing), + "\u2713", + (int)(position.X + this.Component.MenuWidth - checkmarkWidth - TextSpacing), y, new ColorBGRA(1, 165, 226, 255)); } } - Line.Width = 1f; - Line.Begin(); - Line.Draw( + Line.Width = 1f; + Line.Begin(); + Line.Draw( new[] { new Vector2( - position.X + Component.MenuWidth - dropdownMenuWidth, - position.Y + MenuSettings.ContainerHeight), + position.X + this.Component.MenuWidth - dropdownMenuWidth, + position.Y + MenuSettings.ContainerHeight), new Vector2( - position.X + Component.MenuWidth - dropdownMenuWidth, - position.Y + MenuSettings.ContainerHeight * (valueStrings.Length + 1)), + position.X + this.Component.MenuWidth - dropdownMenuWidth, + position.Y + MenuSettings.ContainerHeight * (valueStrings.Length + 1)), new Vector2( - position.X + Component.MenuWidth, - position.Y + MenuSettings.ContainerHeight * (valueStrings.Length + 1)), + position.X + this.Component.MenuWidth, + position.Y + MenuSettings.ContainerHeight * (valueStrings.Length + 1)), new Vector2( - position.X + Component.MenuWidth, + position.X + this.Component.MenuWidth, position.Y + MenuSettings.ContainerHeight) }, MenuSettings.ContainerSeparatorColor); @@ -257,14 +259,14 @@ public override void Draw() /// /// The /// The - public Rectangle DropDownBoundaries(MenuList component) + public new Rectangle DropDownBoundaries(MenuList component) { return new Rectangle( (int) (component.Position.X + component.MenuWidth - this.dropDownButtonWidth - (2 * TextSpacing) - - component.MaxStringWidth), - (int)component.Position.Y, + - component.MaxStringWidth), + (int)component.Position.Y, this.dropDownButtonWidth + (2 * TextSpacing) + component.MaxStringWidth, MenuSettings.ContainerHeight); } @@ -273,16 +275,18 @@ public Rectangle DropDownBoundaries(MenuList component) /// Gets the complete dropdown boundaries /// /// The - /// The - public Rectangle DropDownExpandedBoundaries(MenuList component) + /// + /// The + /// + public new Rectangle DropDownExpandedBoundaries(MenuList component) { return new Rectangle( (int) (component.Position.X + component.MenuWidth - this.dropDownButtonWidth - (2 * TextSpacing) - - component.MaxStringWidth), - (int)component.Position.Y, - this.dropDownButtonWidth + (2 * TextSpacing) + component.MaxStringWidth, + - component.MaxStringWidth), + (int)component.Position.Y, + this.dropDownButtonWidth + (2 * TextSpacing) + component.MaxStringWidth, (component.Count + 1) * MenuSettings.ContainerHeight); } @@ -290,8 +294,10 @@ public Rectangle DropDownExpandedBoundaries(MenuList component) /// Gets the list of dropdown item boundaries. /// /// The - /// List of - public List DropDownListBoundaries(MenuList component) + /// + /// List of + /// + public new List DropDownListBoundaries(MenuList component) { var rectangles = new List(); for (var i = 0; i < component.Count; i++) @@ -300,8 +306,8 @@ public List DropDownListBoundaries(MenuList component) new Rectangle( (int) (component.Position.X + component.MenuWidth - this.dropDownButtonWidth - (2 * TextSpacing) - - component.MaxStringWidth), - (int)(component.Position.Y + ((i + 1) * MenuSettings.ContainerHeight)), + - component.MaxStringWidth), + (int)(component.Position.Y + ((i + 1) * MenuSettings.ContainerHeight)), this.dropDownButtonWidth + (2 * TextSpacing) + component.MaxStringWidth, MenuSettings.ContainerHeight + 1)); } @@ -340,9 +346,9 @@ public override void OnWndProc(WindowsKeys args) const int Buffer = 20; if (this.Component.Active && !args.Cursor.IsUnderRectangle( - entireDropdownRect.X - Buffer, - entireDropdownRect.Y - Buffer, - entireDropdownRect.Width + (2 * Buffer), + entireDropdownRect.X - Buffer, + entireDropdownRect.Y - Buffer, + entireDropdownRect.Width + (2 * Buffer), entireDropdownRect.Height + (2 * Buffer))) { this.Component.Active = false; @@ -355,9 +361,9 @@ public override void OnWndProc(WindowsKeys args) for (var i = 0; i < dropdownRectangles.Count; i++) { if (args.Cursor.IsUnderRectangle( - dropdownRectangles[i].X, - dropdownRectangles[i].Y, - dropdownRectangles[i].Width, + dropdownRectangles[i].X, + dropdownRectangles[i].Y, + dropdownRectangles[i].Width, dropdownRectangles[i].Height)) { this.Component.HoveringIndex = i; diff --git a/Core/UI/IMenu/Skins/Light2/LightMenu2.cs b/Core/UI/IMenu/Skins/Light2/LightMenu2.cs index 4c6ce68..a729a52 100644 --- a/Core/UI/IMenu/Skins/Light2/LightMenu2.cs +++ b/Core/UI/IMenu/Skins/Light2/LightMenu2.cs @@ -19,10 +19,9 @@ // Provides a custom implementation of // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light2 { - using System; - using System.Drawing; using System.Linq; using LeagueSharp.SDK.Core.Enumerations; @@ -31,22 +30,15 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light2 using LeagueSharp.SDK.Core.UI.IMenu.Customizer; using LeagueSharp.SDK.Core.UI.IMenu.Skins.Light; using LeagueSharp.SDK.Core.Utils; - using LeagueSharp.SDK.Properties; using SharpDX; using SharpDX.Direct3D9; - using Color = SharpDX.Color; - /// /// Provides a default implementation of /// public class LightMenu2 : LightMenu { - #region Constants - - #endregion - #region Static Fields /// @@ -57,7 +49,7 @@ public class LightMenu2 : LightMenu #endregion #region Fields - + /// /// Gets or sets a value indicating whether the user is dragging the menu. /// @@ -99,7 +91,6 @@ public class LightMenu2 : LightMenu public LightMenu2(Menu component) : base(component) { - } #endregion @@ -126,9 +117,9 @@ public override void Draw() Line.Draw( new[] { - new Vector2(position.X, position.Y + MenuSettings.ContainerHeight / 2f), + new Vector2(position.X, position.Y + MenuSettings.ContainerHeight / 2f), new Vector2( - position.X + this.Component.MenuWidth, + position.X + this.Component.MenuWidth, position.Y + MenuSettings.ContainerHeight / 2f) }, MenuSettings.HoverColor); @@ -157,7 +148,9 @@ public override void Draw() (position.X + this.Component.MenuWidth - MenuSettings.ContainerTextMarkWidth - MenuSettings.ContainerTextMarkOffset), centerY, - this.Component.Components.Count > 0 ? new ColorBGRA(237, 245, 254, 255) : MenuSettings.ContainerSeparatorColor); + this.Component.Components.Count > 0 + ? new ColorBGRA(237, 245, 254, 255) + : MenuSettings.ContainerSeparatorColor); } else { @@ -175,7 +168,9 @@ public override void Draw() (position.X + this.Component.MenuWidth - MenuSettings.ContainerTextMarkWidth - MenuSettings.ContainerTextMarkOffset), centerY, - this.Component.Components.Count > 0 ? new ColorBGRA(5, 151, 250, 255) : MenuSettings.ContainerSeparatorColor); + this.Component.Components.Count > 0 + ? new ColorBGRA(5, 151, 250, 255) + : MenuSettings.ContainerSeparatorColor); } if (this.Component.Toggled) @@ -185,9 +180,9 @@ public override void Draw() Line.Draw( new[] { - new Vector2(position.X + this.Component.MenuWidth / 2f, position.Y), + new Vector2(position.X + this.Component.MenuWidth / 2f, position.Y), new Vector2( - position.X + this.Component.MenuWidth / 2f, + position.X + this.Component.MenuWidth / 2f, position.Y + MenuSettings.ContainerHeight) }, MenuSettings.ContainerSelectedColor); @@ -205,21 +200,19 @@ public override void Draw() Line.Draw( new[] { - new Vector2((position.X + this.Component.MenuWidth) + width / 2, position.Y), + new Vector2((position.X + this.Component.MenuWidth) + width / 2, position.Y), new Vector2((position.X + this.Component.MenuWidth) + width / 2, position.Y + height) }, new ColorBGRA(255, 255, 255, 255)); Line.End(); - - for (var i = 0; i < this.Component.Components.Count; ++i) { var childComponent = this.Component.Components.Values.ToList()[i]; if (childComponent != null) { var childPos = new Vector2( - position.X + this.Component.MenuWidth, + position.X + this.Component.MenuWidth, position.Y + i * MenuSettings.ContainerHeight); childComponent.OnDraw(childPos); @@ -233,33 +226,32 @@ public override void Draw() Line.Draw( new[] { - new Vector2(position.X + this.Component.MenuWidth, position.Y), + new Vector2(position.X + this.Component.MenuWidth, position.Y), new Vector2(position.X + this.Component.MenuWidth + width, position.Y) }, contourColor); Line.Draw( new[] { - new Vector2(position.X + this.Component.MenuWidth, position.Y + height), + new Vector2(position.X + this.Component.MenuWidth, position.Y + height), new Vector2(position.X + this.Component.MenuWidth + width, position.Y + height) }, contourColor); Line.Draw( new[] { - new Vector2(position.X + this.Component.MenuWidth, position.Y), + new Vector2(position.X + this.Component.MenuWidth, position.Y), new Vector2(position.X + this.Component.MenuWidth, position.Y + height) }, contourColor); Line.Draw( new[] { - new Vector2(position.X + this.Component.MenuWidth + width, position.Y), + new Vector2(position.X + this.Component.MenuWidth + width, position.Y), new Vector2(position.X + this.Component.MenuWidth + width, position.Y + height) }, contourColor); Line.End(); - } if (this.hasDragged && !MenuCustomizer.Instance.LockPosition.Value) @@ -279,9 +271,9 @@ public override void Draw() Line.Draw( new[] { - new Vector2(x - 1, y + 1), new Vector2(x - 1 + dragTexture.Width, y + 1), - new Vector2(x - 1 + dragTexture.Width, y + dragTexture.Width + 2), - new Vector2(x - 2, y + dragTexture.Width + 2), new Vector2(x - 2, y), + new Vector2(x - 1, y + 1), new Vector2(x - 1 + dragTexture.Width, y + 1), + new Vector2(x - 1 + dragTexture.Width, y + dragTexture.Width + 2), + new Vector2(x - 2, y + dragTexture.Width + 2), new Vector2(x - 2, y), }, MenuSettings.ContainerSeparatorColor); Line.End(); @@ -298,13 +290,17 @@ public override void OnWndProc(WindowsKeys args) { if (this.Component.Visible) { - if (args.Msg == WindowsMessages.MOUSEMOVE && this.dragging && !MenuCustomizer.Instance.LockPosition.Value) + if (args.Msg == WindowsMessages.MOUSEMOVE && this.dragging + && !MenuCustomizer.Instance.LockPosition.Value) { MenuSettings.Position = new Vector2(args.Cursor.X - this.xd, args.Cursor.Y - this.yd); this.hasDragged = true; } - if (args.Cursor.IsUnderRectangle(this.Component.Position.X, this.Component.Position.Y, this.Component.MenuWidth, + if (args.Cursor.IsUnderRectangle( + this.Component.Position.X, + this.Component.Position.Y, + this.Component.MenuWidth, MenuSettings.ContainerHeight)) { if (args.Msg == WindowsMessages.LBUTTONDOWN && this.Component.Root) diff --git a/Core/UI/IMenu/Skins/Light2/LightMenuSettings2.cs b/Core/UI/IMenu/Skins/Light2/LightMenuSettings2.cs index 34ad325..12daff6 100644 --- a/Core/UI/IMenu/Skins/Light2/LightMenuSettings2.cs +++ b/Core/UI/IMenu/Skins/Light2/LightMenuSettings2.cs @@ -24,11 +24,6 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light2 { - using System.Collections.Generic; - using System.ComponentModel; - using System.Runtime.CompilerServices; - - using LeagueSharp.SDK.Core.UI.IMenu.Customizer; using LeagueSharp.SDK.Core.UI.IMenu.Skins.Light; using SharpDX; @@ -39,6 +34,15 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light2 /// public class LightMenuSettings2 : MenuSettings { + #region Static Fields + + /// + /// Local Caption Font. + /// + private static Font fontCaption; + + #endregion + #region Constructors and Destructors /// @@ -72,19 +76,6 @@ static LightMenuSettings2() #endregion - #region Static Fields - - /// - /// Local Caption Font. - /// - private static Font fontCaption; - - #endregion - - #region Constructors and Destructors - - #endregion - #region Public Properties /// @@ -103,11 +94,6 @@ public static Font FontCaption } } - /// - /// Gets or sets the Global Text Caption Color. - /// - public static ColorBGRA TextCaptionColor { get; set; } - /// /// Gets or sets the Global KeyBind Color. /// @@ -118,6 +104,11 @@ public static Font FontCaption /// public static ColorBGRA SliderColor { get; set; } + /// + /// Gets or sets the Global Text Caption Color. + /// + public static ColorBGRA TextCaptionColor { get; set; } + #endregion #region Public Methods and Operators @@ -131,6 +122,5 @@ public static void LoadSettings() } #endregion - } } \ No newline at end of file diff --git a/Core/UI/IMenu/Skins/Light2/LightSeparator2.cs b/Core/UI/IMenu/Skins/Light2/LightSeparator2.cs index 5a2dd31..446e1fd 100644 --- a/Core/UI/IMenu/Skins/Light2/LightSeparator2.cs +++ b/Core/UI/IMenu/Skins/Light2/LightSeparator2.cs @@ -19,13 +19,13 @@ // Implements as a custom skin. // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light2 { using LeagueSharp.SDK.Core.Enumerations; using LeagueSharp.SDK.Core.Math; using LeagueSharp.SDK.Core.UI.IMenu.Skins.Light; using LeagueSharp.SDK.Core.UI.IMenu.Values; - using LeagueSharp.SDK.Core.Utils; using SharpDX; @@ -59,14 +59,14 @@ public override void Draw() var centerY = LightUtilities.GetContainerRectangle(this.Component) .GetCenteredText( null, - LightMenuSettings.FontCaption, - this.Component.DisplayName.ToUpper(), + LightMenuSettings.FontCaption, + this.Component.DisplayName.ToUpper(), CenteredFlags.VerticalCenter | CenteredFlags.HorizontalCenter); LightMenuSettings.FontCaption.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName.ToUpper(), - (int)centerY.X, + MenuManager.Instance.Sprite, + this.Component.DisplayName.ToUpper(), + (int)centerY.X, (int)centerY.Y, new ColorBGRA(40, 40, 40, 255)); } diff --git a/Core/UI/IMenu/Skins/Light2/LightSlider2.cs b/Core/UI/IMenu/Skins/Light2/LightSlider2.cs index ebda316..bddba72 100644 --- a/Core/UI/IMenu/Skins/Light2/LightSlider2.cs +++ b/Core/UI/IMenu/Skins/Light2/LightSlider2.cs @@ -19,17 +19,15 @@ // A custom implementation of an // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light2 { - using System; using System.Globalization; using LeagueSharp.SDK.Core.Enumerations; - using LeagueSharp.SDK.Core.Extensions.SharpDX; using LeagueSharp.SDK.Core.Math; using LeagueSharp.SDK.Core.UI.IMenu.Skins.Light; using LeagueSharp.SDK.Core.UI.IMenu.Values; - using LeagueSharp.SDK.Core.Utils; using SharpDX; using SharpDX.Direct3D9; @@ -93,20 +91,20 @@ public override void Draw() Line.End(); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(position.X + MenuSettings.ContainerTextOffset), + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(position.X + MenuSettings.ContainerTextOffset), centeredY, MenuSettings.TextColor); var measureText = MenuSettings.Font.MeasureText( - null, - this.Component.Value.ToString(CultureInfo.InvariantCulture), + null, + this.Component.Value.ToString(CultureInfo.InvariantCulture), 0); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.Value.ToString(CultureInfo.InvariantCulture), - (int)(position.X + this.Component.MenuWidth - 5 - measureText.Width), + MenuManager.Instance.Sprite, + this.Component.Value.ToString(CultureInfo.InvariantCulture), + (int)(position.X + this.Component.MenuWidth - 5 - measureText.Width), centeredY, MenuSettings.TextColor); diff --git a/Core/UI/IMenu/Skins/Light2/LightSliderButton2.cs b/Core/UI/IMenu/Skins/Light2/LightSliderBool2.cs similarity index 81% rename from Core/UI/IMenu/Skins/Light2/LightSliderButton2.cs rename to Core/UI/IMenu/Skins/Light2/LightSliderBool2.cs index 3f2a7d3..93c8bc2 100644 --- a/Core/UI/IMenu/Skins/Light2/LightSliderButton2.cs +++ b/Core/UI/IMenu/Skins/Light2/LightSliderBool2.cs @@ -19,17 +19,15 @@ // A custom implementation of an // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light2 { - using System; using System.Globalization; using LeagueSharp.SDK.Core.Enumerations; - using LeagueSharp.SDK.Core.Extensions.SharpDX; using LeagueSharp.SDK.Core.Math; using LeagueSharp.SDK.Core.UI.IMenu.Skins.Light; using LeagueSharp.SDK.Core.UI.IMenu.Values; - using LeagueSharp.SDK.Core.Utils; using SharpDX; using SharpDX.Direct3D9; @@ -37,7 +35,7 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light2 /// /// A default implementation of an /// - public class LightSliderButton2 : LightSliderButton + public class LightSliderBool2 : LightSliderBool { #region Static Fields @@ -56,12 +54,12 @@ public class LightSliderButton2 : LightSliderButton #region Constructors and Destructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// The menu component /// - public LightSliderButton2(MenuSliderButton component) + public LightSliderBool2(MenuSliderBool component) : base(component) { } @@ -71,7 +69,7 @@ public LightSliderButton2(MenuSliderButton component) #region Public Methods and Operators /// - /// Draws a + /// Draws a /// public override void Draw() { @@ -83,9 +81,10 @@ public override void Draw() LightUtilities.GetContainerRectangle(this.Component) .GetCenteredText(null, MenuSettings.Font, this.Component.DisplayName, CenteredFlags.VerticalCenter) .Y; - var percent = (this.Component.SValue - this.Component.MinValue) - / (float)(this.Component.MaxValue - this.Component.MinValue); - var x = position.X + Offset + (percent * (this.Component.MenuWidth - Offset * 2 - MenuSettings.ContainerHeight / 2)); + var percent = (this.Component.SliderValue - this.Component.SliderMinValue) + / (float)(this.Component.SliderMaxValue - this.Component.SliderMinValue); + var x = position.X + Offset + + (percent * (this.Component.MenuWidth - Offset * 2 - MenuSettings.ContainerHeight / 2)); Line.Width = 3; Line.Begin(); @@ -95,20 +94,20 @@ public override void Draw() Line.End(); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(position.X + MenuSettings.ContainerTextOffset), + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(position.X + MenuSettings.ContainerTextOffset), centeredY, MenuSettings.TextColor); var measureText = MenuSettings.Font.MeasureText( - null, - this.Component.SValue.ToString(CultureInfo.InvariantCulture), + null, + this.Component.SliderValue.ToString(CultureInfo.InvariantCulture), 0); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.SValue.ToString(CultureInfo.InvariantCulture), - (int)(position.X + this.Component.MenuWidth - 5 - measureText.Width - MenuSettings.ContainerHeight), + MenuManager.Instance.Sprite, + this.Component.SliderValue.ToString(CultureInfo.InvariantCulture), + (int)(position.X + this.Component.MenuWidth - 5 - measureText.Width - MenuSettings.ContainerHeight), centeredY, MenuSettings.TextColor); @@ -139,7 +138,7 @@ public override void Draw() + MenuSettings.ContainerHeight / 2f, this.Component.Position.Y + MenuSettings.ContainerHeight - 3) }, - this.Component.BValue ? new ColorBGRA(68, 160, 255, 255) : new ColorBGRA(151, 151, 151, 255)); + this.Component.BoolValue ? new ColorBGRA(68, 160, 255, 255) : new ColorBGRA(151, 151, 151, 255)); Line.End(); var centerX = @@ -151,11 +150,11 @@ public override void Draw() MenuSettings.ContainerHeight).GetCenteredText( null, MenuSettings.Font, - this.Component.BValue ? "On" : "Off", + this.Component.BoolValue ? "On" : "Off", CenteredFlags.HorizontalCenter).X; MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, - this.Component.BValue ? "On" : "Off", + this.Component.BoolValue ? "On" : "Off", centerX, centeredY, new ColorBGRA(221, 233, 255, 255)); diff --git a/Core/UI/IMenu/Skins/Light2/LightTextures2.cs b/Core/UI/IMenu/Skins/Light2/LightTextures2.cs index 377f56c..26adcd9 100644 --- a/Core/UI/IMenu/Skins/Light2/LightTextures2.cs +++ b/Core/UI/IMenu/Skins/Light2/LightTextures2.cs @@ -20,19 +20,14 @@ // // -------------------------------------------------------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light2 { + using System.Collections.Generic; using System.Drawing; + using System.Linq; using LeagueSharp.SDK.Properties; - using SharpDX; using SharpDX.Direct3D9; internal enum LightTexture2 @@ -42,23 +37,38 @@ internal enum LightTexture2 internal class LightTextures2 { - - private readonly Dictionary textures = new Dictionary(); + #region Static Fields public static readonly LightTextures2 Instance = new LightTextures2(); + #endregion + + #region Fields + + private readonly Dictionary textures = + new Dictionary(); + + #endregion + + #region Constructors and Destructors + private LightTextures2() { - this.textures[LightTexture2.Dragging] = BuildTexture(Resources.cursor_drag, 16, 16); + this.textures[LightTexture2.Dragging] = this.BuildTexture(Resources.cursor_drag, 16, 16); } ~LightTextures2() { - foreach (var entry in this.textures.Where(entry => !entry.Value.Texture.IsDisposed)) { + foreach (var entry in this.textures.Where(entry => !entry.Value.Texture.IsDisposed)) + { entry.Value.Texture.Dispose(); } } + #endregion + + #region Public Indexers + public BlueTextureWrapper this[LightTexture2 textureType] { get @@ -67,10 +77,24 @@ public BlueTextureWrapper this[LightTexture2 textureType] } } + #endregion + + #region Public Methods and Operators + + public BlueTextureWrapper AddTexture(Image bmp, int width, int height, LightTexture2 textureType) + { + this.textures[textureType] = this.BuildTexture(bmp, height, width); + return this.textures[textureType]; + } + + #endregion + + #region Methods + private BlueTextureWrapper BuildTexture(Image bmp, int height, int width) { var resized = new Bitmap(bmp, width, height); - var texture = Texture.FromMemory( + var texture = Texture.FromMemory( Drawing.Direct3DDevice, (byte[])new ImageConverter().ConvertTo(resized, typeof(byte[])), resized.Width, @@ -87,19 +111,12 @@ private BlueTextureWrapper BuildTexture(Image bmp, int height, int width) return new BlueTextureWrapper(texture, width, height); } - public BlueTextureWrapper AddTexture(Image bmp, int width, int height, LightTexture2 textureType) - { - this.textures[textureType] = BuildTexture(bmp, height, width); - return this.textures[textureType]; - } - + #endregion } internal class BlueTextureWrapper { - public Texture Texture { get; private set; } - public int Width { get; private set; } - public int Height { get; private set; } + #region Constructors and Destructors public BlueTextureWrapper(Texture texture, int width, int height) { @@ -107,6 +124,17 @@ public BlueTextureWrapper(Texture texture, int width, int height) this.Width = width; this.Height = height; } - + + #endregion + + #region Public Properties + + public int Height { get; private set; } + + public Texture Texture { get; private set; } + + public int Width { get; private set; } + + #endregion } -} +} \ No newline at end of file diff --git a/Core/UI/IMenu/Skins/Light2/LightTheme2.cs b/Core/UI/IMenu/Skins/Light2/LightTheme2.cs index dffde31..111027f 100644 --- a/Core/UI/IMenu/Skins/Light2/LightTheme2.cs +++ b/Core/UI/IMenu/Skins/Light2/LightTheme2.cs @@ -19,6 +19,7 @@ // Implements a custom ITheme. // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Light2 { using System.Linq; @@ -128,23 +129,23 @@ public ADrawable BuildSeparatorHandler(MenuSeparator component) } /// - /// Builds a new handler for the given . + /// Builds a new handler for the given . /// - /// The where this handler is responsible for. + /// The where this handler is responsible for. /// The handler - public ADrawable BuildSliderHandler(MenuSlider component) + public ADrawable BuildSliderBoolHandler(MenuSliderBool component) { - return new LightSlider2(component); + return new LightSliderBool2(component); } /// - /// Builds a new handler for the given . + /// Builds a new handler for the given . /// - /// The where this handler is responsible for. + /// The where this handler is responsible for. /// The handler - public ADrawable BuildSliderButtonHandler(MenuSliderButton component) + public ADrawable BuildSliderHandler(MenuSlider component) { - return new LightSliderButton2(component); + return new LightSlider2(component); } /// @@ -166,7 +167,7 @@ public void Draw() Line.Draw( new[] { - new Vector2(position.X + (width / 2f), position.Y), + new Vector2(position.X + (width / 2f), position.Y), new Vector2(position.X + (width / 2), position.Y + height) }, MenuSettings.RootContainerColor); @@ -200,13 +201,12 @@ public void Draw() Line.Draw( new[] { - new Vector2(position.X, position.Y), new Vector2(position.X + width, position.Y), - new Vector2(position.X + width, position.Y + height), new Vector2(position.X, position.Y + height), + new Vector2(position.X, position.Y), new Vector2(position.X + width, position.Y), + new Vector2(position.X + width, position.Y + height), new Vector2(position.X, position.Y + height), new Vector2(position.X, position.Y) }, new ColorBGRA(254, 255, 255, 255)); Line.End(); - } #endregion diff --git a/Core/UI/IMenu/Skins/Light2/LightUtilities2.cs b/Core/UI/IMenu/Skins/Light2/LightUtilities2.cs index c002050..e028baa 100644 --- a/Core/UI/IMenu/Skins/Light2/LightUtilities2.cs +++ b/Core/UI/IMenu/Skins/Light2/LightUtilities2.cs @@ -65,9 +65,9 @@ public static int CalcWidthText(string text) public static Rectangle GetContainerRectangle(AMenuComponent component) { return new Rectangle( - (int)component.Position.X, - (int)component.Position.Y, - component.MenuWidth, + (int)component.Position.X, + (int)component.Position.Y, + component.MenuWidth, MenuSettings.ContainerHeight); } diff --git a/Core/UI/IMenu/Skins/MenuSettings.cs b/Core/UI/IMenu/Skins/MenuSettings.cs index bad6dd5..d0c42bd 100644 --- a/Core/UI/IMenu/Skins/MenuSettings.cs +++ b/Core/UI/IMenu/Skins/MenuSettings.cs @@ -19,11 +19,9 @@ // Default Skin Settings. // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins { - using System.Collections.Generic; - using System.ComponentModel; - using LeagueSharp.SDK.Core.UI.IMenu.Customizer; using SharpDX; @@ -40,7 +38,8 @@ public class MenuSettings /// Local Font. /// private static Font font; - + + private static Vector2 position; #endregion @@ -58,16 +57,16 @@ static MenuSettings() Position = new Vector2(30, 30); ContainerWidth = 200f; Font = new Font( - Drawing.Direct3DDevice, - 14, - 0, - FontWeight.DoNotCare, - 0, - false, + Drawing.Direct3DDevice, + 14, + 0, + FontWeight.DoNotCare, + 0, + false, FontCharacterSet.Default, FontPrecision.TrueType, FontQuality.ClearTypeNatural, - FontPitchAndFamily.DontCare | FontPitchAndFamily.Decorative | FontPitchAndFamily.Modern, + FontPitchAndFamily.DontCare | FontPitchAndFamily.Decorative | FontPitchAndFamily.Modern, "Tahoma"); ContainerTextMarkOffset = 8f; ContainerTextOffset = 15f; @@ -137,19 +136,17 @@ public static Font Font /// public static ColorBGRA HoverColor { get; set; } - private static Vector2 position; - /// /// Gets or sets the default menu zero-position. /// - public static Vector2 Position { + public static Vector2 Position + { get { return position; } set { - if (MenuCustomizer.Instance != null) { position = value; diff --git a/Core/UI/IMenu/Skins/Tech/TechBool.cs b/Core/UI/IMenu/Skins/Tech/TechBool.cs index 27cc905..b7ac2cf 100644 --- a/Core/UI/IMenu/Skins/Tech/TechBool.cs +++ b/Core/UI/IMenu/Skins/Tech/TechBool.cs @@ -19,6 +19,7 @@ // A custom implementation of a // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Tech { using LeagueSharp.SDK.Core.Enumerations; @@ -69,7 +70,7 @@ public TechBool(MenuBool component) public Rectangle ButtonBoundaries(MenuBool component) { return new Rectangle( - (int)(component.Position.X + component.MenuWidth - MenuSettings.ContainerHeight), + (int)(component.Position.X + component.MenuWidth - MenuSettings.ContainerHeight), (int)component.Position.Y, MenuSettings.ContainerHeight, MenuSettings.ContainerHeight); @@ -95,30 +96,44 @@ public override void Draw() .Y; MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(this.Component.Position.X + MenuSettings.ContainerTextOffset), + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(this.Component.Position.X + MenuSettings.ContainerTextOffset), centerY, MenuSettings.TextColor); var centerX = (int) new Rectangle( - (int)(this.Component.Position.X + this.Component.MenuWidth - MenuSettings.ContainerHeight), + (int)(this.Component.Position.X + this.Component.MenuWidth - MenuSettings.ContainerHeight), (int)this.Component.Position.Y, MenuSettings.ContainerHeight, MenuSettings.ContainerHeight).GetCenteredText( - null, - MenuSettings.Font, - this.Component.Value ? "On" : "Off", + null, + MenuSettings.Font, + this.Component.Value ? "On" : "Off", CenteredFlags.HorizontalCenter).X - 5; //Left - Utils.DrawCircle(centerX, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, 7, 270, Utils.CircleType.Half, true, 32, + Utils.DrawCircle( + centerX, + this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, + 7, + 270, + Utils.CircleType.Half, + true, + 32, this.Component.Value ? new Color(75, 215, 128, 255) : new Color(36, 204, 205, 255)); //Right - Utils.DrawCircle(centerX + 15, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, 7, 90, Utils.CircleType.Half, true, 32, + Utils.DrawCircle( + centerX + 15, + this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, + 7, + 90, + Utils.CircleType.Half, + true, + 32, this.Component.Value ? new Color(75, 215, 128, 255) : new Color(36, 204, 205, 255)); //Top @@ -146,8 +161,14 @@ public override void Draw() Line.End(); //FullCircle - Utils.DrawCircleFilled(this.Component.Value ? centerX + 14 : centerX + 1, - this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, 6, 0, Utils.CircleType.Full, true, 32, + Utils.DrawCircleFilled( + this.Component.Value ? centerX + 14 : centerX + 1, + this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, + 6, + 0, + Utils.CircleType.Full, + true, + 32, this.Component.Value ? new Color(73, 227, 139, 255) : new Color(17, 65, 65, 255)); } diff --git a/Core/UI/IMenu/Skins/Tech/TechButton.cs b/Core/UI/IMenu/Skins/Tech/TechButton.cs index f7e85cc..710a93a 100644 --- a/Core/UI/IMenu/Skins/Tech/TechButton.cs +++ b/Core/UI/IMenu/Skins/Tech/TechButton.cs @@ -19,6 +19,7 @@ // A custom implementation of // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Tech { using LeagueSharp.SDK.Core.Enumerations; @@ -96,8 +97,8 @@ public Rectangle ButtonBoundaries(MenuButton component) var buttonTextWidth = MenuSettings.Font.MeasureText(MenuManager.Instance.Sprite, component.ButtonText, 0).Width; return new Rectangle( - (int)(component.Position.X + component.MenuWidth - buttonTextWidth - (2 * TextGap)), - (int)component.Position.Y, + (int)(component.Position.X + component.MenuWidth - buttonTextWidth - (2 * TextGap)), + (int)component.Position.Y, (2 * TextGap) + buttonTextWidth, MenuSettings.ContainerHeight); } @@ -119,9 +120,9 @@ public override void Draw() .GetCenteredText(null, MenuSettings.Font, this.Component.DisplayName, CenteredFlags.VerticalCenter); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(this.Component.Position.X + MenuSettings.ContainerTextOffset), + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(this.Component.Position.X + MenuSettings.ContainerTextOffset), (int)rectangleName.Y, MenuSettings.TextColor); @@ -140,9 +141,9 @@ public override void Draw() this.Component.Hovering ? new ColorBGRA(17, 65, 65, 255) : this.buttonColor); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.ButtonText, - (int)(this.Component.Position.X + this.Component.MenuWidth - buttonTextWidth - TextGap), + MenuManager.Instance.Sprite, + this.Component.ButtonText, + (int)(this.Component.Position.X + this.Component.MenuWidth - buttonTextWidth - TextGap), (int)rectangleName.Y, MenuSettings.TextColor); } diff --git a/Core/UI/IMenu/Skins/Tech/TechColorPicker.cs b/Core/UI/IMenu/Skins/Tech/TechColorPicker.cs index cc1478b..98116de 100644 --- a/Core/UI/IMenu/Skins/Tech/TechColorPicker.cs +++ b/Core/UI/IMenu/Skins/Tech/TechColorPicker.cs @@ -19,6 +19,7 @@ // A custom implementation of // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Tech { using System.Drawing; @@ -249,11 +250,11 @@ public override void Draw() new[] { new Vector2( - this.Component.Position.X + this.Component.MenuWidth - (Line.Width / 2f) - 4, - this.Component.Position.Y + 1 + 3), - new Vector2( - this.Component.Position.X + this.Component.MenuWidth - (Line.Width / 2f) - 4, - this.Component.Position.Y + Line.Width + 3) + this.Component.Position.X + this.Component.MenuWidth - (Line.Width / 2f) - 4, + this.Component.Position.Y + 1 + 3), + new Vector2( + this.Component.Position.X + this.Component.MenuWidth - (Line.Width / 2f) - 4, + this.Component.Position.Y + Line.Width + 3) }, MenuSettings.HoverColor); Line.End(); @@ -264,53 +265,58 @@ public override void Draw() MenuManager.Instance.DrawDelayed( delegate { - Line.Width = ColorPickerBoundaries().Width; + Line.Width = this.ColorPickerBoundaries().Width; Line.Begin(); Line.Draw( new[] { - new Vector2(ColorPickerBoundaries().X + 165, ColorPickerBoundaries().Y), + new Vector2(this.ColorPickerBoundaries().X + 165, this.ColorPickerBoundaries().Y), new Vector2( - ColorPickerBoundaries().X + 165, - ColorPickerBoundaries().Y + ColorPickerBoundaries().Height) + this.ColorPickerBoundaries().X + 165, + this.ColorPickerBoundaries().Y + this.ColorPickerBoundaries().Height) }, MenuSettings.RootContainerColor); Line.End(); - colorBox.DrawControl(new Vector2(ColorBoxBoundaries().X, ColorBoxBoundaries().Y)); - verticalColorSlider.DrawControl( - new Vector2(VerticalColorSliderBoundaries().X, VerticalColorSliderBoundaries().Y)); - verticalAlphaSlider.DrawControl( - new Vector2(VerticalAlphaSliderBoundaries().X, VerticalAlphaSliderBoundaries().Y)); + this.colorBox.DrawControl( + new Vector2(this.ColorBoxBoundaries().X, this.ColorBoxBoundaries().Y)); + this.verticalColorSlider.DrawControl( + new Vector2( + this.VerticalColorSliderBoundaries().X, + this.VerticalColorSliderBoundaries().Y)); + this.verticalAlphaSlider.DrawControl( + new Vector2( + this.VerticalAlphaSliderBoundaries().X, + this.VerticalAlphaSliderBoundaries().Y)); Utils.DrawBoxFilled( - PreviewBoundaries().X, - PreviewBoundaries().Y, - PreviewBoundaries().Width, - PreviewBoundaries().Height, + this.PreviewBoundaries().X, + this.PreviewBoundaries().Y, + this.PreviewBoundaries().Width, + this.PreviewBoundaries().Height, Color.Black); Utils.DrawBoxFilled( - PreviewBoundaries().X, - PreviewBoundaries().Y, - PreviewBoundaries().Width, - PreviewBoundaries().Height, - colorBox.Rgb.ToSharpDxColor()); + this.PreviewBoundaries().X, + this.PreviewBoundaries().Y, + this.PreviewBoundaries().Width, + this.PreviewBoundaries().Height, + this.colorBox.Rgb.ToSharpDxColor()); var applyButtonTextWidth = MenuSettings.Font.MeasureText(MenuManager.Instance.Sprite, "Apply", 0).Width; var cancelButtonTextWidth = MenuSettings.Font.MeasureText(MenuManager.Instance.Sprite, "Cancel", 0).Width; - Line.Width = ApplyButtonBoundaries().Width; + Line.Width = this.ApplyButtonBoundaries().Width; Line.Begin(); Line.Draw( new[] { - new Vector2(ApplyButtonBoundaries().X + 25, ApplyButtonBoundaries().Y), + new Vector2(this.ApplyButtonBoundaries().X + 25, this.ApplyButtonBoundaries().Y), new Vector2( - ApplyButtonBoundaries().X + 25, - ApplyButtonBoundaries().Y + ApplyButtonBoundaries().Height) + this.ApplyButtonBoundaries().X + 25, + this.ApplyButtonBoundaries().Y + this.ApplyButtonBoundaries().Height) }, new ColorBGRA(68, 160, 255, 255)); Line.End(); @@ -318,22 +324,22 @@ public override void Draw() MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, "Apply", - ApplyButtonBoundaries().X - applyButtonTextWidth / 2 + 25, + this.ApplyButtonBoundaries().X - applyButtonTextWidth / 2 + 25, (int) - CancelButtonBoundaries() + this.CancelButtonBoundaries() .GetCenteredText(null, MenuSettings.Font, "Apply", CenteredFlags.VerticalCenter) .Y, new ColorBGRA(221, 233, 255, 255)); - Line.Width = CancelButtonBoundaries().Width; + Line.Width = this.CancelButtonBoundaries().Width; Line.Begin(); Line.Draw( new[] { - new Vector2(CancelButtonBoundaries().X + 25, CancelButtonBoundaries().Y), + new Vector2(this.CancelButtonBoundaries().X + 25, this.CancelButtonBoundaries().Y), new Vector2( - CancelButtonBoundaries().X + 25, - CancelButtonBoundaries().Y + CancelButtonBoundaries().Height) + this.CancelButtonBoundaries().X + 25, + this.CancelButtonBoundaries().Y + this.CancelButtonBoundaries().Height) }, new ColorBGRA(68, 160, 255, 255)); Line.End(); @@ -341,9 +347,9 @@ public override void Draw() MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, "Cancel", - CancelButtonBoundaries().X - cancelButtonTextWidth / 2 + 25, + this.CancelButtonBoundaries().X - cancelButtonTextWidth / 2 + 25, (int) - CancelButtonBoundaries() + this.CancelButtonBoundaries() .GetCenteredText(null, MenuSettings.Font, "Cancel", CenteredFlags.VerticalCenter) .Y, new ColorBGRA(221, 233, 255, 255)); @@ -382,11 +388,11 @@ public override void OnWndProc(WindowsKeys args) } else if (this.InteractingVerticalColorSlider) { - this.verticalColorSlider.VerticalColorSlider_MouseMove(args); + this.verticalColorSlider.VerticalColorSliderMouseMove(args); } else if (this.InteractingVerticalAlphaSlider) { - this.verticalAlphaSlider.VerticalAlphaSlider_MouseMove(args); + this.verticalAlphaSlider.VerticalAlphaSliderMouseMove(args); } } } @@ -401,12 +407,12 @@ public override void OnWndProc(WindowsKeys args) if (this.InteractingVerticalColorSlider) { this.InteractingVerticalColorSlider = false; - this.verticalColorSlider.VerticalColorSlider_MouseUp(args); + this.verticalColorSlider.VerticalColorSliderMouseUp(args); } if (this.InteractingVerticalAlphaSlider) { this.InteractingVerticalAlphaSlider = false; - this.verticalAlphaSlider.VerticalAlphaSlider_MouseUp(args); + this.verticalAlphaSlider.VerticalAlphaSliderMouseUp(args); } } @@ -435,7 +441,7 @@ public override void OnWndProc(WindowsKeys args) this.VerticalColorSliderBoundaries().Height)) { this.InteractingVerticalColorSlider = true; - this.verticalColorSlider.VerticalColorSlider_MouseDown(args); + this.verticalColorSlider.VerticalColorSliderMouseDown(args); } else if (args.Cursor.IsUnderRectangle( this.VerticalAlphaSliderBoundaries().X, @@ -444,7 +450,7 @@ public override void OnWndProc(WindowsKeys args) this.VerticalAlphaSliderBoundaries().Height)) { this.InteractingVerticalAlphaSlider = true; - this.verticalAlphaSlider.VerticalAlphaSlider_MouseDown(args); + this.verticalAlphaSlider.VerticalAlphaSliderMouseDown(args); } else if (args.Cursor.IsUnderRectangle( this.ApplyButtonBoundaries().X, diff --git a/Core/UI/IMenu/Skins/Tech/TechKeyBind.cs b/Core/UI/IMenu/Skins/Tech/TechKeyBind.cs index f9ce04a..7809db4 100644 --- a/Core/UI/IMenu/Skins/Tech/TechKeyBind.cs +++ b/Core/UI/IMenu/Skins/Tech/TechKeyBind.cs @@ -112,12 +112,14 @@ public override void Draw() Line.Draw( new[] { - new Vector2((this.Component.Position.X + this.Component.MenuWidth - MenuSettings.ContainerHeight - - TechUtilities.CalcWidthText(keyString) / 2 - MenuSettings.ContainerTextOffset), - centerY - 2), - new Vector2((this.Component.Position.X + this.Component.MenuWidth - MenuSettings.ContainerHeight - - TechUtilities.CalcWidthText(keyString) / 2 - MenuSettings.ContainerTextOffset), - centerY + TechUtilities.MeasureString(keyString).Height + 2) + new Vector2( + (this.Component.Position.X + this.Component.MenuWidth - MenuSettings.ContainerHeight + - TechUtilities.CalcWidthText(keyString) / 2 - MenuSettings.ContainerTextOffset), + centerY - 2), + new Vector2( + (this.Component.Position.X + this.Component.MenuWidth - MenuSettings.ContainerHeight + - TechUtilities.CalcWidthText(keyString) / 2 - MenuSettings.ContainerTextOffset), + centerY + TechUtilities.MeasureString(keyString).Height + 2) }, new Color(17, 32, 27, 255)); Line.End(); @@ -145,11 +147,25 @@ public override void Draw() CenteredFlags.HorizontalCenter).X - 5; //Left - Utils.DrawCircle(centerX, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, 7, 270, Utils.CircleType.Half, true, 32, + Utils.DrawCircle( + centerX, + this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, + 7, + 270, + Utils.CircleType.Half, + true, + 32, this.Component.Active ? new Color(75, 215, 128, 255) : new Color(36, 204, 205, 255)); //Right - Utils.DrawCircle(centerX + 15, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, 7, 90, Utils.CircleType.Half, true, 32, + Utils.DrawCircle( + centerX + 15, + this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, + 7, + 90, + Utils.CircleType.Half, + true, + 32, this.Component.Active ? new Color(75, 215, 128, 255) : new Color(36, 204, 205, 255)); //Top @@ -177,8 +193,14 @@ public override void Draw() Line.End(); //FullCircle - Utils.DrawCircleFilled(this.Component.Active ? centerX + 14 : centerX + 1, - this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, 6, 0, Utils.CircleType.Full, true, 32, + Utils.DrawCircleFilled( + this.Component.Active ? centerX + 14 : centerX + 1, + this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, + 6, + 0, + Utils.CircleType.Full, + true, + 32, this.Component.Active ? new Color(73, 227, 139, 255) : new Color(17, 65, 65, 255)); } diff --git a/Core/UI/IMenu/Skins/Tech/TechList.cs b/Core/UI/IMenu/Skins/Tech/TechList.cs index a40a46f..76423a1 100644 --- a/Core/UI/IMenu/Skins/Tech/TechList.cs +++ b/Core/UI/IMenu/Skins/Tech/TechList.cs @@ -19,6 +19,7 @@ // A custom implementation of a // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Tech { using System.Collections.Generic; @@ -107,24 +108,24 @@ public override void Draw() .GetCenteredText(null, MenuSettings.Font, this.Component.DisplayName, CenteredFlags.VerticalCenter); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, - (int)(position.X + MenuSettings.ContainerTextOffset), + MenuManager.Instance.Sprite, + this.Component.DisplayName, + (int)(position.X + MenuSettings.ContainerTextOffset), (int)rectangleName.Y, MenuSettings.TextColor); MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, - "\u23EC", - (int)(position.X + this.Component.MenuWidth - this.dropDownButtonWidth + ArrowSpacing), + "\u23EC", + (int)(position.X + this.Component.MenuWidth - this.dropDownButtonWidth + ArrowSpacing), (int)rectangleName.Y, MenuSettings.TextColor); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.SelectedValueAsObject.ToString(), + MenuManager.Instance.Sprite, + this.Component.SelectedValueAsObject.ToString(), (int)position.X + this.Component.MenuWidth - this.dropDownButtonWidth - TextSpacing - - this.Component.MaxStringWidth, + - this.Component.MaxStringWidth, (int)rectangleName.Y, MenuSettings.TextColor); @@ -137,18 +138,24 @@ public override void Draw() { var color = MenuSettings.RootContainerColor; - Utils.DrawBoxRounded(position.X + Component.MenuWidth - dropdownMenuWidth, position.Y + MenuSettings.ContainerHeight, - dropdownMenuWidth, dropdownMenuHeight, 4, true, - MenuSettings.RootContainerColor, new ColorBGRA(55, 76, 95, 255)); + Utils.DrawBoxRounded( + position.X + this.Component.MenuWidth - dropdownMenuWidth, + position.Y + MenuSettings.ContainerHeight, + dropdownMenuWidth, + dropdownMenuHeight, + 4, + true, + MenuSettings.RootContainerColor, + new ColorBGRA(55, 76, 95, 255)); var x = (int) - (position.X + Component.MenuWidth - dropDownButtonWidth - TextSpacing - - Component.MaxStringWidth); + (position.X + this.Component.MenuWidth - this.dropDownButtonWidth - TextSpacing + - this.Component.MaxStringWidth); var y = (int)rectangleName.Y; for (var i = 0; i < valueStrings.Length; i++) { - if (i == Component.HoveringIndex) + if (i == this.Component.HoveringIndex) { Line.Width = MenuSettings.ContainerHeight; Line.Begin(); @@ -156,11 +163,11 @@ public override void Draw() new[] { new Vector2( - position.X + Component.MenuWidth - dropdownMenuWidth, + position.X + this.Component.MenuWidth - dropdownMenuWidth, position.Y + ((i + 1) * MenuSettings.ContainerHeight) - + MenuSettings.ContainerHeight / 2f), + + MenuSettings.ContainerHeight / 2f), new Vector2( - position.X + Component.MenuWidth, + position.X + this.Component.MenuWidth, position.Y + ((i + 1) * MenuSettings.ContainerHeight) + MenuSettings.ContainerHeight / 2f) }, @@ -168,37 +175,38 @@ public override void Draw() Line.End(); } - if (i != 0) { + if (i != 0) + { Line.Width = 1f; Line.Begin(); Line.Draw( new[] { - new Vector2( - position.X + Component.MenuWidth - dropdownMenuWidth + 10, - position.Y + (MenuSettings.ContainerHeight * (i + 1))), - new Vector2( - position.X + Component.MenuWidth - 10, - position.Y + (MenuSettings.ContainerHeight * (i + 1))) + new Vector2( + position.X + this.Component.MenuWidth - dropdownMenuWidth + 10, + position.Y + (MenuSettings.ContainerHeight * (i + 1))), + new Vector2( + position.X + this.Component.MenuWidth - 10, + position.Y + (MenuSettings.ContainerHeight * (i + 1))) }, MenuSettings.ContainerSeparatorColor); Line.End(); } - + y += MenuSettings.ContainerHeight; MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - valueStrings[i], - x, + MenuManager.Instance.Sprite, + valueStrings[i], + x, y, MenuSettings.TextColor); - if (Component.Index == i) + if (this.Component.Index == i) { var checkmarkWidth = MenuSettings.Font.MeasureText(null, "\u2713", 0).Width; MenuSettings.Font.DrawText( MenuManager.Instance.Sprite, - "\u2713", - (int)(position.X + Component.MenuWidth - checkmarkWidth - TextSpacing), + "\u2713", + (int)(position.X + this.Component.MenuWidth - checkmarkWidth - TextSpacing), y, new ColorBGRA(1, 165, 226, 255)); } @@ -218,8 +226,8 @@ public Rectangle DropDownBoundaries(MenuList component) new Rectangle( (int) (component.Position.X + component.MenuWidth - this.dropDownButtonWidth - (2 * TextSpacing) - - component.MaxStringWidth), - (int)component.Position.Y, + - component.MaxStringWidth), + (int)component.Position.Y, this.dropDownButtonWidth + (2 * TextSpacing) + component.MaxStringWidth, MenuSettings.ContainerHeight); } @@ -235,9 +243,9 @@ public Rectangle DropDownExpandedBoundaries(MenuList component) new Rectangle( (int) (component.Position.X + component.MenuWidth - this.dropDownButtonWidth - (2 * TextSpacing) - - component.MaxStringWidth), - (int)component.Position.Y, - this.dropDownButtonWidth + (2 * TextSpacing) + component.MaxStringWidth, + - component.MaxStringWidth), + (int)component.Position.Y, + this.dropDownButtonWidth + (2 * TextSpacing) + component.MaxStringWidth, (component.Count + 1) * MenuSettings.ContainerHeight); } @@ -255,8 +263,8 @@ public List DropDownListBoundaries(MenuList component) new Rectangle( (int) (component.Position.X + component.MenuWidth - this.dropDownButtonWidth - (2 * TextSpacing) - - component.MaxStringWidth), - (int)(component.Position.Y + ((i + 1) * MenuSettings.ContainerHeight)), + - component.MaxStringWidth), + (int)(component.Position.Y + ((i + 1) * MenuSettings.ContainerHeight)), this.dropDownButtonWidth + (2 * TextSpacing) + component.MaxStringWidth, MenuSettings.ContainerHeight + 1)); } @@ -295,9 +303,9 @@ public override void OnWndProc(WindowsKeys args) const int Buffer = 20; if (this.Component.Active && !args.Cursor.IsUnderRectangle( - entireDropdownRect.X - Buffer, - entireDropdownRect.Y - Buffer, - entireDropdownRect.Width + (2 * Buffer), + entireDropdownRect.X - Buffer, + entireDropdownRect.Y - Buffer, + entireDropdownRect.Width + (2 * Buffer), entireDropdownRect.Height + (2 * Buffer))) { this.Component.Active = false; @@ -310,9 +318,9 @@ public override void OnWndProc(WindowsKeys args) for (var i = 0; i < dropdownRectangles.Count; i++) { if (args.Cursor.IsUnderRectangle( - dropdownRectangles[i].X, - dropdownRectangles[i].Y, - dropdownRectangles[i].Width, + dropdownRectangles[i].X, + dropdownRectangles[i].Y, + dropdownRectangles[i].Width, dropdownRectangles[i].Height)) { this.Component.HoveringIndex = i; diff --git a/Core/UI/IMenu/Skins/Tech/TechMenu.cs b/Core/UI/IMenu/Skins/Tech/TechMenu.cs index 327217c..98fa950 100644 --- a/Core/UI/IMenu/Skins/Tech/TechMenu.cs +++ b/Core/UI/IMenu/Skins/Tech/TechMenu.cs @@ -19,10 +19,9 @@ // Provides a custom implementation of // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Tech { - using System; - using System.Drawing; using System.Linq; using LeagueSharp.SDK.Core.Enumerations; @@ -31,22 +30,15 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Tech using LeagueSharp.SDK.Core.UI.IMenu.Customizer; using LeagueSharp.SDK.Core.UI.IMenu.Values; using LeagueSharp.SDK.Core.Utils; - using LeagueSharp.SDK.Properties; using SharpDX; using SharpDX.Direct3D9; - using Color = SharpDX.Color; - /// /// Provides a default implementation of /// public class TechMenu : ADrawable { - #region Constants - - #endregion - #region Static Fields /// @@ -57,7 +49,7 @@ public class TechMenu : ADrawable #endregion #region Fields - + /// /// Gets or sets a value indicating whether the user is dragging the menu. /// @@ -99,13 +91,180 @@ public class TechMenu : ADrawable public TechMenu(Menu component) : base(component) { - } #endregion #region Public Methods and Operators + /// + /// Draws a rounded Box. If Smoothing is true it will draw also a border. + /// + /// Position X + /// Position Y + /// Width + /// Height + /// Radius + /// Color + /// Border Color + public static void DrawBoxBotRounded( + float x, + float y, + float w, + float h, + float radius, + Color color, + Color bcolor) + { + Utils.DrawBoxFilled(x + radius, y + radius, w - 2 * radius - 1, h - 2 * radius - 1, color); // Center rect. + Utils.DrawBoxFilled(x + radius, y + 1, w - 2 * radius - 1, radius - 1, color); // Top rect. + Utils.DrawBoxFilled(x + radius, y + h - radius - 1, w - 2 * radius - 1, radius, color); // Bottom rect. + Utils.DrawBoxFilled(x + 1, y + radius, radius - 1, h - 2 * radius - 1, color); // Left rect. + Utils.DrawBoxFilled(x + w - radius - 1, y + radius, radius, h - 2 * radius - 1, color); // Right rect. + + Utils.DrawCircleFilled(x + radius, y + radius, radius - 1, 0, Utils.CircleType.Quarter, true, 16, color); + // Top-left corner + Utils.DrawCircleFilled( + x + w - radius - 1, + y + radius, + radius - 1, + 90, + Utils.CircleType.Quarter, + true, + 16, + color); // Top-right corner + Utils.DrawCircleFilled( + x + w - radius - 1, + y + h - radius - 1, + radius - 1, + 180, + Utils.CircleType.Quarter, + true, + 16, + color); // Bottom-right corner + Utils.DrawCircleFilled( + x + radius, + y + h - radius - 1, + radius - 1, + 270, + Utils.CircleType.Quarter, + true, + 16, + color); // Bottom-left corner + + Utils.DrawCircle(x + radius + 1, y + radius + 1, radius, 0, Utils.CircleType.Quarter, true, 16, bcolor); + // Top-left corner + Utils.DrawCircle(x + w - radius - 1, y + radius + 1, radius, 90, Utils.CircleType.Quarter, true, 16, bcolor); + // Top-right corner + Utils.DrawCircle( + x + w - radius - 1, + y + h - radius - 1, + radius, + 180, + Utils.CircleType.Quarter, + true, + 16, + bcolor); // Bottom-right corner + Utils.DrawCircle( + x + radius + 1, + y + h - radius - 1, + radius, + 270, + Utils.CircleType.Quarter, + true, + 16, + bcolor); // Bottom-left corner + + Utils.DrawLine(x + radius, y + 1, x + w - radius - 1, y + 1, 1, bcolor); // Top line + Utils.DrawLine(x + radius, y + h - 2, x + w - radius - 1, y + h - 2, 1, bcolor); // Bottom line + Utils.DrawLine(x + 1, y + radius, x + 1, y + h - radius - 1, 1, bcolor); // Left line + Utils.DrawLine(x + w - 2, y + radius, x + w - 2, y + h - radius - 1, 1, bcolor); // Right line + } + + /// + /// Draws a rounded Box. If Smoothing is true it will draw also a border. + /// + /// Position X + /// Position Y + /// Width + /// Height + /// Radius + /// Color + /// Border Color + public static void DrawBoxTopRounded( + float x, + float y, + float w, + float h, + float radius, + Color color, + Color bcolor) + { + Utils.DrawBoxFilled(x + radius, y + radius, w - 2 * radius - 1, h - 2 * radius - 1, color); // Center rect. + Utils.DrawBoxFilled(x + radius, y + 1, w - 2 * radius - 1, radius - 1, color); // Top rect. + Utils.DrawBoxFilled(x + radius, y + h - radius - 1, w - 2 * radius - 1, radius, color); // Bottom rect. + Utils.DrawBoxFilled(x + 1, y + radius, radius - 1, h - 2 * radius - 1, color); // Left rect. + Utils.DrawBoxFilled(x + w - radius - 1, y + radius, radius, h - 2 * radius - 1, color); // Right rect. + + Utils.DrawCircleFilled(x + radius, y + radius, radius - 1, 0, Utils.CircleType.Quarter, true, 16, color); + // Top-left corner + Utils.DrawCircleFilled( + x + w - radius - 1, + y + radius, + radius - 1, + 90, + Utils.CircleType.Quarter, + true, + 16, + color); // Top-right corner + Utils.DrawCircleFilled( + x + w - radius - 1, + y + h - radius - 1, + radius - 1, + 180, + Utils.CircleType.Quarter, + true, + 16, + color); // Bottom-right corner + Utils.DrawCircleFilled( + x + radius, + y + h - radius - 1, + radius - 1, + 270, + Utils.CircleType.Quarter, + true, + 16, + color); // Bottom-left corner + + Utils.DrawCircle(x + radius + 1, y + radius + 1, radius, 0, Utils.CircleType.Quarter, true, 16, bcolor); + // Top-left corner + Utils.DrawCircle(x + w - radius - 1, y + radius + 1, radius, 90, Utils.CircleType.Quarter, true, 16, bcolor); + // Top-right corner + Utils.DrawCircle( + x + w - radius - 1, + y + h - radius - 1, + radius, + 180, + Utils.CircleType.Quarter, + true, + 16, + bcolor); // Bottom-right corner + Utils.DrawCircle( + x + radius + 1, + y + h - radius - 1, + radius, + 270, + Utils.CircleType.Quarter, + true, + 16, + bcolor); // Bottom-left corner + + Utils.DrawLine(x + radius, y + 1, x + w - radius - 1, y + 1, 1, bcolor); // Top line + Utils.DrawLine(x + radius, y + h - 2, x + w - radius - 1, y + h - 2, 1, bcolor); // Bottom line + Utils.DrawLine(x + 1, y + radius, x + 1, y + h - radius - 1, 1, bcolor); // Left line + Utils.DrawLine(x + w - 2, y + radius, x + w - 2, y + h - radius - 1, 1, bcolor); // Right line + } + /// /// Disposes any resources used in this handler. /// @@ -126,9 +285,9 @@ public override void Draw() Line.Draw( new[] { - new Vector2(position.X, position.Y + MenuSettings.ContainerHeight / 2f), + new Vector2(position.X, position.Y + MenuSettings.ContainerHeight / 2f), new Vector2( - position.X + this.Component.MenuWidth, + position.X + this.Component.MenuWidth, position.Y + MenuSettings.ContainerHeight / 2f) }, MenuSettings.HoverColor); @@ -152,19 +311,25 @@ public override void Draw() delegate { var symbolCenterY = - (int) - TechUtilities.GetContainerRectangle(this.Component) - .GetCenteredText(null, TechMenuSettings.FontMenuSymbol, this.Component.DisplayName, CenteredFlags.VerticalCenter) - .Y; + (int) + TechUtilities.GetContainerRectangle(this.Component) + .GetCenteredText( + null, + TechMenuSettings.FontMenuSymbol, + this.Component.DisplayName, + CenteredFlags.VerticalCenter) + .Y; TechMenuSettings.FontMenuSymbol.DrawText( MenuManager.Instance.Sprite, "›", (int) (position.X + this.Component.MenuWidth - MenuSettings.ContainerTextMarkWidth - - MenuSettings.ContainerTextMarkOffset) + 1, + - MenuSettings.ContainerTextMarkOffset) + 1, symbolCenterY, - this.Component.Components.Count > 0 ? TechMenuSettings.TextCaptionColor : MenuSettings.ContainerSeparatorColor); + this.Component.Components.Count > 0 + ? TechMenuSettings.TextCaptionColor + : MenuSettings.ContainerSeparatorColor); }); if (this.Component.Toggled) @@ -189,8 +354,15 @@ public override void Draw() width = this.Component.Components.First().Value.MenuWidth; } - Utils.DrawBoxRounded(position.X + this.Component.MenuWidth, position.Y, width, height + 1, 4, true, - MenuSettings.RootContainerColor, MenuSettings.TextColor); + Utils.DrawBoxRounded( + position.X + this.Component.MenuWidth, + position.Y, + width, + height + 1, + 4, + true, + MenuSettings.RootContainerColor, + MenuSettings.TextColor); for (var i = 0; i < this.Component.Components.Count; ++i) { @@ -198,7 +370,7 @@ public override void Draw() if (childComponent != null) { var childPos = new Vector2( - position.X + this.Component.MenuWidth, + position.X + this.Component.MenuWidth, position.Y + i * MenuSettings.ContainerHeight); childComponent.OnDraw(childPos); @@ -215,37 +387,37 @@ public override void Draw() Line.Draw( new[] { - new Vector2(rec.Left + 1, rec.Bottom - 2), - new Vector2(rec.Right - 2, rec.Bottom - 2) + new Vector2(rec.Left + 1, rec.Bottom - 2), + new Vector2(rec.Right - 2, rec.Bottom - 2) }, TechMenuSettings.TextCaptionColor); - } - else if (childComponent is MenuBool || childComponent is MenuButton || childComponent is MenuColor || childComponent is MenuKeyBind - || childComponent is MenuList || childComponent is MenuSlider) + else if (childComponent is MenuBool || childComponent is MenuButton + || childComponent is MenuColor || childComponent is MenuKeyBind + || childComponent is MenuList || childComponent is MenuSlider) { Line.Begin(); Line.Draw( new[] { - new Vector2(rec.Left + 1, rec.Bottom), - new Vector2(rec.Right - 2, rec.Bottom) + new Vector2(rec.Left + 1, rec.Bottom), + new Vector2(rec.Right - 2, rec.Bottom) }, new Color(13, 34, 37, 255)); Line.Draw( new[] { - new Vector2(rec.Left + 1, rec.Bottom), - new Vector2(rec.Left + 5, rec.Bottom) + new Vector2(rec.Left + 1, rec.Bottom), + new Vector2(rec.Left + 5, rec.Bottom) }, TechMenuSettings.TextCaptionColor); Line.Draw( new[] { - new Vector2(rec.Right - 6, rec.Bottom), - new Vector2(rec.Right - 2, rec.Bottom) + new Vector2(rec.Right - 6, rec.Bottom), + new Vector2(rec.Right - 2, rec.Bottom) }, TechMenuSettings.TextCaptionColor); } @@ -255,8 +427,8 @@ public override void Draw() Line.Draw( new[] { - new Vector2(rec.Left + 1, rec.Bottom), - new Vector2(rec.Right - 2, rec.Bottom) + new Vector2(rec.Left + 1, rec.Bottom), + new Vector2(rec.Right - 2, rec.Bottom) }, TechMenuSettings.TextCaptionColor); } @@ -283,9 +455,9 @@ public override void Draw() Line.Draw( new[] { - new Vector2(x - 1, y + 1), new Vector2(x - 1 + dragTexture.Width, y + 1), - new Vector2(x - 1 + dragTexture.Width, y + dragTexture.Width + 2), - new Vector2(x - 2, y + dragTexture.Width + 2), new Vector2(x - 2, y), + new Vector2(x - 1, y + 1), new Vector2(x - 1 + dragTexture.Width, y + 1), + new Vector2(x - 1 + dragTexture.Width, y + dragTexture.Width + 2), + new Vector2(x - 2, y + dragTexture.Width + 2), new Vector2(x - 2, y), }, MenuSettings.ContainerSeparatorColor); Line.End(); @@ -302,13 +474,17 @@ public override void OnWndProc(WindowsKeys args) { if (this.Component.Visible) { - if (args.Msg == WindowsMessages.MOUSEMOVE && this.dragging && !MenuCustomizer.Instance.LockPosition.Value) + if (args.Msg == WindowsMessages.MOUSEMOVE && this.dragging + && !MenuCustomizer.Instance.LockPosition.Value) { MenuSettings.Position = new Vector2(args.Cursor.X - this.xd, args.Cursor.Y - this.yd); this.hasDragged = true; } - if (args.Cursor.IsUnderRectangle(this.Component.Position.X, this.Component.Position.Y, this.Component.MenuWidth, + if (args.Cursor.IsUnderRectangle( + this.Component.Position.X, + this.Component.Position.Y, + this.Component.MenuWidth, MenuSettings.ContainerHeight)) { if (args.Msg == WindowsMessages.LBUTTONDOWN && this.Component.Root) @@ -338,74 +514,6 @@ public override void OnWndProc(WindowsKeys args) } } - /// - /// Draws a rounded Box. If Smoothing is true it will draw also a border. - /// - /// Position X - /// Position Y - /// Width - /// Height - /// Radius - /// Color - /// Border Color - public static void DrawBoxTopRounded(float x, float y, float w, float h, float radius, Color color, Color bcolor) - { - Utils.DrawBoxFilled(x + radius, y + radius, w - 2 * radius - 1, h - 2 * radius - 1, color); // Center rect. - Utils.DrawBoxFilled(x + radius, y + 1, w - 2 * radius - 1, radius - 1, color); // Top rect. - Utils.DrawBoxFilled(x + radius, y + h - radius - 1, w - 2 * radius - 1, radius, color); // Bottom rect. - Utils.DrawBoxFilled(x + 1, y + radius, radius - 1, h - 2 * radius - 1, color); // Left rect. - Utils.DrawBoxFilled(x + w - radius - 1, y + radius, radius, h - 2 * radius - 1, color); // Right rect. - - Utils.DrawCircleFilled(x + radius, y + radius, radius - 1, 0, Utils.CircleType.Quarter, true, 16, color); // Top-left corner - Utils.DrawCircleFilled(x + w - radius - 1, y + radius, radius - 1, 90, Utils.CircleType.Quarter, true, 16, color); // Top-right corner - Utils.DrawCircleFilled(x + w - radius - 1, y + h - radius - 1, radius - 1, 180, Utils.CircleType.Quarter, true, 16, color); // Bottom-right corner - Utils.DrawCircleFilled(x + radius, y + h - radius - 1, radius - 1, 270, Utils.CircleType.Quarter, true, 16, color); // Bottom-left corner - - Utils.DrawCircle(x + radius + 1, y + radius + 1, radius, 0, Utils.CircleType.Quarter, true, 16, bcolor); // Top-left corner - Utils.DrawCircle(x + w - radius - 1, y + radius + 1, radius, 90, Utils.CircleType.Quarter, true, 16, bcolor); // Top-right corner - Utils.DrawCircle(x + w - radius - 1, y + h - radius - 1, radius, 180, Utils.CircleType.Quarter, true, 16, bcolor); // Bottom-right corner - Utils.DrawCircle(x + radius + 1, y + h - radius - 1, radius, 270, Utils.CircleType.Quarter, true, 16, bcolor); // Bottom-left corner - - Utils.DrawLine(x + radius, y + 1, x + w - radius - 1, y + 1, 1, bcolor); // Top line - Utils.DrawLine(x + radius, y + h - 2, x + w - radius - 1, y + h - 2, 1, bcolor); // Bottom line - Utils.DrawLine(x + 1, y + radius, x + 1, y + h - radius - 1, 1, bcolor); // Left line - Utils.DrawLine(x + w - 2, y + radius, x + w - 2, y + h - radius - 1, 1, bcolor); // Right line - } - - /// - /// Draws a rounded Box. If Smoothing is true it will draw also a border. - /// - /// Position X - /// Position Y - /// Width - /// Height - /// Radius - /// Color - /// Border Color - public static void DrawBoxBotRounded(float x, float y, float w, float h, float radius, Color color, Color bcolor) - { - Utils.DrawBoxFilled(x + radius, y + radius, w - 2 * radius - 1, h - 2 * radius - 1, color); // Center rect. - Utils.DrawBoxFilled(x + radius, y + 1, w - 2 * radius - 1, radius - 1, color); // Top rect. - Utils.DrawBoxFilled(x + radius, y + h - radius - 1, w - 2 * radius - 1, radius, color); // Bottom rect. - Utils.DrawBoxFilled(x + 1, y + radius, radius - 1, h - 2 * radius - 1, color); // Left rect. - Utils.DrawBoxFilled(x + w - radius - 1, y + radius, radius, h - 2 * radius - 1, color); // Right rect. - - Utils.DrawCircleFilled(x + radius, y + radius, radius - 1, 0, Utils.CircleType.Quarter, true, 16, color); // Top-left corner - Utils.DrawCircleFilled(x + w - radius - 1, y + radius, radius - 1, 90, Utils.CircleType.Quarter, true, 16, color); // Top-right corner - Utils.DrawCircleFilled(x + w - radius - 1, y + h - radius - 1, radius - 1, 180, Utils.CircleType.Quarter, true, 16, color); // Bottom-right corner - Utils.DrawCircleFilled(x + radius, y + h - radius - 1, radius - 1, 270, Utils.CircleType.Quarter, true, 16, color); // Bottom-left corner - - Utils.DrawCircle(x + radius + 1, y + radius + 1, radius, 0, Utils.CircleType.Quarter, true, 16, bcolor); // Top-left corner - Utils.DrawCircle(x + w - radius - 1, y + radius + 1, radius, 90, Utils.CircleType.Quarter, true, 16, bcolor); // Top-right corner - Utils.DrawCircle(x + w - radius - 1, y + h - radius - 1, radius, 180, Utils.CircleType.Quarter, true, 16, bcolor); // Bottom-right corner - Utils.DrawCircle(x + radius + 1, y + h - radius - 1, radius, 270, Utils.CircleType.Quarter, true, 16, bcolor); // Bottom-left corner - - Utils.DrawLine(x + radius, y + 1, x + w - radius - 1, y + 1, 1, bcolor); // Top line - Utils.DrawLine(x + radius, y + h - 2, x + w - radius - 1, y + h - 2, 1, bcolor); // Bottom line - Utils.DrawLine(x + 1, y + radius, x + 1, y + h - radius - 1, 1, bcolor); // Left line - Utils.DrawLine(x + w - 2, y + radius, x + w - 2, y + h - radius - 1, 1, bcolor); // Right line - } - /// /// Calculates the Width of an AMenuComponent /// diff --git a/Core/UI/IMenu/Skins/Tech/TechMenuSettings.cs b/Core/UI/IMenu/Skins/Tech/TechMenuSettings.cs index c47df16..417bdef 100644 --- a/Core/UI/IMenu/Skins/Tech/TechMenuSettings.cs +++ b/Core/UI/IMenu/Skins/Tech/TechMenuSettings.cs @@ -24,12 +24,6 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Tech { - using System.Collections.Generic; - using System.ComponentModel; - using System.Runtime.CompilerServices; - - using LeagueSharp.SDK.Core.UI.IMenu.Customizer; - using SharpDX; using SharpDX.Direct3D9; @@ -144,11 +138,6 @@ public static Font FontMenuSymbol } } - /// - /// Gets or sets the Global Text Caption Color. - /// - public static ColorBGRA TextCaptionColor { get; set; } - /// /// Gets or sets the Global KeyBind Color. /// @@ -159,6 +148,11 @@ public static Font FontMenuSymbol /// public static ColorBGRA SliderColor { get; set; } + /// + /// Gets or sets the Global Text Caption Color. + /// + public static ColorBGRA TextCaptionColor { get; set; } + #endregion #region Public Methods and Operators @@ -168,7 +162,6 @@ public static Font FontMenuSymbol /// public static void LoadSettings() { - } #endregion diff --git a/Core/UI/IMenu/Skins/Tech/TechSeparator.cs b/Core/UI/IMenu/Skins/Tech/TechSeparator.cs index 27805c1..4fc8a8f 100644 --- a/Core/UI/IMenu/Skins/Tech/TechSeparator.cs +++ b/Core/UI/IMenu/Skins/Tech/TechSeparator.cs @@ -19,37 +19,19 @@ // Implements as a custom skin. // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Tech { - using System; - using LeagueSharp.SDK.Core.Enumerations; using LeagueSharp.SDK.Core.Math; using LeagueSharp.SDK.Core.UI.IMenu.Values; using LeagueSharp.SDK.Core.Utils; - using SharpDX; - using SharpDX.Direct3D9; /// /// Implements as a default skin. /// public class TechSeparator : ADrawable { - - #region Static Fields - - /// - /// The line. - /// - private static readonly Line Line = new Line(Drawing.Direct3DDevice) { GLLines = true }; - - /// - /// Offset. - /// - private static readonly int Offset = 15; - - #endregion - #region Constructors and Destructors /// diff --git a/Core/UI/IMenu/Skins/Tech/TechSlider.cs b/Core/UI/IMenu/Skins/Tech/TechSlider.cs index 5b0a9fa..17992d0 100644 --- a/Core/UI/IMenu/Skins/Tech/TechSlider.cs +++ b/Core/UI/IMenu/Skins/Tech/TechSlider.cs @@ -19,6 +19,7 @@ // A custom implementation of an // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Tech { using System; @@ -128,20 +129,20 @@ public override void Draw() }); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, + MenuManager.Instance.Sprite, + this.Component.DisplayName, (int)(position.X + MenuSettings.ContainerTextOffset), (int)(position.Y + (centeredY - position.Y) / 2), MenuSettings.TextColor); var measureText = MenuSettings.Font.MeasureText( - null, - this.Component.Value.ToString(CultureInfo.InvariantCulture), + null, + this.Component.Value.ToString(CultureInfo.InvariantCulture), 0); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.Value.ToString(CultureInfo.InvariantCulture), - (int)(position.X + this.Component.MenuWidth - measureText.Width - Offset), + MenuManager.Instance.Sprite, + this.Component.Value.ToString(CultureInfo.InvariantCulture), + (int)(position.X + this.Component.MenuWidth - measureText.Width - Offset), (int)(position.Y + (centeredY - position.Y) / 2), MenuSettings.TextColor); diff --git a/Core/UI/IMenu/Skins/Tech/TechSliderButton.cs b/Core/UI/IMenu/Skins/Tech/TechSliderBool.cs similarity index 75% rename from Core/UI/IMenu/Skins/Tech/TechSliderButton.cs rename to Core/UI/IMenu/Skins/Tech/TechSliderBool.cs index 9ae54ce..027aa1e 100644 --- a/Core/UI/IMenu/Skins/Tech/TechSliderButton.cs +++ b/Core/UI/IMenu/Skins/Tech/TechSliderBool.cs @@ -19,6 +19,7 @@ // A custom implementation of an // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Tech { using System; @@ -36,7 +37,7 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Tech /// /// A default implementation of an /// - public class TechSliderButton : ADrawable + public class TechSliderBool : ADrawable { #region Static Fields @@ -55,12 +56,12 @@ public class TechSliderButton : ADrawable #region Constructors and Destructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// The menu component /// - public TechSliderButton(MenuSliderButton component) + public TechSliderBool(MenuSliderBool component) : base(component) { } @@ -69,26 +70,12 @@ public TechSliderButton(MenuSliderButton component) #region Public Methods and Operators - /// - /// Returns the Rectangle that defines the Slider - /// - /// The - /// The - public Rectangle SliderBoundaries(MenuSliderButton component) - { - return new Rectangle( - (int)component.Position.X + Offset, - (int)component.Position.Y, - component.MenuWidth - MenuSettings.ContainerHeight - (int)(Offset * 1.1), - MenuSettings.ContainerHeight); - } - /// /// Returns the Rectangle that defines the on/off Button /// - /// The + /// The /// The - public Rectangle ButtonBoundaries(MenuSliderButton component) + public Rectangle ButtonBoundaries(MenuSliderBool component) { return new Rectangle( (int)(component.Position.X + component.MenuWidth - MenuSettings.ContainerHeight * 1.2), @@ -106,7 +93,7 @@ public override void Dispose() } /// - /// Draws a + /// Draws a /// public override void Draw() { @@ -118,9 +105,10 @@ public override void Draw() TechUtilities.GetContainerRectangle(this.Component) .GetCenteredText(null, MenuSettings.Font, this.Component.DisplayName, CenteredFlags.VerticalCenter) .Y; - var percent = (this.Component.SValue - this.Component.MinValue) - / (float)(this.Component.MaxValue - this.Component.MinValue); - var x = position.X + Offset + (percent * (this.Component.MenuWidth - Offset * 2 - MenuSettings.ContainerHeight)); + var percent = (this.Component.SliderValue - this.Component.SliderMinValue) + / (float)(this.Component.SliderMaxValue - this.Component.SliderMinValue); + var x = position.X + Offset + + (percent * (this.Component.MenuWidth - Offset * 2 - MenuSettings.ContainerHeight)); var maxX = position.X + Offset + ((this.Component.MenuWidth - Offset * 2 - MenuSettings.ContainerHeight)); MenuManager.Instance.DrawDelayed( @@ -138,20 +126,20 @@ public override void Draw() }); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.DisplayName, + MenuManager.Instance.Sprite, + this.Component.DisplayName, (int)(position.X + MenuSettings.ContainerTextOffset), (int)(position.Y + (centeredY - position.Y) / 2), MenuSettings.TextColor); var measureText = MenuSettings.Font.MeasureText( - null, - this.Component.SValue.ToString(CultureInfo.InvariantCulture), + null, + this.Component.SliderValue.ToString(CultureInfo.InvariantCulture), 0); MenuSettings.Font.DrawText( - MenuManager.Instance.Sprite, - this.Component.SValue.ToString(CultureInfo.InvariantCulture), - (int)(position.X + this.Component.MenuWidth - measureText.Width - Offset - MenuSettings.ContainerHeight), + MenuManager.Instance.Sprite, + this.Component.SliderValue.ToString(CultureInfo.InvariantCulture), + (int)(position.X + this.Component.MenuWidth - measureText.Width - Offset - MenuSettings.ContainerHeight), (int)(position.Y + (centeredY - position.Y) / 2), MenuSettings.TextColor); @@ -188,16 +176,30 @@ public override void Draw() MenuSettings.ContainerHeight).GetCenteredText( null, MenuSettings.Font, - this.Component.BValue ? "On" : "Off", + this.Component.BoolValue ? "On" : "Off", CenteredFlags.HorizontalCenter).X - 5; //Left - Utils.DrawCircle(centerX, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, 7, 270, Utils.CircleType.Half, true, 32, - this.Component.BValue ? new Color(75, 215, 128, 255) : new Color(36, 204, 205, 255)); + Utils.DrawCircle( + centerX, + this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, + 7, + 270, + Utils.CircleType.Half, + true, + 32, + this.Component.BoolValue ? new Color(75, 215, 128, 255) : new Color(36, 204, 205, 255)); //Right - Utils.DrawCircle(centerX + 15, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, 7, 90, Utils.CircleType.Half, true, 32, - this.Component.BValue ? new Color(75, 215, 128, 255) : new Color(36, 204, 205, 255)); + Utils.DrawCircle( + centerX + 15, + this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, + 7, + 90, + Utils.CircleType.Half, + true, + 32, + this.Component.BoolValue ? new Color(75, 215, 128, 255) : new Color(36, 204, 205, 255)); //Top Line.Width = 1; @@ -208,7 +210,7 @@ public override void Draw() new Vector2(centerX, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f - 8), new Vector2(centerX + 15, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f - 8) }, - this.Component.BValue ? new Color(75, 215, 128, 255) : new Color(36, 204, 205, 255)); + this.Component.BoolValue ? new Color(75, 215, 128, 255) : new Color(36, 204, 205, 255)); Line.End(); //Bot @@ -220,13 +222,19 @@ public override void Draw() new Vector2(centerX, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f + 7), new Vector2(centerX + 15, this.Component.Position.Y + MenuSettings.ContainerHeight / 2f + 7) }, - this.Component.BValue ? new Color(75, 215, 128, 255) : new Color(36, 204, 205, 255)); + this.Component.BoolValue ? new Color(75, 215, 128, 255) : new Color(36, 204, 205, 255)); Line.End(); //FullCircle - Utils.DrawCircleFilled(this.Component.BValue ? centerX + 14 : centerX + 1, - this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, 6, 0, Utils.CircleType.Full, true, 32, - this.Component.BValue ? new Color(73, 227, 139, 255) : new Color(17, 65, 65, 255)); + Utils.DrawCircleFilled( + this.Component.BoolValue ? centerX + 14 : centerX + 1, + this.Component.Position.Y + MenuSettings.ContainerHeight / 2f, + 6, + 0, + Utils.CircleType.Full, + true, + 32, + this.Component.BoolValue ? new Color(73, 227, 139, 255) : new Color(17, 65, 65, 255)); } /// @@ -250,7 +258,7 @@ public override void OnWndProc(WindowsKeys args) if (args.Cursor.IsUnderRectangle(rect.X, rect.Y, rect.Width, rect.Height)) { - this.Component.BValue = !this.Component.BValue; + this.Component.BoolValue = !this.Component.BoolValue; this.Component.FireEvent(); } @@ -271,6 +279,20 @@ public override void OnWndProc(WindowsKeys args) } } + /// + /// Returns the Rectangle that defines the Slider + /// + /// The + /// The + public Rectangle SliderBoundaries(MenuSliderBool component) + { + return new Rectangle( + (int)component.Position.X + Offset, + (int)component.Position.Y, + component.MenuWidth - MenuSettings.ContainerHeight - (int)(Offset * 1.1), + MenuSettings.ContainerHeight); + } + /// /// Calculates the width of this component /// @@ -293,26 +315,27 @@ public override int Width() /// /// data /// - private void CalculateNewValue(MenuSliderButton component, WindowsKeys args) + private void CalculateNewValue(MenuSliderBool component, WindowsKeys args) { var newValue = (int) Math.Round( - component.MinValue - + ((args.Cursor.X - component.Position.X - Offset) * (component.MaxValue - component.MinValue)) + component.SliderMinValue + + ((args.Cursor.X - component.Position.X - Offset) + * (component.SliderMaxValue - component.SliderMinValue)) / (component.MenuWidth - Offset * 2 - MenuSettings.ContainerHeight)); - if (newValue < component.MinValue) + if (newValue < component.SliderMinValue) { - newValue = component.MinValue; + newValue = component.SliderMinValue; } - else if (newValue > component.MaxValue) + else if (newValue > component.SliderMaxValue) { - newValue = component.MaxValue; + newValue = component.SliderMaxValue; } - if (newValue != component.Value) + if (newValue != component.SliderValue) { - component.SValue = newValue; + component.SliderValue = newValue; component.FireEvent(); } } diff --git a/Core/UI/IMenu/Skins/Tech/TechTextures.cs b/Core/UI/IMenu/Skins/Tech/TechTextures.cs index 48d7d50..f50568e 100644 --- a/Core/UI/IMenu/Skins/Tech/TechTextures.cs +++ b/Core/UI/IMenu/Skins/Tech/TechTextures.cs @@ -19,19 +19,15 @@ // A custom implementation of // // -------------------------------------------------------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Tech { + using System.Collections.Generic; using System.Drawing; + using System.Linq; using LeagueSharp.SDK.Properties; - using SharpDX; using SharpDX.Direct3D9; internal enum TechTexture @@ -41,23 +37,38 @@ internal enum TechTexture internal class TechTextures { - - private readonly Dictionary textures = new Dictionary(); + #region Static Fields public static readonly TechTextures Instance = new TechTextures(); + #endregion + + #region Fields + + private readonly Dictionary textures = + new Dictionary(); + + #endregion + + #region Constructors and Destructors + private TechTextures() { - this.textures[TechTexture.Dragging] = BuildTexture(Resources.cursor_drag, 16, 16); + this.textures[TechTexture.Dragging] = this.BuildTexture(Resources.cursor_drag, 16, 16); } ~TechTextures() { - foreach (var entry in this.textures.Where(entry => !entry.Value.Texture.IsDisposed)) { + foreach (var entry in this.textures.Where(entry => !entry.Value.Texture.IsDisposed)) + { entry.Value.Texture.Dispose(); } } + #endregion + + #region Public Indexers + public TechTextureWrapper this[TechTexture textureType] { get @@ -66,10 +77,24 @@ public TechTextureWrapper this[TechTexture textureType] } } + #endregion + + #region Public Methods and Operators + + public TechTextureWrapper AddTexture(Image bmp, int width, int height, TechTexture textureType) + { + this.textures[textureType] = this.BuildTexture(bmp, height, width); + return this.textures[textureType]; + } + + #endregion + + #region Methods + private TechTextureWrapper BuildTexture(Image bmp, int height, int width) { var resized = new Bitmap(bmp, width, height); - var texture = Texture.FromMemory( + var texture = Texture.FromMemory( Drawing.Direct3DDevice, (byte[])new ImageConverter().ConvertTo(resized, typeof(byte[])), resized.Width, @@ -86,19 +111,12 @@ private TechTextureWrapper BuildTexture(Image bmp, int height, int width) return new TechTextureWrapper(texture, width, height); } - public TechTextureWrapper AddTexture(Image bmp, int width, int height, TechTexture textureType) - { - this.textures[textureType] = BuildTexture(bmp, height, width); - return this.textures[textureType]; - } - + #endregion } internal class TechTextureWrapper { - public Texture Texture { get; private set; } - public int Width { get; private set; } - public int Height { get; private set; } + #region Constructors and Destructors public TechTextureWrapper(Texture texture, int width, int height) { @@ -106,6 +124,17 @@ public TechTextureWrapper(Texture texture, int width, int height) this.Width = width; this.Height = height; } - + + #endregion + + #region Public Properties + + public int Height { get; private set; } + + public Texture Texture { get; private set; } + + public int Width { get; private set; } + + #endregion } -} +} \ No newline at end of file diff --git a/Core/UI/IMenu/Skins/Tech/TechTheme.cs b/Core/UI/IMenu/Skins/Tech/TechTheme.cs index ec67665..a1248c6 100644 --- a/Core/UI/IMenu/Skins/Tech/TechTheme.cs +++ b/Core/UI/IMenu/Skins/Tech/TechTheme.cs @@ -19,6 +19,7 @@ // Implements a custom ITheme. // // -------------------------------------------------------------------------------------------------------------------- + namespace LeagueSharp.SDK.Core.UI.IMenu.Skins.Tech { using System.Linq; @@ -128,23 +129,23 @@ public ADrawable BuildSeparatorHandler(MenuSeparator component) } /// - /// Builds a new handler for the given . + /// Builds a new handler for the given . /// - /// The where this handler is responsible for. + /// The where this handler is responsible for. /// The handler - public ADrawable BuildSliderHandler(MenuSlider component) + public ADrawable BuildSliderBoolHandler(MenuSliderBool component) { - return new TechSlider(component); + return new TechSliderBool(component); } /// - /// Builds a new handler for the given . + /// Builds a new handler for the given . /// - /// The where this handler is responsible for. + /// The where this handler is responsible for. /// The handler - public ADrawable BuildSliderButtonHandler(MenuSliderButton component) + public ADrawable BuildSliderHandler(MenuSlider component) { - return new TechSliderButton(component); + return new TechSlider(component); } /// @@ -161,8 +162,16 @@ public void Draw() width = menuManager.Menus.First().MenuWidth; } - Utils.DrawBoxRounded(position.X - 1, position.Y - 1, width + 2, height + 3, 4, true, - MenuSettings.RootContainerColor, new ColorBGRA(13, 37, 37, 255), new ColorBGRA(30, 126, 125, 255)); + Utils.DrawBoxRounded( + position.X - 1, + position.Y - 1, + width + 2, + height + 3, + 4, + true, + MenuSettings.RootContainerColor, + new ColorBGRA(13, 37, 37, 255), + new ColorBGRA(30, 126, 125, 255)); for (var i = 0; i < menuManager.Menus.Count; ++i) { diff --git a/Core/UI/IMenu/Skins/Tech/TechUtilities.cs b/Core/UI/IMenu/Skins/Tech/TechUtilities.cs index ba5ebec..695251f 100644 --- a/Core/UI/IMenu/Skins/Tech/TechUtilities.cs +++ b/Core/UI/IMenu/Skins/Tech/TechUtilities.cs @@ -65,9 +65,9 @@ public static int CalcWidthText(string text) public static Rectangle GetContainerRectangle(AMenuComponent component) { return new Rectangle( - (int)component.Position.X, - (int)component.Position.Y, - component.MenuWidth, + (int)component.Position.X, + (int)component.Position.Y, + component.MenuWidth, MenuSettings.ContainerHeight); } diff --git a/Core/UI/IMenu/Skins/ThemeManager.cs b/Core/UI/IMenu/Skins/ThemeManager.cs index 7f3d593..0340fd2 100644 --- a/Core/UI/IMenu/Skins/ThemeManager.cs +++ b/Core/UI/IMenu/Skins/ThemeManager.cs @@ -17,7 +17,7 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Skins { - using Default; + using LeagueSharp.SDK.Core.UI.IMenu.Skins.Default; /// /// Manages themes. diff --git a/Core/UI/IMenu/Values/MenuBool.cs b/Core/UI/IMenu/Values/MenuBool.cs index bc373af..a414ac9 100644 --- a/Core/UI/IMenu/Values/MenuBool.cs +++ b/Core/UI/IMenu/Values/MenuBool.cs @@ -20,8 +20,9 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Values using System; using System.Runtime.Serialization; using System.Security.Permissions; - using Core.Utils; - using Skins; + + using LeagueSharp.SDK.Core.UI.IMenu.Skins; + using LeagueSharp.SDK.Core.Utils; /// /// Menu boolean. diff --git a/Core/UI/IMenu/Values/MenuButton.cs b/Core/UI/IMenu/Values/MenuButton.cs index d85be8d..379f01e 100644 --- a/Core/UI/IMenu/Values/MenuButton.cs +++ b/Core/UI/IMenu/Values/MenuButton.cs @@ -17,8 +17,8 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Values { - using Core.Utils; - using Skins; + using LeagueSharp.SDK.Core.UI.IMenu.Skins; + using LeagueSharp.SDK.Core.Utils; /// /// A Button designed to perform an action when clicked diff --git a/Core/UI/IMenu/Values/MenuColor.cs b/Core/UI/IMenu/Values/MenuColor.cs index 2f17317..3e77423 100644 --- a/Core/UI/IMenu/Values/MenuColor.cs +++ b/Core/UI/IMenu/Values/MenuColor.cs @@ -20,9 +20,11 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Values using System; using System.Runtime.Serialization; using System.Security.Permissions; - using Core.Utils; + + using LeagueSharp.SDK.Core.UI.IMenu.Skins; + using LeagueSharp.SDK.Core.Utils; + using SharpDX; - using Skins; /// /// The menu color. diff --git a/Core/UI/IMenu/Values/MenuKeyBind.cs b/Core/UI/IMenu/Values/MenuKeyBind.cs index b847920..f020400 100644 --- a/Core/UI/IMenu/Values/MenuKeyBind.cs +++ b/Core/UI/IMenu/Values/MenuKeyBind.cs @@ -21,10 +21,12 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Values using System.Runtime.Serialization; using System.Security.Permissions; using System.Windows.Forms; - using Core.Utils; - using Enumerations; - using Skins; - using MenuItem = MenuItem; + + using LeagueSharp.SDK.Core.Enumerations; + using LeagueSharp.SDK.Core.UI.IMenu.Skins; + using LeagueSharp.SDK.Core.Utils; + + using MenuItem = LeagueSharp.SDK.Core.UI.IMenu.MenuItem; /// /// Menu KeyBind. @@ -80,11 +82,6 @@ public MenuKeyBind(string name, string displayName, Keys key, KeyBindType type, Game.OnWndProc += this.Game_OnWndProc; } - private void Game_OnWndProc(WndEventArgs args) - { - this.Handler.OnWndProc(new WindowsKeys(args)); - } - /// /// Initializes a new instance of the class. /// @@ -265,6 +262,11 @@ protected virtual void GetObjectData(SerializationInfo info, StreamingContext co info.AddValue("active", this.active, typeof(bool)); } + private void Game_OnWndProc(WndEventArgs args) + { + this.Handler.OnWndProc(new WindowsKeys(args)); + } + #endregion } } \ No newline at end of file diff --git a/Core/UI/IMenu/Values/MenuList.cs b/Core/UI/IMenu/Values/MenuList.cs index a64ddaf..17a42bb 100644 --- a/Core/UI/IMenu/Values/MenuList.cs +++ b/Core/UI/IMenu/Values/MenuList.cs @@ -46,7 +46,9 @@ public abstract class MenuList : MenuItem /// /// Initializes a new instance of the class. /// - internal MenuList() {} + internal MenuList() + { + } /// /// Initializes a new instance of the class. @@ -55,7 +57,9 @@ internal MenuList() {} /// Display name of the component /// String to make this component unique protected MenuList(string name, string displayName, string uniqueString = "") - : base(name, displayName, uniqueString) {} + : base(name, displayName, uniqueString) + { + } #endregion @@ -219,7 +223,9 @@ public MenuList(string name, string displayName, IEnumerable objects, string /// The unique String. /// public MenuList(string name, string displayName, string uniqueString = "") - : this(name, displayName, Enum.GetValues(typeof(T)).Cast(), uniqueString) {} + : this(name, displayName, Enum.GetValues(typeof(T)).Cast(), uniqueString) + { + } /// /// Initializes a new instance of the class. diff --git a/Core/UI/IMenu/Values/MenuSeparator.cs b/Core/UI/IMenu/Values/MenuSeparator.cs index 1e2382c..b16f2a5 100644 --- a/Core/UI/IMenu/Values/MenuSeparator.cs +++ b/Core/UI/IMenu/Values/MenuSeparator.cs @@ -17,8 +17,8 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Values { - using Core.Utils; - using Skins; + using LeagueSharp.SDK.Core.UI.IMenu.Skins; + using LeagueSharp.SDK.Core.Utils; /// /// A menu separator. diff --git a/Core/UI/IMenu/Values/MenuSlider.cs b/Core/UI/IMenu/Values/MenuSlider.cs index d674b45..40ea2ac 100644 --- a/Core/UI/IMenu/Values/MenuSlider.cs +++ b/Core/UI/IMenu/Values/MenuSlider.cs @@ -20,8 +20,9 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Values using System; using System.Runtime.Serialization; using System.Security.Permissions; - using Core.Utils; - using Skins; + + using LeagueSharp.SDK.Core.UI.IMenu.Skins; + using LeagueSharp.SDK.Core.Utils; /// /// Menu Slider. @@ -67,11 +68,11 @@ public class MenuSlider : MenuItem, ISerializable /// String used in saving settings /// public MenuSlider( - string name, - string displayName, - int value = 0, - int minValue = 0, - int maxValue = 100, + string name, + string displayName, + int value = 0, + int minValue = 0, + int maxValue = 100, string uniqueString = "") : base(name, displayName, uniqueString) { diff --git a/Core/UI/IMenu/Values/MenuSliderButton.cs b/Core/UI/IMenu/Values/MenuSliderBool.cs similarity index 75% rename from Core/UI/IMenu/Values/MenuSliderButton.cs rename to Core/UI/IMenu/Values/MenuSliderBool.cs index ee64c2b..54b2a48 100644 --- a/Core/UI/IMenu/Values/MenuSliderButton.cs +++ b/Core/UI/IMenu/Values/MenuSliderBool.cs @@ -20,36 +20,34 @@ namespace LeagueSharp.SDK.Core.UI.IMenu.Values using System; using System.Runtime.Serialization; using System.Security.Permissions; - using Core.Utils; - using Skins; + + using LeagueSharp.SDK.Core.UI.IMenu.Skins; + using LeagueSharp.SDK.Core.Utils; /// /// Menu Slider. /// [Serializable] - public class MenuSliderButton : MenuItem, ISerializable + public class MenuSliderBool : MenuItem, ISerializable { #region Fields - /// - /// The original. - /// - private readonly int original; - /// /// The boriginal. /// - private readonly bool bOriginal; + private readonly bool originalBoolValue; /// - /// The value. + /// The original. /// - private int value; + private readonly int originalSliderValue; + + private bool boolValue; /// - /// The Button value. + /// The value. /// - private bool bValue; + private int sliderValue; #endregion @@ -73,38 +71,39 @@ public class MenuSliderButton : MenuItem, ISerializable /// /// Maximum Value Boundary /// - /// - /// The Button Value + /// + /// The Bool Value /// /// /// String used in saving settings /// - public MenuSliderButton( - string name, - string displayName, - int value = 0, - int minValue = 0, + public MenuSliderBool( + string name, + string displayName, + int value = 0, + int minValue = 0, int maxValue = 100, - bool bValue = false, + bool boolean = false, string uniqueString = "") : base(name, displayName, uniqueString) { - this.MinValue = minValue; - this.MaxValue = maxValue; - this.SValue = value; - this.original = value; - this.bOriginal = bValue; + this.SliderMinValue = minValue; + this.SliderMaxValue = maxValue; + this.SliderValue = value; + this.BoolValue = boolean; + this.originalSliderValue = value; + this.originalBoolValue = boolean; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The information. /// The context. - protected MenuSliderButton(SerializationInfo info, StreamingContext context) + protected MenuSliderBool(SerializationInfo info, StreamingContext context) { - this.value = (int)info.GetValue("value", typeof(int)); - this.bValue = (bool)info.GetValue("bValue", typeof(bool)); + this.sliderValue = (int)info.GetValue("sliderValue", typeof(int)); + this.boolValue = (bool)info.GetValue("boolValue", typeof(bool)); } #endregion @@ -112,7 +111,22 @@ protected MenuSliderButton(SerializationInfo info, StreamingContext context) #region Public Properties /// - /// Gets or sets a value indicating whether this is interacting. + /// Gets or sets a value indicating whether the boolean value is true or false. + /// + public bool BoolValue + { + get + { + return this.boolValue; + } + set + { + this.boolValue = value; + } + } + + /// + /// Gets or sets a value indicating whether this is interacting. /// /// /// true if interacting; otherwise, false. @@ -122,56 +136,40 @@ protected MenuSliderButton(SerializationInfo info, StreamingContext context) /// /// Gets or sets the Slider Maximum Value. /// - public int MaxValue { get; set; } + public int SliderMaxValue { get; set; } /// /// Gets or sets the Slider Minimum Value. /// - public int MinValue { get; set; } - - /// - /// Gets the Slider Value if Button is active. - /// - public int Value - { - get - { - return this.SValue != this.MinValue && this.BValue ? this.value : -1; - } - } + public int SliderMinValue { get; set; } /// /// Gets or sets the Slider Current Value. /// - public int SValue + public int SliderValue { get { - return this.value; + return this.sliderValue; } set { - if (value < this.MinValue) + if (value < this.SliderMinValue) { - this.value = this.MinValue; + this.sliderValue = this.SliderMinValue; } - else if (value > this.MaxValue) + else if (value > this.SliderMaxValue) { - this.value = this.MaxValue; + this.sliderValue = this.SliderMaxValue; } else { - this.value = value; + this.sliderValue = value; } } } - /// - /// Gets or sets a value indicating whether the boolean value is true or false. - /// - public bool BValue { get; set; } - /// /// Slider Item Width. /// @@ -195,8 +193,8 @@ public override void Draw() /// The value. public override void Extract(MenuItem menuValue) { - this.SValue = ((MenuSliderButton)menuValue).value; - this.BValue = ((MenuSliderButton)menuValue).bValue; + this.SliderValue = ((MenuSliderBool)menuValue).sliderValue; + this.BoolValue = ((MenuSliderBool)menuValue).boolValue; } /// @@ -204,8 +202,8 @@ public override void Extract(MenuItem menuValue) /// public override void RestoreDefault() { - this.SValue = this.original; - this.BValue = this.bOriginal; + this.SliderValue = this.originalSliderValue; + this.BoolValue = this.originalBoolValue; } /// @@ -241,8 +239,8 @@ void ISerializable.GetObjectData(SerializationInfo info, StreamingContext contex throw new ArgumentNullException(nameof(info)); } - info.AddValue("value", this.SValue, typeof(int)); - info.AddValue("bValue", this.BValue, typeof(bool)); + info.AddValue("sliderValue", this.SliderValue, typeof(int)); + info.AddValue("boolValue", this.BoolValue, typeof(bool)); } #endregion @@ -260,7 +258,7 @@ void ISerializable.GetObjectData(SerializationInfo info, StreamingContext contex /// protected override ADrawable BuildHandler(ITheme theme) { - return theme.BuildSliderButtonHandler(this); + return theme.BuildSliderBoolHandler(this); } /// @@ -276,8 +274,8 @@ protected override ADrawable BuildHandler(ITheme theme) [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)] protected virtual void GetObjectData(SerializationInfo info, StreamingContext context) { - info.AddValue("value", this.SValue, typeof(int)); - info.AddValue("bValue", this.BValue, typeof(bool)); + info.AddValue("sliderValue", this.SliderValue, typeof(int)); + info.AddValue("boolValue", this.BoolValue, typeof(bool)); } #endregion diff --git a/Core/UI/INotifications/ANotification.cs b/Core/UI/INotifications/ANotification.cs index af8af90..04d8cae 100644 --- a/Core/UI/INotifications/ANotification.cs +++ b/Core/UI/INotifications/ANotification.cs @@ -17,7 +17,7 @@ namespace LeagueSharp.SDK.Core.UI.INotifications { - using Core.Utils; + using LeagueSharp.SDK.Core.Utils; using SharpDX; diff --git a/Core/UI/INotifications/Notification.cs b/Core/UI/INotifications/Notification.cs index 2f9f0bc..45bec7e 100644 --- a/Core/UI/INotifications/Notification.cs +++ b/Core/UI/INotifications/Notification.cs @@ -20,13 +20,16 @@ namespace LeagueSharp.SDK.Core.UI.INotifications using System; using System.Collections.Generic; using System.Drawing; - using Core.Utils; - using Enumerations; - using Extensions.SharpDX; - using Math; - using Properties; + + using LeagueSharp.SDK.Core.Enumerations; + using LeagueSharp.SDK.Core.Extensions.SharpDX; + using LeagueSharp.SDK.Core.Math; + using LeagueSharp.SDK.Core.Utils; + using LeagueSharp.SDK.Properties; + using SharpDX; using SharpDX.Direct3D9; + using Color = SharpDX.Color; using Font = SharpDX.Direct3D9.Font; using Rectangle = SharpDX.Rectangle; @@ -56,57 +59,55 @@ public class Notification : ANotification /// The body font. /// private static readonly Font BodyFont = new Font( - Drawing.Direct3DDevice, - 13, - 0, - FontWeight.DoNotCare, - 5, - false, - FontCharacterSet.Default, - FontPrecision.Character, - FontQuality.Antialiased, - FontPitchAndFamily.Mono | FontPitchAndFamily.Decorative, + Drawing.Direct3DDevice, + 13, + 0, + FontWeight.DoNotCare, + 5, + false, + FontCharacterSet.Default, + FontPrecision.Character, + FontQuality.Antialiased, + FontPitchAndFamily.Mono | FontPitchAndFamily.Decorative, "Tahoma"); /// /// The header font. /// private static readonly Font HeaderFont = new Font( - Drawing.Direct3DDevice, - 16, - 0, - FontWeight.Bold, - 5, - false, - FontCharacterSet.Default, - FontPrecision.Character, - FontQuality.Antialiased, - FontPitchAndFamily.Mono | FontPitchAndFamily.Decorative, + Drawing.Direct3DDevice, + 16, + 0, + FontWeight.Bold, + 5, + false, + FontCharacterSet.Default, + FontPrecision.Character, + FontQuality.Antialiased, + FontPitchAndFamily.Mono | FontPitchAndFamily.Decorative, "Tahoma"); /// /// The hide icon texture. /// private static readonly Texture HideTexture = Texture.FromMemory( - Drawing.Direct3DDevice, - (byte[])new ImageConverter().ConvertTo(Resources.notifications_arrow, typeof(byte[])), - Resources.notifications_arrow.Width, - Resources.notifications_arrow.Height, - 0, - Usage.None, - Format.A1, - Pool.Managed, - Filter.Default, - Filter.Default, + Drawing.Direct3DDevice, + (byte[])new ImageConverter().ConvertTo(Resources.notifications_arrow, typeof(byte[])), + Resources.notifications_arrow.Width, + Resources.notifications_arrow.Height, + 0, + Usage.None, + Format.A1, + Pool.Managed, + Filter.Default, + Filter.Default, 0); /// /// The line. /// private static readonly Line Line = new Line(Drawing.Direct3DDevice) - { - Antialias = true, GLLines = true, Width = 300f - }; + { Antialias = true, GLLines = true, Width = 300f }; /// /// The sprite. @@ -404,6 +405,11 @@ public bool IconFlash #region Properties + /// + /// Gets the hide icon bitmap. + /// + private static Bitmap HideBitmap => Resources.notifications_arrow; + /// /// Gets or sets the body height. /// @@ -424,11 +430,6 @@ public bool IconFlash /// private Texture IconTexture { get; set; } - /// - /// Gets the hide icon bitmap. - /// - private static Bitmap HideBitmap => Resources.notifications_arrow; - #endregion #region Public Methods and Operators @@ -464,7 +465,7 @@ public List FormatText(string value, bool htmlSupport) formatLines.Add(!string.IsNullOrEmpty(breakLine) ? breakLine : string.Empty); valueCopy = valueCopy.Substring( - valueCopy.IndexOf("
", StringComparison.Ordinal) + 5, + valueCopy.IndexOf("
", StringComparison.Ordinal) + 5, valueCopy.Length - valueCopy.IndexOf("
", StringComparison.Ordinal) - 5); } @@ -536,7 +537,7 @@ public List FormatText(string value, bool htmlSupport) } /// - /// Gets the notification reserved height. + /// Gets the notification reserved height. /// /// /// The reserved height in float units. @@ -547,7 +548,7 @@ public override float GetReservedHeight() } /// - /// Gets the notification reserved width. + /// Gets the notification reserved width. /// /// /// The reserved width in float units. @@ -577,9 +578,9 @@ public override void OnDraw(Vector2 basePosition) Line.Draw( new[] { - new Vector2(basePosition.X - (this.Width / 2f), basePosition.Y), + new Vector2(basePosition.X - (this.Width / 2f), basePosition.Y), new Vector2(basePosition.X - (this.Width / 2f), basePosition.Y + this.HeaderHeight) - }, + }, new ColorBGRA(0, 0, 0, 255 / 2)); if (this.IsOpen || this.DrawBodyHeight > 0 || this.DrawFooterHeight > 0) @@ -587,22 +588,22 @@ public override void OnDraw(Vector2 basePosition) Line.Draw( new[] { - new Vector2(basePosition.X - (this.Width / 2f), basePosition.Y + this.HeaderHeight), + new Vector2(basePosition.X - (this.Width / 2f), basePosition.Y + this.HeaderHeight), new Vector2( - basePosition.X - (this.Width / 2f), + basePosition.X - (this.Width / 2f), basePosition.Y + this.HeaderHeight + this.DrawBodyHeight) - }, + }, new ColorBGRA(0, 0, 0, (byte)(255 / 1.5f))); Line.Draw( new[] { new Vector2( - basePosition.X - (this.Width / 2f), - basePosition.Y + this.HeaderHeight + this.DrawBodyHeight), + basePosition.X - (this.Width / 2f), + basePosition.Y + this.HeaderHeight + this.DrawBodyHeight), new Vector2( - basePosition.X - (this.Width / 2f), + basePosition.X - (this.Width / 2f), basePosition.Y + this.HeaderHeight + this.DrawFooterHeight + this.DrawBodyHeight) - }, + }, new ColorBGRA(0, 0, 0, (byte)(255 / 1.25f))); } @@ -635,12 +636,12 @@ public override void OnDraw(Vector2 basePosition) { Sprite.Transform = Matrix.Scaling(0.7f, 0.7f, 0f) * Matrix.Translation( - basePosition.X - this.Width + 5f, - basePosition.Y + this.HeaderHeight + this.BodyHeight + 1.5f, + basePosition.X - this.Width + 5f, + basePosition.Y + this.HeaderHeight + this.BodyHeight + 1.5f, 0f); Sprite.Draw( - HideTexture, - Color.White, + HideTexture, + Color.White, new Rectangle(0, 0, HideBitmap.Width, (int)this.DrawFooterHeight)); } @@ -708,16 +709,16 @@ public override void OnUpdate() } /// - /// OnWndProc event, occurs on a windows process message to the thread. + /// OnWndProc event, occurs on a windows process message to the thread. /// /// - /// The base position + /// The base position /// /// - /// The windows keys + /// The windows keys /// /// - /// Indicates whether it's an edit message. + /// Indicates whether it's an edit message. /// public override void OnWndProc(Vector2 basePosition, WindowsKeys windowsKeys, bool isEdit) { @@ -789,8 +790,8 @@ private Rectangle GetHeaderRectangle(Vector2 basePosition) var x = basePosition.X - (this.Width / 2f) - BaseLeftPosition; var y = basePosition.Y + new Rectangle(0, 0, 0, (int)this.HeaderHeight).GetCenteredText( - Sprite, - this.Header, + Sprite, + this.Header, CenteredFlags.VerticalCenter).Y; return new Rectangle((int)x, (int)y, (int)this.Width, (int)this.HeaderHeight); diff --git a/Core/UI/INotifications/NotificationIcons.cs b/Core/UI/INotifications/NotificationIcons.cs index c9c9226..24403a8 100644 --- a/Core/UI/INotifications/NotificationIcons.cs +++ b/Core/UI/INotifications/NotificationIcons.cs @@ -21,8 +21,8 @@ namespace LeagueSharp.SDK.Core.UI.INotifications using System.Drawing; using System.Linq; - using Enumerations; - using Properties; + using LeagueSharp.SDK.Core.Enumerations; + using LeagueSharp.SDK.Properties; using SharpDX.Direct3D9; @@ -39,9 +39,9 @@ public class NotificationIcons private static readonly IDictionary IconBitmaps = new Dictionary { - { NotificationIconType.Error, Resources.notifications_error }, - { NotificationIconType.Warning, Resources.notifications_warning }, - { NotificationIconType.Check, Resources.notifications_check }, + { NotificationIconType.Error, Resources.notifications_error }, + { NotificationIconType.Warning, Resources.notifications_warning }, + { NotificationIconType.Check, Resources.notifications_check }, { NotificationIconType.Select, Resources.notifications_select } }; @@ -63,18 +63,18 @@ static NotificationIcons() foreach (var bitmap in IconBitmaps.Where(bitmap => !IconTextures.ContainsKey(bitmap.Key))) { IconTextures.Add( - bitmap.Key, + bitmap.Key, Texture.FromMemory( - Drawing.Direct3DDevice, - (byte[])new ImageConverter().ConvertTo(bitmap.Value, typeof(byte[])), - bitmap.Value.Width, - bitmap.Value.Height, - 0, - Usage.None, - Format.A1, - Pool.Managed, - Filter.Default, - Filter.Default, + Drawing.Direct3DDevice, + (byte[])new ImageConverter().ConvertTo(bitmap.Value, typeof(byte[])), + bitmap.Value.Width, + bitmap.Value.Height, + 0, + Usage.None, + Format.A1, + Pool.Managed, + Filter.Default, + Filter.Default, 0)); } } diff --git a/Core/UI/INotifications/Notifications.cs b/Core/UI/INotifications/Notifications.cs index 3d871ad..422c14a 100644 --- a/Core/UI/INotifications/Notifications.cs +++ b/Core/UI/INotifications/Notifications.cs @@ -20,13 +20,15 @@ namespace LeagueSharp.SDK.Core.UI.INotifications using System; using System.Collections.Generic; using System.Linq; - using Core.Utils; - using Enumerations; - using Events; - using Extensions; - using Extensions.SharpDX; - using IMenu; - using IMenu.Values; + + using LeagueSharp.SDK.Core.Enumerations; + using LeagueSharp.SDK.Core.Events; + using LeagueSharp.SDK.Core.Extensions; + using LeagueSharp.SDK.Core.Extensions.SharpDX; + using LeagueSharp.SDK.Core.UI.IMenu; + using LeagueSharp.SDK.Core.UI.IMenu.Values; + using LeagueSharp.SDK.Core.Utils; + using SharpDX; using SharpDX.Direct3D9; @@ -199,9 +201,9 @@ private static void OnDraw(EventArgs args) Line.Draw( new[] { - new Vector2(Position.X - (line.Width / 2f), Position.Y), + new Vector2(Position.X - (line.Width / 2f), Position.Y), new Vector2(Position.X - (line.Width / 2f), height) - }, + }, new ColorBGRA(255, 0, 0, 255 / 2)); Line.End(); } @@ -254,9 +256,9 @@ private static void OnWndProc(WndEventArgs args) EditButtonDown = value && windowsKeys.Cursor.IsUnderRectangle( - Position.X - widthRectangle, - Position.Y, - widthRectangle, + Position.X - widthRectangle, + Position.Y, + widthRectangle, heightRectangle); if (!value) diff --git a/Core/UI/Utils.cs b/Core/UI/Utils.cs index 6f1502c..3043ae1 100644 --- a/Core/UI/Utils.cs +++ b/Core/UI/Utils.cs @@ -8,41 +8,85 @@ class Utils { + #region Static Fields + /// /// The line. /// private static readonly Line Line = new Line(Drawing.Direct3DDevice) { GLLines = true }; + #endregion + + #region Enums + /// - /// Draws a line from X to Y with a width and a color + /// Circle Type Enum /// - /// Position X1 - /// Position Y1 - /// Position X2 - /// Position Y2 - /// Width - /// Color - public static void DrawLine(float xa, float ya, float xb, float yb, float dwWidth, Color color) + public enum CircleType { - Vector2[] vLine = new Vector2[2]; - Line.Width = dwWidth; - Line.Begin(); + Full, - vLine[0][0] = xa; // Set points into array - vLine[0][1] = ya; - vLine[1][0] = xb; - vLine[1][1] = yb; + Half, - Line.Draw(new[] - { - vLine[0], - vLine[1] - }, color); // Draw with Line, number of lines, and color - Line.End(); // finish + Quarter + } + + #endregion + + #region Public Methods and Operators + + /// + /// Draws a Box + /// + /// Position X + /// Position Y + /// Width + /// Height + /// Line Width + /// Color + public static void DrawBox(float x, float y, float w, float h, float linewidth, Color color) + { + if (linewidth.Equals(0) || linewidth.Equals(1)) + { + DrawBoxFilled(x, y, w, 1, color); // Top + DrawBoxFilled(x, y + h - 1, w, 1, color); // Bottom + DrawBoxFilled(x, y + 1, 1, h - 2 * 1, color); // Left + DrawBoxFilled(x + w - 1, y + 1, 1, h - 2 * 1, color); // Right + } + else + { + DrawBoxFilled(x, y, w, linewidth, color); // Top + DrawBoxFilled(x, y + h - linewidth, w, linewidth, color); // Bottom + DrawBoxFilled(x, y + linewidth, linewidth, h - 2 * linewidth, color); // Left + DrawBoxFilled(x + w - linewidth, y + linewidth, linewidth, h - 2 * linewidth, color); // Right + } } /// - /// Draws a filled Box + /// Draws a bordered Box + /// + /// Position X + /// Position Y + /// Width + /// Height + /// The border width + /// Color + /// Border Color + public static void DrawBoxBordered( + float x, + float y, + float w, + float h, + float borderWidth, + Color color, + Color colorBorder) + { + DrawBoxFilled(x, y, w, h, color); + DrawBox(x - borderWidth, y - borderWidth, w + 2 * borderWidth, h + borderWidth, borderWidth, colorBorder); + } + + /// + /// Draws a filled Box /// /// Position X /// Position Y @@ -51,7 +95,7 @@ public static void DrawLine(float xa, float ya, float xb, float yb, float dwWidt /// Color public static void DrawBoxFilled(float x, float y, float w, float h, Color color) { - Vector2[] vLine = new Vector2[2]; + var vLine = new Vector2[2]; Line.Width = w; Line.Begin(); @@ -60,77 +104,102 @@ public static void DrawBoxFilled(float x, float y, float w, float h, Color color vLine[1][0] = x + w / 2; vLine[1][1] = y + h; - Line.Draw(new[] - { - vLine[0], - vLine[1] - }, color); + Line.Draw(new[] { vLine[0], vLine[1] }, color); Line.End(); } /// - /// Draws a rounded Rectangle + /// Draws a rounded Box. If Smoothing is true it will draw a border too. /// /// Position X /// Position Y /// Width /// Height - /// Smooth + /// Radius + /// Smoothing /// Color - public static void RoundedRectangle(int x, int y, int w, int h, int iSmooth, Color color) + /// Border Color + /// Corner Color + public static void DrawBoxRounded( + float x, + float y, + float w, + float h, + float radius, + bool smoothing, + Color color, + Color bcolor, + Color? ccolor = null) { - Vector2[] pt = new Vector2[4]; - - // Get all corners - pt[0].X = x + (w - iSmooth); - pt[0].Y = y + (h - iSmooth); - - pt[1].X = x + iSmooth; - pt[1].Y = y + (h - iSmooth); - - pt[2].X = x + iSmooth; - pt[2].Y = y + iSmooth; - - pt[3].X = x + w - iSmooth; - pt[3].Y = y + iSmooth; - + var cornerColor = ccolor ?? bcolor; + DrawBoxFilled(x + radius, y + radius, w - 2 * radius - 1, h - 2 * radius - 1, color); // Center rect. + DrawBoxFilled(x + radius, y, w - 2 * radius - 1, radius, color); // Top rect. + DrawBoxFilled(x + radius, y + h - radius - 1, w - 2 * radius - 1, radius, color); // Bottom rect. + DrawBoxFilled(x, y + radius, radius, h - 2 * radius - 1, color); // Left rect. + DrawBoxFilled(x + w - radius - 1, y + radius, radius, h - 2 * radius - 1, color); // Right rect. - // Draw cross - DrawBoxFilled(x, y + iSmooth, w, h - iSmooth * 2, color); - - DrawBoxFilled(x + iSmooth, y, w - iSmooth * 2, h, color); - - - float fDegree = 0; - - for (int i = 0; i < 4; i++) + // Smoothing method + if (smoothing) { - for (float k = fDegree; k < fDegree + (Math.PI * 2) / 4f; k += (float)((1) * (Math.PI / 180.0f))) - { - // Draw quarter circles on every corner - DrawLine(pt[i].X, pt[i].Y, - pt[i].X + (float)(Math.Cos(k) * iSmooth), - pt[i].Y + (float)(Math.Sin(k) * iSmooth), - 1, color); // 3 is with line width - } - - fDegree += (float)(Math.PI * 2) / 4; // quarter circle offset + DrawCircleFilled(x + radius, y + radius, radius - 1, 0, CircleType.Quarter, true, 16, color); + // Top-left corner + DrawCircleFilled(x + w - radius - 1, y + radius, radius - 1, 90, CircleType.Quarter, true, 16, color); + // Top-right corner + DrawCircleFilled( + x + w - radius - 1, + y + h - radius - 1, + radius - 1, + 180, + CircleType.Quarter, + true, + 16, + color); // Bottom-right corner + DrawCircleFilled(x + radius, y + h - radius - 1, radius - 1, 270, CircleType.Quarter, true, 16, color); + // Bottom-left corner + + DrawCircle(x + radius + 1, y + radius + 1, radius, 0, CircleType.Quarter, true, 16, cornerColor); + // Top-left corner + DrawCircle(x + w - radius - 1, y + radius + 1, radius, 90, CircleType.Quarter, true, 16, cornerColor); + // Top-right corner + DrawCircle( + x + w - radius - 1, + y + h - radius - 1, + radius, + 180, + CircleType.Quarter, + true, + 16, + cornerColor); // Bottom-right corner + DrawCircle(x + radius + 1, y + h - radius - 1, radius, 270, CircleType.Quarter, true, 16, cornerColor); + // Bottom-left corner + + DrawLine(x + radius, y, x + w - radius - 1, y, 1, bcolor); // Top line + DrawLine(x + radius, y + h - 2, x + w - radius - 1, y + h - 2, 1, bcolor); // Bottom line + DrawLine(x, y + radius, x, y + h - radius - 1, 1, bcolor); // Left line + DrawLine(x + w - 2, y + radius, x + w - 2, y + h - radius - 1, 1, bcolor); // Right line + } + else + { + DrawCircleFilled(x + radius, y + radius, radius, 0, CircleType.Quarter, false, 16, color); + // Top-left corner + DrawCircleFilled(x + w - radius - 1, y + radius, radius, 90, CircleType.Quarter, false, 16, color); + // Top-right corner + DrawCircleFilled( + x + w - radius - 1, + y + h - radius - 1, + radius, + 180, + CircleType.Quarter, + false, + 16, + color); // Bottom-right corner + DrawCircleFilled(x + radius, y + h - radius - 1, radius, 270, CircleType.Quarter, false, 16, color); + // Bottom-left corner } - - } - - /// - /// Circle Type Enum - /// - public enum CircleType - { - Full, - Half, - Quarter } /// - /// Draws a Circle (not filled) + /// Draws a Circle (not filled) /// /// Position X /// Position Y @@ -140,51 +209,82 @@ public enum CircleType /// Smooth Antialiasing /// Real smooth value /// Color - public static void DrawCircle(float x, float y, float radius, int rotate, CircleType type, bool smoothing, int resolution, Color color) + public static void DrawCircle( + float x, + float y, + float radius, + int rotate, + CircleType type, + bool smoothing, + int resolution, + Color color) { - VertexBuffer vertices = new VertexBuffer( - Drawing.Direct3DDevice, Utilities.SizeOf() * 2 * (resolution + 4), Usage.WriteOnly, VertexFormat.Diffuse | VertexFormat.PositionRhw, Pool.Default); + var vertices = new VertexBuffer( + Drawing.Direct3DDevice, + Utilities.SizeOf() * 2 * (resolution + 4), + Usage.WriteOnly, + VertexFormat.Diffuse | VertexFormat.PositionRhw, + Pool.Default); - float angle = rotate * (float)Math.PI / 180f; - float pi = 0.0f; + var angle = rotate * (float)Math.PI / 180f; + var pi = 0.0f; - if (type == CircleType.Full) pi = (float)Math.PI; // Full circle - if (type == CircleType.Half) pi = (float)Math.PI / 2f; // 1/2 circle - if (type == CircleType.Quarter) pi = (float)Math.PI / 4f; // 1/4 circle + if (type == CircleType.Full) + { + pi = (float)Math.PI; // Full circle + } + if (type == CircleType.Half) + { + pi = (float)Math.PI / 2f; // 1/2 circle + } + if (type == CircleType.Quarter) + { + pi = (float)Math.PI / 4f; // 1/4 circle + } - List data = new List(); + var data = new List(); - for (int i = 0; i < resolution + 4; i++) + for (var i = 0; i < resolution + 4; i++) { - float x1 = x - radius * (float)Math.Cos(i * (2f * pi / resolution)); - float y1 = y - radius * (float)Math.Sin(i * (2f * pi / resolution)); - data.AddRange(new[] - { - new Vector4(x1, y1, 0f, 1.0f), color.ToVector4() - }); + var x1 = x - radius * (float)Math.Cos(i * (2f * pi / resolution)); + var y1 = y - radius * (float)Math.Sin(i * (2f * pi / resolution)); + data.AddRange(new[] { new Vector4(x1, y1, 0f, 1.0f), color.ToVector4() }); } // Rotate matrix - int res = 2 * resolution + 4; - for (int i = 0; i < res; i = i + 2) + var res = 2 * resolution + 4; + for (var i = 0; i < res; i = i + 2) { - data[i] = new Vector4((float)(x + Math.Cos(angle) * (data[i].X - x) - Math.Sin(angle) * (data[i].Y - y)), + data[i] = new Vector4( + (float)(x + Math.Cos(angle) * (data[i].X - x) - Math.Sin(angle) * (data[i].Y - y)), (float)(y + Math.Sin(angle) * (data[i].X - x) + Math.Cos(angle) * (data[i].Y - y)), - data[i].Z, data[i].W); + data[i].Z, + data[i].W); } vertices.Lock(0, 0, LockFlags.None).WriteRange(data.ToArray()); vertices.Unlock(); - VertexElement[] vertexElements = { + VertexElement[] vertexElements = + { new VertexElement( - 0, 0, DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.Position, 0), + 0, + 0, + DeclarationType.Float4, + DeclarationMethod.Default, + DeclarationUsage.Position, + 0), new VertexElement( - 0, 16, DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.Color, 0), + 0, + 16, + DeclarationType.Float4, + DeclarationMethod.Default, + DeclarationUsage.Color, + 0), VertexElement.VertexDeclarationEnd - }; + }; - VertexDeclaration vertexDeclaration = new VertexDeclaration(Drawing.Direct3DDevice, vertexElements); + var vertexDeclaration = new VertexDeclaration(Drawing.Direct3DDevice, vertexElements); if (smoothing) { @@ -208,7 +308,7 @@ public static void DrawCircle(float x, float y, float radius, int rotate, Circle } /// - /// Draws a filled Circle + /// Draws a filled Circle /// /// Position X /// Position Y @@ -218,54 +318,83 @@ public static void DrawCircle(float x, float y, float radius, int rotate, Circle /// Smooth Antialiasing /// Real smooth value /// Color - public static void DrawCircleFilled(float x, float y, float rad, float rotate, CircleType type, bool smoothing, int resolution, Color color) + public static void DrawCircleFilled( + float x, + float y, + float rad, + float rotate, + CircleType type, + bool smoothing, + int resolution, + Color color) { - VertexBuffer vertices = new VertexBuffer( - Drawing.Direct3DDevice, Utilities.SizeOf() * 2 * (resolution + 4), Usage.WriteOnly, VertexFormat.Diffuse | VertexFormat.PositionRhw, Pool.Default); + var vertices = new VertexBuffer( + Drawing.Direct3DDevice, + Utilities.SizeOf() * 2 * (resolution + 4), + Usage.WriteOnly, + VertexFormat.Diffuse | VertexFormat.PositionRhw, + Pool.Default); - double angle = rotate * Math.PI / 180d; - double pi = 0.0d; + var angle = rotate * Math.PI / 180d; + var pi = 0.0d; - if (type == CircleType.Full) pi = Math.PI; // Full circle - if (type == CircleType.Half) pi = Math.PI / 2d; // 1/2 circle - if (type == CircleType.Quarter) pi = Math.PI / 4d; // 1/4 circle + if (type == CircleType.Full) + { + pi = Math.PI; // Full circle + } + if (type == CircleType.Half) + { + pi = Math.PI / 2d; // 1/2 circle + } + if (type == CircleType.Quarter) + { + pi = Math.PI / 4d; // 1/4 circle + } - List data = new List(new [] - { - new Vector4(x, y, 0f, 1f), color.ToVector4() - }); + var data = new List(new[] { new Vector4(x, y, 0f, 1f), color.ToVector4() }); - for (int i = 1; i < resolution + 4; i++) + for (var i = 1; i < resolution + 4; i++) { - float x1 = (float)(x - rad * Math.Cos(pi * ((i - 1) / (resolution / 2.0f)))); - float y1 = (float)(y - rad * Math.Sin(pi * ((i - 1) / (resolution / 2.0f)))); - data.AddRange(new[] - { - new Vector4(x1, y1, 0f, 1.0f), color.ToVector4() - }); + var x1 = (float)(x - rad * Math.Cos(pi * ((i - 1) / (resolution / 2.0f)))); + var y1 = (float)(y - rad * Math.Sin(pi * ((i - 1) / (resolution / 2.0f)))); + data.AddRange(new[] { new Vector4(x1, y1, 0f, 1.0f), color.ToVector4() }); } // Rotate matrix - int res = 2 * resolution + 4; - for (int i = 0; i < res; i = i + 2) + var res = 2 * resolution + 4; + for (var i = 0; i < res; i = i + 2) { - data[i] = new Vector4((float)(x + Math.Cos(angle) * (data[i].X - x) - Math.Sin(angle) * (data[i].Y - y)), + data[i] = new Vector4( + (float)(x + Math.Cos(angle) * (data[i].X - x) - Math.Sin(angle) * (data[i].Y - y)), (float)(y + Math.Sin(angle) * (data[i].X - x) + Math.Cos(angle) * (data[i].Y - y)), - data[i].Z, data[i].W); + data[i].Z, + data[i].W); } - vertices.Lock(0, Utilities.SizeOf() * 2 * (resolution + 4), LockFlags.None).WriteRange(data.ToArray()); + vertices.Lock(0, Utilities.SizeOf() * 2 * (resolution + 4), LockFlags.None) + .WriteRange(data.ToArray()); vertices.Unlock(); - VertexElement[] vertexElements = { + VertexElement[] vertexElements = + { new VertexElement( - 0, 0, DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.Position, 0), + 0, + 0, + DeclarationType.Float4, + DeclarationMethod.Default, + DeclarationUsage.Position, + 0), new VertexElement( - 0, 16, DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.Color, 0), + 0, + 16, + DeclarationType.Float4, + DeclarationMethod.Default, + DeclarationUsage.Color, + 0), VertexElement.VertexDeclarationEnd - }; + }; - VertexDeclaration vertexDeclaration = new VertexDeclaration(Drawing.Direct3DDevice, vertexElements); + var vertexDeclaration = new VertexDeclaration(Drawing.Direct3DDevice, vertexElements); if (smoothing) { @@ -289,103 +418,80 @@ public static void DrawCircleFilled(float x, float y, float rad, float rotate, C } /// - /// Draws a Box + /// Draws a line from X to Y with a width and a color /// - /// Position X - /// Position Y - /// Width - /// Height - /// Line Width + /// Position X1 + /// Position Y1 + /// Position X2 + /// Position Y2 + /// Width /// Color - public static void DrawBox(float x, float y, float w, float h, float linewidth, Color color) + public static void DrawLine(float xa, float ya, float xb, float yb, float dwWidth, Color color) { - if (linewidth.Equals(0) || linewidth.Equals(1)) - { - DrawBoxFilled(x, y, w, 1, color); // Top - DrawBoxFilled(x, y + h - 1, w, 1, color); // Bottom - DrawBoxFilled(x, y + 1, 1, h - 2 * 1, color); // Left - DrawBoxFilled(x + w - 1, y + 1, 1, h - 2 * 1, color); // Right - } - else - { - DrawBoxFilled(x, y, w, linewidth, color); // Top - DrawBoxFilled(x, y + h - linewidth, w, linewidth, color); // Bottom - DrawBoxFilled(x, y + linewidth, linewidth, h - 2 * linewidth, color); // Left - DrawBoxFilled(x + w - linewidth, y + linewidth, linewidth, h - 2 * linewidth, color); // Right - } - } + var vLine = new Vector2[2]; + Line.Width = dwWidth; + Line.Begin(); - /// - /// Draws a bordered Box - /// - /// Position X - /// Position Y - /// Width - /// Height - /// The border width - /// Color - /// Border Color - public static void DrawBoxBordered(float x, float y, float w, float h, float borderWidth, Color color, Color colorBorder) - { - DrawBoxFilled(x, y, w, h, color); - DrawBox(x - borderWidth, y - borderWidth, w + 2 * borderWidth, h + borderWidth, borderWidth, colorBorder); + vLine[0][0] = xa; // Set points into array + vLine[0][1] = ya; + vLine[1][0] = xb; + vLine[1][1] = yb; + + Line.Draw(new[] { vLine[0], vLine[1] }, color); // Draw with Line, number of lines, and color + Line.End(); // finish } /// - /// Draws a rounded Box. If Smoothing is true it will draw a border too. + /// Draws a rounded Rectangle /// /// Position X /// Position Y /// Width /// Height - /// Radius - /// Smoothing + /// Smooth /// Color - /// Border Color - /// Corner Color - public static void DrawBoxRounded(float x, float y, float w, float h, float radius, bool smoothing, Color color, Color bcolor, Color? ccolor = null) + public static void RoundedRectangle(int x, int y, int w, int h, int iSmooth, Color color) { - Color cornerColor; - if (!ccolor.HasValue) - { - cornerColor = bcolor; - } - else - { - cornerColor = ccolor.Value; - } + var pt = new Vector2[4]; - DrawBoxFilled(x + radius, y + radius, w - 2 * radius - 1, h - 2 * radius - 1, color); // Center rect. - DrawBoxFilled(x + radius, y, w - 2 * radius - 1, radius, color); // Top rect. - DrawBoxFilled(x + radius, y + h - radius - 1, w - 2 * radius - 1, radius, color); // Bottom rect. - DrawBoxFilled(x, y + radius, radius, h - 2 * radius - 1, color); // Left rect. - DrawBoxFilled(x + w - radius - 1, y + radius, radius, h - 2 * radius - 1, color); // Right rect. + // Get all corners + pt[0].X = x + (w - iSmooth); + pt[0].Y = y + (h - iSmooth); - // Smoothing method - if (smoothing) - { - DrawCircleFilled(x + radius, y + radius, radius - 1, 0, CircleType.Quarter, true, 16, color); // Top-left corner - DrawCircleFilled(x + w - radius - 1, y + radius, radius - 1, 90, CircleType.Quarter, true, 16, color); // Top-right corner - DrawCircleFilled(x + w - radius - 1, y + h - radius - 1, radius - 1, 180, CircleType.Quarter, true, 16, color); // Bottom-right corner - DrawCircleFilled(x + radius, y + h - radius - 1, radius - 1, 270, CircleType.Quarter, true, 16, color); // Bottom-left corner - - DrawCircle(x + radius + 1, y + radius + 1, radius, 0, CircleType.Quarter, true, 16, cornerColor); // Top-left corner - DrawCircle(x + w - radius - 1, y + radius + 1, radius, 90, CircleType.Quarter, true, 16, cornerColor); // Top-right corner - DrawCircle(x + w - radius - 1, y + h - radius - 1, radius, 180, CircleType.Quarter, true, 16, cornerColor); // Bottom-right corner - DrawCircle(x + radius + 1, y + h - radius - 1, radius, 270, CircleType.Quarter, true, 16, cornerColor); // Bottom-left corner - - DrawLine(x + radius, y, x + w - radius - 1, y, 1, bcolor); // Top line - DrawLine(x + radius, y + h - 2, x + w - radius - 1, y + h - 2, 1, bcolor); // Bottom line - DrawLine(x, y + radius, x, y + h - radius - 1, 1, bcolor); // Left line - DrawLine(x + w - 2, y + radius, x + w - 2, y + h - radius - 1, 1, bcolor); // Right line - } - else + pt[1].X = x + iSmooth; + pt[1].Y = y + (h - iSmooth); + + pt[2].X = x + iSmooth; + pt[2].Y = y + iSmooth; + + pt[3].X = x + w - iSmooth; + pt[3].Y = y + iSmooth; + + // Draw cross + DrawBoxFilled(x, y + iSmooth, w, h - iSmooth * 2, color); + + DrawBoxFilled(x + iSmooth, y, w - iSmooth * 2, h, color); + + float fDegree = 0; + + for (var i = 0; i < 4; i++) { - DrawCircleFilled(x + radius, y + radius, radius, 0, CircleType.Quarter, false, 16, color); // Top-left corner - DrawCircleFilled(x + w - radius - 1, y + radius, radius, 90, CircleType.Quarter, false, 16, color); // Top-right corner - DrawCircleFilled(x + w - radius - 1, y + h - radius - 1, radius, 180, CircleType.Quarter, false, 16, color); // Bottom-right corner - DrawCircleFilled(x + radius, y + h - radius - 1, radius, 270, CircleType.Quarter, false, 16, color); // Bottom-left corner + for (var k = fDegree; k < fDegree + (Math.PI * 2) / 4f; k += (float)((1) * (Math.PI / 180.0f))) + { + // Draw quarter circles on every corner + DrawLine( + pt[i].X, + pt[i].Y, + pt[i].X + (float)(Math.Cos(k) * iSmooth), + pt[i].Y + (float)(Math.Sin(k) * iSmooth), + 1, + color); // 3 is with line width + } + + fDegree += (float)(Math.PI * 2) / 4; // quarter circle offset } } + + #endregion } -} +} \ No newline at end of file diff --git a/Core/Utils/ActionQueue.cs b/Core/Utils/ActionQueue.cs index 0f97352..1cc7598 100644 --- a/Core/Utils/ActionQueue.cs +++ b/Core/Utils/ActionQueue.cs @@ -5,8 +5,8 @@ using System.Collections.Generic; using System.Reflection; - using Enumerations; - using Extensions; + using LeagueSharp.SDK.Core.Enumerations; + using LeagueSharp.SDK.Core.Extensions; /// /// Queues actions. diff --git a/Core/Utils/BinarySerializer.cs b/Core/Utils/BinarySerializer.cs index c7c3043..ef82fd4 100644 --- a/Core/Utils/BinarySerializer.cs +++ b/Core/Utils/BinarySerializer.cs @@ -44,7 +44,7 @@ public static T Deserialize(byte[] data) { using ( var reader = XmlDictionaryReader.CreateBinaryReader( - new MemoryStream(data), + new MemoryStream(data), XmlDictionaryReaderQuotas.Max)) { return (T)new DataContractSerializer(typeof(T)).ReadObject(reader); diff --git a/Core/Utils/Cache.cs b/Core/Utils/Cache.cs index 65feffa..4fcf6d6 100644 --- a/Core/Utils/Cache.cs +++ b/Core/Utils/Cache.cs @@ -22,7 +22,7 @@ namespace LeagueSharp.SDK.Core.Utils using System.Linq; using System.Runtime.Caching; - using Enumerations; + using LeagueSharp.SDK.Core.Enumerations; /// /// Provides an implementation of ObjectCache, for any object. Check for diff --git a/Core/Utils/CallbackPerformance.cs b/Core/Utils/CallbackPerformance.cs index f291f6c..1833c4b 100644 --- a/Core/Utils/CallbackPerformance.cs +++ b/Core/Utils/CallbackPerformance.cs @@ -21,7 +21,7 @@ namespace LeagueSharp.SDK.Core.Utils using System.Diagnostics; using System.Runtime.CompilerServices; - using Enumerations; + using LeagueSharp.SDK.Core.Enumerations; /// /// Performance class, measures how much time does a function takes to execute. @@ -42,8 +42,8 @@ public class CallbackPerformance /// Member name of the function that called the measurement request. /// Elapsed Milliseconds the function took (long-units) public static long MeasureMilliseconds( - Action funcCallback, - int iterations = 1, + Action funcCallback, + int iterations = 1, [CallerMemberName] string memberName = "") { try @@ -58,9 +58,9 @@ public static long MeasureMilliseconds( stopwatch.Stop(); Logging.Write()( - LogLevel.Info, - "{0} has taken {1} elapsed milliseconds to execute, and was executed successfuly.", - memberName, + LogLevel.Info, + "{0} has taken {1} elapsed milliseconds to execute, and was executed successfuly.", + memberName, stopwatch.ElapsedMilliseconds); return stopwatch.ElapsedMilliseconds; @@ -68,8 +68,8 @@ public static long MeasureMilliseconds( catch (Exception) { Logging.Write()( - LogLevel.Error, - "{0} had an error during execution and was unable to be measured.", + LogLevel.Error, + "{0} had an error during execution and was unable to be measured.", memberName); return -1L; } @@ -84,8 +84,8 @@ public static long MeasureMilliseconds( /// Member name of the function that called the measurement request. /// Elapsed Ticks the function took (long-units) public static long MeasureTicks( - Action funcCallback, - int iterations = 1, + Action funcCallback, + int iterations = 1, [CallerMemberName] string memberName = "") { try @@ -100,9 +100,9 @@ public static long MeasureTicks( stopwatch.Stop(); Logging.Write()( - LogLevel.Info, - "{0} has taken {1} elapsed ticks to execute, and was executed successfuly.", - memberName, + LogLevel.Info, + "{0} has taken {1} elapsed ticks to execute, and was executed successfuly.", + memberName, stopwatch.ElapsedTicks); return stopwatch.ElapsedTicks; @@ -110,8 +110,8 @@ public static long MeasureTicks( catch (Exception) { Logging.Write()( - LogLevel.Error, - "{0} had an error during execution and was unable to be measured.", + LogLevel.Error, + "{0} had an error during execution and was unable to be measured.", memberName); return -1L; } @@ -126,8 +126,8 @@ public static long MeasureTicks( /// Member name of the function that called the measurement request. /// Elapsed Time Span the function took (long-units) public static TimeSpan MeasureTimeSpan( - Action funcCallback, - int iterations = 1, + Action funcCallback, + int iterations = 1, [CallerMemberName] string memberName = "") { try @@ -142,9 +142,9 @@ public static TimeSpan MeasureTimeSpan( stopwatch.Stop(); Logging.Write()( - LogLevel.Info, - "{0} has taken {1} elapsed time span to execute, and was executed successfuly.", - memberName, + LogLevel.Info, + "{0} has taken {1} elapsed time span to execute, and was executed successfuly.", + memberName, stopwatch.Elapsed); return stopwatch.Elapsed; @@ -152,8 +152,8 @@ public static TimeSpan MeasureTimeSpan( catch (Exception) { Logging.Write()( - LogLevel.Error, - "{0} had an error during execution and was unable to be measured.", + LogLevel.Error, + "{0} had an error during execution and was unable to be measured.", memberName); return TimeSpan.Zero; } diff --git a/Core/Utils/DelayAction.cs b/Core/Utils/DelayAction.cs index bb3f3b6..ff541cf 100644 --- a/Core/Utils/DelayAction.cs +++ b/Core/Utils/DelayAction.cs @@ -21,7 +21,7 @@ namespace LeagueSharp.SDK.Core.Utils using System.Collections.Generic; using System.Threading; - using Signals; + using LeagueSharp.SDK.Core.Signals; /// /// Delays actions by a set time. diff --git a/Core/Utils/Jungle.cs b/Core/Utils/Jungle.cs index 052e8d8..a5c4b47 100644 --- a/Core/Utils/Jungle.cs +++ b/Core/Utils/Jungle.cs @@ -20,7 +20,7 @@ namespace LeagueSharp.SDK.Core.Utils using System.Linq; using System.Text.RegularExpressions; - using Enumerations; + using LeagueSharp.SDK.Core.Enumerations; /// /// The jungle utility class, provides utils for jungle related items. diff --git a/Core/Utils/Logging.cs b/Core/Utils/Logging.cs index 4ef13c8..5f0f39d 100644 --- a/Core/Utils/Logging.cs +++ b/Core/Utils/Logging.cs @@ -21,7 +21,7 @@ namespace LeagueSharp.SDK.Core.Utils using System.IO; using System.Runtime.CompilerServices; - using Enumerations; + using LeagueSharp.SDK.Core.Enumerations; /// /// Logging class for LeagueSharp.SDK, used to log output data into a file and the console. diff --git a/Core/Utils/MathUtils.cs b/Core/Utils/MathUtils.cs index 3deaaeb..25f13f8 100644 --- a/Core/Utils/MathUtils.cs +++ b/Core/Utils/MathUtils.cs @@ -21,9 +21,9 @@ namespace LeagueSharp.SDK.Core.Utils using System.Collections.Generic; using System.Linq; - using Clipper; - using Extensions.SharpDX; - using Math.Polygons; + using LeagueSharp.SDK.Clipper; + using LeagueSharp.SDK.Core.Extensions.SharpDX; + using LeagueSharp.SDK.Core.Math.Polygons; using SharpDX; diff --git a/Core/Utils/Minion.cs b/Core/Utils/Minion.cs index 9a96d0f..2376266 100644 --- a/Core/Utils/Minion.cs +++ b/Core/Utils/Minion.cs @@ -20,11 +20,11 @@ namespace LeagueSharp.SDK.Core.Utils using System.Collections.Generic; using System.Linq; - using Enumerations; - using Extensions; - using Extensions.SharpDX; - using Math; - using Math.Prediction; + using LeagueSharp.SDK.Core.Enumerations; + using LeagueSharp.SDK.Core.Extensions; + using LeagueSharp.SDK.Core.Extensions.SharpDX; + using LeagueSharp.SDK.Core.Math; + using LeagueSharp.SDK.Core.Math.Prediction; using SharpDX; diff --git a/Core/Utils/NetworkUtils.cs b/Core/Utils/NetworkUtils.cs index a439429..a11e084 100644 --- a/Core/Utils/NetworkUtils.cs +++ b/Core/Utils/NetworkUtils.cs @@ -17,7 +17,7 @@ namespace LeagueSharp.SDK.Core.Utils { - using Network; + using LeagueSharp.SDK.Core.Network; /// /// Utilities for Packets. diff --git a/Core/Utils/Performance.cs b/Core/Utils/Performance.cs index 59948ee..b563c90 100644 --- a/Core/Utils/Performance.cs +++ b/Core/Utils/Performance.cs @@ -21,7 +21,7 @@ namespace LeagueSharp.SDK.Core.Utils using System.Diagnostics; using System.Runtime.CompilerServices; - using Enumerations; + using LeagueSharp.SDK.Core.Enumerations; /// /// Performance block class, for block method performance logging. diff --git a/Core/Utils/Storage.cs b/Core/Utils/Storage.cs index 29bc918..a28eff9 100644 --- a/Core/Utils/Storage.cs +++ b/Core/Utils/Storage.cs @@ -25,7 +25,7 @@ namespace LeagueSharp.SDK.Core.Utils using System.Reflection; using System.Runtime.Serialization; - using Enumerations; + using LeagueSharp.SDK.Core.Enumerations; /// /// The storage, main purpose is to save share-able settings between assemblies. diff --git a/Core/Utils/WeightedRandom.cs b/Core/Utils/WeightedRandom.cs index 5cc04cb..b2a2ae6 100644 --- a/Core/Utils/WeightedRandom.cs +++ b/Core/Utils/WeightedRandom.cs @@ -26,10 +26,6 @@ namespace LeagueSharp.SDK.Core.Utils /// public static class WeightedRandom { - #region Static Fields - - #endregion - #region Public Properties /// diff --git a/Core/Utils/WindowsKeys.cs b/Core/Utils/WindowsKeys.cs index b67c43f..59d482f 100644 --- a/Core/Utils/WindowsKeys.cs +++ b/Core/Utils/WindowsKeys.cs @@ -20,7 +20,7 @@ namespace LeagueSharp.SDK.Core.Utils using System; using System.Windows.Forms; - using Enumerations; + using LeagueSharp.SDK.Core.Enumerations; using SharpDX; diff --git a/Core/Wrappers/Damages/Damage.cs b/Core/Wrappers/Damages/Damage.cs index 69bc45b..acd6c70 100644 --- a/Core/Wrappers/Damages/Damage.cs +++ b/Core/Wrappers/Damages/Damage.cs @@ -21,9 +21,9 @@ namespace LeagueSharp.SDK.Core.Wrappers.Damages using System.Linq; using System.Text.RegularExpressions; - using Enumerations; - using Extensions; - using Utils; + using LeagueSharp.SDK.Core.Enumerations; + using LeagueSharp.SDK.Core.Extensions; + using LeagueSharp.SDK.Core.Utils; /// /// Damage wrapper class, contains functions to calculate estimated damage to a unit and also provides damage details. @@ -116,9 +116,7 @@ public static double CalculateMixedDamage( /// /// The estimated auto attack damage. /// - public static double GetAutoAttackDamage( - this Obj_AI_Base source, - Obj_AI_Base target) + public static double GetAutoAttackDamage(this Obj_AI_Base source, Obj_AI_Base target) { double result = source.TotalAttackDamage; var damageModifier = 1d; diff --git a/Core/Wrappers/Damages/DamageLibrary.cs b/Core/Wrappers/Damages/DamageLibrary.cs index 77a601e..b9b106f 100644 --- a/Core/Wrappers/Damages/DamageLibrary.cs +++ b/Core/Wrappers/Damages/DamageLibrary.cs @@ -23,10 +23,10 @@ namespace LeagueSharp.SDK.Core.Wrappers.Damages using System.Security.Permissions; using System.Text; - using Enumerations; - using Events; - using Utils; - using Properties; + using LeagueSharp.SDK.Core.Enumerations; + using LeagueSharp.SDK.Core.Events; + using LeagueSharp.SDK.Core.Utils; + using LeagueSharp.SDK.Properties; using Newtonsoft.Json; using Newtonsoft.Json.Linq; diff --git a/Core/Wrappers/Damages/DamageMastery.cs b/Core/Wrappers/Damages/DamageMastery.cs index 8e3f3d5..f0ec0f0 100644 --- a/Core/Wrappers/Damages/DamageMastery.cs +++ b/Core/Wrappers/Damages/DamageMastery.cs @@ -2,94 +2,223 @@ { using System.Linq; + /// + /// The damage mastery enum. + /// public static class DamageMastery { #region Enums + /// + /// The cunning enum. + /// public enum Cunning { + /// + /// The wanderer + /// Wanderer = 65, + /// + /// The savagery + /// Savagery = 66, + /// + /// The runic affinity + /// RunicAffinity = 81, + /// + /// The secret stash + /// SecretStash = 82, + /// + /// The merciless + /// Merciless = 97, + /// + /// The meditation + /// Meditation = 98, + /// + /// The bandit + /// Bandit = 114, + /// + /// The dangerous game + /// DangerousGame = 115, + /// + /// The precision + /// Precision = 129, + /// + /// The intelligence + /// Intelligence = 130, + /// + /// The stormraiders surge + /// StormraidersSurge = 145, + /// + /// The thunderlords decree + /// ThunderlordsDecree = 146, + /// + /// The windspeakers blessing + /// WindspeakersBlessing = 147 } + /// + /// The ferocity enum. + /// public enum Ferocity { + /// + /// The fury + /// Fury = 65, + /// + /// The sorcery + /// Sorcery = 68, + /// + /// The double edged sword + /// DoubleEdgedSword = 81, + /// + /// The feast + /// Feast = 82, + /// + /// The vampirism + /// Vampirism = 97, + /// + /// The natural talent + /// NaturalTalent = 100, + /// + /// The bounty hunter + /// BountyHunter = 113, + /// + /// The oppressor + /// Oppressor = 114, + /// + /// The battering blows + /// BatteringBlows = 129, + /// + /// The piercing thoughts + /// PiercingThoughts = 132, + /// + /// The warlords bloodlust + /// WarlordsBloodlust = 145, + /// + /// The fervorof battle + /// FervorofBattle = 146, + /// + /// The deathfire touch + /// DeathfireTouch = 137 } + /// + /// The resolve enum. + /// public enum Resolve { + /// + /// The recovery + /// Recovery = 65, + /// + /// The unyielding + /// Unyielding = 66, + /// + /// The explorer + /// Explorer = 81, + /// + /// The tough skin + /// ToughSkin = 82, + /// + /// The runic armor + /// RunicArmor = 97, + /// + /// The veterans scars + /// VeteransScars = 98, + /// + /// The insight + /// Insight = 113, + /// + /// The perseverance + /// Perseverance = 114, + /// + /// The swiftness + /// Swiftness = 129, + /// + /// The legendary guardian + /// LegendaryGuardian = 130, + /// + /// The graspofthe undying + /// GraspoftheUndying = 145, + /// + /// The strengthofthe ages + /// StrengthoftheAges = 146, + /// + /// The bondof stone + /// BondofStone = 147 } @@ -97,21 +226,44 @@ public enum Resolve #region Public Methods and Operators + /// + /// Gets the cunning. + /// + /// The hero. + /// The cunning. + /// public static Mastery GetCunning(this Obj_AI_Hero hero, Cunning cunning) { return hero.GetMastery(MasteryPage.Cunning, (int)cunning); } + /// + /// Gets the ferocity. + /// + /// The hero. + /// The ferocity. + /// public static Mastery GetFerocity(this Obj_AI_Hero hero, Ferocity ferocity) { return hero.GetMastery(MasteryPage.Ferocity, (int)ferocity); } + /// + /// Gets the resolve. + /// + /// The hero. + /// The resolve. + /// public static Mastery GetResolve(this Obj_AI_Hero hero, Resolve resolve) { return hero.GetMastery(MasteryPage.Resolve, (int)resolve); } + /// + /// Returns true if mastery is valid. + /// + /// The mastery. + /// public static bool IsValid(this Mastery mastery) { return mastery != null && mastery.Points > 0; diff --git a/Core/Wrappers/Damages/DamagePassives.cs b/Core/Wrappers/Damages/DamagePassives.cs index 87da6a1..8878f05 100644 --- a/Core/Wrappers/Damages/DamagePassives.cs +++ b/Core/Wrappers/Damages/DamagePassives.cs @@ -21,7 +21,7 @@ namespace LeagueSharp.SDK.Core.Wrappers.Damages using System.Collections.Generic; using System.Linq; - using Extensions; + using LeagueSharp.SDK.Core.Extensions; /// /// Damage wrapper class, contains functions to calculate estimated damage to a unit and also provides damage details. diff --git a/Core/Wrappers/Items.cs b/Core/Wrappers/Items.cs index 3b12826..c386c10 100644 --- a/Core/Wrappers/Items.cs +++ b/Core/Wrappers/Items.cs @@ -21,7 +21,7 @@ namespace LeagueSharp.SDK.Core.Wrappers using System.Collections.Generic; using System.Linq; - using Extensions.SharpDX; + using LeagueSharp.SDK.Core.Extensions.SharpDX; using SharpDX; @@ -275,10 +275,7 @@ public Item(ItemId id, float range) this.Range = range; this.BasePrice = item.Price; this.SellPrice = (int)(item.Price * item.SellBackModifier); - //this.TotalPrice = item.Price - // + ItemData.Entries.Where(i => item.RecipeItem.Any(j => j == i.Id)).Sum(i => i.Price); this.Purchaseable = item.CanBeSold; - //this.From = item.RecipeItem.Cast().ToArray(); this.Stacks = item.MaxStack; this.HideFromAll = !item.UsableInStore; } @@ -292,11 +289,6 @@ public Item(ItemId id, float range) /// public int BasePrice { get; private set; } - /// - /// Gets the Id's of the included Items. - /// - public int[] From { get; private set; } - /// /// Gets a value indicating whether hide from all. /// @@ -368,11 +360,6 @@ public List Slot /// public int Stacks { get; private set; } - /// - /// Gets the total price. - /// - public int TotalPrice { get; private set; } - #endregion #region Public Methods and Operators diff --git a/Core/Wrappers/Map.cs b/Core/Wrappers/Map.cs index aa649e2..4ca212b 100644 --- a/Core/Wrappers/Map.cs +++ b/Core/Wrappers/Map.cs @@ -19,8 +19,6 @@ namespace LeagueSharp.SDK.Core.Wrappers { using System.Collections.Generic; - using Enumerations; - using SharpDX; /// @@ -33,57 +31,56 @@ public class Map /// /// Map by ID list. /// - private static readonly IDictionary MapById = new Dictionary - { - { - 8, - new Map - { - Name = "The Crystal Scar", - ShortName = "crystalScar", - MapId = GameMapId.CrystalScar, - Grid = - new Vector2(13894f / 2, 13218f / 2), - StartingLevel = 3 - } - }, - { - 10, - new Map - { - Name = "The Twisted Treeline", - ShortName = "twistedTreeline", - MapId = GameMapId.TwistedTreeline, - Grid = - new Vector2(15436f / 2, 14474f / 2), - StartingLevel = 1 - } - }, - { - 11, - new Map - { - Name = "Summoner's Rift", - ShortName = "summonerRift", - MapId = GameMapId.SummonersRift, - Grid = - new Vector2(13982f / 2, 14446f / 2), - StartingLevel = 1 - } - }, - { - 12, - new Map - { - Name = "Howling Abyss", - ShortName = "howlingAbyss", - MapId = GameMapId.HowlingAbyss, - Grid = - new Vector2(13120f / 2, 12618f / 2), - StartingLevel = 3 - } - } - }; + private static readonly IDictionary MapById; + + #endregion + + #region Constructors and Destructors + + /// + /// Initializes the class. + /// + static Map() + { + MapById = new Dictionary + { + { + 8, + new Map + { + Name = "The Crystal Scar", ShortName = "crystalScar", + MapId = GameMapId.CrystalScar, Grid = new Vector2(13894f / 2, 13218f / 2), + StartingLevel = 3 + } + }, + { + 10, + new Map + { + Name = "The Twisted Treeline", ShortName = "twistedTreeline", + MapId = GameMapId.TwistedTreeline, Grid = new Vector2(15436f / 2, 14474f / 2), + StartingLevel = 1 + } + }, + { + 11, + new Map + { + Name = "Summoner's Rift", ShortName = "summonerRift", + MapId = GameMapId.SummonersRift, Grid = new Vector2(13982f / 2, 14446f / 2), + StartingLevel = 1 + } + }, + { + 12, + new Map + { + Name = "Howling Abyss", ShortName = "howlingAbyss", MapId = GameMapId.HowlingAbyss, + Grid = new Vector2(13120f / 2, 12618f / 2), StartingLevel = 3 + } + } + }; + } #endregion @@ -94,6 +91,11 @@ public class Map /// public Vector2 Grid { get; private set; } + /// + /// Gets the MapType + /// + public GameMapId MapId { get; private set; } + /// /// Gets the name of the map /// @@ -109,11 +111,6 @@ public class Map /// public int StartingLevel { get; private set; } - /// - /// Gets the MapType - /// - public GameMapId MapId { get; private set; } - #endregion #region Public Methods and Operators @@ -131,8 +128,7 @@ public static Map GetMap() return new Map { - Name = "Unknown", ShortName = "unknown", MapId = (GameMapId) 0, Grid = new Vector2(0, 0), - StartingLevel = 1 + Name = "Unknown", ShortName = "unknown", MapId = 0, Grid = new Vector2(0, 0), StartingLevel = 1 }; } diff --git a/Core/Wrappers/Orbwalking/Orbwalker.cs b/Core/Wrappers/Orbwalking/Orbwalker.cs index ad1d799..0c3425b 100644 --- a/Core/Wrappers/Orbwalking/Orbwalker.cs +++ b/Core/Wrappers/Orbwalking/Orbwalker.cs @@ -155,7 +155,7 @@ internal Orbwalker(Menu menu) #region Public Properties /// - /// Block Attack & Move methods until tick + /// Block Attack and Move methods until tick /// public int BlockOrdersUntilTick { get; private set; } diff --git a/Core/Wrappers/Spells/Database/DatabaseEntry.cs b/Core/Wrappers/Spells/Database/DatabaseEntry.cs index 8e28bc3..30ad200 100644 --- a/Core/Wrappers/Spells/Database/DatabaseEntry.cs +++ b/Core/Wrappers/Spells/Database/DatabaseEntry.cs @@ -45,7 +45,7 @@ public class DatabaseEntry /// The buffs applied by the spell on my hero /// public BuffType[] AppliedBuffsOnSelf; - + /// /// Indicates whether the spell can be removed. /// diff --git a/Core/Wrappers/Spells/Spell.cs b/Core/Wrappers/Spells/Spell.cs index 2c5d601..8cc940c 100644 --- a/Core/Wrappers/Spells/Spell.cs +++ b/Core/Wrappers/Spells/Spell.cs @@ -51,6 +51,11 @@ public class Spell /// private Vector3 @from; + /// + /// The Minimum Mana Percentage + /// + private float minManaPercent; + /// /// The Range /// @@ -66,11 +71,6 @@ public class Spell /// private float width; - - /// - /// The Minimum Mana Percentage - /// - private float minManaPercent; #endregion #region Constructors and Destructors @@ -860,6 +860,7 @@ public Spell SetCharged(string spellName, string buffName, int minRange, int max return this; } + /// /// Sets the minimum mana percentage to cast the spell. /// diff --git a/Core/Wrappers/TargetSelector/Modes/Closest.cs b/Core/Wrappers/TargetSelector/Modes/Closest.cs index 147f804..3036a6e 100644 --- a/Core/Wrappers/TargetSelector/Modes/Closest.cs +++ b/Core/Wrappers/TargetSelector/Modes/Closest.cs @@ -48,7 +48,9 @@ public class Closest : ITargetSelectorMode /// Adds to menu. /// /// The menu. - public void AddToMenu(Menu menu) {} + public void AddToMenu(Menu menu) + { + } /// /// Orders the champions. diff --git a/Core/Wrappers/TargetSelector/Modes/LeastHealth.cs b/Core/Wrappers/TargetSelector/Modes/LeastHealth.cs index b4c0161..ae034b6 100644 --- a/Core/Wrappers/TargetSelector/Modes/LeastHealth.cs +++ b/Core/Wrappers/TargetSelector/Modes/LeastHealth.cs @@ -47,7 +47,9 @@ public class LeastHealth : ITargetSelectorMode /// Adds to menu. /// /// The menu. - public void AddToMenu(Menu menu) {} + public void AddToMenu(Menu menu) + { + } /// /// Orders the champions. diff --git a/Core/Wrappers/TargetSelector/Modes/LessAttacksToKill.cs b/Core/Wrappers/TargetSelector/Modes/LessAttacksToKill.cs index 6e2b79d..929daa5 100644 --- a/Core/Wrappers/TargetSelector/Modes/LessAttacksToKill.cs +++ b/Core/Wrappers/TargetSelector/Modes/LessAttacksToKill.cs @@ -48,7 +48,9 @@ public class LessAttacksToKill : ITargetSelectorMode /// Adds to menu. /// /// The menu. - public void AddToMenu(Menu menu) {} + public void AddToMenu(Menu menu) + { + } /// /// Orders the champions. diff --git a/Core/Wrappers/TargetSelector/Modes/LessCastsToKill.cs b/Core/Wrappers/TargetSelector/Modes/LessCastsToKill.cs index 377bcda..0598dce 100644 --- a/Core/Wrappers/TargetSelector/Modes/LessCastsToKill.cs +++ b/Core/Wrappers/TargetSelector/Modes/LessCastsToKill.cs @@ -51,7 +51,9 @@ public class LessCastsToKill : ITargetSelectorMode /// Adds to menu. /// /// The menu. - public void AddToMenu(Menu menu) {} + public void AddToMenu(Menu menu) + { + } /// /// Orders the champions. diff --git a/Core/Wrappers/TargetSelector/Modes/MostAbilityPower.cs b/Core/Wrappers/TargetSelector/Modes/MostAbilityPower.cs index e93697b..49de157 100644 --- a/Core/Wrappers/TargetSelector/Modes/MostAbilityPower.cs +++ b/Core/Wrappers/TargetSelector/Modes/MostAbilityPower.cs @@ -47,7 +47,9 @@ public class MostAbilityPower : ITargetSelectorMode /// Adds to menu. /// /// The menu. - public void AddToMenu(Menu menu) {} + public void AddToMenu(Menu menu) + { + } /// /// Orders the champions. diff --git a/Core/Wrappers/TargetSelector/Modes/MostAttackDamage.cs b/Core/Wrappers/TargetSelector/Modes/MostAttackDamage.cs index c008211..69d0af1 100644 --- a/Core/Wrappers/TargetSelector/Modes/MostAttackDamage.cs +++ b/Core/Wrappers/TargetSelector/Modes/MostAttackDamage.cs @@ -47,7 +47,9 @@ public class MostAttackDamage : ITargetSelectorMode /// Adds to menu. /// /// The menu. - public void AddToMenu(Menu menu) {} + public void AddToMenu(Menu menu) + { + } /// /// Orders the champions. diff --git a/Core/Wrappers/TargetSelector/Modes/NearMouse.cs b/Core/Wrappers/TargetSelector/Modes/NearMouse.cs index bad4eff..98d50e4 100644 --- a/Core/Wrappers/TargetSelector/Modes/NearMouse.cs +++ b/Core/Wrappers/TargetSelector/Modes/NearMouse.cs @@ -48,7 +48,9 @@ public class NearMouse : ITargetSelectorMode /// Adds to menu. /// /// The menu. - public void AddToMenu(Menu menu) {} + public void AddToMenu(Menu menu) + { + } /// /// Orders the champions. diff --git a/Core/Wrappers/TargetSelector/Modes/Weights/AbilityPower.cs b/Core/Wrappers/TargetSelector/Modes/Weights/AbilityPower.cs index df03fef..5cf2ec3 100644 --- a/Core/Wrappers/TargetSelector/Modes/Weights/AbilityPower.cs +++ b/Core/Wrappers/TargetSelector/Modes/Weights/AbilityPower.cs @@ -44,12 +44,36 @@ public class AbilityPower : IWeightItem #region Public Properties + /// + /// Gets the default weight. + /// + /// + /// The default weight. + /// public int DefaultWeight => 15; + /// + /// Gets the display name. + /// + /// + /// The display name. + /// public string DisplayName => "Ability Power"; + /// + /// Gets a value indicating whether this is inverted. + /// + /// + /// true if inverted; otherwise, false. + /// public bool Inverted => false; + /// + /// Gets the name. + /// + /// + /// The name. + /// public string Name => "ability-power"; /// @@ -64,6 +88,11 @@ public class AbilityPower : IWeightItem #region Public Methods and Operators + /// + /// Gets the value. + /// + /// The hero. + /// public float GetValue(Obj_AI_Hero hero) { if (Variables.TickCount - this.lastUpdate > this.UpdateInterval) diff --git a/Core/Wrappers/TargetSelector/Modes/Weights/AttackDamage.cs b/Core/Wrappers/TargetSelector/Modes/Weights/AttackDamage.cs index d373def..423f404 100644 --- a/Core/Wrappers/TargetSelector/Modes/Weights/AttackDamage.cs +++ b/Core/Wrappers/TargetSelector/Modes/Weights/AttackDamage.cs @@ -47,12 +47,36 @@ public class AttackDamage : IWeightItem #region Public Properties + /// + /// Gets the default weight. + /// + /// + /// The default weight. + /// public int DefaultWeight => 15; + /// + /// Gets the display name. + /// + /// + /// The display name. + /// public string DisplayName => "Attack Damage"; + /// + /// Gets a value indicating whether this is inverted. + /// + /// + /// true if inverted; otherwise, false. + /// public bool Inverted => false; + /// + /// Gets the name. + /// + /// + /// The name. + /// public string Name => "attack-damage"; /// @@ -67,6 +91,11 @@ public class AttackDamage : IWeightItem #region Public Methods and Operators + /// + /// Gets the value. + /// + /// The hero. + /// public float GetValue(Obj_AI_Hero hero) { if (Variables.TickCount - this.lastUpdate > this.UpdateInterval) diff --git a/Core/Wrappers/TargetSelector/Modes/Weights/CrowdControl.cs b/Core/Wrappers/TargetSelector/Modes/Weights/CrowdControl.cs index 7f1c2ad..0b141d2 100644 --- a/Core/Wrappers/TargetSelector/Modes/Weights/CrowdControl.cs +++ b/Core/Wrappers/TargetSelector/Modes/Weights/CrowdControl.cs @@ -56,18 +56,47 @@ public CrowdControl() /// public List BuffTypes { get; set; } + /// + /// Gets the default weight. + /// + /// + /// The default weight. + /// public int DefaultWeight => 0; + /// + /// Gets the display name. + /// + /// + /// The display name. + /// public string DisplayName => "Crowd Control"; + /// + /// Gets a value indicating whether this is inverted. + /// + /// + /// true if inverted; otherwise, false. + /// public bool Inverted => false; + /// + /// Gets the name. + /// + /// + /// The name. + /// public string Name => "crowd-control"; #endregion #region Public Methods and Operators + /// + /// Gets the value. + /// + /// The hero. + /// public float GetValue(Obj_AI_Hero hero) { var buffs = hero.Buffs.Where(b => this.BuffTypes.Contains(b.Type)).ToList(); diff --git a/Core/Wrappers/TargetSelector/Modes/Weights/FocusMe.cs b/Core/Wrappers/TargetSelector/Modes/Weights/FocusMe.cs index 109b905..26f62d6 100644 --- a/Core/Wrappers/TargetSelector/Modes/Weights/FocusMe.cs +++ b/Core/Wrappers/TargetSelector/Modes/Weights/FocusMe.cs @@ -30,8 +30,20 @@ public class FocusMe : IWeightItem { #region Public Properties + /// + /// Gets the default weight. + /// + /// + /// The default weight. + /// public int DefaultWeight => 0; + /// + /// Gets the display name. + /// + /// + /// The display name. + /// public string DisplayName => "Focus Me"; /// @@ -42,14 +54,31 @@ public class FocusMe : IWeightItem /// public int FadeTime { get; set; } = 10000; + /// + /// Gets a value indicating whether this is inverted. + /// + /// + /// true if inverted; otherwise, false. + /// public bool Inverted => false; + /// + /// Gets the name. + /// + /// + /// The name. + /// public string Name => "focus-me"; #endregion #region Public Methods and Operators + /// + /// Gets the value. + /// + /// The hero. + /// public float GetValue(Obj_AI_Hero hero) { var entry = Aggro.GetSenderTargetItem(hero, ObjectManager.Player); diff --git a/Core/Wrappers/TargetSelector/Modes/Weights/Gold.cs b/Core/Wrappers/TargetSelector/Modes/Weights/Gold.cs index b57de77..faf3dca 100644 --- a/Core/Wrappers/TargetSelector/Modes/Weights/Gold.cs +++ b/Core/Wrappers/TargetSelector/Modes/Weights/Gold.cs @@ -40,10 +40,28 @@ public class Gold : IWeightItem /// public float Champion { get; set; } = 300f; + /// + /// Gets the default weight. + /// + /// + /// The default weight. + /// public int DefaultWeight => 0; + /// + /// Gets the display name. + /// + /// + /// The display name. + /// public string DisplayName => "Acquired Gold"; + /// + /// Gets a value indicating whether this is inverted. + /// + /// + /// true if inverted; otherwise, false. + /// public bool Inverted => false; /// @@ -54,6 +72,12 @@ public class Gold : IWeightItem /// public float Minion { get; set; } = 27.35f; + /// + /// Gets the name. + /// + /// + /// The name. + /// public string Name => "acquired-gold"; /// @@ -68,6 +92,11 @@ public class Gold : IWeightItem #region Public Methods and Operators + /// + /// Gets the value. + /// + /// The hero. + /// public float GetValue(Obj_AI_Hero hero) => hero.MinionsKilled * this.Minion + hero.NeutralMinionsKilled * this.NeutralMinion diff --git a/Core/Wrappers/TargetSelector/Modes/Weights/Killable.cs b/Core/Wrappers/TargetSelector/Modes/Weights/Killable.cs index ba7d520..21dd447 100644 --- a/Core/Wrappers/TargetSelector/Modes/Weights/Killable.cs +++ b/Core/Wrappers/TargetSelector/Modes/Weights/Killable.cs @@ -26,18 +26,47 @@ public class Killable : IWeightItem { #region Public Properties + /// + /// Gets the default weight. + /// + /// + /// The default weight. + /// public int DefaultWeight => 20; + /// + /// Gets the display name. + /// + /// + /// The display name. + /// public string DisplayName => "AA Killable"; + /// + /// Gets a value indicating whether this is inverted. + /// + /// + /// true if inverted; otherwise, false. + /// public bool Inverted => false; + /// + /// Gets the name. + /// + /// + /// The name. + /// public string Name => "aa-killable"; #endregion #region Public Methods and Operators + /// + /// Gets the value. + /// + /// The hero. + /// public float GetValue(Obj_AI_Hero hero) => hero.Health < GameObjects.Player.GetAutoAttackDamage(hero) ? 1 : 0; #endregion diff --git a/Core/Wrappers/TargetSelector/Modes/Weights/LowHealth.cs b/Core/Wrappers/TargetSelector/Modes/Weights/LowHealth.cs index b97f90c..ff05c63 100644 --- a/Core/Wrappers/TargetSelector/Modes/Weights/LowHealth.cs +++ b/Core/Wrappers/TargetSelector/Modes/Weights/LowHealth.cs @@ -24,18 +24,47 @@ public class LowHealth : IWeightItem { #region Public Properties + /// + /// Gets the default weight. + /// + /// + /// The default weight. + /// public int DefaultWeight => 20; + /// + /// Gets the display name. + /// + /// + /// The display name. + /// public string DisplayName => "Low Health"; + /// + /// Gets a value indicating whether this is inverted. + /// + /// + /// true if inverted; otherwise, false. + /// public bool Inverted => true; + /// + /// Gets the name. + /// + /// + /// The name. + /// public string Name => "low-health"; #endregion #region Public Methods and Operators + /// + /// Gets the value. + /// + /// The hero. + /// public float GetValue(Obj_AI_Hero hero) => hero.Health; #endregion diff --git a/Core/Wrappers/TargetSelector/Modes/Weights/LowResists.cs b/Core/Wrappers/TargetSelector/Modes/Weights/LowResists.cs index b31bc9e..309d4a0 100644 --- a/Core/Wrappers/TargetSelector/Modes/Weights/LowResists.cs +++ b/Core/Wrappers/TargetSelector/Modes/Weights/LowResists.cs @@ -24,18 +24,47 @@ public class LowResists : IWeightItem { #region Public Properties + /// + /// Gets the default weight. + /// + /// + /// The default weight. + /// public int DefaultWeight => 0; + /// + /// Gets the display name. + /// + /// + /// The display name. + /// public string DisplayName => "Low Resists"; + /// + /// Gets a value indicating whether this is inverted. + /// + /// + /// true if inverted; otherwise, false. + /// public bool Inverted => true; + /// + /// Gets the name. + /// + /// + /// The name. + /// public string Name => "low-resists"; #endregion #region Public Methods and Operators + /// + /// Gets the value. + /// + /// The hero. + /// public float GetValue(Obj_AI_Hero hero) => GameObjects.Player.FlatPhysicalDamageMod >= GameObjects.Player.FlatMagicDamageMod diff --git a/Core/Wrappers/TargetSelector/Modes/Weights/ShortDistanceCursor.cs b/Core/Wrappers/TargetSelector/Modes/Weights/ShortDistanceCursor.cs index e57bdf0..ef7a203 100644 --- a/Core/Wrappers/TargetSelector/Modes/Weights/ShortDistanceCursor.cs +++ b/Core/Wrappers/TargetSelector/Modes/Weights/ShortDistanceCursor.cs @@ -26,18 +26,47 @@ public class ShortDistanceCursor : IWeightItem { #region Public Properties + /// + /// Gets the default weight. + /// + /// + /// The default weight. + /// public int DefaultWeight => 0; + /// + /// Gets the display name. + /// + /// + /// The display name. + /// public string DisplayName => "Short Distance to Cursor"; + /// + /// Gets a value indicating whether this is inverted. + /// + /// + /// true if inverted; otherwise, false. + /// public bool Inverted => true; + /// + /// Gets the name. + /// + /// + /// The name. + /// public string Name => "short-distance-cursor"; #endregion #region Public Methods and Operators + /// + /// Gets the value. + /// + /// The hero. + /// public float GetValue(Obj_AI_Hero hero) => hero.Distance(Game.CursorPos); #endregion diff --git a/Core/Wrappers/TargetSelector/Modes/Weights/ShortDistancePlayer.cs b/Core/Wrappers/TargetSelector/Modes/Weights/ShortDistancePlayer.cs index 6428b9e..f301497 100644 --- a/Core/Wrappers/TargetSelector/Modes/Weights/ShortDistancePlayer.cs +++ b/Core/Wrappers/TargetSelector/Modes/Weights/ShortDistancePlayer.cs @@ -26,18 +26,47 @@ public class ShortDistancePlayer : IWeightItem { #region Public Properties + /// + /// Gets the default weight. + /// + /// + /// The default weight. + /// public int DefaultWeight => 5; + /// + /// Gets the display name. + /// + /// + /// The display name. + /// public string DisplayName => "Short Distance to Player"; + /// + /// Gets a value indicating whether this is inverted. + /// + /// + /// true if inverted; otherwise, false. + /// public bool Inverted => true; + /// + /// Gets the name. + /// + /// + /// The name. + /// public string Name => "short-distance-player"; #endregion #region Public Methods and Operators + /// + /// Gets the value. + /// + /// The hero. + /// public float GetValue(Obj_AI_Hero hero) => hero.Distance(GameObjects.Player); #endregion diff --git a/Core/Wrappers/TargetSelector/Modes/Weights/TeamFocus.cs b/Core/Wrappers/TargetSelector/Modes/Weights/TeamFocus.cs index 8804fdf..d788c04 100644 --- a/Core/Wrappers/TargetSelector/Modes/Weights/TeamFocus.cs +++ b/Core/Wrappers/TargetSelector/Modes/Weights/TeamFocus.cs @@ -32,6 +32,12 @@ public class TeamFocus : IWeightItem /// public int DefaultWeight => 0; + /// + /// Gets the display name. + /// + /// + /// The display name. + /// public string DisplayName => "Team Focus"; /// @@ -42,14 +48,31 @@ public class TeamFocus : IWeightItem /// public int FadeTime { get; set; } = 10000; + /// + /// Gets a value indicating whether this is inverted. + /// + /// + /// true if inverted; otherwise, false. + /// public bool Inverted => false; + /// + /// Gets the name. + /// + /// + /// The name. + /// public string Name => "team-focus"; #endregion #region Public Methods and Operators + /// + /// Gets the value. + /// + /// The hero. + /// public float GetValue(Obj_AI_Hero hero) => Aggro.Entries.Where(a => a.Value.Target.Compare(hero)) diff --git a/LeagueSharp.SDK.csproj b/LeagueSharp.SDK.csproj index a724b78..ef200c1 100644 --- a/LeagueSharp.SDK.csproj +++ b/LeagueSharp.SDK.csproj @@ -153,7 +153,7 @@ - + @@ -166,15 +166,15 @@ - + - - - - + + + + @@ -183,7 +183,7 @@ - + @@ -244,7 +244,7 @@ - +