diff --git a/Artemis/Artemis/App.config b/Artemis/Artemis/App.config index 0bda778e9..c2fb1013a 100644 --- a/Artemis/Artemis/App.config +++ b/Artemis/Artemis/App.config @@ -45,9 +45,6 @@ True - - True - True @@ -60,6 +57,15 @@ #FF0000FF + + Default + + + #FF00FF00 + + + #FF6A5ACD + diff --git a/Artemis/Artemis/KeyboardProviders/Corsair/CorsairRGB.cs b/Artemis/Artemis/KeyboardProviders/Corsair/CorsairRGB.cs index 7274c83c7..ef5571c30 100644 --- a/Artemis/Artemis/KeyboardProviders/Corsair/CorsairRGB.cs +++ b/Artemis/Artemis/KeyboardProviders/Corsair/CorsairRGB.cs @@ -75,23 +75,27 @@ namespace Artemis.KeyboardProviders.Corsair Width = 24; KeyboardRegions.Add(new KeyboardRegion("TopRow", new Point(0, 1), new Point(20, 1))); KeyboardRegions.Add(new KeyboardRegion("NumPad", new Point(21, 2), new Point(25, 7))); + KeyboardRegions.Add(new KeyboardRegion("QWER", new Point(5, 3), new Point(8, 3))); break; case "K70 RGB": Height = 7; Width = 21; KeyboardRegions.Add(new KeyboardRegion("TopRow", new Point(0, 1), new Point(16, 1))); KeyboardRegions.Add(new KeyboardRegion("NumPad", new Point(17, 2), new Point(21, 7))); + KeyboardRegions.Add(new KeyboardRegion("QWER", new Point(1, 3), new Point(4, 3))); break; case "K65 RGB": Height = 7; Width = 18; KeyboardRegions.Add(new KeyboardRegion("TopRow", new Point(0, 1), new Point(16, 1))); KeyboardRegions.Add(new KeyboardRegion("NumPad", new Point(17, 2), new Point(20, 7))); + KeyboardRegions.Add(new KeyboardRegion("QWER", new Point(1, 3), new Point(4, 3))); break; case "STRAFE RGB": Height = 7; KeyboardRegions.Add(new KeyboardRegion("TopRow", new Point(0, 1), new Point(16, 1))); KeyboardRegions.Add(new KeyboardRegion("NumPad", new Point(17, 2), new Point(21, 7))); + KeyboardRegions.Add(new KeyboardRegion("QWER", new Point(1, 3), new Point(4, 3))); Width = 22; break; } diff --git a/Artemis/Artemis/Modules/Games/Dota2/Dota2.Designer.cs b/Artemis/Artemis/Modules/Games/Dota2/Dota2.Designer.cs index bcd46002b..ae346373b 100644 --- a/Artemis/Artemis/Modules/Games/Dota2/Dota2.Designer.cs +++ b/Artemis/Artemis/Modules/Games/Dota2/Dota2.Designer.cs @@ -83,18 +83,6 @@ namespace Artemis.Modules.Games.Dota2 { } } - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool CanCastItem { - get { - return ((bool)(this["CanCastItem"])); - } - set { - this["CanCastItem"] = value; - } - } - [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("True")] @@ -142,5 +130,41 @@ namespace Artemis.Modules.Games.Dota2 { this["ManaColor"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("Default")] + public string KeyboardLayout { + get { + return ((string)(this["KeyboardLayout"])); + } + set { + this["KeyboardLayout"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("#FF00FF00")] + public global::System.Windows.Media.Color AbilityReadyColor { + get { + return ((global::System.Windows.Media.Color)(this["AbilityReadyColor"])); + } + set { + this["AbilityReadyColor"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("#FF6A5ACD")] + public global::System.Windows.Media.Color AbilityCooldownColor { + get { + return ((global::System.Windows.Media.Color)(this["AbilityCooldownColor"])); + } + set { + this["AbilityCooldownColor"] = value; + } + } } } diff --git a/Artemis/Artemis/Modules/Games/Dota2/Dota2.settings b/Artemis/Artemis/Modules/Games/Dota2/Dota2.settings index 064cc8115..473a385a3 100644 --- a/Artemis/Artemis/Modules/Games/Dota2/Dota2.settings +++ b/Artemis/Artemis/Modules/Games/Dota2/Dota2.settings @@ -17,9 +17,6 @@ True - - True - True @@ -32,5 +29,14 @@ #FF0000FF + + Default + + + #FF00FF00 + + + #FF6A5ACD + \ No newline at end of file diff --git a/Artemis/Artemis/Modules/Games/Dota2/Dota2Model.cs b/Artemis/Artemis/Modules/Games/Dota2/Dota2Model.cs index ea8bf76c3..d8f3cdeb1 100644 --- a/Artemis/Artemis/Modules/Games/Dota2/Dota2Model.cs +++ b/Artemis/Artemis/Modules/Games/Dota2/Dota2Model.cs @@ -4,6 +4,7 @@ using System.Drawing; using System.Drawing.Drawing2D; using System.Linq; using System.Windows.Forms.VisualStyles; +using System.Windows.Media; using Artemis.KeyboardProviders; using Artemis.Managers; using Artemis.Models; @@ -11,13 +12,14 @@ using Artemis.Utilities; using Artemis.Utilities.GameState; using Artemis.Utilities.Keyboard; using Newtonsoft.Json; +using Color = System.Drawing.Color; namespace Artemis.Modules.Games.Dota2 { internal class Dota2Model : GameModel { private KeyboardRegion _keyPad; - + private KeyboardRegion _abilityKeys; private KeyboardRegion _topRow; public Dota2Model(MainManager mainManager, Dota2Settings settings) : base(mainManager) @@ -42,6 +44,7 @@ namespace Artemis.Modules.Games.Dota2 Initialized = false; _topRow = MainManager.KeyboardManager.ActiveKeyboard.KeyboardRegions.First(r => r.RegionName == "TopRow"); _keyPad = MainManager.KeyboardManager.ActiveKeyboard.KeyboardRegions.First(r => r.RegionName == "NumPad"); + _abilityKeys = MainManager.KeyboardManager.ActiveKeyboard.KeyboardRegions.First(r => r.RegionName == "QWER"); HealthRectangle = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard , 0 , _topRow.BottomRight.Y*Scale @@ -69,7 +72,7 @@ namespace Artemis.Modules.Games.Dota2 DayCycleRectangle = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard , _keyPad.TopLeft.X*Scale - , _keyPad.TopLeft.Y*Scale + , _keyPad.BottomRight.Y*Scale , new List() , LinearGradientMode.Horizontal) { @@ -85,7 +88,81 @@ namespace Artemis.Modules.Games.Dota2 private void SetAbilityKeys() { + #region Long Switch Statement for Keys + switch (Settings.KeyboardLayout) + { + case "0": //default + case "4": //Heroes of newearth + case "3": //League of Legends + for (int i = 0; i < AbilityKeysRectangles.Length; i++) + { + AbilityKeysRectangles[i] = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, + (_abilityKeys.TopLeft.X + i) * Scale - 2, + _abilityKeys.TopLeft.Y * Scale, + new List(), + LinearGradientMode.Horizontal) + { + Height = Scale, + Width = Scale + }; + } + break; + case "2": + AbilityKeysRectangles[0] = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, + (_abilityKeys.TopLeft.X * Scale) - 2, + _abilityKeys.TopLeft.Y * Scale, + new List(), + LinearGradientMode.Horizontal) + { + Height = Scale, + Width = Scale + }; + AbilityKeysRectangles[1] = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, + ((_abilityKeys.TopLeft.X + 2) * Scale) - 2, + _abilityKeys.TopLeft.Y * Scale, + new List(), + LinearGradientMode.Horizontal) + { + Height = Scale, + Width = Scale + }; + AbilityKeysRectangles[2] = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, + ((_abilityKeys.TopLeft.X +3) * Scale) - 2, + _abilityKeys.TopLeft.Y * Scale, + new List(), + LinearGradientMode.Horizontal) + { + Height = Scale, + Width = Scale + }; + AbilityKeysRectangles[3] = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, + ((_abilityKeys.TopLeft.X +3)* Scale) - 2, + (_abilityKeys.TopLeft.Y +1)* Scale, + new List(), + LinearGradientMode.Horizontal) + { + Height = Scale, + Width = Scale + }; + break; + case "1": //MMO + case "5": //Smite + for (int i = 0; i < AbilityKeysRectangles.Length; i++) + { + AbilityKeysRectangles[i] = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, + (_abilityKeys.TopLeft.X + i) * Scale - 3, + (_abilityKeys.TopLeft.Y-1) * Scale, + new List(), + LinearGradientMode.Horizontal) + { + Height = Scale, + Width = Scale + }; + } + break; + } + #endregion } public override void Update() @@ -106,8 +183,6 @@ namespace Artemis.Modules.Games.Dota2 UpdateDay(); if (Settings.ShowMana) UpdateMana(); - if (Settings.CanCastItem) - UpdateItems(); } @@ -142,7 +217,6 @@ namespace Artemis.Modules.Games.Dota2 var timeLeft = 240 - D2Json.map.clock_time%240; var timePercentage = 100.00/240*timeLeft; - var test = _keyPad.GetRectangle().Width; DayCycleRectangle.Width = (int) (_keyPad.GetRectangle().Width*Scale/100.00*timePercentage); DayCycleRectangle.Colors = D2Json.map.daytime ? new List {Color.Yellow} @@ -159,16 +233,19 @@ namespace Artemis.Modules.Games.Dota2 ManaRectangle.Width = (int) Math.Floor(_topRow.GetRectangle().Width*Scale/100.00*manaPercent); } - private void UpdateItems() - { - //throw new NotImplementedException(); - } - private void UpdateAbilities() { - //Console.WriteLine(); - - //Update keys according to the abilities they take. + if (AbilityKeysRectangles == null) + return; + + AbilityKeysRectangles[0].Colors = D2Json?.abilities?.ability0?.can_cast == true ? new List + { ColorHelpers.ToDrawingColor(Settings.AbilityReadyColor) } : new List { ColorHelpers.ToDrawingColor(Settings.AbilityCooldownColor) }; + AbilityKeysRectangles[1].Colors = D2Json?.abilities?.ability1?.can_cast == true ? new List + { ColorHelpers.ToDrawingColor(Settings.AbilityReadyColor) } : new List { ColorHelpers.ToDrawingColor(Settings.AbilityCooldownColor) }; + AbilityKeysRectangles[2].Colors = D2Json?.abilities?.ability2?.can_cast == true ? new List + { ColorHelpers.ToDrawingColor(Settings.AbilityReadyColor) } : new List { ColorHelpers.ToDrawingColor(Settings.AbilityCooldownColor) }; + AbilityKeysRectangles[3].Colors = D2Json?.abilities?.ability3?.can_cast == true ? new List + { ColorHelpers.ToDrawingColor(Settings.AbilityReadyColor) } : new List { ColorHelpers.ToDrawingColor(Settings.AbilityCooldownColor) }; } @@ -200,6 +277,8 @@ namespace Artemis.Modules.Games.Dota2 HealthRectangle.Draw(g); ManaRectangle.Draw(g); DayCycleRectangle.Draw(g); + foreach (var key in AbilityKeysRectangles) + key.Draw(g); } return bitmap; } @@ -226,10 +305,8 @@ namespace Artemis.Modules.Games.Dota2 public KeyboardRectangle EventRectangle { get; set; } public KeyboardRectangle DayCycleRectangle { get; set; } public KeyboardRectangle ManaRectangle { get; set; } - public KeyboardRectangle[] AbilityKeys { get; set; } + public KeyboardRectangle[] AbilityKeysRectangles = new KeyboardRectangle[4]; #endregion - - } } \ No newline at end of file diff --git a/Artemis/Artemis/Modules/Games/Dota2/Dota2Settings.cs b/Artemis/Artemis/Modules/Games/Dota2/Dota2Settings.cs index 2332a99dd..2f4990db7 100644 --- a/Artemis/Artemis/Modules/Games/Dota2/Dota2Settings.cs +++ b/Artemis/Artemis/Modules/Games/Dota2/Dota2Settings.cs @@ -21,31 +21,36 @@ namespace Artemis.Modules.Games.Dota2 public string GameDirectory { get; set; } public bool CanCastAbility { get; set; } public bool ShowHealth { get; set; } - public bool ShowDayCycle { get; set; } - public bool CanCastItem { get; set; } + public bool ShowDayCycle { get; set; } public bool ShowMana { get; set; } public bool ShowDead { get; set; } public Color MainColor { get; set; } public Color ManaColor { get; set; } + public string KeyboardLayout { get; set; } + public Color AbilityCooldownColor { get; set; } + public Color AbilityReadyColor { get; set; } #endregion public override void Load() { + KeyboardLayout = Dota2.Default.KeyboardLayout; MainColor = Dota2.Default.MainColor; ManaColor = Dota2.Default.ManaColor; ShowHealth = Dota2.Default.ShowHealth; CanCastAbility = Dota2.Default.CanCastAbility; Enabled = Dota2.Default.Enabled; GameDirectory = Dota2.Default.GameDirectory; - CanCastItem = Dota2.Default.CanCastItem; ShowDayCycle = Dota2.Default.ShowDayCycle; ShowMana = Dota2.Default.ShowMana; ShowDead = Dota2.Default.ShowDead; + AbilityReadyColor = Dota2.Default.AbilityReadyColor; + AbilityCooldownColor = Dota2.Default.AbilityCooldownColor; } public override void Save() { + Dota2.Default.KeyboardLayout = KeyboardLayout; Dota2.Default.MainColor = MainColor; Dota2.Default.ManaColor = ManaColor; Dota2.Default.ShowDayCycle = ShowDayCycle; @@ -53,9 +58,10 @@ namespace Artemis.Modules.Games.Dota2 Dota2.Default.CanCastAbility = CanCastAbility; Dota2.Default.Enabled = Enabled; Dota2.Default.GameDirectory = GameDirectory; - Dota2.Default.CanCastItem = CanCastItem; Dota2.Default.ShowMana = ShowMana; Dota2.Default.ShowDead = ShowDead; + Dota2.Default.AbilityCooldownColor = AbilityCooldownColor; + Dota2.Default.AbilityReadyColor = AbilityReadyColor; Dota2.Default.Save(); } @@ -66,12 +72,14 @@ namespace Artemis.Modules.Games.Dota2 Enabled = true; GameDirectory = string.Empty; + KeyboardLayout = "Default"; MainColor = Color.FromArgb(255,255,0,0); ManaColor = Color.FromArgb(255,0,0,255); + AbilityCooldownColor = Color.FromArgb(255,106,90,205); + AbilityReadyColor = Color.FromArgb(255, 0, 255, 0); ShowHealth = true; CanCastAbility = true; ShowDayCycle = true; - CanCastItem = true; ShowMana = true; ShowDead = true; diff --git a/Artemis/Artemis/Modules/Games/Dota2/Dota2View.xaml b/Artemis/Artemis/Modules/Games/Dota2/Dota2View.xaml index d95c69e4b..d4fed513b 100644 --- a/Artemis/Artemis/Modules/Games/Dota2/Dota2View.xaml +++ b/Artemis/Artemis/Modules/Games/Dota2/Dota2View.xaml @@ -8,7 +8,7 @@ xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" mc:Ignorable="d" d:DesignHeight="495" d:DesignWidth="635"> - + @@ -26,6 +26,8 @@ + + @@ -70,75 +72,95 @@ SelectedColor="{Binding Path=GameSettings.MainColor, Mode=TwoWay}" Grid.Row="2" Grid.Column="1" Width="110" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" /> - + + + + Ability Ready Color + + + + + + Ability on Cooldown Color + + + - Keyboard Template - - Castable Abilities - - Display health - Display mana - Mana color - Display day/night - Display gray when dead - +