mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Setup keyboard alignments for all Corsair keyboards. Converted Dota2 to use profiles
This commit is contained in:
parent
0739885453
commit
8cb783f5f8
BIN
Artemis/Artemis/Artemis base layout.png
Normal file
BIN
Artemis/Artemis/Artemis base layout.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 53 KiB |
@ -368,6 +368,8 @@
|
||||
<DependentUpon>TheDivisionView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Modules\Games\TheDivision\TheDivisionViewModel.cs" />
|
||||
<Compile Include="Modules\Games\Witcher3\TheWitcherDataModel.cs" />
|
||||
<Compile Include="Modules\Games\Witcher3\Witcher3DataModel.cs" />
|
||||
<Compile Include="Modules\Games\Witcher3\Witcher3Settings.cs" />
|
||||
<Compile Include="Modules\Games\Witcher3\Witcher3.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
|
||||
@ -24,7 +24,6 @@ namespace Artemis.KeyboardProviders.Corsair
|
||||
"Please check your cables and/or drivers (could be outdated) and that Corsair Utility Engine is running.\n" +
|
||||
"In CUE, make sure \"Enable SDK\" is checked under Settings > Program.\n\n" +
|
||||
"If needed, you can select a different keyboard in Artemis under settings.";
|
||||
KeyboardRegions = new List<KeyboardRegion>();
|
||||
}
|
||||
|
||||
public override bool CanEnable()
|
||||
@ -74,40 +73,29 @@ namespace Artemis.KeyboardProviders.Corsair
|
||||
/*CUE is already initialized*/
|
||||
}
|
||||
_keyboard = CueSDK.KeyboardSDK;
|
||||
switch (_keyboard.DeviceInfo.Model)
|
||||
if (_keyboard.DeviceInfo.Model == "K95 RGB")
|
||||
{
|
||||
case "K95 RGB":
|
||||
Height = 7;
|
||||
Width = 25;
|
||||
PreviewSettings = new PreviewSettings(626, 175, new Thickness(0, -15, 0, 0), Resources.k95);
|
||||
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;
|
||||
PreviewSettings = new PreviewSettings(626, 175, new Thickness(0, -15, 0, 0), Resources.k70);
|
||||
KeyboardRegions.Add(new KeyboardRegion("TopRow", new Point(0, 1), new Point(18, 1)));
|
||||
KeyboardRegions.Add(new KeyboardRegion("NumPad", new Point(17, 2), new Point(21, 7)));
|
||||
KeyboardRegions.Add(new KeyboardRegion("QWER", new Point(2, 3), new Point(5, 3)));
|
||||
break;
|
||||
case "K65 RGB":
|
||||
Height = 7;
|
||||
Width = 18;
|
||||
PreviewSettings = new PreviewSettings(626, 175, new Thickness(0, -15, 0, 0), Resources.k65);
|
||||
KeyboardRegions.Add(new KeyboardRegion("TopRow", new Point(0, 1), new Point(18, 1)));
|
||||
KeyboardRegions.Add(new KeyboardRegion("NumPad", new Point(17, 2), new Point(20, 7)));
|
||||
KeyboardRegions.Add(new KeyboardRegion("QWER", new Point(2, 3), new Point(5, 3)));
|
||||
break;
|
||||
case "STRAFE RGB":
|
||||
Height = 6;
|
||||
Width = 22;
|
||||
PreviewSettings = new PreviewSettings(626, 175, new Thickness(0, -15, 0, 0), Resources.strafe);
|
||||
KeyboardRegions.Add(new KeyboardRegion("TopRow", new Point(0, 1), new Point(18, 1)));
|
||||
KeyboardRegions.Add(new KeyboardRegion("NumPad", new Point(18, 2), new Point(22, 7)));
|
||||
KeyboardRegions.Add(new KeyboardRegion("QWER", new Point(1, 3), new Point(4, 3)));
|
||||
break;
|
||||
Height = 7;
|
||||
Width = 25;
|
||||
PreviewSettings = new PreviewSettings(626, 175, new Thickness(0, -15, 0, 0), Resources.k95);
|
||||
}
|
||||
else if (_keyboard.DeviceInfo.Model == "K70 RGB")
|
||||
{
|
||||
Height = 7;
|
||||
Width = 21;
|
||||
PreviewSettings = new PreviewSettings(626, 195, new Thickness(0, -25, 0, 0), Resources.k70);
|
||||
}
|
||||
else if (_keyboard.DeviceInfo.Model == "K65 RGB")
|
||||
{
|
||||
Height = 7;
|
||||
Width = 18;
|
||||
PreviewSettings = new PreviewSettings(610, 240, new Thickness(0, -30, 0, 0), Resources.k65);
|
||||
}
|
||||
else if (_keyboard.DeviceInfo.Model == "STRAFE RGB")
|
||||
{
|
||||
Height = 6;
|
||||
Width = 22;
|
||||
PreviewSettings = new PreviewSettings(620, 215, new Thickness(0, -15, 0, 0), Resources.strafe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -12,8 +12,6 @@ namespace Artemis.KeyboardProviders
|
||||
public int Width { get; set; }
|
||||
public string CantEnableText { get; set; }
|
||||
|
||||
public List<KeyboardRegion> KeyboardRegions { get; set; }
|
||||
|
||||
public PreviewSettings PreviewSettings { get; set; }
|
||||
|
||||
public abstract bool CanEnable();
|
||||
|
||||
@ -21,12 +21,6 @@ namespace Artemis.KeyboardProviders.Logitech
|
||||
Height = 6;
|
||||
Width = 21;
|
||||
PreviewSettings = new PreviewSettings(540, 154, new Thickness(25, -80, 0, 0), Resources.g910);
|
||||
KeyboardRegions = new List<KeyboardRegion>
|
||||
{
|
||||
new KeyboardRegion("TopRow", new Point(0, 0), new Point(18, 0)),
|
||||
new KeyboardRegion("NumPad", new Point(17, 1), new Point(21, 6)),
|
||||
new KeyboardRegion("QWER", new Point(2, 2), new Point(5, 2))
|
||||
};
|
||||
}
|
||||
|
||||
public override bool CanEnable()
|
||||
|
||||
@ -32,10 +32,6 @@ namespace Artemis.KeyboardProviders.Razer
|
||||
Chroma.Instance.Initialize();
|
||||
Height = Constants.MaxRows;
|
||||
Width = Constants.MaxColumns;
|
||||
|
||||
KeyboardRegions.Add(new KeyboardRegion("TopRow", new Point(0, 0), new Point(19, 0)));
|
||||
KeyboardRegions.Add(new KeyboardRegion("NumPad", new Point(20, 1), new Point(23, 6)));
|
||||
KeyboardRegions.Add(new KeyboardRegion("QWER", new Point(2, 2), new Point(5, 2)));
|
||||
}
|
||||
|
||||
public override void Disable()
|
||||
|
||||
@ -94,13 +94,20 @@ namespace Artemis.Managers
|
||||
_keyboardManager.EnableLastKeyboard();
|
||||
// If still null, no last keyboard, so stop.
|
||||
if (_keyboardManager.ActiveKeyboard == null)
|
||||
{
|
||||
_logger.Debug("Cancelling effect change, no LastKeyboard");
|
||||
return;
|
||||
}
|
||||
|
||||
// Game models are only used if they are enabled
|
||||
var gameModel = effectModel as GameModel;
|
||||
if (gameModel != null)
|
||||
if (!gameModel.Enabled)
|
||||
{
|
||||
_logger.Debug("Cancelling effect change, provided game not enabled");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var wasNull = false;
|
||||
if (ActiveEffect == null)
|
||||
@ -116,13 +123,6 @@ namespace Artemis.Managers
|
||||
|
||||
ActiveEffect = effectModel;
|
||||
ActiveEffect.Enable();
|
||||
|
||||
if (ActiveEffect is GameModel || ActiveEffect is ProfilePreviewModel)
|
||||
return;
|
||||
|
||||
// Non-game effects are stored as the new LastEffect.
|
||||
General.Default.LastEffect = ActiveEffect?.Name;
|
||||
General.Default.Save();
|
||||
}
|
||||
|
||||
if (loopManager != null && !loopManager.Running)
|
||||
@ -132,6 +132,13 @@ namespace Artemis.Managers
|
||||
}
|
||||
|
||||
_logger.Debug("Changed active effect to: {0}", effectModel.Name);
|
||||
|
||||
if (ActiveEffect is GameModel || ActiveEffect is ProfilePreviewModel)
|
||||
return;
|
||||
|
||||
// Non-game effects are stored as the new LastEffect.
|
||||
General.Default.LastEffect = ActiveEffect?.Name;
|
||||
General.Default.Save();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -135,14 +135,16 @@ namespace Artemis.Managers
|
||||
if (bitmap == null)
|
||||
return;
|
||||
|
||||
// Fill the bitmap's background with blackness to avoid trailing colors on some keyboards
|
||||
using (var g = Graphics.FromImage(bitmap))
|
||||
// Fill the bitmap's background with black to avoid trailing colors on some keyboards
|
||||
var fixedBmp = new Bitmap(bitmap.Width, bitmap.Height);
|
||||
using (var g = Graphics.FromImage(fixedBmp))
|
||||
{
|
||||
var preFix = (Bitmap)bitmap.Clone();
|
||||
g.Clear(Color.Black);
|
||||
g.DrawImage(preFix, 0, 0);
|
||||
g.DrawImage(bitmap, 0, 0);
|
||||
}
|
||||
|
||||
bitmap = fixedBmp;
|
||||
|
||||
// If it exists, send bitmap to the device
|
||||
_keyboardManager.ActiveKeyboard?.DrawBitmap(bitmap);
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using Artemis.Events;
|
||||
using Artemis.Models;
|
||||
using Artemis.Services;
|
||||
using Artemis.Modules.Effects.ProfilePreview;
|
||||
using Artemis.Utilities.GameState;
|
||||
using Artemis.Utilities.Keyboard;
|
||||
using Artemis.Utilities.LogitechDll;
|
||||
@ -126,20 +126,31 @@ namespace Artemis.Managers
|
||||
if (EffectManager.ActiveEffect != null)
|
||||
EffectManager.DisableInactiveGame();
|
||||
|
||||
if (EffectManager.ActiveEffect is ProfilePreviewModel)
|
||||
return;
|
||||
|
||||
// If the currently active effect is a no longer running game, get rid of it.
|
||||
var activeGame = EffectManager.ActiveEffect as GameModel;
|
||||
if (activeGame != null)
|
||||
{
|
||||
if (!runningProcesses.Any(p => p.ProcessName == activeGame.ProcessName && p.HasExited == false))
|
||||
{
|
||||
_logger.Info("Disabling game: {0}", activeGame.Name);
|
||||
EffectManager.DisableGame(activeGame);
|
||||
}
|
||||
}
|
||||
|
||||
// Look for running games, stopping on the first one that's found.
|
||||
var newGame = EffectManager.EnabledGames
|
||||
.FirstOrDefault(
|
||||
g => runningProcesses.Any(p => p.ProcessName == g.ProcessName && p.HasExited == false));
|
||||
.FirstOrDefault(g => runningProcesses
|
||||
.Any(p => p.ProcessName == g.ProcessName && p.HasExited == false));
|
||||
|
||||
// If it's not already enabled, do so.
|
||||
if (newGame != null && EffectManager.ActiveEffect != newGame)
|
||||
EffectManager.ChangeEffect(newGame);
|
||||
{
|
||||
_logger.Info("Detected and enabling game: {0}", newGame.Name);
|
||||
EffectManager.ChangeEffect(newGame, LoopManager);
|
||||
}
|
||||
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
|
||||
@ -1,14 +1,16 @@
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models.Interfaces;
|
||||
using Artemis.Models.Profiles;
|
||||
using Artemis.Modules.Games.RocketLeague;
|
||||
|
||||
namespace Artemis.Models
|
||||
{
|
||||
public abstract class GameModel : EffectModel
|
||||
{
|
||||
protected GameModel(MainManager mainManager, GameSettings settings) : base(mainManager)
|
||||
protected GameModel(MainManager mainManager, GameSettings settings, IGameDataModel gameDataModel) : base(mainManager)
|
||||
{
|
||||
Settings = settings;
|
||||
GameDataModel = gameDataModel;
|
||||
}
|
||||
|
||||
public GameSettings Settings { get; set; }
|
||||
|
||||
@ -60,7 +60,7 @@ namespace Artemis.Models.Profiles
|
||||
layerProp.SetValue(props, opacity);
|
||||
}
|
||||
else
|
||||
layerProp.SetValue(props, (int) (percentage*(int) userProp.GetValue(userProps, null)));
|
||||
layerProp.SetValue(props, percentage*(double) userProp.GetValue(userProps, null));
|
||||
}
|
||||
|
||||
private void ApplyProp(LayerPropertiesModel props, LayerPropertiesModel userProps, IGameDataModel data)
|
||||
|
||||
@ -11,10 +11,10 @@ namespace Artemis.Models.Profiles
|
||||
[XmlInclude(typeof(MatrixTransform))]
|
||||
public class LayerPropertiesModel
|
||||
{
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
public int Width { get; set; }
|
||||
public int Height { get; set; }
|
||||
public double X { get; set; }
|
||||
public double Y { get; set; }
|
||||
public double Width { get; set; }
|
||||
public double Height { get; set; }
|
||||
public double Opacity { get; set; }
|
||||
public bool ContainedBrush { get; set; }
|
||||
public LayerAnimation Animation { get; set; }
|
||||
|
||||
@ -8,7 +8,7 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
{
|
||||
public class CounterStrikeModel : GameModel
|
||||
{
|
||||
public CounterStrikeModel(MainManager mainManager, CounterStrikeSettings settings) : base(mainManager, settings)
|
||||
public CounterStrikeModel(MainManager mainManager, CounterStrikeSettings settings) : base(mainManager, settings, new CounterStrikeDataModel())
|
||||
{
|
||||
Name = "CounterStrike";
|
||||
ProcessName = "csgo";
|
||||
@ -29,7 +29,6 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
{
|
||||
Initialized = false;
|
||||
|
||||
GameDataModel = new CounterStrikeDataModel();
|
||||
MainManager.GameStateWebServer.GameDataReceived += HandleGameData;
|
||||
|
||||
Initialized = true;
|
||||
|
||||
@ -3,8 +3,6 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="476.986" d:DesignWidth="538.772">
|
||||
@ -20,8 +18,8 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<Label FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
|
||||
@ -15,7 +15,6 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
{
|
||||
DisplayName = "CS:GO";
|
||||
|
||||
// Create effect model and add it to MainManager
|
||||
MainManager.EffectManager.EffectModels.Add(GameModel);
|
||||
PlaceConfigFile();
|
||||
}
|
||||
|
||||
@ -1,228 +1,227 @@
|
||||
namespace Artemis.Modules.Games.Dota2
|
||||
using Artemis.Models.Interfaces;
|
||||
|
||||
namespace Artemis.Modules.Games.Dota2
|
||||
{
|
||||
public class Dota2DataModel
|
||||
public class Dota2DataModel : IGameDataModel
|
||||
{
|
||||
public class Rootobject
|
||||
{
|
||||
public Provider provider { get; set; }
|
||||
public Map map { get; set; }
|
||||
public Player player { get; set; }
|
||||
public Hero hero { get; set; }
|
||||
public Abilities abilities { get; set; }
|
||||
public Items items { get; set; }
|
||||
public Previously previously { get; set; }
|
||||
}
|
||||
public Provider provider { get; set; }
|
||||
public Map map { get; set; }
|
||||
public Player player { get; set; }
|
||||
public Hero hero { get; set; }
|
||||
public Abilities abilities { get; set; }
|
||||
public Items items { get; set; }
|
||||
public Previously previously { get; set; }
|
||||
}
|
||||
|
||||
public class Provider
|
||||
{
|
||||
public string name { get; set; }
|
||||
public int appid { get; set; }
|
||||
public int version { get; set; }
|
||||
public int timestamp { get; set; }
|
||||
}
|
||||
public class Provider
|
||||
{
|
||||
public string name { get; set; }
|
||||
public int appid { get; set; }
|
||||
public int version { get; set; }
|
||||
public int timestamp { get; set; }
|
||||
}
|
||||
|
||||
public class Map
|
||||
{
|
||||
public string name { get; set; }
|
||||
public long matchid { get; set; }
|
||||
public int game_time { get; set; }
|
||||
public int clock_time { get; set; }
|
||||
public bool daytime { get; set; }
|
||||
public bool nightstalker_night { get; set; }
|
||||
public string game_state { get; set; }
|
||||
public string win_team { get; set; }
|
||||
public string customgamename { get; set; }
|
||||
public int ward_purchase_cooldown { get; set; }
|
||||
}
|
||||
public class Map
|
||||
{
|
||||
public string name { get; set; }
|
||||
public long matchid { get; set; }
|
||||
public int game_time { get; set; }
|
||||
public int clock_time { get; set; }
|
||||
public bool daytime { get; set; }
|
||||
public bool nightstalker_night { get; set; }
|
||||
public string game_state { get; set; }
|
||||
public string win_team { get; set; }
|
||||
public string customgamename { get; set; }
|
||||
public int ward_purchase_cooldown { get; set; }
|
||||
}
|
||||
|
||||
public class Player
|
||||
{
|
||||
public string steamid { get; set; }
|
||||
public string name { get; set; }
|
||||
public string activity { get; set; }
|
||||
public int kills { get; set; }
|
||||
public int deaths { get; set; }
|
||||
public int assists { get; set; }
|
||||
public int last_hits { get; set; }
|
||||
public int denies { get; set; }
|
||||
public int kill_streak { get; set; }
|
||||
public string team_name { get; set; }
|
||||
public int gold { get; set; }
|
||||
public int gold_reliable { get; set; }
|
||||
public int gold_unreliable { get; set; }
|
||||
public int gpm { get; set; }
|
||||
public int xpm { get; set; }
|
||||
}
|
||||
public class Player
|
||||
{
|
||||
public string steamid { get; set; }
|
||||
public string name { get; set; }
|
||||
public string activity { get; set; }
|
||||
public int kills { get; set; }
|
||||
public int deaths { get; set; }
|
||||
public int assists { get; set; }
|
||||
public int last_hits { get; set; }
|
||||
public int denies { get; set; }
|
||||
public int kill_streak { get; set; }
|
||||
public string team_name { get; set; }
|
||||
public int gold { get; set; }
|
||||
public int gold_reliable { get; set; }
|
||||
public int gold_unreliable { get; set; }
|
||||
public int gpm { get; set; }
|
||||
public int xpm { get; set; }
|
||||
}
|
||||
|
||||
public class Hero
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
public int level { get; set; }
|
||||
public bool alive { get; set; }
|
||||
public int respawn_seconds { get; set; }
|
||||
public int buyback_cost { get; set; }
|
||||
public int buyback_cooldown { get; set; }
|
||||
public int health { get; set; }
|
||||
public int max_health { get; set; }
|
||||
public int health_percent { get; set; }
|
||||
public int mana { get; set; }
|
||||
public int max_mana { get; set; }
|
||||
public int mana_percent { get; set; }
|
||||
public bool silenced { get; set; }
|
||||
public bool stunned { get; set; }
|
||||
public bool disarmed { get; set; }
|
||||
public bool magicimmune { get; set; }
|
||||
public bool hexed { get; set; }
|
||||
public bool muted { get; set; }
|
||||
public bool _break { get; set; }
|
||||
public bool has_debuff { get; set; }
|
||||
}
|
||||
public class Hero
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
public int level { get; set; }
|
||||
public bool alive { get; set; }
|
||||
public int respawn_seconds { get; set; }
|
||||
public int buyback_cost { get; set; }
|
||||
public int buyback_cooldown { get; set; }
|
||||
public int health { get; set; }
|
||||
public int max_health { get; set; }
|
||||
public int health_percent { get; set; }
|
||||
public int mana { get; set; }
|
||||
public int max_mana { get; set; }
|
||||
public int mana_percent { get; set; }
|
||||
public bool silenced { get; set; }
|
||||
public bool stunned { get; set; }
|
||||
public bool disarmed { get; set; }
|
||||
public bool magicimmune { get; set; }
|
||||
public bool hexed { get; set; }
|
||||
public bool muted { get; set; }
|
||||
public bool _break { get; set; }
|
||||
public bool has_debuff { get; set; }
|
||||
}
|
||||
|
||||
public class Abilities
|
||||
{
|
||||
public Ability0 ability0 { get; set; }
|
||||
public Ability1 ability1 { get; set; }
|
||||
public Ability2 ability2 { get; set; }
|
||||
public Ability3 ability3 { get; set; }
|
||||
public class Abilities
|
||||
{
|
||||
public Ability0 ability0 { get; set; }
|
||||
public Ability1 ability1 { get; set; }
|
||||
public Ability2 ability2 { get; set; }
|
||||
public Ability3 ability3 { get; set; }
|
||||
|
||||
public Attributes attributes { get; set; }
|
||||
}
|
||||
public Attributes attributes { get; set; }
|
||||
}
|
||||
|
||||
public class Ability0
|
||||
{
|
||||
public string name { get; set; }
|
||||
public int level { get; set; }
|
||||
public bool can_cast { get; set; }
|
||||
public bool passive { get; set; }
|
||||
public bool ability_active { get; set; }
|
||||
public int cooldown { get; set; }
|
||||
public bool ultimate { get; set; }
|
||||
}
|
||||
public class Ability0
|
||||
{
|
||||
public string name { get; set; }
|
||||
public int level { get; set; }
|
||||
public bool can_cast { get; set; }
|
||||
public bool passive { get; set; }
|
||||
public bool ability_active { get; set; }
|
||||
public int cooldown { get; set; }
|
||||
public bool ultimate { get; set; }
|
||||
}
|
||||
|
||||
public class Ability1
|
||||
{
|
||||
public string name { get; set; }
|
||||
public int level { get; set; }
|
||||
public bool can_cast { get; set; }
|
||||
public bool passive { get; set; }
|
||||
public bool ability_active { get; set; }
|
||||
public int cooldown { get; set; }
|
||||
public bool ultimate { get; set; }
|
||||
}
|
||||
public class Ability1
|
||||
{
|
||||
public string name { get; set; }
|
||||
public int level { get; set; }
|
||||
public bool can_cast { get; set; }
|
||||
public bool passive { get; set; }
|
||||
public bool ability_active { get; set; }
|
||||
public int cooldown { get; set; }
|
||||
public bool ultimate { get; set; }
|
||||
}
|
||||
|
||||
public class Ability2
|
||||
{
|
||||
public string name { get; set; }
|
||||
public int level { get; set; }
|
||||
public bool can_cast { get; set; }
|
||||
public bool passive { get; set; }
|
||||
public bool ability_active { get; set; }
|
||||
public int cooldown { get; set; }
|
||||
public bool ultimate { get; set; }
|
||||
}
|
||||
public class Ability2
|
||||
{
|
||||
public string name { get; set; }
|
||||
public int level { get; set; }
|
||||
public bool can_cast { get; set; }
|
||||
public bool passive { get; set; }
|
||||
public bool ability_active { get; set; }
|
||||
public int cooldown { get; set; }
|
||||
public bool ultimate { get; set; }
|
||||
}
|
||||
|
||||
public class Ability3
|
||||
{
|
||||
public string name { get; set; }
|
||||
public int level { get; set; }
|
||||
public bool can_cast { get; set; }
|
||||
public bool passive { get; set; }
|
||||
public bool ability_active { get; set; }
|
||||
public int cooldown { get; set; }
|
||||
public bool ultimate { get; set; }
|
||||
}
|
||||
public class Ability3
|
||||
{
|
||||
public string name { get; set; }
|
||||
public int level { get; set; }
|
||||
public bool can_cast { get; set; }
|
||||
public bool passive { get; set; }
|
||||
public bool ability_active { get; set; }
|
||||
public int cooldown { get; set; }
|
||||
public bool ultimate { get; set; }
|
||||
}
|
||||
|
||||
public class Attributes
|
||||
{
|
||||
public int level { get; set; }
|
||||
}
|
||||
public class Attributes
|
||||
{
|
||||
public int level { get; set; }
|
||||
}
|
||||
|
||||
public class Items
|
||||
{
|
||||
public Slot0 slot0 { get; set; }
|
||||
public Slot1 slot1 { get; set; }
|
||||
public Slot2 slot2 { get; set; }
|
||||
public Slot3 slot3 { get; set; }
|
||||
public Slot4 slot4 { get; set; }
|
||||
public Slot5 slot5 { get; set; }
|
||||
public Stash0 stash0 { get; set; }
|
||||
public Stash1 stash1 { get; set; }
|
||||
public Stash2 stash2 { get; set; }
|
||||
public Stash3 stash3 { get; set; }
|
||||
public Stash4 stash4 { get; set; }
|
||||
public Stash5 stash5 { get; set; }
|
||||
}
|
||||
public class Items
|
||||
{
|
||||
public Slot0 slot0 { get; set; }
|
||||
public Slot1 slot1 { get; set; }
|
||||
public Slot2 slot2 { get; set; }
|
||||
public Slot3 slot3 { get; set; }
|
||||
public Slot4 slot4 { get; set; }
|
||||
public Slot5 slot5 { get; set; }
|
||||
public Stash0 stash0 { get; set; }
|
||||
public Stash1 stash1 { get; set; }
|
||||
public Stash2 stash2 { get; set; }
|
||||
public Stash3 stash3 { get; set; }
|
||||
public Stash4 stash4 { get; set; }
|
||||
public Stash5 stash5 { get; set; }
|
||||
}
|
||||
|
||||
public class Slot0
|
||||
{
|
||||
public string name { get; set; }
|
||||
}
|
||||
public class Slot0
|
||||
{
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
public class Slot1
|
||||
{
|
||||
public string name { get; set; }
|
||||
}
|
||||
public class Slot1
|
||||
{
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
public class Slot2
|
||||
{
|
||||
public string name { get; set; }
|
||||
}
|
||||
public class Slot2
|
||||
{
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
public class Slot3
|
||||
{
|
||||
public string name { get; set; }
|
||||
}
|
||||
public class Slot3
|
||||
{
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
public class Slot4
|
||||
{
|
||||
public string name { get; set; }
|
||||
}
|
||||
public class Slot4
|
||||
{
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
public class Slot5
|
||||
{
|
||||
public string name { get; set; }
|
||||
}
|
||||
public class Slot5
|
||||
{
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
public class Stash0
|
||||
{
|
||||
public string name { get; set; }
|
||||
}
|
||||
public class Stash0
|
||||
{
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
public class Stash1
|
||||
{
|
||||
public string name { get; set; }
|
||||
}
|
||||
public class Stash1
|
||||
{
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
public class Stash2
|
||||
{
|
||||
public string name { get; set; }
|
||||
}
|
||||
public class Stash2
|
||||
{
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
public class Stash3
|
||||
{
|
||||
public string name { get; set; }
|
||||
}
|
||||
public class Stash3
|
||||
{
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
public class Stash4
|
||||
{
|
||||
public string name { get; set; }
|
||||
}
|
||||
public class Stash4
|
||||
{
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
public class Stash5
|
||||
{
|
||||
public string name { get; set; }
|
||||
}
|
||||
public class Stash5
|
||||
{
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
public class Previously
|
||||
{
|
||||
public Player1 player { get; set; }
|
||||
}
|
||||
public class Previously
|
||||
{
|
||||
public Player1 player { get; set; }
|
||||
}
|
||||
|
||||
public class Player1
|
||||
{
|
||||
public int gold { get; set; }
|
||||
public int gold_unreliable { get; set; }
|
||||
}
|
||||
public class Player1
|
||||
{
|
||||
public int gold { get; set; }
|
||||
public int gold_unreliable { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,25 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using Artemis.KeyboardProviders;
|
||||
using System.Drawing;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.Utilities.GameState;
|
||||
using Artemis.Utilities.Keyboard;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Modules.Games.Dota2
|
||||
{
|
||||
internal class Dota2Model : GameModel
|
||||
{
|
||||
private KeyboardRegion _abilityKeys;
|
||||
private KeyboardRegion _keyPad;
|
||||
private KeyboardRegion _topRow;
|
||||
|
||||
public Dota2Model(MainManager mainManager, Dota2Settings settings) : base(mainManager, settings)
|
||||
public Dota2Model(MainManager mainManager, Dota2Settings settings)
|
||||
: base(mainManager, settings, new Dota2DataModel())
|
||||
{
|
||||
Name = "Dota2";
|
||||
ProcessName = "dota2";
|
||||
@ -29,7 +19,9 @@ namespace Artemis.Modules.Games.Dota2
|
||||
Scale = 4;
|
||||
}
|
||||
|
||||
public int Scale { get; set; }
|
||||
public new Dota2Settings Settings { get; set; }
|
||||
public Dota2DataModel D2Json { get; set; }
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
@ -40,186 +32,17 @@ namespace Artemis.Modules.Games.Dota2
|
||||
public override void Enable()
|
||||
{
|
||||
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
|
||||
, new List<Color>()
|
||||
, LinearGradientMode.Horizontal)
|
||||
{Height = Scale, ContainedBrush = false};
|
||||
|
||||
ManaRectangle = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard
|
||||
, 0
|
||||
, (_topRow.BottomRight.Y + 1)*Scale
|
||||
, new List<Color>()
|
||||
, LinearGradientMode.Horizontal)
|
||||
{Height = Scale, ContainedBrush = false};
|
||||
|
||||
EventRectangle = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard
|
||||
, 0
|
||||
, _topRow.TopLeft.X + 3
|
||||
, new List<Color>()
|
||||
, LinearGradientMode.Horizontal)
|
||||
{
|
||||
Height = MainManager.KeyboardManager.ActiveKeyboard.Height*Scale - Scale
|
||||
,
|
||||
Width = MainManager.KeyboardManager.ActiveKeyboard.Width*Scale - Scale - 12
|
||||
};
|
||||
|
||||
DayCycleRectangle = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard
|
||||
, _keyPad.TopLeft.X*Scale
|
||||
, _keyPad.TopLeft.Y*Scale
|
||||
, new List<Color>()
|
||||
, LinearGradientMode.Horizontal)
|
||||
{
|
||||
Height = _keyPad.GetRectangle().Height*Scale,
|
||||
Width = _keyPad.GetRectangle().Width*Scale
|
||||
};
|
||||
|
||||
SetAbilityKeys();
|
||||
|
||||
MainManager.GameStateWebServer.GameDataReceived += HandleGameData;
|
||||
Initialized = true;
|
||||
}
|
||||
|
||||
private void SetAbilityKeys()
|
||||
{
|
||||
#region Long Switch Statement for Keys
|
||||
|
||||
switch (Settings.KeyboardLayout)
|
||||
{
|
||||
case "0":
|
||||
case "Default": //default
|
||||
case "4": //Heroes of newearth
|
||||
case "3": //League of Legends
|
||||
for (var 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<Color>(),
|
||||
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<Color>(),
|
||||
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<Color>(),
|
||||
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<Color>(),
|
||||
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<Color>(),
|
||||
LinearGradientMode.Horizontal)
|
||||
{
|
||||
Height = Scale,
|
||||
Width = Scale
|
||||
};
|
||||
break;
|
||||
case "1": //MMO
|
||||
case "5": //Smite
|
||||
for (var 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<Color>(),
|
||||
LinearGradientMode.Horizontal)
|
||||
{
|
||||
Height = Scale,
|
||||
Width = Scale
|
||||
};
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
if (D2Json?.map == null)
|
||||
return;
|
||||
|
||||
UpdateMainColor();
|
||||
if (Settings.ShowEvents)
|
||||
UpdateEvents();
|
||||
if (Settings.ShowDayCycle)
|
||||
UpdateDay();
|
||||
if (!D2Json.hero.alive)
|
||||
return;
|
||||
if (Settings.CanCastAbility)
|
||||
UpdateAbilities();
|
||||
if (Settings.ShowHealth)
|
||||
UpdateHealth();
|
||||
if (Settings.ShowMana)
|
||||
UpdateMana();
|
||||
}
|
||||
|
||||
private void UpdateMainColor()
|
||||
{
|
||||
var list = new List<Color> {ColorHelpers.ToDrawingColor(Settings.MainColor)};
|
||||
EventRectangle.Colors = list;
|
||||
DayCycleRectangle.Colors = list;
|
||||
HealthRectangle.Colors = list;
|
||||
ManaRectangle.Colors = list;
|
||||
foreach (var key in AbilityKeysRectangles)
|
||||
key.Colors = list;
|
||||
}
|
||||
|
||||
private void UpdateEvents()
|
||||
{
|
||||
List<Color> list = null;
|
||||
if (!D2Json.hero.alive)
|
||||
list = new List<Color> {Color.LightGray};
|
||||
else if (D2Json.hero.disarmed)
|
||||
list = new List<Color> {Color.Yellow};
|
||||
else if (D2Json.hero.hexed)
|
||||
list = new List<Color> {Color.Yellow};
|
||||
else if (D2Json.hero.silenced)
|
||||
list = new List<Color> {Color.Yellow};
|
||||
else if (D2Json.hero.stunned)
|
||||
list = new List<Color> {Color.Yellow};
|
||||
else if (D2Json.hero.magicimmune)
|
||||
list = new List<Color> {Color.Lime};
|
||||
if (list == null)
|
||||
return;
|
||||
|
||||
EventRectangle.Colors = list;
|
||||
DayCycleRectangle.Colors = list;
|
||||
HealthRectangle.Colors = list;
|
||||
ManaRectangle.Colors = list;
|
||||
foreach (var item in AbilityKeysRectangles)
|
||||
item.Colors = list;
|
||||
UpdateDay();
|
||||
}
|
||||
|
||||
private void UpdateDay()
|
||||
@ -227,88 +50,19 @@ namespace Artemis.Modules.Games.Dota2
|
||||
if (D2Json?.map?.daytime == null)
|
||||
return;
|
||||
|
||||
if (D2Json.map.nightstalker_night)
|
||||
{
|
||||
DayCycleRectangle.Colors = new List<Color> {Color.Blue};
|
||||
return;
|
||||
}
|
||||
|
||||
var timeLeft = 240 - D2Json.map.clock_time%240;
|
||||
var timePercentage = 100.00/240*timeLeft;
|
||||
DayCycleRectangle.Width = (int) (_keyPad.GetRectangle().Width*Scale/100.00*timePercentage);
|
||||
DayCycleRectangle.Colors = D2Json.map.daytime
|
||||
? new List<Color> {Color.Yellow}
|
||||
: new List<Color> {Color.Blue};
|
||||
}
|
||||
|
||||
private void UpdateMana()
|
||||
{
|
||||
if (D2Json?.hero == null || D2Json.hero.mana_percent == -1)
|
||||
return;
|
||||
|
||||
var manaPercent = D2Json.hero.mana_percent;
|
||||
ManaRectangle.Colors = new List<Color> {ColorHelpers.ToDrawingColor(Settings.ManaColor)};
|
||||
ManaRectangle.Width = (int) Math.Floor(_topRow.GetRectangle().Width*Scale/100.00*manaPercent);
|
||||
}
|
||||
|
||||
private void UpdateAbilities()
|
||||
{
|
||||
if (AbilityKeysRectangles == null)
|
||||
return;
|
||||
|
||||
AbilityKeysRectangles[0].Colors = D2Json?.abilities?.ability0?.can_cast == true
|
||||
? new List<Color>
|
||||
{ColorHelpers.ToDrawingColor(Settings.AbilityReadyColor)}
|
||||
: new List<Color> {ColorHelpers.ToDrawingColor(Settings.AbilityCooldownColor)};
|
||||
AbilityKeysRectangles[1].Colors = D2Json?.abilities?.ability1?.can_cast == true
|
||||
? new List<Color>
|
||||
{ColorHelpers.ToDrawingColor(Settings.AbilityReadyColor)}
|
||||
: new List<Color> {ColorHelpers.ToDrawingColor(Settings.AbilityCooldownColor)};
|
||||
AbilityKeysRectangles[2].Colors = D2Json?.abilities?.ability2?.can_cast == true
|
||||
? new List<Color>
|
||||
{ColorHelpers.ToDrawingColor(Settings.AbilityReadyColor)}
|
||||
: new List<Color> {ColorHelpers.ToDrawingColor(Settings.AbilityCooldownColor)};
|
||||
AbilityKeysRectangles[3].Colors = D2Json?.abilities?.ability3?.can_cast == true
|
||||
? new List<Color>
|
||||
{ColorHelpers.ToDrawingColor(Settings.AbilityReadyColor)}
|
||||
: new List<Color> {ColorHelpers.ToDrawingColor(Settings.AbilityCooldownColor)};
|
||||
}
|
||||
|
||||
|
||||
private void UpdateHealth()
|
||||
{
|
||||
if (D2Json?.hero == null || D2Json.hero.health_percent == -1)
|
||||
return;
|
||||
|
||||
var healthPercent = D2Json.hero.health_percent;
|
||||
if (healthPercent > 66)
|
||||
HealthRectangle.Colors = new List<Color> {Color.Lime};
|
||||
else if (healthPercent > 33)
|
||||
HealthRectangle.Colors = new List<Color> {Color.Yellow};
|
||||
else
|
||||
HealthRectangle.Colors = new List<Color> {Color.Red};
|
||||
|
||||
HealthRectangle.Width = (int) Math.Floor(_topRow.GetRectangle().Width*Scale/100.00*healthPercent);
|
||||
// TODO: Insert timePercentage into the DataModel as it will be useful when creating profiles
|
||||
}
|
||||
|
||||
|
||||
public override Bitmap GenerateBitmap()
|
||||
{
|
||||
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
||||
if (Profile == null || GameDataModel == null)
|
||||
return null;
|
||||
|
||||
using (var g = Graphics.FromImage(bitmap))
|
||||
{
|
||||
g.Clear(Color.Transparent);
|
||||
EventRectangle.Draw(g);
|
||||
HealthRectangle.Draw(g);
|
||||
ManaRectangle.Draw(g);
|
||||
foreach (var item in AbilityKeysRectangles)
|
||||
{
|
||||
item.Draw(g);
|
||||
}
|
||||
DayCycleRectangle.Draw(g);
|
||||
}
|
||||
return bitmap;
|
||||
var keyboardRect = MainManager.KeyboardManager.ActiveKeyboard.KeyboardRectangle(Scale);
|
||||
return Profile.GenerateBitmap<Dota2DataModel>(keyboardRect, GameDataModel);
|
||||
}
|
||||
|
||||
|
||||
@ -321,19 +75,7 @@ namespace Artemis.Modules.Games.Dota2
|
||||
return;
|
||||
|
||||
// Parse the JSON
|
||||
D2Json = JsonConvert.DeserializeObject<Dota2DataModel.Rootobject>(jsonString);
|
||||
D2Json = JsonConvert.DeserializeObject<Dota2DataModel>(jsonString);
|
||||
}
|
||||
|
||||
#region Variables
|
||||
|
||||
public Dota2DataModel.Rootobject D2Json { get; set; }
|
||||
public int Scale { get; set; }
|
||||
public KeyboardRectangle HealthRectangle { get; set; }
|
||||
public KeyboardRectangle EventRectangle { get; set; }
|
||||
public KeyboardRectangle DayCycleRectangle { get; set; }
|
||||
public KeyboardRectangle ManaRectangle { get; set; }
|
||||
public KeyboardRectangle[] AbilityKeysRectangles = new KeyboardRectangle[4];
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -4,10 +4,9 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
mc:Ignorable="d" d:DesignWidth="635" Height="515.691">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Margin="0,0,0,-19">
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="476.986" d:DesignWidth="538.772">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||
<Grid Margin="15, 5, 15, 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
@ -18,22 +17,14 @@
|
||||
<RowDefinition Height="80" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<Label FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap"
|
||||
Text="Shows game states and events from Dota 2." />
|
||||
Text="Shows verious game states and events on the keyboard." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
@ -45,7 +36,6 @@
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<StackPanel Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
@ -57,118 +47,21 @@
|
||||
cal:Message.Attach="[Event LostFocus] = [Action PlaceConfigFile]" />
|
||||
<Button x:Name="BrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944"
|
||||
HorizontalAlignment="Right" Width="25"
|
||||
Style="{DynamicResource SquareButtonStyle}" Height="25" />
|
||||
Style="{DynamicResource SquareButtonStyle}" Height="26" Margin="0,-2,0,0" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Main Color -->
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" HorizontalAlignment="Left" Width="114" VerticalAlignment="Center"
|
||||
Height="16" Margin="0,8">
|
||||
Main keyboard color
|
||||
</TextBlock>
|
||||
<xctk:ColorPicker x:Name="MainColor"
|
||||
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" />
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-30,0" />
|
||||
|
||||
<!-- Ability Ready Color -->
|
||||
<TextBlock Grid.Row="3" Grid.Column="0" HorizontalAlignment="Left" Width="114" VerticalAlignment="Center"
|
||||
Height="16" Margin="0,8">
|
||||
Ability Ready Color
|
||||
</TextBlock>
|
||||
<xctk:ColorPicker x:Name="AbilityReadyColor"
|
||||
SelectedColor="{Binding Path=GameSettings.AbilityReadyColor, Mode=TwoWay}"
|
||||
Grid.Row="3" Grid.Column="1" Width="110" HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
|
||||
|
||||
<!-- Ability on Cooldown Color -->
|
||||
<TextBlock Grid.Row="4" Grid.Column="0" HorizontalAlignment="Left" Width="147" VerticalAlignment="Center"
|
||||
Height="16" Margin="0,8">
|
||||
Ability on Cooldown Color
|
||||
</TextBlock>
|
||||
<xctk:ColorPicker x:Name="AbilityCooldownColor"
|
||||
SelectedColor="{Binding Path=GameSettings.AbilityCooldownColor, Mode=TwoWay}"
|
||||
Grid.Row="4" Grid.Column="1" Width="110" HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
|
||||
|
||||
<!-- Abilities Display -->
|
||||
<TextBlock Grid.Row="5" Grid.Column="0" HorizontalAlignment="Left" Width="168" VerticalAlignment="Center"
|
||||
Height="16" Margin="0,10,0,9">
|
||||
Keyboard Template
|
||||
</TextBlock>
|
||||
<ComboBox Grid.Row="5" Grid.Column="1" x:Name="KeyboardLayouts"
|
||||
ItemsSource="{Binding Path=KeyboardLayouts}"
|
||||
SelectedIndex="{Binding Path=GameSettings.KeyboardLayout}" VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"
|
||||
Width="109" Margin="0,6,0,7" />
|
||||
|
||||
<!-- Items Display -->
|
||||
<TextBlock Grid.Row="6" Grid.Column="0" HorizontalAlignment="Left" Width="168" VerticalAlignment="Center"
|
||||
Height="16" Margin="0,10,0,9">
|
||||
Castable Abilities
|
||||
</TextBlock>
|
||||
<controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.CanCastAbility, Mode=TwoWay}"
|
||||
Grid.Row="6" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No"
|
||||
Margin="0,0,-5,0" Width="114" />
|
||||
|
||||
<!-- Health Display -->
|
||||
<TextBlock Grid.Row="7" Grid.Column="0" HorizontalAlignment="Left" Width="168" VerticalAlignment="Center"
|
||||
Height="16" Margin="0,10,0,9">
|
||||
Display health
|
||||
</TextBlock>
|
||||
<controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.ShowHealth, Mode=TwoWay}"
|
||||
Grid.Row="7" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No"
|
||||
Margin="0,0,-5,0" Width="114" />
|
||||
|
||||
<!-- Mana Display-->
|
||||
<TextBlock Grid.Row="8" Grid.Column="0" HorizontalAlignment="Left" Width="168" VerticalAlignment="Center"
|
||||
Height="16" Margin="0,10,0,9">
|
||||
Display mana
|
||||
</TextBlock>
|
||||
<controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.ShowMana, Mode=TwoWay}"
|
||||
Grid.Row="8" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No"
|
||||
Margin="0,0,-5,0" Width="114" />
|
||||
|
||||
<!-- Mana Color -->
|
||||
<TextBlock Grid.Row="9" Grid.Column="0" HorizontalAlignment="Left" Width="114" VerticalAlignment="Center"
|
||||
Height="16" Margin="0,8">
|
||||
Mana color
|
||||
</TextBlock>
|
||||
<xctk:ColorPicker x:Name="ManaColor"
|
||||
SelectedColor="{Binding Path=GameSettings.ManaColor, Mode=TwoWay}"
|
||||
Grid.Row="9" Grid.Column="1" Width="110" HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
|
||||
|
||||
<!-- Daytime Display -->
|
||||
<TextBlock Grid.Row="10" Grid.Column="0" HorizontalAlignment="Left" Width="168" VerticalAlignment="Center"
|
||||
Height="16" Margin="0,10,0,9">
|
||||
Display day/night
|
||||
</TextBlock>
|
||||
<controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.ShowDayCycle, Mode=TwoWay}"
|
||||
Grid.Row="10" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes"
|
||||
OffLabel="No"
|
||||
Margin="0,0,-5,0" Width="114" />
|
||||
|
||||
<!-- Dead Display -->
|
||||
<TextBlock Grid.Row="11" Grid.Column="0" HorizontalAlignment="Left" Width="168" VerticalAlignment="Center"
|
||||
Height="16" Margin="0,10,0,9">
|
||||
Show events on the keyboard
|
||||
</TextBlock>
|
||||
<controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.ShowEvents, Mode=TwoWay}"
|
||||
Grid.Row="11" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes"
|
||||
OffLabel="No"
|
||||
Margin="0,0,-5,0" Width="114" />
|
||||
|
||||
|
||||
<StackPanel Grid.Column="0" Grid.Row="12" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
|
||||
Margin="10,0,0,0"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@ -19,19 +19,6 @@ namespace Artemis.Modules.Games.Dota2
|
||||
PlaceConfigFile();
|
||||
}
|
||||
|
||||
public BindableCollection<string> KeyboardLayouts => new BindableCollection<string>(new[]
|
||||
{
|
||||
"Default",
|
||||
"MMO",
|
||||
"WASD",
|
||||
"League of Legends",
|
||||
"Heros of Newearth",
|
||||
"Smite"
|
||||
});
|
||||
|
||||
public static string Name => "Dota 2";
|
||||
public string Content => "Dota 2 Content";
|
||||
|
||||
public void BrowseDirectory()
|
||||
{
|
||||
var dialog = new FolderBrowserDialog {SelectedPath = ((Dota2Settings) GameSettings).GameDirectory};
|
||||
@ -71,7 +58,6 @@ namespace Artemis.Modules.Games.Dota2
|
||||
cfgFile);
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -15,7 +15,8 @@ namespace Artemis.Modules.Games.RocketLeague
|
||||
private Memory _memory;
|
||||
private GamePointersCollection _pointer;
|
||||
|
||||
public RocketLeagueModel(MainManager mainManager, RocketLeagueSettings settings) : base(mainManager, settings)
|
||||
public RocketLeagueModel(MainManager mainManager, RocketLeagueSettings settings)
|
||||
: base(mainManager, settings, new RocketLeagueDataModel())
|
||||
{
|
||||
Name = "RocketLeague";
|
||||
ProcessName = "RocketLeague";
|
||||
@ -41,7 +42,6 @@ namespace Artemis.Modules.Games.RocketLeague
|
||||
|
||||
var tempProcess = MemoryHelpers.GetProcessIfRunning(ProcessName);
|
||||
_memory = new Memory(tempProcess);
|
||||
GameDataModel = new RocketLeagueDataModel();
|
||||
|
||||
Initialized = true;
|
||||
}
|
||||
|
||||
@ -13,7 +13,6 @@ namespace Artemis.Modules.Games.TheDivision
|
||||
public class TheDivisionModel : GameModel
|
||||
{
|
||||
private Wave _ammoWave;
|
||||
private TheDivisionDataModel _dataModel;
|
||||
private KeyboardRectangle _hpRect;
|
||||
private KeyboardRectangle _p2;
|
||||
private KeyboardRectangle _p3;
|
||||
@ -22,7 +21,7 @@ namespace Artemis.Modules.Games.TheDivision
|
||||
private StickyValue<bool> _stickyHp;
|
||||
private int _trans;
|
||||
|
||||
public TheDivisionModel(MainManager mainManager, TheDivisionSettings settings) : base(mainManager, settings)
|
||||
public TheDivisionModel(MainManager mainManager, TheDivisionSettings settings) : base(mainManager, settings, new TheDivisionDataModel())
|
||||
{
|
||||
Name = "TheDivision";
|
||||
ProcessName = "TheDivision";
|
||||
@ -89,7 +88,6 @@ namespace Artemis.Modules.Games.TheDivision
|
||||
_stickyHp = new StickyValue<bool>(200);
|
||||
|
||||
DllManager.PlaceDll();
|
||||
_dataModel = new TheDivisionDataModel();
|
||||
|
||||
MainManager.PipeServer.PipeMessage += PipeServerOnPipeMessage;
|
||||
Initialized = true;
|
||||
@ -113,6 +111,7 @@ namespace Artemis.Modules.Games.TheDivision
|
||||
// Parses Division key data to game data
|
||||
private void InterpertrateDivisionKey(IReadOnlyList<int> parts)
|
||||
{
|
||||
var gameDataModel = (TheDivisionDataModel)GameDataModel;
|
||||
var keyCode = parts[1];
|
||||
var rPer = parts[2];
|
||||
var gPer = parts[3];
|
||||
@ -132,39 +131,40 @@ namespace Artemis.Modules.Games.TheDivision
|
||||
newState = PlayerState.Offline;
|
||||
|
||||
if (playerId == 1)
|
||||
_dataModel.PartyMember1 = newState;
|
||||
gameDataModel.PartyMember1 = newState;
|
||||
else if (playerId == 2)
|
||||
_dataModel.PartyMember2 = newState;
|
||||
gameDataModel.PartyMember2 = newState;
|
||||
else if (playerId == 3)
|
||||
_dataModel.PartyMember3 = newState;
|
||||
gameDataModel.PartyMember3 = newState;
|
||||
}
|
||||
// R blinks white when low on ammo
|
||||
else if (keyCode == 19)
|
||||
{
|
||||
_stickyAmmo.Value = rPer == 100 && gPer > 1 && bPer > 1;
|
||||
_dataModel.LowAmmo = _stickyAmmo.Value;
|
||||
gameDataModel.LowAmmo = _stickyAmmo.Value;
|
||||
}
|
||||
// G turns white when holding a grenade, turns off when out of grenades
|
||||
else if (keyCode == 34)
|
||||
{
|
||||
if (rPer == 100 && gPer < 10 && bPer < 10)
|
||||
_dataModel.GrenadeState = GrenadeState.HasGrenade;
|
||||
gameDataModel.GrenadeState = GrenadeState.HasGrenade;
|
||||
else if (rPer == 100 && gPer > 10 && bPer > 10)
|
||||
_dataModel.GrenadeState = GrenadeState.GrenadeEquipped;
|
||||
gameDataModel.GrenadeState = GrenadeState.GrenadeEquipped;
|
||||
else
|
||||
_dataModel.GrenadeState = GrenadeState.HasNoGrenade;
|
||||
gameDataModel.GrenadeState = GrenadeState.HasNoGrenade;
|
||||
}
|
||||
// V blinks on low HP
|
||||
else if (keyCode == 47)
|
||||
{
|
||||
_stickyHp.Value = rPer == 100 && gPer > 1 && bPer > 1;
|
||||
_dataModel.LowHp = _stickyHp.Value;
|
||||
gameDataModel.LowHp = _stickyHp.Value;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
if (_dataModel.LowAmmo)
|
||||
var gameDataModel = (TheDivisionDataModel)GameDataModel;
|
||||
if (gameDataModel.LowAmmo)
|
||||
{
|
||||
_ammoWave.Size++;
|
||||
if (_ammoWave.Size > 30)
|
||||
@ -176,27 +176,27 @@ namespace Artemis.Modules.Games.TheDivision
|
||||
else
|
||||
_ammoWave.Size = 0;
|
||||
|
||||
_hpRect.Colors = _dataModel.LowHp
|
||||
_hpRect.Colors = gameDataModel.LowHp
|
||||
? new List<Color> {Color.Red, Color.Orange}
|
||||
: new List<Color> {Color.FromArgb(10, 255, 0), Color.FromArgb(80, 255, 45)};
|
||||
|
||||
if (_dataModel.PartyMember1 == PlayerState.Offline)
|
||||
if (gameDataModel.PartyMember1 == PlayerState.Offline)
|
||||
_p2.Colors = new List<Color> {Color.Gray, Color.White};
|
||||
else if (_dataModel.PartyMember1 == PlayerState.Online)
|
||||
else if (gameDataModel.PartyMember1 == PlayerState.Online)
|
||||
_p2.Colors = new List<Color> {Color.FromArgb(10, 255, 0), Color.FromArgb(80, 255, 45)};
|
||||
else
|
||||
_p2.Colors = new List<Color> {Color.Red, Color.Orange};
|
||||
|
||||
if (_dataModel.PartyMember2 == PlayerState.Offline)
|
||||
if (gameDataModel.PartyMember2 == PlayerState.Offline)
|
||||
_p3.Colors = new List<Color> {Color.Gray, Color.White};
|
||||
else if (_dataModel.PartyMember2 == PlayerState.Online)
|
||||
else if (gameDataModel.PartyMember2 == PlayerState.Online)
|
||||
_p3.Colors = new List<Color> {Color.FromArgb(10, 255, 0), Color.FromArgb(80, 255, 45)};
|
||||
else
|
||||
_p3.Colors = new List<Color> {Color.Red, Color.Orange};
|
||||
|
||||
if (_dataModel.PartyMember3 == PlayerState.Offline)
|
||||
if (gameDataModel.PartyMember3 == PlayerState.Offline)
|
||||
_p4.Colors = new List<Color> {Color.Gray, Color.White};
|
||||
else if (_dataModel.PartyMember3 == PlayerState.Online)
|
||||
else if (gameDataModel.PartyMember3 == PlayerState.Online)
|
||||
_p4.Colors = new List<Color> {Color.FromArgb(10, 255, 0), Color.FromArgb(80, 255, 45)};
|
||||
else
|
||||
_p4.Colors = new List<Color> {Color.Red, Color.Orange};
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
using Artemis.Models.Interfaces;
|
||||
|
||||
namespace Artemis.Modules.Games.Witcher3
|
||||
{
|
||||
public class TheWitcherDataModel : IGameDataModel
|
||||
{
|
||||
public WitcherSign WitcherSign { get; set; }
|
||||
}
|
||||
|
||||
public enum WitcherSign
|
||||
{
|
||||
Aard,
|
||||
Yrden,
|
||||
Igni,
|
||||
Quen,
|
||||
Axii
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
using Artemis.Models.Interfaces;
|
||||
|
||||
namespace Artemis.Modules.Games.Witcher3
|
||||
{
|
||||
public class Witcher3DataModel : IGameDataModel
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -18,7 +18,8 @@ namespace Artemis.Modules.Games.Witcher3
|
||||
private KeyboardRectangle _signRect;
|
||||
private string _witcherSettings;
|
||||
|
||||
public Witcher3Model(MainManager mainManager, Witcher3Settings settings) : base(mainManager, settings)
|
||||
public Witcher3Model(MainManager mainManager, Witcher3Settings settings)
|
||||
: base(mainManager, settings, new TheWitcherDataModel())
|
||||
{
|
||||
Name = "Witcher3";
|
||||
ProcessName = "witcher3";
|
||||
@ -64,6 +65,7 @@ namespace Artemis.Modules.Games.Witcher3
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
var gameDataModel = (TheWitcherDataModel) GameDataModel;
|
||||
// Witcher effect is very static and reads from disk, don't want to update too often.
|
||||
if (_updateSw.ElapsedMilliseconds < 500)
|
||||
return;
|
||||
@ -72,10 +74,8 @@ namespace Artemis.Modules.Games.Witcher3
|
||||
if (_witcherSettings == null)
|
||||
return;
|
||||
|
||||
var reader = new StreamReader(File.Open(_witcherSettings,
|
||||
FileMode.Open,
|
||||
FileAccess.Read,
|
||||
FileShare.ReadWrite));
|
||||
var reader = new StreamReader(
|
||||
File.Open(_witcherSettings, FileMode.Open, FileAccess.Read, FileShare.ReadWrite));
|
||||
var configContent = reader.ReadToEnd();
|
||||
reader.Close();
|
||||
|
||||
@ -87,32 +87,30 @@ namespace Artemis.Modules.Games.Witcher3
|
||||
switch (sign)
|
||||
{
|
||||
case "ST_Aard\r":
|
||||
_signRect.Colors = new List<Color> {Color.DeepSkyBlue, Color.Blue};
|
||||
gameDataModel.WitcherSign = WitcherSign.Aard;
|
||||
break;
|
||||
case "ST_Yrden\r":
|
||||
_signRect.Colors = new List<Color> {Color.Purple, Color.DeepPink};
|
||||
gameDataModel.WitcherSign = WitcherSign.Yrden;
|
||||
break;
|
||||
case "ST_Igni\r":
|
||||
_signRect.Colors = new List<Color> {Color.DarkOrange, Color.Red};
|
||||
gameDataModel.WitcherSign = WitcherSign.Igni;
|
||||
break;
|
||||
case "ST_Quen\r":
|
||||
_signRect.Colors = new List<Color> {Color.DarkOrange, Color.FromArgb(232, 193, 0)};
|
||||
gameDataModel.WitcherSign = WitcherSign.Quen;
|
||||
break;
|
||||
case "ST_Axii\r":
|
||||
_signRect.Colors = new List<Color> {Color.LawnGreen, Color.DarkGreen};
|
||||
gameDataModel.WitcherSign = WitcherSign.Axii;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override Bitmap GenerateBitmap()
|
||||
{
|
||||
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
||||
using (var g = Graphics.FromImage(bitmap))
|
||||
{
|
||||
g.Clear(Color.Transparent);
|
||||
_signRect.Draw(g);
|
||||
}
|
||||
return bitmap;
|
||||
if (Profile == null || GameDataModel == null)
|
||||
return null;
|
||||
|
||||
var keyboardRect = MainManager.KeyboardManager.ActiveKeyboard.KeyboardRectangle(Scale);
|
||||
return Profile.GenerateBitmap<TheWitcherDataModel>(keyboardRect, GameDataModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5,7 +5,6 @@ using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using Artemis.InjectionFactories;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models.Interfaces;
|
||||
using Artemis.Properties;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Caliburn.Micro;
|
||||
@ -107,8 +106,4 @@ namespace Artemis.Modules.Games.Witcher3
|
||||
DialogService.ShowMessageBox("Success", "The mod was successfully installed!");
|
||||
}
|
||||
}
|
||||
|
||||
public class Witcher3DataModel : IGameDataModel
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -46,13 +46,21 @@ namespace Artemis.Utilities.Memory
|
||||
/// <returns></returns>
|
||||
protected ProcessModule FindModule(string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
throw new ArgumentNullException("name");
|
||||
foreach (ProcessModule module in Process.Modules)
|
||||
try
|
||||
{
|
||||
if (module.ModuleName.ToLower() == name.ToLower())
|
||||
return module;
|
||||
if (string.IsNullOrEmpty(name))
|
||||
throw new ArgumentNullException("name");
|
||||
foreach (ProcessModule module in Process.Modules)
|
||||
{
|
||||
if (module.ModuleName.ToLower() == name.ToLower())
|
||||
return module;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -6,6 +6,8 @@ using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Media;
|
||||
using Artemis.KeyboardProviders;
|
||||
using Artemis.Models;
|
||||
using Artemis.Models.Interfaces;
|
||||
using Artemis.Models.Profiles;
|
||||
using Artemis.Services;
|
||||
using Artemis.Utilities;
|
||||
@ -15,7 +17,7 @@ using Screen = Caliburn.Micro.Screen;
|
||||
|
||||
namespace Artemis.ViewModels.LayerEditor
|
||||
{
|
||||
public class LayerEditorViewModel : Screen
|
||||
public sealed class LayerEditorViewModel : Screen
|
||||
{
|
||||
private readonly KeyboardProvider _activeKeyboard;
|
||||
private readonly BackgroundWorker _previewWorker;
|
||||
@ -25,7 +27,7 @@ namespace Artemis.ViewModels.LayerEditor
|
||||
private LayerModel _proposedLayer;
|
||||
private LayerPropertiesModel _proposedProperties;
|
||||
|
||||
public LayerEditorViewModel(KeyboardProvider activeKeyboard, LayerModel layer)
|
||||
public LayerEditorViewModel(IGameDataModel gameDataModel, KeyboardProvider activeKeyboard, LayerModel layer)
|
||||
{
|
||||
_activeKeyboard = activeKeyboard;
|
||||
_wasEnabled = layer.Enabled;
|
||||
@ -36,7 +38,7 @@ namespace Artemis.ViewModels.LayerEditor
|
||||
Layer.Enabled = false;
|
||||
DataModelProps = new BindableCollection<GeneralHelpers.PropertyCollection>();
|
||||
ProposedProperties = new LayerPropertiesModel();
|
||||
//DataModelProps.AddRange(GeneralHelpers.GenerateTypeMap<T>());
|
||||
DataModelProps.AddRange(GeneralHelpers.GenerateTypeMap(gameDataModel));
|
||||
LayerConditionVms =
|
||||
new BindableCollection<LayerConditionViewModel>(
|
||||
layer.LayerConditions.Select(c => new LayerConditionViewModel(this, c, DataModelProps)));
|
||||
|
||||
@ -265,7 +265,7 @@ namespace Artemis.ViewModels
|
||||
public void LayerEditor(LayerModel layer)
|
||||
{
|
||||
IWindowManager manager = new WindowManager();
|
||||
_editorVm = new LayerEditorViewModel(ActiveKeyboard, layer);
|
||||
_editorVm = new LayerEditorViewModel(_gameModel.GameDataModel, ActiveKeyboard, layer);
|
||||
dynamic settings = new ExpandoObject();
|
||||
|
||||
settings.Title = "Artemis | Edit " + layer.Name;
|
||||
|
||||
@ -133,9 +133,6 @@ namespace Artemis.ViewModels
|
||||
{
|
||||
MainManager.Dispose();
|
||||
Application.Current.Shutdown();
|
||||
|
||||
// Sometimes you need to be rough.
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user