mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-12 21:38:38 +00:00
Major refactor of core systems (MainModel replaces with a MainManager, EffectsManager and KeyboardManager)
This commit is contained in:
parent
6da41400fb
commit
60d15a12e6
@ -1,93 +1,61 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.23107.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis", "Artemis\Artemis.csproj", "{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}"
|
||||
EndProject
|
||||
Project("{6141683F-8A12-4E36-9623-2EB02B2C2303}") = "ArtemisSetup", "ArtemisSetup\ArtemisSetup.isproj", "{9E76B2E0-12AE-431D-8FA5-2233D6853F29}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
CD_ROM|Any CPU = CD_ROM|Any CPU
|
||||
CD_ROM|x64 = CD_ROM|x64
|
||||
CD_ROM|x86 = CD_ROM|x86
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
DVD-5|Any CPU = DVD-5|Any CPU
|
||||
DVD-5|x64 = DVD-5|x64
|
||||
DVD-5|x86 = DVD-5|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
SingleImage|Any CPU = SingleImage|Any CPU
|
||||
SingleImage|x64 = SingleImage|x64
|
||||
SingleImage|x86 = SingleImage|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.CD_ROM|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.CD_ROM|Any CPU.Build.0 = Release|Any CPU
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.CD_ROM|x64.ActiveCfg = Release|x64
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.CD_ROM|x64.Build.0 = Release|x64
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.CD_ROM|x86.ActiveCfg = Release|x86
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.CD_ROM|x86.Build.0 = Release|x86
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|x64.Build.0 = Debug|x64
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|x86.Build.0 = Debug|x86
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.DVD-5|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.DVD-5|Any CPU.Build.0 = Debug|Any CPU
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.DVD-5|x64.ActiveCfg = Debug|x64
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.DVD-5|x64.Build.0 = Debug|x64
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.DVD-5|x86.ActiveCfg = Debug|x86
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.DVD-5|x86.Build.0 = Debug|x86
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|x64.ActiveCfg = Release|x64
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|x64.Build.0 = Release|x64
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|x86.ActiveCfg = Release|x86
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|x86.Build.0 = Release|x86
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.SingleImage|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.SingleImage|Any CPU.Build.0 = Release|Any CPU
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.SingleImage|x64.ActiveCfg = Release|x64
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.SingleImage|x64.Build.0 = Release|x64
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.SingleImage|x86.ActiveCfg = Release|x86
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.SingleImage|x86.Build.0 = Release|x86
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.CD_ROM|Any CPU.ActiveCfg = CD_ROM
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.CD_ROM|Any CPU.Build.0 = CD_ROM
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.CD_ROM|x64.ActiveCfg = CD_ROM
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.CD_ROM|x64.Build.0 = CD_ROM
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.CD_ROM|x86.ActiveCfg = CD_ROM
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.CD_ROM|x86.Build.0 = CD_ROM
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.Debug|Any CPU.ActiveCfg = DVD-5
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.Debug|Any CPU.Build.0 = DVD-5
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.Debug|x64.ActiveCfg = DVD-5
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.Debug|x64.Build.0 = DVD-5
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.Debug|x86.ActiveCfg = DVD-5
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.Debug|x86.Build.0 = DVD-5
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.DVD-5|Any CPU.ActiveCfg = DVD-5
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.DVD-5|Any CPU.Build.0 = DVD-5
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.DVD-5|x64.ActiveCfg = DVD-5
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.DVD-5|x64.Build.0 = DVD-5
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.DVD-5|x86.ActiveCfg = DVD-5
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.DVD-5|x86.Build.0 = DVD-5
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.Release|Any CPU.ActiveCfg = SingleImage
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.Release|Any CPU.Build.0 = SingleImage
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.Release|x64.ActiveCfg = SingleImage
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.Release|x64.Build.0 = SingleImage
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.Release|x86.ActiveCfg = SingleImage
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.Release|x86.Build.0 = SingleImage
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.SingleImage|Any CPU.ActiveCfg = SingleImage
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.SingleImage|Any CPU.Build.0 = SingleImage
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.SingleImage|x64.ActiveCfg = SingleImage
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.SingleImage|x64.Build.0 = SingleImage
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.SingleImage|x86.ActiveCfg = SingleImage
|
||||
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.SingleImage|x86.Build.0 = SingleImage
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.24720.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis", "Artemis\Artemis.csproj", "{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
CD_ROM|Any CPU = CD_ROM|Any CPU
|
||||
CD_ROM|x64 = CD_ROM|x64
|
||||
CD_ROM|x86 = CD_ROM|x86
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
DVD-5|Any CPU = DVD-5|Any CPU
|
||||
DVD-5|x64 = DVD-5|x64
|
||||
DVD-5|x86 = DVD-5|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
SingleImage|Any CPU = SingleImage|Any CPU
|
||||
SingleImage|x64 = SingleImage|x64
|
||||
SingleImage|x86 = SingleImage|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.CD_ROM|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.CD_ROM|Any CPU.Build.0 = Release|Any CPU
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.CD_ROM|x64.ActiveCfg = Release|x64
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.CD_ROM|x64.Build.0 = Release|x64
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.CD_ROM|x86.ActiveCfg = Release|x86
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.CD_ROM|x86.Build.0 = Release|x86
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|x64.Build.0 = Debug|x64
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|x86.Build.0 = Debug|x86
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.DVD-5|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.DVD-5|Any CPU.Build.0 = Debug|Any CPU
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.DVD-5|x64.ActiveCfg = Debug|x64
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.DVD-5|x64.Build.0 = Debug|x64
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.DVD-5|x86.ActiveCfg = Debug|x86
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.DVD-5|x86.Build.0 = Debug|x86
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|x64.ActiveCfg = Release|x64
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|x64.Build.0 = Release|x64
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|x86.ActiveCfg = Release|x86
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|x86.Build.0 = Release|x86
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.SingleImage|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.SingleImage|Any CPU.Build.0 = Release|Any CPU
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.SingleImage|x64.ActiveCfg = Release|x64
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.SingleImage|x64.Build.0 = Release|x64
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.SingleImage|x86.ActiveCfg = Release|x86
|
||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.SingleImage|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@ -4,7 +4,8 @@
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings"
|
||||
type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<section name="Artemis.Modules.Games.RocketLeague.RocketLeague"
|
||||
<section name="Artemis.Modules.Overlays.VolumeDisplay.VolumeDisplay" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<section name="Artemis.Modules.Games.RocketLeague.RocketLeague"
|
||||
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<section name="Artemis.Settings.Offsets"
|
||||
@ -22,9 +23,6 @@
|
||||
<section name="Artemis.Settings.CounterStrike"
|
||||
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<section name="Artemis.Settings.VolumeDisplay"
|
||||
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<section name="Artemis.Settings.AudioVisualization"
|
||||
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
@ -47,6 +45,17 @@
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
<userSettings>
|
||||
<Artemis.Modules.Overlays.VolumeDisplay.VolumeDisplay>
|
||||
<setting name="Enabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="MainColor" serializeAs="String">
|
||||
<value>#FFFF2900</value>
|
||||
</setting>
|
||||
<setting name="SecondaryColor" serializeAs="String">
|
||||
<value>#FF26F600</value>
|
||||
</setting>
|
||||
</Artemis.Modules.Overlays.VolumeDisplay.VolumeDisplay>
|
||||
<Artemis.Modules.Games.RocketLeague.RocketLeague>
|
||||
<setting name="Enabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
@ -95,6 +104,9 @@
|
||||
</setting>
|
||||
</Artemis.Modules.Effects.AudioVisualizer.AudioVisualization>
|
||||
<Artemis.Modules.Games.CounterStrike.CounterStrike>
|
||||
<setting name="Enabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="GameDirectory" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
@ -119,9 +131,6 @@
|
||||
<setting name="LowHpEnabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="Enabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</Artemis.Modules.Games.CounterStrike.CounterStrike>
|
||||
<Artemis.Settings.CounterStrike>
|
||||
<setting name="GameDirectory" serializeAs="String">
|
||||
@ -149,17 +158,6 @@
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</Artemis.Settings.CounterStrike>
|
||||
<Artemis.Settings.VolumeDisplay>
|
||||
<setting name="MainColor" serializeAs="String">
|
||||
<value>#FFFF2900</value>
|
||||
</setting>
|
||||
<setting name="SecondaryColor" serializeAs="String">
|
||||
<value>#FF26F600</value>
|
||||
</setting>
|
||||
<setting name="Enabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</Artemis.Settings.VolumeDisplay>
|
||||
<Artemis.Settings.AudioVisualization>
|
||||
<setting name="Sensitivity" serializeAs="String">
|
||||
<value>4</value>
|
||||
|
||||
@ -228,7 +228,7 @@
|
||||
</Compile>
|
||||
<Compile Include="ArtemisBootstrapper.cs" />
|
||||
<Compile Include="Events\ToggleEnabled.cs" />
|
||||
<Compile Include="Events\ChangeActiveEffect.cs" />
|
||||
<Compile Include="Events\ActiveEffectChanged.cs" />
|
||||
<Compile Include="Events\ChangeBitmap.cs" />
|
||||
<Compile Include="KeyboardProviders\Corsair\CorsairRGB.cs" />
|
||||
<Compile Include="KeyboardProviders\KeyboardProvider.cs" />
|
||||
@ -241,6 +241,9 @@
|
||||
<Compile Include="KeyboardProviders\ProviderHelper.cs" />
|
||||
<Compile Include="KeyboardProviders\Razer\BlackWidow.cs" />
|
||||
<Compile Include="KeyboardProviders\Razer\Utilities\RazerUtilities.cs" />
|
||||
<Compile Include="Managers\EffectManager.cs" />
|
||||
<Compile Include="Managers\KeyboardManager.cs" />
|
||||
<Compile Include="Managers\MainManager.cs" />
|
||||
<Compile Include="Models\EffectModel.cs" />
|
||||
<Compile Include="Models\GamePointersCollectionModel.cs" />
|
||||
<Compile Include="Modules\Effects\AudioVisualizer\AudioVisualization.Designer.cs">
|
||||
@ -278,13 +281,12 @@
|
||||
<DependentUpon>Witcher3.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Modules\Games\Witcher3\Witcher3Model.cs" />
|
||||
<Compile Include="Models\MainModel.cs" />
|
||||
<Compile Include="Models\OverlayModel.cs" />
|
||||
<Compile Include="Modules\Overlays\VolumeDisplay\VolumeDisplay.cs" />
|
||||
<Compile Include="Modules\Overlays\VolumeDisplay\VolumeDisplay.Designer.cs">
|
||||
<DependentUpon>VolumeDisplay.settings</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>VolumeDisplay.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Modules\Overlays\VolumeDisplay\VolumeDisplayModel.cs" />
|
||||
<Compile Include="Modules\Effects\AudioVisualizer\AudioVisualizerSettings.cs" />
|
||||
@ -323,6 +325,7 @@
|
||||
<Compile Include="Utilities\Keyboard\Key.cs" />
|
||||
<Compile Include="Utilities\Keyboard\KeyboardRectangle.cs" />
|
||||
<Compile Include="Utilities\ShellLink.cs" />
|
||||
<Compile Include="ViewModels\Abstract\EffectViewModel.cs" />
|
||||
<Compile Include="ViewModels\EffectsViewModel.cs" />
|
||||
<Compile Include="Modules\Effects\AudioVisualizer\AudioVisualizerViewModel.cs" />
|
||||
<Compile Include="Modules\Effects\Debug\DebugEffectViewModel.cs" />
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
namespace Artemis.Events
|
||||
{
|
||||
public class ChangeActiveEffect
|
||||
public class ActiveEffectChanged
|
||||
{
|
||||
public ChangeActiveEffect(string activeEffect)
|
||||
public ActiveEffectChanged(string activeEffect)
|
||||
{
|
||||
ActiveEffect = activeEffect;
|
||||
}
|
||||
@ -4,15 +4,15 @@ namespace Artemis.KeyboardProviders
|
||||
{
|
||||
public class KeyboardRegion
|
||||
{
|
||||
public string RegionName { get; set; }
|
||||
public Point TopLeft { get; set; }
|
||||
public Point BottomRight { get; set; }
|
||||
|
||||
public KeyboardRegion(string regionName, Point topLeft, Point bottomRight)
|
||||
{
|
||||
RegionName = regionName;
|
||||
TopLeft = topLeft;
|
||||
BottomRight = bottomRight;
|
||||
}
|
||||
|
||||
public string RegionName { get; set; }
|
||||
public Point TopLeft { get; set; }
|
||||
public Point BottomRight { get; set; }
|
||||
}
|
||||
}
|
||||
133
Artemis/Artemis/Managers/EffectManager.cs
Normal file
133
Artemis/Artemis/Managers/EffectManager.cs
Normal file
@ -0,0 +1,133 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Artemis.Events;
|
||||
using Artemis.Models;
|
||||
using Artemis.Settings;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Artemis.Managers
|
||||
{
|
||||
public class EffectManager
|
||||
{
|
||||
private readonly MainManager _mainManager;
|
||||
private readonly IEventAggregator _events;
|
||||
|
||||
public EffectManager(MainManager mainManager, IEventAggregator events)
|
||||
{
|
||||
_mainManager = mainManager;
|
||||
_events = events;
|
||||
|
||||
EffectModels = new List<EffectModel>();
|
||||
}
|
||||
|
||||
public List<EffectModel> EffectModels { get; set; }
|
||||
public EffectModel ActiveEffect { get; private set; }
|
||||
|
||||
public IEnumerable<OverlayModel> EnabledOverlays
|
||||
{
|
||||
get { return EffectModels.OfType<OverlayModel>().Where(o => o.Enabled); }
|
||||
}
|
||||
|
||||
public IEnumerable<GameModel> EnabledGames
|
||||
{
|
||||
get { return EffectModels.OfType<GameModel>().Where(g => g.Enabled); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads the last active effect from settings and enables it.
|
||||
/// </summary>
|
||||
/// <returns>Whether enabling was successful or not.</returns>
|
||||
public EffectModel GetLastEffect()
|
||||
{
|
||||
if (General.Default.LastEffect == null)
|
||||
return null;
|
||||
|
||||
var effect = EffectModels.FirstOrDefault(e => e.Name == General.Default.LastEffect);
|
||||
|
||||
// Fall back to the first effect found, in case settings are messed up
|
||||
return effect ?? EffectModels.First();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disables the current effect and changes it to the provided effect.
|
||||
/// </summary>
|
||||
/// <param name="effectModel"></param>
|
||||
public void ChangeEffect(EffectModel effectModel)
|
||||
{
|
||||
if (effectModel is OverlayModel)
|
||||
throw new ArgumentException("Can't set an Overlay effect as the active effect");
|
||||
|
||||
// Game models are only used if they are enabled
|
||||
var gameModel = effectModel as GameModel;
|
||||
if (gameModel != null)
|
||||
if (!gameModel.Enabled)
|
||||
return;
|
||||
|
||||
if (ActiveEffect != null)
|
||||
if (effectModel.Name == ActiveEffect.Name)
|
||||
return;
|
||||
|
||||
ActiveEffect?.Dispose();
|
||||
|
||||
if (!_mainManager.Running)
|
||||
{
|
||||
_mainManager.Start(effectModel);
|
||||
return;
|
||||
}
|
||||
|
||||
ActiveEffect = effectModel;
|
||||
ActiveEffect.Enable();
|
||||
|
||||
if (ActiveEffect is GameModel)
|
||||
return;
|
||||
|
||||
// Non-game effects are stored as the new LastEffect.
|
||||
General.Default.LastEffect = ActiveEffect.Name;
|
||||
General.Default.Save();
|
||||
|
||||
// Let the ViewModels know
|
||||
_events.PublishOnUIThread(new ActiveEffectChanged(ActiveEffect.Name));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears the current effect
|
||||
/// </summary>
|
||||
public void ClearEffect()
|
||||
{
|
||||
if (ActiveEffect == null)
|
||||
return;
|
||||
|
||||
ActiveEffect.Dispose();
|
||||
ActiveEffect = null;
|
||||
|
||||
General.Default.LastEffect = null;
|
||||
General.Default.Save();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disables the given game
|
||||
/// </summary>
|
||||
/// <param name="activeEffect"></param>
|
||||
public void DisableGame(EffectModel activeEffect)
|
||||
{
|
||||
if (GetLastEffect() == null)
|
||||
ClearEffect();
|
||||
else
|
||||
ChangeEffect(GetLastEffect());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disables the current ActiveEffect if it's a game that is disabled.
|
||||
/// </summary>
|
||||
public void DisableInactiveGame()
|
||||
{
|
||||
if (!(ActiveEffect is GameModel))
|
||||
return;
|
||||
if (EnabledGames.Contains(ActiveEffect))
|
||||
return;
|
||||
|
||||
DisableGame(ActiveEffect);
|
||||
}
|
||||
}
|
||||
}
|
||||
65
Artemis/Artemis/Managers/KeyboardManager.cs
Normal file
65
Artemis/Artemis/Managers/KeyboardManager.cs
Normal file
@ -0,0 +1,65 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using Artemis.KeyboardProviders;
|
||||
using Artemis.Settings;
|
||||
|
||||
namespace Artemis.Managers
|
||||
{
|
||||
public class KeyboardManager
|
||||
{
|
||||
private readonly MainManager _mainManager;
|
||||
|
||||
public KeyboardManager(MainManager mainManager)
|
||||
{
|
||||
_mainManager = mainManager;
|
||||
KeyboardProviders = ProviderHelper.GetKeyboardProviders();
|
||||
}
|
||||
|
||||
public List<KeyboardProvider> KeyboardProviders { get; set; }
|
||||
public KeyboardProvider ActiveKeyboard { get; set; }
|
||||
|
||||
public bool LoadLastKeyboard()
|
||||
{
|
||||
var keyboard = KeyboardProviders.FirstOrDefault(k => k.Name == General.Default.LastKeyboard);
|
||||
return ChangeKeyboard(keyboard ?? KeyboardProviders.First());
|
||||
}
|
||||
|
||||
public bool ChangeKeyboard(KeyboardProvider keyboardProvider)
|
||||
{
|
||||
if (keyboardProvider == null)
|
||||
return false;
|
||||
|
||||
if (ActiveKeyboard != null)
|
||||
if (keyboardProvider.Name == ActiveKeyboard.Name)
|
||||
return true;
|
||||
|
||||
ReleaseActiveKeyboard();
|
||||
|
||||
// Disable everything if there's no active keyboard found
|
||||
if (!keyboardProvider.CanEnable())
|
||||
{
|
||||
MessageBox.Show(keyboardProvider.CantEnableText, "Artemis (╯°□°)╯︵ ┻━┻", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Warning);
|
||||
return false;
|
||||
}
|
||||
|
||||
ActiveKeyboard = keyboardProvider;
|
||||
ActiveKeyboard.Enable();
|
||||
|
||||
General.Default.LastKeyboard = ActiveKeyboard.Name;
|
||||
General.Default.Save();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void ReleaseActiveKeyboard()
|
||||
{
|
||||
if (ActiveKeyboard == null)
|
||||
return;
|
||||
|
||||
ActiveKeyboard.Disable();
|
||||
ActiveKeyboard = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using Artemis.Managers;
|
||||
|
||||
namespace Artemis.Models
|
||||
{
|
||||
@ -7,12 +8,12 @@ namespace Artemis.Models
|
||||
{
|
||||
public delegate void SettingsUpdateHandler(EffectSettings settings);
|
||||
|
||||
public MainModel MainModel;
|
||||
public MainManager MainManager;
|
||||
public string Name;
|
||||
|
||||
protected EffectModel(MainModel mainModel)
|
||||
protected EffectModel(MainManager mainManager)
|
||||
{
|
||||
MainModel = mainModel;
|
||||
MainManager = mainManager;
|
||||
}
|
||||
|
||||
public abstract void Dispose();
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
namespace Artemis.Models
|
||||
using Artemis.Managers;
|
||||
|
||||
namespace Artemis.Models
|
||||
{
|
||||
public abstract class GameModel : EffectModel
|
||||
{
|
||||
public bool Enabled;
|
||||
public string ProcessName;
|
||||
|
||||
protected GameModel(MainModel mainModel) : base(mainModel)
|
||||
protected GameModel(MainManager mainManager) : base(mainManager)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,323 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using Artemis.Events;
|
||||
using Artemis.KeyboardProviders;
|
||||
using Artemis.Settings;
|
||||
using Artemis.Utilities.GameState;
|
||||
using Artemis.Utilities.Keyboard;
|
||||
using Artemis.Utilities.Memory;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Artemis.Models
|
||||
{
|
||||
public class MainModel
|
||||
{
|
||||
private readonly int _fps;
|
||||
private readonly BackgroundWorker _processWorker;
|
||||
private readonly BackgroundWorker _updateWorker;
|
||||
|
||||
private EffectModel _activeEffect;
|
||||
private bool _wasSuspendedBeforeGame;
|
||||
|
||||
public MainModel(IEventAggregator events)
|
||||
{
|
||||
EffectModels = new List<EffectModel>();
|
||||
KeyboardProviders = ProviderHelper.GetKeyboardProviders();
|
||||
GameStateWebServer = new GameStateWebServer();
|
||||
KeyboardHook = new KeyboardHook();
|
||||
Suspended = false;
|
||||
|
||||
Events = events;
|
||||
|
||||
_fps = 25;
|
||||
_updateWorker = new BackgroundWorker {WorkerSupportsCancellation = true};
|
||||
_processWorker = new BackgroundWorker {WorkerSupportsCancellation = true};
|
||||
_updateWorker.DoWork += UpdateWorker_DoWork;
|
||||
_processWorker.DoWork += ProcessWorker_DoWork;
|
||||
}
|
||||
|
||||
public KeyboardHook KeyboardHook { get; set; }
|
||||
public KeyboardProvider ActiveKeyboard { get; set; }
|
||||
public List<EffectModel> EffectModels { get; set; }
|
||||
public List<KeyboardProvider> KeyboardProviders { get; set; }
|
||||
public GameStateWebServer GameStateWebServer { get; set; }
|
||||
public IEventAggregator Events { get; set; }
|
||||
public bool Enabled { get; private set; }
|
||||
public bool Suspended { get; private set; }
|
||||
|
||||
#region Effect methods
|
||||
|
||||
public void StartEffects()
|
||||
{
|
||||
if (Enabled)
|
||||
return;
|
||||
if (_updateWorker.IsBusy || _processWorker.IsBusy)
|
||||
{
|
||||
Events.PublishOnUIThread(new ToggleEnabled(Enabled));
|
||||
return;
|
||||
}
|
||||
|
||||
LoadLastKeyboard();
|
||||
// If no keyboard was loaded, don't enable effects.
|
||||
if (ActiveKeyboard == null)
|
||||
return;
|
||||
|
||||
// Start the webserver
|
||||
GameStateWebServer.Start();
|
||||
|
||||
// Load last non-game effect and enable
|
||||
LoadLastEffect();
|
||||
|
||||
// Start the Background Workers
|
||||
_updateWorker.RunWorkerAsync();
|
||||
_processWorker.RunWorkerAsync();
|
||||
|
||||
Enabled = true;
|
||||
Events.PublishOnUIThread(new ToggleEnabled(Enabled));
|
||||
|
||||
if (General.Default.Suspended && !Suspended)
|
||||
ToggleSuspension();
|
||||
}
|
||||
|
||||
public void ShutdownEffects()
|
||||
{
|
||||
if (!Enabled)
|
||||
return;
|
||||
|
||||
// Stop the Background Worker
|
||||
_updateWorker.CancelAsync();
|
||||
_processWorker.CancelAsync();
|
||||
|
||||
// Dispose the current active effect
|
||||
_activeEffect?.Dispose();
|
||||
_activeEffect = null;
|
||||
|
||||
ActiveKeyboard?.Disable();
|
||||
ActiveKeyboard = null;
|
||||
|
||||
Enabled = false;
|
||||
Events.PublishOnUIThread(new ToggleEnabled(Enabled));
|
||||
}
|
||||
|
||||
private void LoadLastEffect()
|
||||
{
|
||||
var effect = EffectModels.FirstOrDefault(e => e.Name == General.Default.LastEffect);
|
||||
ChangeEffect(effect ?? EffectModels.First(e => e.Name == "TypeWave"));
|
||||
}
|
||||
|
||||
private void ChangeEffect(EffectModel effectModel)
|
||||
{
|
||||
// Can't set a new effect if ActiveKeyboard is null
|
||||
if (ActiveKeyboard == null)
|
||||
return;
|
||||
|
||||
if (effectModel is OverlayModel)
|
||||
throw new ArgumentException("Can't set an Overlay effect as the active effect");
|
||||
|
||||
// Game models are only used if they are enabled
|
||||
var gameModel = effectModel as GameModel;
|
||||
if (gameModel != null)
|
||||
if (!gameModel.Enabled)
|
||||
return;
|
||||
|
||||
if (_activeEffect != null && effectModel.Name == _activeEffect.Name)
|
||||
return;
|
||||
|
||||
_activeEffect?.Dispose();
|
||||
|
||||
// If needed, unsuspend when loading a new effect
|
||||
if (Suspended)
|
||||
{
|
||||
_wasSuspendedBeforeGame = true;
|
||||
ToggleSuspension();
|
||||
}
|
||||
|
||||
_activeEffect = effectModel;
|
||||
_activeEffect.Enable();
|
||||
|
||||
if (_activeEffect is GameModel)
|
||||
return;
|
||||
|
||||
// Non-game effects are stored as the new LastEffect.
|
||||
General.Default.LastEffect = _activeEffect.Name;
|
||||
General.Default.Save();
|
||||
|
||||
// Let the ViewModels know
|
||||
Events.PublishOnUIThread(new ChangeActiveEffect(_activeEffect.Name));
|
||||
}
|
||||
|
||||
public void EnableEffect(EffectModel effectModel)
|
||||
{
|
||||
if (effectModel is GameModel || effectModel is OverlayModel)
|
||||
return;
|
||||
|
||||
ChangeEffect(effectModel);
|
||||
}
|
||||
|
||||
public void ToggleSuspension()
|
||||
{
|
||||
if (Suspended)
|
||||
{
|
||||
LoadLastKeyboard();
|
||||
|
||||
// Don't resume if no keyboard was found
|
||||
if (ActiveKeyboard == null)
|
||||
return;
|
||||
|
||||
Suspended = false;
|
||||
General.Default.Suspended = false;
|
||||
General.Default.Save();
|
||||
Events.PublishOnUIThread(new ChangeActiveEffect(_activeEffect?.Name));
|
||||
return;
|
||||
}
|
||||
|
||||
Suspended = true;
|
||||
General.Default.Suspended = true;
|
||||
General.Default.Save();
|
||||
ActiveKeyboard?.Disable();
|
||||
ActiveKeyboard = null;
|
||||
Events.PublishOnUIThread(new ChangeActiveEffect(_activeEffect?.Name));
|
||||
}
|
||||
|
||||
public bool IsEnabled(EffectModel effectModel)
|
||||
{
|
||||
if (Suspended)
|
||||
return false;
|
||||
if (effectModel is GameModel)
|
||||
return false;
|
||||
|
||||
return General.Default.LastEffect == effectModel.Name;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard methods
|
||||
|
||||
private void LoadLastKeyboard()
|
||||
{
|
||||
var keyboard = KeyboardProviders.FirstOrDefault(k => k.Name == General.Default.LastKeyboard);
|
||||
ChangeKeyboard(keyboard ?? KeyboardProviders.First());
|
||||
}
|
||||
|
||||
public void ChangeKeyboard(KeyboardProvider keyboardProvider)
|
||||
{
|
||||
if (ActiveKeyboard != null && keyboardProvider.Name == ActiveKeyboard.Name)
|
||||
return;
|
||||
|
||||
ActiveKeyboard?.Disable();
|
||||
|
||||
// Disable everything if there's no active keyboard found
|
||||
if (!keyboardProvider.CanEnable())
|
||||
{
|
||||
ActiveKeyboard = null;
|
||||
MessageBox.Show(keyboardProvider.CantEnableText, "Artemis (╯°□°)╯︵ ┻━┻",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
ShutdownEffects();
|
||||
return;
|
||||
}
|
||||
|
||||
ActiveKeyboard = keyboardProvider;
|
||||
ActiveKeyboard.Enable();
|
||||
|
||||
General.Default.LastKeyboard = ActiveKeyboard.Name;
|
||||
General.Default.Save();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Workers
|
||||
|
||||
private void UpdateWorker_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
var sw = new Stopwatch();
|
||||
while (!_updateWorker.CancellationPending)
|
||||
{
|
||||
if (ActiveKeyboard == null || Suspended || _activeEffect == null)
|
||||
{
|
||||
Thread.Sleep(1000/_fps);
|
||||
continue;
|
||||
}
|
||||
|
||||
sw.Start();
|
||||
|
||||
// Update the current effect
|
||||
_activeEffect.Update();
|
||||
|
||||
// Get ActiveEffect's bitmap
|
||||
var bitmap = _activeEffect.GenerateBitmap();
|
||||
|
||||
// Draw enabled overlays on top
|
||||
foreach (var overlayModel in EffectModels.OfType<OverlayModel>()
|
||||
.Where(overlayModel => overlayModel.Enabled))
|
||||
{
|
||||
overlayModel.Update();
|
||||
bitmap = bitmap != null ? overlayModel.GenerateBitmap(bitmap) : overlayModel.GenerateBitmap();
|
||||
}
|
||||
|
||||
// If it exists, send bitmap to the device
|
||||
if (bitmap != null && ActiveKeyboard != null)
|
||||
{
|
||||
ActiveKeyboard.DrawBitmap(bitmap);
|
||||
|
||||
// debugging TODO: Disable when window isn't shown
|
||||
Events.PublishOnUIThread(new ChangeBitmap(bitmap));
|
||||
}
|
||||
|
||||
// Sleep according to time left this frame
|
||||
var sleep = (int) (1000/_fps - sw.ElapsedMilliseconds);
|
||||
if (sleep > 0)
|
||||
Thread.Sleep(sleep);
|
||||
sw.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
private void ProcessWorker_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
while (!_processWorker.CancellationPending)
|
||||
{
|
||||
var foundProcess = false;
|
||||
|
||||
// ReSharper disable once LoopCanBePartlyConvertedToQuery
|
||||
foreach (var effectModel in EffectModels.OfType<GameModel>())
|
||||
{
|
||||
var process = MemoryHelpers.GetProcessIfRunning(effectModel.ProcessName);
|
||||
if (process == null)
|
||||
continue;
|
||||
if (process.HasExited)
|
||||
continue;
|
||||
|
||||
// If the active effect is a disabled game model, disable it
|
||||
var model = _activeEffect as GameModel;
|
||||
if (model != null && !model.Enabled)
|
||||
LoadLastEffect();
|
||||
else
|
||||
{
|
||||
ChangeEffect(effectModel);
|
||||
foundProcess = true;
|
||||
}
|
||||
}
|
||||
|
||||
// If no game process is found, but the active effect still belongs to a game,
|
||||
// set it to a normal effect, and if needed, suspend again.
|
||||
if (!foundProcess && _activeEffect is GameModel)
|
||||
{
|
||||
LoadLastEffect();
|
||||
if (_wasSuspendedBeforeGame)
|
||||
{
|
||||
ToggleSuspension();
|
||||
_wasSuspendedBeforeGame = false;
|
||||
}
|
||||
}
|
||||
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
using System.Drawing;
|
||||
using Artemis.Managers;
|
||||
|
||||
namespace Artemis.Models
|
||||
{
|
||||
@ -7,11 +8,10 @@ namespace Artemis.Models
|
||||
private bool _enabled;
|
||||
public string ProcessName;
|
||||
|
||||
protected OverlayModel(MainModel mainModel) : base(mainModel)
|
||||
protected OverlayModel(MainManager mainManager) : base(mainManager)
|
||||
{
|
||||
}
|
||||
|
||||
// Overlay Enabled() and Dispose() is called when changing the Enabled value
|
||||
public bool Enabled
|
||||
{
|
||||
get { return _enabled; }
|
||||
|
||||
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.Utilities.Audio;
|
||||
@ -19,7 +20,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
|
||||
private bool _generating;
|
||||
private IWaveIn _waveIn;
|
||||
|
||||
public AudioVisualizerModel(MainModel mainModel, AudioVisualizerSettings settings) : base(mainModel)
|
||||
public AudioVisualizerModel(MainManager mainManager, AudioVisualizerSettings settings) : base(mainManager)
|
||||
{
|
||||
Settings = settings;
|
||||
Name = "Audiovisualizer";
|
||||
@ -51,7 +52,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
Lines = MainModel.ActiveKeyboard.Width;
|
||||
Lines = MainManager.KeyboardManager.ActiveKeyboard.Width;
|
||||
|
||||
// TODO: Device selection
|
||||
SelectedDeviceId = new MMDeviceEnumerator()
|
||||
@ -62,7 +63,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
|
||||
for (var i = 0; i < Lines; i++)
|
||||
{
|
||||
SoundRectangles.Add(new KeyboardRectangle(
|
||||
MainModel.ActiveKeyboard,
|
||||
MainManager.KeyboardManager.ActiveKeyboard,
|
||||
0, 0, new List<Color>
|
||||
{
|
||||
ColorHelpers.ToDrawingColor(Settings.TopColor),
|
||||
@ -108,7 +109,8 @@ namespace Artemis.Modules.Effects.AudioVisualizer
|
||||
|
||||
// Apply Sensitivity setting
|
||||
height = height*Settings.Sensitivity;
|
||||
var keyboardHeight = (int) Math.Round(MainModel.ActiveKeyboard.Height/100.00*height*Scale);
|
||||
var keyboardHeight =
|
||||
(int) Math.Round(MainManager.KeyboardManager.ActiveKeyboard.Height/100.00*height*Scale);
|
||||
if (keyboardHeight > SoundRectangles[i].Height)
|
||||
SoundRectangles[i].Height = keyboardHeight;
|
||||
else
|
||||
@ -118,7 +120,8 @@ namespace Artemis.Modules.Effects.AudioVisualizer
|
||||
SoundRectangles[i].Width = Scale;
|
||||
|
||||
if (Settings.FromBottom)
|
||||
SoundRectangles[i].Y = MainModel.ActiveKeyboard.Height*Scale - SoundRectangles[i].Height;
|
||||
SoundRectangles[i].Y = MainManager.KeyboardManager.ActiveKeyboard.Height*Scale -
|
||||
SoundRectangles[i].Height;
|
||||
}
|
||||
_generating = false;
|
||||
}
|
||||
@ -131,7 +134,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
|
||||
// Lock the _spectrumData array while busy with it
|
||||
_generating = true;
|
||||
|
||||
var bitmap = MainModel.ActiveKeyboard.KeyboardBitmap(Scale);
|
||||
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
||||
using (var g = Graphics.FromImage(bitmap))
|
||||
{
|
||||
foreach (var soundRectangle in SoundRectangles)
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
Color used on top
|
||||
</TextBlock>
|
||||
<xctk:ColorPicker x:Name="TopColor"
|
||||
SelectedColor="{Binding Path=AudioVisualizerSettings.TopColor, Mode=TwoWay}"
|
||||
SelectedColor="{Binding Path=EffectSettings.TopColor, Mode=TwoWay}"
|
||||
Grid.Row="1" Grid.Column="1" Width="110" HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
Color used in the middle
|
||||
</TextBlock>
|
||||
<xctk:ColorPicker x:Name="MiddleColor"
|
||||
SelectedColor="{Binding Path=AudioVisualizerSettings.MiddleColor, Mode=TwoWay}"
|
||||
SelectedColor="{Binding Path=EffectSettings.MiddleColor, Mode=TwoWay}"
|
||||
Grid.Row="2" Grid.Column="1" Width="110" HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
|
||||
|
||||
@ -67,7 +67,7 @@
|
||||
Color used on the bottom
|
||||
</TextBlock>
|
||||
<xctk:ColorPicker x:Name="Bottom"
|
||||
SelectedColor="{Binding Path=AudioVisualizerSettings.BottomColor, Mode=TwoWay}"
|
||||
SelectedColor="{Binding Path=EffectSettings.BottomColor, Mode=TwoWay}"
|
||||
Grid.Row="3" Grid.Column="1" Width="110" HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
|
||||
|
||||
@ -76,7 +76,7 @@
|
||||
Height="16" Margin="0,9,0,10">
|
||||
Grow bars bottom (broken, sorry!)
|
||||
</TextBlock>
|
||||
<controls:ToggleSwitch IsChecked="{Binding Path=AudioVisualizerSettings.FromBottom, Mode=TwoWay}"
|
||||
<controls:ToggleSwitch IsChecked="{Binding Path=EffectSettings.FromBottom, Mode=TwoWay}"
|
||||
Grid.Row="4" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes"
|
||||
OffLabel="No"
|
||||
Margin="0,0,-5,0" Width="114" IsEnabled="False" />
|
||||
@ -88,7 +88,7 @@
|
||||
</TextBlock>
|
||||
<Slider x:Name="Bars" Grid.Row="5" Grid.Column="1" VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right" Width="110" TickPlacement="BottomRight" TickFrequency="1"
|
||||
Value="{Binding Path=AudioVisualizerSettings.Bars, Mode=TwoWay}" Minimum="2" Maximum="21"
|
||||
Value="{Binding Path=EffectSettings.Bars, Mode=TwoWay}" Minimum="2" Maximum="21"
|
||||
SmallChange="1" IsSnapToTickEnabled="True" />
|
||||
|
||||
<!-- Sensitivity -->
|
||||
@ -98,7 +98,7 @@
|
||||
</TextBlock>
|
||||
<Slider x:Name="Sensitivity" Grid.Row="6" Grid.Column="1" VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right" Width="110" TickPlacement="BottomRight" TickFrequency="1"
|
||||
Value="{Binding Path=AudioVisualizerSettings.Sensitivity, Mode=TwoWay}" Minimum="1" Maximum="10"
|
||||
Value="{Binding Path=EffectSettings.Sensitivity, Mode=TwoWay}" Minimum="1" Maximum="10"
|
||||
SmallChange="1" IsSnapToTickEnabled="True" />
|
||||
|
||||
<!-- Fade speed -->
|
||||
@ -108,7 +108,7 @@
|
||||
</TextBlock>
|
||||
<Slider x:Name="FadeSpeed" Grid.Row="7" Grid.Column="1" VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right" Width="110" TickPlacement="BottomRight" TickFrequency="1"
|
||||
Value="{Binding Path=AudioVisualizerSettings.FadeSpeed, Mode=TwoWay}" Minimum="1" Maximum="3"
|
||||
Value="{Binding Path=EffectSettings.FadeSpeed, Mode=TwoWay}" Minimum="1" Maximum="3"
|
||||
SmallChange="1" IsSnapToTickEnabled="True" />
|
||||
|
||||
<!-- Buttons -->
|
||||
|
||||
@ -1,74 +1,31 @@
|
||||
using Artemis.Events;
|
||||
using Artemis.Models;
|
||||
using Artemis.Managers;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Artemis.Modules.Effects.AudioVisualizer
|
||||
{
|
||||
public class AudioVisualizerViewModel : Screen, IHandle<ChangeActiveEffect>
|
||||
public class AudioVisualizerViewModel : EffectViewModel, IHandle<ActiveEffectChanged>
|
||||
{
|
||||
private AudioVisualizerSettings _audioVisualizerSettings;
|
||||
|
||||
public AudioVisualizerViewModel(MainModel mainModel)
|
||||
public AudioVisualizerViewModel(MainManager mainManager)
|
||||
{
|
||||
// Subscribe to main model
|
||||
MainModel = mainModel;
|
||||
MainModel.Events.Subscribe(this);
|
||||
MainManager = mainManager;
|
||||
MainManager.Events.Subscribe(this);
|
||||
|
||||
// Settings are loaded from file by class
|
||||
AudioVisualizerSettings = new AudioVisualizerSettings();
|
||||
EffectSettings = new AudioVisualizerSettings();
|
||||
|
||||
// Create effect model and add it to MainModel
|
||||
AudioVisualizerModel = new AudioVisualizerModel(mainModel, AudioVisualizerSettings);
|
||||
MainModel.EffectModels.Add(AudioVisualizerModel);
|
||||
// Create effect model and add it to MainManager
|
||||
EffectModel = new AudioVisualizerModel(mainManager, (AudioVisualizerSettings) EffectSettings);
|
||||
MainManager.EffectManager.EffectModels.Add((AudioVisualizerModel) EffectModel);
|
||||
}
|
||||
|
||||
public MainModel MainModel { get; set; }
|
||||
public AudioVisualizerModel AudioVisualizerModel { get; set; }
|
||||
|
||||
public static string Name => "Audio Visualizer";
|
||||
public bool EffectEnabled => MainModel.IsEnabled(AudioVisualizerModel);
|
||||
|
||||
public AudioVisualizerSettings AudioVisualizerSettings
|
||||
{
|
||||
get { return _audioVisualizerSettings; }
|
||||
set
|
||||
{
|
||||
if (Equals(value, _audioVisualizerSettings)) return;
|
||||
_audioVisualizerSettings = value;
|
||||
NotifyOfPropertyChange(() => AudioVisualizerSettings);
|
||||
}
|
||||
}
|
||||
|
||||
public void Handle(ChangeActiveEffect message)
|
||||
public void Handle(ActiveEffectChanged message)
|
||||
{
|
||||
NotifyOfPropertyChange(() => EffectEnabled);
|
||||
}
|
||||
|
||||
public void ToggleEffect()
|
||||
{
|
||||
if (EffectEnabled && !MainModel.Suspended)
|
||||
MainModel.ToggleSuspension();
|
||||
else if (!EffectEnabled && !MainModel.Suspended)
|
||||
MainModel.EnableEffect(AudioVisualizerModel);
|
||||
else
|
||||
{
|
||||
MainModel.ToggleSuspension();
|
||||
MainModel.EnableEffect(AudioVisualizerModel);
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveSettings()
|
||||
{
|
||||
AudioVisualizerSettings?.Save();
|
||||
}
|
||||
|
||||
public void ResetSettings()
|
||||
{
|
||||
// TODO: Confirmation dialog (Generic MVVM approach)
|
||||
AudioVisualizerSettings.ToDefault();
|
||||
NotifyOfPropertyChange(() => AudioVisualizerSettings);
|
||||
|
||||
SaveSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Utilities.Keyboard;
|
||||
|
||||
@ -8,7 +9,7 @@ namespace Artemis.Modules.Effects.Debug
|
||||
{
|
||||
internal class DebugEffectModel : EffectModel
|
||||
{
|
||||
public DebugEffectModel(MainModel mainModel, DebugEffectSettings settings) : base(mainModel)
|
||||
public DebugEffectModel(MainManager mainManager, DebugEffectSettings settings) : base(mainManager)
|
||||
{
|
||||
Name = "Debug Effect";
|
||||
Settings = settings;
|
||||
@ -27,7 +28,7 @@ namespace Artemis.Modules.Effects.Debug
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
KeyboardRectangle = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, 0, new List<Color>
|
||||
KeyboardRectangle = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color>
|
||||
{
|
||||
Color.Red,
|
||||
Color.OrangeRed,
|
||||
|
||||
@ -54,7 +54,7 @@
|
||||
</TextBlock>
|
||||
<Slider x:Name="Width" Grid.Row="2" Grid.Column="1" VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right" Width="110" TickPlacement="None" TickFrequency="1"
|
||||
Value="{Binding Path=DebugEffectSettings.Width, Mode=TwoWay}" Minimum="0" Maximum="84"
|
||||
Value="{Binding Path=EffectSettings.Width, Mode=TwoWay}" Minimum="0" Maximum="84"
|
||||
SmallChange="1" IsSnapToTickEnabled="True" />
|
||||
|
||||
<!-- Height -->
|
||||
@ -64,7 +64,7 @@
|
||||
</TextBlock>
|
||||
<Slider x:Name="Height" Grid.Row="3" Grid.Column="1" VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right" Width="110" TickPlacement="None" TickFrequency="1"
|
||||
Value="{Binding Path=DebugEffectSettings.Height, Mode=TwoWay}" Minimum="0" Maximum="24"
|
||||
Value="{Binding Path=EffectSettings.Height, Mode=TwoWay}" Minimum="0" Maximum="24"
|
||||
SmallChange="1" IsSnapToTickEnabled="True" />
|
||||
|
||||
<!-- Scale -->
|
||||
@ -74,7 +74,7 @@
|
||||
</TextBlock>
|
||||
<Slider x:Name="Scale" Grid.Row="4" Grid.Column="1" VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right" Width="110" TickPlacement="BottomRight" TickFrequency="1"
|
||||
Value="{Binding Path=DebugEffectSettings.Scale, Mode=TwoWay}" Minimum="1" Maximum="4"
|
||||
Value="{Binding Path=EffectSettings.Scale, Mode=TwoWay}" Minimum="1" Maximum="4"
|
||||
SmallChange="1" IsSnapToTickEnabled="True" />
|
||||
|
||||
<!-- Color rotation -->
|
||||
@ -82,7 +82,7 @@
|
||||
Height="16" Margin="0,9,0,10">
|
||||
Rotate colors on debug-rectangle
|
||||
</TextBlock>
|
||||
<controls:ToggleSwitch IsChecked="{Binding Path=DebugEffectSettings.Rotate, Mode=TwoWay}"
|
||||
<controls:ToggleSwitch IsChecked="{Binding Path=EffectSettings.Rotate, Mode=TwoWay}"
|
||||
Grid.Row="5" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes"
|
||||
OffLabel="No"
|
||||
Margin="0,0,-5,0" Width="114" />
|
||||
|
||||
@ -5,49 +5,33 @@ using System.IO;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Artemis.Events;
|
||||
using Artemis.Models;
|
||||
using Artemis.Managers;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Artemis.Modules.Effects.Debug
|
||||
{
|
||||
internal class DebugEffectViewModel : Screen, IHandle<ChangeBitmap>, IHandle<ChangeActiveEffect>
|
||||
internal class DebugEffectViewModel : EffectViewModel, IHandle<ChangeBitmap>, IHandle<ActiveEffectChanged>
|
||||
{
|
||||
private DebugEffectSettings _debugEffectSettings;
|
||||
private ImageSource _imageSource;
|
||||
private string _selectedRectangleType;
|
||||
|
||||
public DebugEffectViewModel(MainModel mainModel)
|
||||
public DebugEffectViewModel(MainManager mainManager)
|
||||
{
|
||||
// Subscribe to main model
|
||||
MainModel = mainModel;
|
||||
MainModel.Events.Subscribe(this);
|
||||
MainManager = mainManager;
|
||||
MainManager.Events.Subscribe(this);
|
||||
|
||||
// Settings are loaded from file by class
|
||||
DebugEffectSettings = new DebugEffectSettings();
|
||||
EffectSettings = new DebugEffectSettings();
|
||||
|
||||
// Create effect model and add it to MainModel
|
||||
DebugEffectModel = new DebugEffectModel(mainModel, DebugEffectSettings);
|
||||
MainModel.EffectModels.Add(DebugEffectModel);
|
||||
// Create effect model and add it to MainManager
|
||||
EffectModel = new DebugEffectModel(mainManager, (DebugEffectSettings) EffectSettings);
|
||||
MainManager.EffectManager.EffectModels.Add((DebugEffectModel) EffectModel);
|
||||
}
|
||||
|
||||
public MainModel MainModel { get; set; }
|
||||
public DebugEffectModel DebugEffectModel { get; set; }
|
||||
|
||||
public static string Name => "Type Waves";
|
||||
public bool EffectEnabled => MainModel.IsEnabled(DebugEffectModel);
|
||||
|
||||
public DebugEffectSettings DebugEffectSettings
|
||||
{
|
||||
get { return _debugEffectSettings; }
|
||||
set
|
||||
{
|
||||
if (Equals(value, _debugEffectSettings)) return;
|
||||
_debugEffectSettings = value;
|
||||
NotifyOfPropertyChange(() => DebugEffectSettings);
|
||||
|
||||
SelectedRectangleType = value.Type.ToString();
|
||||
}
|
||||
}
|
||||
public static string Name => "Debug Effect";
|
||||
|
||||
public BindableCollection<string> RectangleTypes
|
||||
=> new BindableCollection<string>(Enum.GetNames(typeof (LinearGradientMode)));
|
||||
@ -61,7 +45,8 @@ namespace Artemis.Modules.Effects.Debug
|
||||
_selectedRectangleType = value;
|
||||
NotifyOfPropertyChange(() => SelectedRectangleType);
|
||||
|
||||
DebugEffectSettings.Type = (LinearGradientMode) Enum.Parse(typeof (LinearGradientMode), value);
|
||||
((DebugEffectSettings) EffectSettings).Type =
|
||||
(LinearGradientMode) Enum.Parse(typeof (LinearGradientMode), value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,14 +60,13 @@ namespace Artemis.Modules.Effects.Debug
|
||||
}
|
||||
}
|
||||
|
||||
public void Handle(ChangeActiveEffect message)
|
||||
public void Handle(ActiveEffectChanged message)
|
||||
{
|
||||
NotifyOfPropertyChange(() => EffectEnabled);
|
||||
}
|
||||
|
||||
public void Handle(ChangeBitmap message)
|
||||
{
|
||||
// Doesn't show transparancy
|
||||
using (var memory = new MemoryStream())
|
||||
{
|
||||
message.Bitmap.Save(memory, ImageFormat.Png);
|
||||
@ -97,25 +81,5 @@ namespace Artemis.Modules.Effects.Debug
|
||||
ImageSource = bitmapImage;
|
||||
}
|
||||
}
|
||||
|
||||
public void ToggleEffect()
|
||||
{
|
||||
if (EffectEnabled && !MainModel.Suspended)
|
||||
MainModel.ToggleSuspension();
|
||||
else if (!EffectEnabled && !MainModel.Suspended)
|
||||
MainModel.EnableEffect(DebugEffectModel);
|
||||
else
|
||||
{
|
||||
MainModel.ToggleSuspension();
|
||||
MainModel.EnableEffect(DebugEffectModel);
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetSettings()
|
||||
{
|
||||
// TODO: Confirmation dialog (Generic MVVM approach)
|
||||
DebugEffectSettings.ToDefault();
|
||||
NotifyOfPropertyChange(() => DebugEffectSettings);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,12 @@
|
||||
using System.Drawing;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
|
||||
namespace Artemis.Modules.Effects.TypeHole
|
||||
{
|
||||
public class TypeHoleModel : EffectModel
|
||||
{
|
||||
public TypeHoleModel(MainModel mainModel) : base(mainModel)
|
||||
public TypeHoleModel(MainManager mainManager) : base(mainManager)
|
||||
{
|
||||
Name = "TypeHole";
|
||||
}
|
||||
|
||||
@ -1,44 +1,28 @@
|
||||
using Artemis.Events;
|
||||
using Artemis.Models;
|
||||
using Artemis.Managers;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Artemis.Modules.Effects.TypeHole
|
||||
{
|
||||
public class TypeHoleViewModel : Screen, IHandle<ChangeActiveEffect>
|
||||
public class TypeHoleViewModel : EffectViewModel, IHandle<ActiveEffectChanged>
|
||||
{
|
||||
public TypeHoleViewModel(MainModel mainModel)
|
||||
public TypeHoleViewModel(MainManager mainManager)
|
||||
{
|
||||
// Subscribe to main model
|
||||
MainModel = mainModel;
|
||||
MainModel.Events.Subscribe(this);
|
||||
MainManager = mainManager;
|
||||
MainManager.Events.Subscribe(this);
|
||||
|
||||
// Create effect model and add it to MainModel
|
||||
TypeHoleModel = new TypeHoleModel(mainModel);
|
||||
MainModel.EffectModels.Add(TypeHoleModel);
|
||||
// Create effect model and add it to MainManager
|
||||
EffectModel = new TypeHoleModel(mainManager);
|
||||
MainManager.EffectManager.EffectModels.Add((TypeHoleModel) EffectModel);
|
||||
}
|
||||
|
||||
public MainModel MainModel { get; set; }
|
||||
public TypeHoleModel TypeHoleModel { get; set; }
|
||||
|
||||
public static string Name => "Type Holes (NYI)";
|
||||
public bool EffectEnabled => MainModel.IsEnabled(TypeHoleModel);
|
||||
|
||||
public void Handle(ChangeActiveEffect message)
|
||||
public void Handle(ActiveEffectChanged message)
|
||||
{
|
||||
NotifyOfPropertyChange(() => EffectEnabled);
|
||||
}
|
||||
|
||||
public void ToggleEffect()
|
||||
{
|
||||
if (EffectEnabled && !MainModel.Suspended)
|
||||
MainModel.ToggleSuspension();
|
||||
else if (!EffectEnabled && !MainModel.Suspended)
|
||||
MainModel.EnableEffect(TypeHoleModel);
|
||||
else
|
||||
{
|
||||
MainModel.ToggleSuspension();
|
||||
MainModel.EnableEffect(TypeHoleModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Artemis.KeyboardProviders.Corsair;
|
||||
using Artemis.KeyboardProviders.Logitech.Utilities;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Utilities;
|
||||
|
||||
@ -16,7 +17,7 @@ namespace Artemis.Modules.Effects.TypeWave
|
||||
private readonly List<Wave> _waves;
|
||||
private Color _randomColor;
|
||||
|
||||
public TypeWaveModel(MainModel mainModel, TypeWaveSettings settings) : base(mainModel)
|
||||
public TypeWaveModel(MainManager mainManager, TypeWaveSettings settings) : base(mainManager)
|
||||
{
|
||||
Name = "TypeWave";
|
||||
_waves = new List<Wave>();
|
||||
@ -28,13 +29,13 @@ namespace Artemis.Modules.Effects.TypeWave
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
MainModel.KeyboardHook.Unsubscribe(HandleKeypress);
|
||||
MainManager.KeyboardHook.Unsubscribe(HandleKeypress);
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
// Listener won't start unless the effect is active
|
||||
MainModel.KeyboardHook.Subscribe(HandleKeypress);
|
||||
MainManager.KeyboardHook.Subscribe(HandleKeypress);
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
@ -71,13 +72,13 @@ namespace Artemis.Modules.Effects.TypeWave
|
||||
if (_waves.Count == 0)
|
||||
return null;
|
||||
|
||||
var bitmap = MainModel.ActiveKeyboard.KeyboardBitmap();
|
||||
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap();
|
||||
using (var g = Graphics.FromImage(bitmap))
|
||||
{
|
||||
g.Clear(Color.Transparent);
|
||||
g.SmoothingMode = SmoothingMode.HighQuality;
|
||||
|
||||
// Don't want a foreach, collection is changed in different thread
|
||||
// Don't want a for-each, collection is changed in different thread
|
||||
// ReSharper disable once ForCanBeConvertedToForeach
|
||||
for (var i = 0; i < _waves.Count; i++)
|
||||
{
|
||||
@ -88,7 +89,7 @@ namespace Artemis.Modules.Effects.TypeWave
|
||||
_waves[i].Size, _waves[i].Size);
|
||||
|
||||
Color fillColor;
|
||||
if (MainModel.ActiveKeyboard is CorsairRGB)
|
||||
if (MainManager.KeyboardManager.ActiveKeyboard is CorsairRGB)
|
||||
fillColor = Color.Black;
|
||||
else
|
||||
fillColor = Color.Transparent;
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
Wave color
|
||||
</TextBlock>
|
||||
<xctk:ColorPicker x:Name="MiddleColor"
|
||||
SelectedColor="{Binding Path=TypeWaveSettings.WaveColor, Mode=TwoWay}"
|
||||
SelectedColor="{Binding Path=EffectSettings.WaveColor, Mode=TwoWay}"
|
||||
Grid.Row="1" Grid.Column="1" Width="110" HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
Height="16" Margin="0,8">
|
||||
Use random colors
|
||||
</TextBlock>
|
||||
<controls:ToggleSwitch IsChecked="{Binding Path=TypeWaveSettings.IsRandomColors, Mode=TwoWay}"
|
||||
<controls:ToggleSwitch IsChecked="{Binding Path=EffectSettings.IsRandomColors, Mode=TwoWay}"
|
||||
Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes"
|
||||
OffLabel="No"
|
||||
Margin="0,0,-5,0" Width="114" />
|
||||
@ -65,7 +65,7 @@
|
||||
Height="16" Margin="0,8">
|
||||
Shift through colors as the wave grows
|
||||
</TextBlock>
|
||||
<controls:ToggleSwitch IsChecked="{Binding Path=TypeWaveSettings.IsShiftColors, Mode=TwoWay}"
|
||||
<controls:ToggleSwitch IsChecked="{Binding Path=EffectSettings.IsShiftColors, Mode=TwoWay}"
|
||||
Grid.Row="3" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes"
|
||||
OffLabel="No"
|
||||
Margin="0,0,-5,0" Width="114" />
|
||||
@ -77,7 +77,7 @@
|
||||
</TextBlock>
|
||||
<Slider x:Name="ColorShiftSpeed" Grid.Row="4" Grid.Column="1" VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right" Width="110" TickPlacement="None" TickFrequency="1"
|
||||
Value="{Binding Path=TypeWaveSettings.ShiftColorSpeed, Mode=TwoWay}" Minimum="1" Maximum="200"
|
||||
Value="{Binding Path=EffectSettings.ShiftColorSpeed, Mode=TwoWay}" Minimum="1" Maximum="200"
|
||||
SmallChange="45" IsSnapToTickEnabled="True" />
|
||||
|
||||
<!-- TTL -->
|
||||
@ -87,7 +87,7 @@
|
||||
</TextBlock>
|
||||
<Slider x:Name="TimeToLive" Grid.Row="5" Grid.Column="1" VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right" Width="110" TickPlacement="None" TickFrequency="1"
|
||||
Value="{Binding Path=TypeWaveSettings.TimeToLive, Mode=TwoWay}" Minimum="100" Maximum="2000"
|
||||
Value="{Binding Path=EffectSettings.TimeToLive, Mode=TwoWay}" Minimum="100" Maximum="2000"
|
||||
SmallChange="45" IsSnapToTickEnabled="True" />
|
||||
|
||||
<!-- Growth speed -->
|
||||
@ -97,7 +97,7 @@
|
||||
</TextBlock>
|
||||
<Slider x:Name="SpreadSpeed" Grid.Row="6" Grid.Column="1" VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right" Width="110" TickPlacement="BottomRight" TickFrequency="1"
|
||||
Value="{Binding Path=TypeWaveSettings.SpreadSpeed, Mode=TwoWay}" Minimum="1" Maximum="6"
|
||||
Value="{Binding Path=EffectSettings.SpreadSpeed, Mode=TwoWay}" Minimum="1" Maximum="6"
|
||||
SmallChange="1" IsSnapToTickEnabled="True" />
|
||||
|
||||
<!-- Buttons -->
|
||||
|
||||
@ -1,77 +1,31 @@
|
||||
using Artemis.Events;
|
||||
using Artemis.Models;
|
||||
using Artemis.Managers;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Artemis.Modules.Effects.TypeWave
|
||||
{
|
||||
public class TypeWaveViewModel : Screen, IHandle<ChangeActiveEffect>
|
||||
public class TypeWaveViewModel : EffectViewModel, IHandle<ActiveEffectChanged>
|
||||
{
|
||||
private TypeWaveSettings _typeWaveSettings;
|
||||
|
||||
public TypeWaveViewModel(MainModel mainModel)
|
||||
public TypeWaveViewModel(MainManager mainManager)
|
||||
{
|
||||
// Subscribe to main model
|
||||
MainModel = mainModel;
|
||||
MainModel.Events.Subscribe(this);
|
||||
MainManager = mainManager;
|
||||
MainManager.Events.Subscribe(this);
|
||||
|
||||
// Settings are loaded from file by class
|
||||
TypeWaveSettings = new TypeWaveSettings();
|
||||
EffectSettings = new TypeWaveSettings();
|
||||
|
||||
// Create effect model and add it to MainModel
|
||||
TypeWaveModel = new TypeWaveModel(mainModel, TypeWaveSettings);
|
||||
MainModel.EffectModels.Add(TypeWaveModel);
|
||||
// Create effect model and add it to MainManager
|
||||
EffectModel = new TypeWaveModel(mainManager, (TypeWaveSettings) EffectSettings);
|
||||
MainManager.EffectManager.EffectModels.Add((TypeWaveModel) EffectModel);
|
||||
}
|
||||
|
||||
public MainModel MainModel { get; set; }
|
||||
public TypeWaveModel TypeWaveModel { get; set; }
|
||||
|
||||
public static string Name => "Type Waves";
|
||||
public bool EffectEnabled => MainModel.IsEnabled(TypeWaveModel);
|
||||
|
||||
public TypeWaveSettings TypeWaveSettings
|
||||
{
|
||||
get { return _typeWaveSettings; }
|
||||
set
|
||||
{
|
||||
if (Equals(value, _typeWaveSettings)) return;
|
||||
_typeWaveSettings = value;
|
||||
NotifyOfPropertyChange(() => TypeWaveSettings);
|
||||
}
|
||||
}
|
||||
|
||||
public void Handle(ChangeActiveEffect message)
|
||||
public void Handle(ActiveEffectChanged message)
|
||||
{
|
||||
NotifyOfPropertyChange(() => EffectEnabled);
|
||||
}
|
||||
|
||||
public void ToggleEffect()
|
||||
{
|
||||
if (EffectEnabled && !MainModel.Suspended)
|
||||
MainModel.ToggleSuspension();
|
||||
else if (!EffectEnabled && !MainModel.Suspended)
|
||||
MainModel.EnableEffect(TypeWaveModel);
|
||||
else
|
||||
{
|
||||
MainModel.ToggleSuspension();
|
||||
MainModel.EnableEffect(TypeWaveModel);
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveSettings()
|
||||
{
|
||||
if (TypeWaveModel == null)
|
||||
return;
|
||||
|
||||
TypeWaveSettings.Save();
|
||||
}
|
||||
|
||||
public void ResetSettings()
|
||||
{
|
||||
// TODO: Confirmation dialog (Generic MVVM approach)
|
||||
TypeWaveSettings.ToDefault();
|
||||
NotifyOfPropertyChange(() => TypeWaveSettings);
|
||||
|
||||
SaveSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,134 +1,134 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Artemis.Modules.Games.CounterStrike {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
||||
internal sealed partial class CounterStrike : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static CounterStrike defaultInstance = ((CounterStrike)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new CounterStrike())));
|
||||
|
||||
public static CounterStrike Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool Enabled {
|
||||
get {
|
||||
return ((bool)(this["Enabled"]));
|
||||
}
|
||||
set {
|
||||
this["Enabled"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string GameDirectory {
|
||||
get {
|
||||
return ((string)(this["GameDirectory"]));
|
||||
}
|
||||
set {
|
||||
this["GameDirectory"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool AmmoEnabled {
|
||||
get {
|
||||
return ((bool)(this["AmmoEnabled"]));
|
||||
}
|
||||
set {
|
||||
this["AmmoEnabled"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("#FFFF2900")]
|
||||
public global::System.Windows.Media.Color AmmoMainColor {
|
||||
get {
|
||||
return ((global::System.Windows.Media.Color)(this["AmmoMainColor"]));
|
||||
}
|
||||
set {
|
||||
this["AmmoMainColor"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("#FF26F600")]
|
||||
public global::System.Windows.Media.Color AmmoSecondaryColor {
|
||||
get {
|
||||
return ((global::System.Windows.Media.Color)(this["AmmoSecondaryColor"]));
|
||||
}
|
||||
set {
|
||||
this["AmmoSecondaryColor"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool TeamColorEnabled {
|
||||
get {
|
||||
return ((bool)(this["TeamColorEnabled"]));
|
||||
}
|
||||
set {
|
||||
this["TeamColorEnabled"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool FlashEnabled {
|
||||
get {
|
||||
return ((bool)(this["FlashEnabled"]));
|
||||
}
|
||||
set {
|
||||
this["FlashEnabled"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool SmokeEnabled {
|
||||
get {
|
||||
return ((bool)(this["SmokeEnabled"]));
|
||||
}
|
||||
set {
|
||||
this["SmokeEnabled"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool LowHpEnabled {
|
||||
get {
|
||||
return ((bool)(this["LowHpEnabled"]));
|
||||
}
|
||||
set {
|
||||
this["LowHpEnabled"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Artemis.Modules.Games.CounterStrike {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
||||
internal sealed partial class CounterStrike : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static CounterStrike defaultInstance = ((CounterStrike)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new CounterStrike())));
|
||||
|
||||
public static CounterStrike Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool Enabled {
|
||||
get {
|
||||
return ((bool)(this["Enabled"]));
|
||||
}
|
||||
set {
|
||||
this["Enabled"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string GameDirectory {
|
||||
get {
|
||||
return ((string)(this["GameDirectory"]));
|
||||
}
|
||||
set {
|
||||
this["GameDirectory"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool AmmoEnabled {
|
||||
get {
|
||||
return ((bool)(this["AmmoEnabled"]));
|
||||
}
|
||||
set {
|
||||
this["AmmoEnabled"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("#FFFF2900")]
|
||||
public global::System.Windows.Media.Color AmmoMainColor {
|
||||
get {
|
||||
return ((global::System.Windows.Media.Color)(this["AmmoMainColor"]));
|
||||
}
|
||||
set {
|
||||
this["AmmoMainColor"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("#FF26F600")]
|
||||
public global::System.Windows.Media.Color AmmoSecondaryColor {
|
||||
get {
|
||||
return ((global::System.Windows.Media.Color)(this["AmmoSecondaryColor"]));
|
||||
}
|
||||
set {
|
||||
this["AmmoSecondaryColor"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool TeamColorEnabled {
|
||||
get {
|
||||
return ((bool)(this["TeamColorEnabled"]));
|
||||
}
|
||||
set {
|
||||
this["TeamColorEnabled"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool FlashEnabled {
|
||||
get {
|
||||
return ((bool)(this["FlashEnabled"]));
|
||||
}
|
||||
set {
|
||||
this["FlashEnabled"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool SmokeEnabled {
|
||||
get {
|
||||
return ((bool)(this["SmokeEnabled"]));
|
||||
}
|
||||
set {
|
||||
this["SmokeEnabled"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool LowHpEnabled {
|
||||
get {
|
||||
return ((bool)(this["LowHpEnabled"]));
|
||||
}
|
||||
set {
|
||||
this["LowHpEnabled"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,35 +1,33 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
|
||||
GeneratedClassNamespace="Artemis.Modules.Games.CounterStrike" GeneratedClassName="CounterStrike">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="GameDirectory" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="AmmoEnabled" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="AmmoMainColor" Type="System.Windows.Media.Color" Scope="User">
|
||||
<Value Profile="(Default)">#FFFF2900</Value>
|
||||
</Setting>
|
||||
<Setting Name="AmmoSecondaryColor" Type="System.Windows.Media.Color" Scope="User">
|
||||
<Value Profile="(Default)">#FF26F600</Value>
|
||||
</Setting>
|
||||
<Setting Name="TeamColorEnabled" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="FlashEnabled" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="SmokeEnabled" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="LowHpEnabled" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Modules.Games.CounterStrike" GeneratedClassName="CounterStrike">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="GameDirectory" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="AmmoEnabled" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="AmmoMainColor" Type="System.Windows.Media.Color" Scope="User">
|
||||
<Value Profile="(Default)">#FFFF2900</Value>
|
||||
</Setting>
|
||||
<Setting Name="AmmoSecondaryColor" Type="System.Windows.Media.Color" Scope="User">
|
||||
<Value Profile="(Default)">#FF26F600</Value>
|
||||
</Setting>
|
||||
<Setting Name="TeamColorEnabled" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="FlashEnabled" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="SmokeEnabled" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="LowHpEnabled" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@ -4,8 +4,7 @@ using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using Artemis.KeyboardProviders;
|
||||
using Artemis.KeyboardProviders.Corsair;
|
||||
using Artemis.KeyboardProviders.Logitech;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.Utilities.GameState;
|
||||
@ -19,7 +18,7 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
{
|
||||
private KeyboardRegion _topRow;
|
||||
|
||||
public CounterStrikeModel(MainModel mainModel, CounterStrikeSettings settings) : base(mainModel)
|
||||
public CounterStrikeModel(MainManager mainManager, CounterStrikeSettings settings) : base(mainManager)
|
||||
{
|
||||
Settings = settings;
|
||||
Name = "CounterStrike";
|
||||
@ -42,20 +41,29 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
MainModel.GameStateWebServer.GameDataReceived -= HandleGameData;
|
||||
MainManager.GameStateWebServer.GameDataReceived -= HandleGameData;
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
// Some keyboards have a different baseline, Corsair F-keys start at row 1
|
||||
_topRow = MainModel.ActiveKeyboard.KeyboardRegions.First(r => r.RegionName == "TopRow");
|
||||
AmmoRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, _topRow.TopLeft.X, new List<Color>(),
|
||||
_topRow = MainManager.KeyboardManager.ActiveKeyboard.KeyboardRegions.First(r => r.RegionName == "TopRow");
|
||||
AmmoRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, _topRow.TopLeft.X,
|
||||
new List<Color>(),
|
||||
LinearGradientMode.Horizontal) {Height = Scale, ContainedBrush = false};
|
||||
TeamRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, _topRow.TopLeft.X + 1, new List<Color>(),
|
||||
LinearGradientMode.Horizontal) {Height = MainModel.ActiveKeyboard.Height*Scale - Scale};
|
||||
EventRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, _topRow.TopLeft.X + 1, new List<Color>(),
|
||||
LinearGradientMode.Horizontal) {Height = MainModel.ActiveKeyboard.Height*Scale - Scale};
|
||||
MainModel.GameStateWebServer.GameDataReceived += HandleGameData;
|
||||
TeamRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, _topRow.TopLeft.X + 1,
|
||||
new List<Color>(),
|
||||
LinearGradientMode.Horizontal)
|
||||
{
|
||||
Height = MainManager.KeyboardManager.ActiveKeyboard.Height*Scale - Scale
|
||||
};
|
||||
EventRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, _topRow.TopLeft.X + 1,
|
||||
new List<Color>(),
|
||||
LinearGradientMode.Horizontal)
|
||||
{
|
||||
Height = MainManager.KeyboardManager.ActiveKeyboard.Height*Scale - Scale
|
||||
};
|
||||
MainManager.GameStateWebServer.GameDataReceived += HandleGameData;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
@ -152,7 +160,7 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
return;
|
||||
|
||||
var ammoPercentage = (int) Math.Ceiling(100.00/maxAmmo)*ammo;
|
||||
AmmoRect.Width = (int) Math.Floor(_topRow.BottomRight.Y / 100.00*ammoPercentage)*Scale;
|
||||
AmmoRect.Width = (int) Math.Floor(_topRow.BottomRight.Y/100.00*ammoPercentage)*Scale;
|
||||
AmmoRect.Colors = new List<Color>
|
||||
{
|
||||
ColorHelpers.ToDrawingColor(Settings.AmmoMainColor),
|
||||
@ -168,7 +176,7 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
|
||||
public override Bitmap GenerateBitmap()
|
||||
{
|
||||
var bitmap = MainModel.ActiveKeyboard.KeyboardBitmap(Scale);
|
||||
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
||||
|
||||
using (var g = Graphics.FromImage(bitmap))
|
||||
{
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using Artemis.Models;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Properties;
|
||||
using Screen = Caliburn.Micro.Screen;
|
||||
|
||||
@ -10,16 +10,16 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
{
|
||||
private CounterStrikeSettings _counterStrikeSettings;
|
||||
|
||||
public CounterStrikeViewModel(MainModel mainModel)
|
||||
public CounterStrikeViewModel(MainManager mainManager)
|
||||
{
|
||||
MainModel = mainModel;
|
||||
MainManager = mainManager;
|
||||
|
||||
// Settings are loaded from file by class
|
||||
CounterStrikeSettings = new CounterStrikeSettings();
|
||||
|
||||
// Create effect model and add it to MainModel
|
||||
CounterStrikeModel = new CounterStrikeModel(mainModel, CounterStrikeSettings);
|
||||
MainModel.EffectModels.Add(CounterStrikeModel);
|
||||
// Create effect model and add it to MainManager
|
||||
CounterStrikeModel = new CounterStrikeModel(mainManager, CounterStrikeSettings);
|
||||
MainManager.EffectManager.EffectModels.Add(CounterStrikeModel);
|
||||
PlaceConfigFile();
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
|
||||
public CounterStrikeModel CounterStrikeModel { get; set; }
|
||||
|
||||
public MainModel MainModel { get; set; }
|
||||
public MainManager MainManager { get; set; }
|
||||
|
||||
public static string Name => "CS:GO";
|
||||
public string Content => "Counter-Strike: GO Content";
|
||||
@ -79,7 +79,7 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
if (Directory.Exists(CounterStrikeSettings.GameDirectory + "/csgo/cfg"))
|
||||
{
|
||||
var cfgFile = Resources.gamestateConfiguration.Replace("{{port}}",
|
||||
MainModel.GameStateWebServer.Port.ToString());
|
||||
MainManager.GameStateWebServer.Port.ToString());
|
||||
File.WriteAllText(CounterStrikeSettings.GameDirectory + "/csgo/cfg/gamestate_integration_artemis.cfg",
|
||||
cfgFile);
|
||||
return;
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
using Artemis.Models;
|
||||
using Artemis.Managers;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Artemis.Modules.Games.Dota2
|
||||
{
|
||||
public class Dota2ViewModel : Screen
|
||||
{
|
||||
public Dota2ViewModel(MainModel mainModel)
|
||||
public Dota2ViewModel(MainManager mainManager)
|
||||
{
|
||||
MainModel = mainModel;
|
||||
MainManager = mainManager;
|
||||
}
|
||||
|
||||
public MainModel MainModel { get; set; }
|
||||
public MainManager MainManager { get; set; }
|
||||
|
||||
public static string Name => "Dota 2 (NYI)";
|
||||
public string Content => "Dota 2 Content";
|
||||
|
||||
@ -1,62 +1,62 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Artemis.Modules.Games.RocketLeague {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
||||
internal sealed partial class RocketLeague : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static RocketLeague defaultInstance = ((RocketLeague)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new RocketLeague())));
|
||||
|
||||
public static RocketLeague Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool Enabled {
|
||||
get {
|
||||
return ((bool)(this["Enabled"]));
|
||||
}
|
||||
set {
|
||||
this["Enabled"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("#FFFF5000")]
|
||||
public global::System.Windows.Media.Color MainColor {
|
||||
get {
|
||||
return ((global::System.Windows.Media.Color)(this["MainColor"]));
|
||||
}
|
||||
set {
|
||||
this["MainColor"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("#FFFF0000")]
|
||||
public global::System.Windows.Media.Color SecondaryColor {
|
||||
get {
|
||||
return ((global::System.Windows.Media.Color)(this["SecondaryColor"]));
|
||||
}
|
||||
set {
|
||||
this["SecondaryColor"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Artemis.Modules.Games.RocketLeague {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
||||
internal sealed partial class RocketLeague : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static RocketLeague defaultInstance = ((RocketLeague)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new RocketLeague())));
|
||||
|
||||
public static RocketLeague Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool Enabled {
|
||||
get {
|
||||
return ((bool)(this["Enabled"]));
|
||||
}
|
||||
set {
|
||||
this["Enabled"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("#FFFF5000")]
|
||||
public global::System.Windows.Media.Color MainColor {
|
||||
get {
|
||||
return ((global::System.Windows.Media.Color)(this["MainColor"]));
|
||||
}
|
||||
set {
|
||||
this["MainColor"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("#FFFF0000")]
|
||||
public global::System.Windows.Media.Color SecondaryColor {
|
||||
get {
|
||||
return ((global::System.Windows.Media.Color)(this["SecondaryColor"]));
|
||||
}
|
||||
set {
|
||||
this["SecondaryColor"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,17 +1,15 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
|
||||
GeneratedClassNamespace="Artemis.Modules.Games.RocketLeague" GeneratedClassName="RocketLeague">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="MainColor" Type="System.Windows.Media.Color" Scope="User">
|
||||
<Value Profile="(Default)">#FFFF5000</Value>
|
||||
</Setting>
|
||||
<Setting Name="SecondaryColor" Type="System.Windows.Media.Color" Scope="User">
|
||||
<Value Profile="(Default)">#FFFF0000</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Modules.Games.RocketLeague" GeneratedClassName="RocketLeague">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="MainColor" Type="System.Windows.Media.Color" Scope="User">
|
||||
<Value Profile="(Default)">#FFFF5000</Value>
|
||||
</Setting>
|
||||
<Setting Name="SecondaryColor" Type="System.Windows.Media.Color" Scope="User">
|
||||
<Value Profile="(Default)">#FFFF0000</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@ -5,6 +5,7 @@ using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Settings;
|
||||
using Artemis.Utilities;
|
||||
@ -23,7 +24,7 @@ namespace Artemis.Modules.Games.RocketLeague
|
||||
private GamePointersCollectionModel _pointer;
|
||||
private int _previousBoost;
|
||||
|
||||
public RocketLeagueModel(MainModel mainModel, RocketLeagueSettings settings) : base(mainModel)
|
||||
public RocketLeagueModel(MainManager mainManager, RocketLeagueSettings settings) : base(mainManager)
|
||||
{
|
||||
Settings = settings;
|
||||
Name = "RocketLeague";
|
||||
@ -43,7 +44,7 @@ namespace Artemis.Modules.Games.RocketLeague
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
_boostRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, 0, new List<Color>
|
||||
_boostRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color>
|
||||
{
|
||||
ColorHelpers.ToDrawingColor(Settings.MainColor),
|
||||
ColorHelpers.ToDrawingColor(Settings.SecondaryColor)
|
||||
@ -91,7 +92,8 @@ namespace Artemis.Modules.Games.RocketLeague
|
||||
if (_boostAmount > 100)
|
||||
_boostAmount = 100;
|
||||
|
||||
_boostRect.Width = (int) Math.Ceiling(MainModel.ActiveKeyboard.Width*Scale/100.00*_boostAmount);
|
||||
_boostRect.Width =
|
||||
(int) Math.Ceiling(MainManager.KeyboardManager.ActiveKeyboard.Width*Scale/100.00*_boostAmount);
|
||||
_boostRect.Colors = new List<Color>
|
||||
{
|
||||
ColorHelpers.ToDrawingColor(Settings.MainColor),
|
||||
@ -113,7 +115,8 @@ namespace Artemis.Modules.Games.RocketLeague
|
||||
var differenceStep = difference/amountOfSteps;
|
||||
var differenceStepRest = difference%amountOfSteps;
|
||||
_boostAmount = _previousBoost;
|
||||
_boostRect.Width = (int) Math.Ceiling(MainModel.ActiveKeyboard.Width*Scale/100.00*_boostAmount);
|
||||
_boostRect.Width =
|
||||
(int) Math.Ceiling(MainManager.KeyboardManager.ActiveKeyboard.Width*Scale/100.00*_boostAmount);
|
||||
|
||||
for (var i = 0; i < amountOfSteps; i++)
|
||||
{
|
||||
@ -121,10 +124,12 @@ namespace Artemis.Modules.Games.RocketLeague
|
||||
{
|
||||
differenceStepRest -= 1;
|
||||
_boostAmount += 1;
|
||||
_boostRect.Width = (int) Math.Ceiling(MainModel.ActiveKeyboard.Width*Scale/100.00*_boostAmount);
|
||||
_boostRect.Width =
|
||||
(int) Math.Ceiling(MainManager.KeyboardManager.ActiveKeyboard.Width*Scale/100.00*_boostAmount);
|
||||
}
|
||||
_boostAmount += differenceStep;
|
||||
_boostRect.Width = (int) Math.Ceiling(MainModel.ActiveKeyboard.Width*Scale/100.00*_boostAmount);
|
||||
_boostRect.Width =
|
||||
(int) Math.Ceiling(MainManager.KeyboardManager.ActiveKeyboard.Width*Scale/100.00*_boostAmount);
|
||||
|
||||
Thread.Sleep(50);
|
||||
}
|
||||
@ -134,7 +139,7 @@ namespace Artemis.Modules.Games.RocketLeague
|
||||
|
||||
public override Bitmap GenerateBitmap()
|
||||
{
|
||||
var bitmap = MainModel.ActiveKeyboard.KeyboardBitmap(Scale);
|
||||
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
||||
if (_boostRect == null)
|
||||
return null;
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using Artemis.Models;
|
||||
using Artemis.Managers;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Artemis.Modules.Games.RocketLeague
|
||||
@ -7,21 +7,21 @@ namespace Artemis.Modules.Games.RocketLeague
|
||||
{
|
||||
private RocketLeagueSettings _rocketLeagueSettings;
|
||||
|
||||
public RocketLeagueViewModel(MainModel mainModel)
|
||||
public RocketLeagueViewModel(MainManager mainManager)
|
||||
{
|
||||
MainModel = mainModel;
|
||||
MainManager = mainManager;
|
||||
|
||||
// Settings are loaded from file by class
|
||||
RocketLeagueSettings = new RocketLeagueSettings();
|
||||
|
||||
// Create effect model and add it to MainModel
|
||||
RocketLeagueModel = new RocketLeagueModel(mainModel, RocketLeagueSettings);
|
||||
MainModel.EffectModels.Add(RocketLeagueModel);
|
||||
// Create effect model and add it to MainManager
|
||||
RocketLeagueModel = new RocketLeagueModel(mainManager, RocketLeagueSettings);
|
||||
MainManager.EffectManager.EffectModels.Add(RocketLeagueModel);
|
||||
}
|
||||
|
||||
public static string Name => "Rocket League";
|
||||
|
||||
public MainModel MainModel { get; set; }
|
||||
public MainManager MainManager { get; set; }
|
||||
public RocketLeagueModel RocketLeagueModel { get; set; }
|
||||
|
||||
public RocketLeagueSettings RocketLeagueSettings
|
||||
|
||||
@ -1,38 +1,38 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Artemis.Modules.Games.Witcher3 {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
||||
internal sealed partial class Witcher3 : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Witcher3 defaultInstance = ((Witcher3)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Witcher3())));
|
||||
|
||||
public static Witcher3 Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool Enabled {
|
||||
get {
|
||||
return ((bool)(this["Enabled"]));
|
||||
}
|
||||
set {
|
||||
this["Enabled"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Artemis.Modules.Games.Witcher3 {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
||||
internal sealed partial class Witcher3 : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Witcher3 defaultInstance = ((Witcher3)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Witcher3())));
|
||||
|
||||
public static Witcher3 Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool Enabled {
|
||||
get {
|
||||
return ((bool)(this["Enabled"]));
|
||||
}
|
||||
set {
|
||||
this["Enabled"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
|
||||
GeneratedClassNamespace="Artemis.Modules.Games.Witcher3" GeneratedClassName="Witcher3">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Modules.Games.Witcher3" GeneratedClassName="Witcher3">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@ -5,6 +5,7 @@ using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Utilities.Keyboard;
|
||||
|
||||
@ -17,7 +18,7 @@ namespace Artemis.Modules.Games.Witcher3
|
||||
private KeyboardRectangle _signRect;
|
||||
private string _witcherSettings;
|
||||
|
||||
public Witcher3Model(MainModel mainModel, Witcher3Settings settings) : base(mainModel)
|
||||
public Witcher3Model(MainManager mainManager, Witcher3Settings settings) : base(mainManager)
|
||||
{
|
||||
Settings = settings;
|
||||
Name = "Witcher3";
|
||||
@ -42,7 +43,7 @@ namespace Artemis.Modules.Games.Witcher3
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
_signRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, 0, new List<Color>(),
|
||||
_signRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color>(),
|
||||
LinearGradientMode.Horizontal)
|
||||
{
|
||||
Rotate = true,
|
||||
@ -102,7 +103,7 @@ namespace Artemis.Modules.Games.Witcher3
|
||||
|
||||
public override Bitmap GenerateBitmap()
|
||||
{
|
||||
var bitmap = MainModel.ActiveKeyboard.KeyboardBitmap(Scale);
|
||||
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
||||
using (var g = Graphics.FromImage(bitmap))
|
||||
{
|
||||
g.Clear(Color.Transparent);
|
||||
|
||||
@ -3,7 +3,7 @@ using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using Artemis.Models;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Properties;
|
||||
using Screen = Caliburn.Micro.Screen;
|
||||
|
||||
@ -13,21 +13,21 @@ namespace Artemis.Modules.Games.Witcher3
|
||||
{
|
||||
private Witcher3Settings _witcher3Settings;
|
||||
|
||||
public Witcher3ViewModel(MainModel mainModel)
|
||||
public Witcher3ViewModel(MainManager mainManager)
|
||||
{
|
||||
MainModel = mainModel;
|
||||
MainManager = mainManager;
|
||||
|
||||
// Settings are loaded from file by class
|
||||
Witcher3Settings = new Witcher3Settings();
|
||||
|
||||
// Create effect model and add it to MainModel
|
||||
Witcher3Model = new Witcher3Model(mainModel, Witcher3Settings);
|
||||
MainModel.EffectModels.Add(Witcher3Model);
|
||||
// Create effect model and add it to MainManager
|
||||
Witcher3Model = new Witcher3Model(mainManager, Witcher3Settings);
|
||||
MainManager.EffectManager.EffectModels.Add(Witcher3Model);
|
||||
}
|
||||
|
||||
public static string Name => "The Witcher 3";
|
||||
|
||||
public MainModel MainModel { get; set; }
|
||||
public MainManager MainManager { get; set; }
|
||||
public Witcher3Model Witcher3Model { get; set; }
|
||||
|
||||
public Witcher3Settings Witcher3Settings
|
||||
@ -115,8 +115,11 @@ namespace Artemis.Modules.Games.Witcher3
|
||||
Directory.CreateDirectory(folder + @"\Witcher3\bin\config\r4game\user_config_matrix\pc");
|
||||
|
||||
// Install the mod files
|
||||
File.WriteAllText(folder + @"\Witcher3\bin\config\r4game\user_config_matrix\pc\artemis.xml",Resources.artemisXml);
|
||||
File.WriteAllText(folder + @"\Witcher3\mods\modArtemis\content\scripts\game\player\playerWitcher.ws",Resources.playerWitcherWs);
|
||||
File.WriteAllText(folder + @"\Witcher3\bin\config\r4game\user_config_matrix\pc\artemis.xml",
|
||||
Resources.artemisXml);
|
||||
File.WriteAllText(
|
||||
folder + @"\Witcher3\mods\modArtemis\content\scripts\game\player\playerWitcher.ws",
|
||||
Resources.playerWitcherWs);
|
||||
|
||||
Process.Start(new ProcessStartInfo("https://github.com/SpoinkyNL/Artemis/wiki/The-Witcher-3"));
|
||||
|
||||
|
||||
@ -1,62 +1,62 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Artemis.Settings {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
||||
internal sealed partial class VolumeDisplay : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static VolumeDisplay defaultInstance = ((VolumeDisplay)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new VolumeDisplay())));
|
||||
|
||||
public static VolumeDisplay Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("#FFFF2900")]
|
||||
public global::System.Windows.Media.Color MainColor {
|
||||
get {
|
||||
return ((global::System.Windows.Media.Color)(this["MainColor"]));
|
||||
}
|
||||
set {
|
||||
this["MainColor"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("#FF26F600")]
|
||||
public global::System.Windows.Media.Color SecondaryColor {
|
||||
get {
|
||||
return ((global::System.Windows.Media.Color)(this["SecondaryColor"]));
|
||||
}
|
||||
set {
|
||||
this["SecondaryColor"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool Enabled {
|
||||
get {
|
||||
return ((bool)(this["Enabled"]));
|
||||
}
|
||||
set {
|
||||
this["Enabled"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Artemis.Modules.Overlays.VolumeDisplay {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
||||
internal sealed partial class VolumeDisplay : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static VolumeDisplay defaultInstance = ((VolumeDisplay)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new VolumeDisplay())));
|
||||
|
||||
public static VolumeDisplay Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool Enabled {
|
||||
get {
|
||||
return ((bool)(this["Enabled"]));
|
||||
}
|
||||
set {
|
||||
this["Enabled"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("#FFFF2900")]
|
||||
public global::System.Windows.Media.Color MainColor {
|
||||
get {
|
||||
return ((global::System.Windows.Media.Color)(this["MainColor"]));
|
||||
}
|
||||
set {
|
||||
this["MainColor"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("#FF26F600")]
|
||||
public global::System.Windows.Media.Color SecondaryColor {
|
||||
get {
|
||||
return ((global::System.Windows.Media.Color)(this["SecondaryColor"]));
|
||||
}
|
||||
set {
|
||||
this["SecondaryColor"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,23 +1,23 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using Artemis.Models;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.Utilities.Keyboard;
|
||||
|
||||
namespace Artemis.Modules.Overlays.VolumeDisplay
|
||||
{
|
||||
public class VolumeDisplay
|
||||
public class VolumeBar
|
||||
{
|
||||
public VolumeDisplay(MainModel mainModel, VolumeDisplaySettings settings)
|
||||
public VolumeBar(MainManager mainManager, VolumeDisplaySettings settings)
|
||||
{
|
||||
MainModel = mainModel;
|
||||
MainManager = mainManager;
|
||||
Settings = settings;
|
||||
Transparancy = 255;
|
||||
Scale = 4;
|
||||
}
|
||||
|
||||
public MainModel MainModel { get; set; }
|
||||
public MainManager MainManager { get; set; }
|
||||
|
||||
public VolumeDisplaySettings Settings { get; set; }
|
||||
|
||||
@ -30,14 +30,14 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
|
||||
|
||||
public void Draw(Graphics g)
|
||||
{
|
||||
var volumeRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, 0, new List<Color>
|
||||
var volumeRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color>
|
||||
{
|
||||
ColorHelpers.ToDrawingColor(Settings.SecondaryColor),
|
||||
ColorHelpers.ToDrawingColor(Settings.MainColor)
|
||||
},
|
||||
LinearGradientMode.Horizontal)
|
||||
{
|
||||
Width = (int) (MainModel.ActiveKeyboard.Width*Scale/100.00*Volume),
|
||||
Width = (int) (MainManager.KeyboardManager.ActiveKeyboard.Width*Scale/100.00*Volume),
|
||||
ContainedBrush = false
|
||||
};
|
||||
volumeRect.Draw(g);
|
||||
|
||||
@ -1,17 +1,15 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
|
||||
GeneratedClassNamespace="Artemis.Settings" GeneratedClassName="VolumeDisplay">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="MainColor" Type="System.Windows.Media.Color" Scope="User">
|
||||
<Value Profile="(Default)">#FFFF2900</Value>
|
||||
</Setting>
|
||||
<Setting Name="SecondaryColor" Type="System.Windows.Media.Color" Scope="User">
|
||||
<Value Profile="(Default)">#FF26F600</Value>
|
||||
</Setting>
|
||||
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Modules.Overlays.VolumeDisplay" GeneratedClassName="VolumeDisplay">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="MainColor" Type="System.Windows.Media.Color" Scope="User">
|
||||
<Value Profile="(Default)">#FFFF2900</Value>
|
||||
</Setting>
|
||||
<Setting Name="SecondaryColor" Type="System.Windows.Media.Color" Scope="User">
|
||||
<Value Profile="(Default)">#FF26F600</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@ -2,6 +2,7 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using NAudio.CoreAudioApi;
|
||||
|
||||
@ -9,28 +10,28 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
|
||||
{
|
||||
public class VolumeDisplayModel : OverlayModel
|
||||
{
|
||||
public VolumeDisplayModel(MainModel mainModel, VolumeDisplaySettings settings) : base(mainModel)
|
||||
public VolumeDisplayModel(MainManager mainManager, VolumeDisplaySettings settings) : base(mainManager)
|
||||
{
|
||||
Settings = settings;
|
||||
Name = "VolumeDisplay";
|
||||
Enabled = Settings.Enabled;
|
||||
|
||||
VolumeDisplay = new VolumeDisplay(mainModel, settings);
|
||||
VolumeDisplay = new VolumeBar(mainManager, settings);
|
||||
}
|
||||
|
||||
public VolumeDisplay VolumeDisplay { get; set; }
|
||||
public VolumeBar VolumeDisplay { get; set; }
|
||||
|
||||
public VolumeDisplaySettings Settings { get; set; }
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
MainModel.KeyboardHook.Unsubscribe(HandleKeypress);
|
||||
MainManager.KeyboardHook.Unsubscribe(HandleKeypress);
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
// Listener won't start unless the effect is active
|
||||
MainModel.KeyboardHook.Subscribe(HandleKeypress);
|
||||
MainManager.KeyboardHook.Subscribe(HandleKeypress);
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
@ -63,7 +64,7 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
|
||||
|
||||
public override Bitmap GenerateBitmap()
|
||||
{
|
||||
return GenerateBitmap(MainModel.ActiveKeyboard.KeyboardBitmap(4));
|
||||
return GenerateBitmap(MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(4));
|
||||
}
|
||||
|
||||
public override Bitmap GenerateBitmap(Bitmap bitmap)
|
||||
|
||||
@ -16,18 +16,18 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
|
||||
|
||||
public sealed override void Load()
|
||||
{
|
||||
Enabled = Settings.VolumeDisplay.Default.Enabled;
|
||||
MainColor = Settings.VolumeDisplay.Default.MainColor;
|
||||
SecondaryColor = Settings.VolumeDisplay.Default.SecondaryColor;
|
||||
Enabled = VolumeDisplay.Default.Enabled;
|
||||
MainColor = VolumeDisplay.Default.MainColor;
|
||||
SecondaryColor = VolumeDisplay.Default.SecondaryColor;
|
||||
}
|
||||
|
||||
public sealed override void Save()
|
||||
{
|
||||
Settings.VolumeDisplay.Default.Enabled = Enabled;
|
||||
Settings.VolumeDisplay.Default.MainColor = MainColor;
|
||||
Settings.VolumeDisplay.Default.SecondaryColor = SecondaryColor;
|
||||
VolumeDisplay.Default.Enabled = Enabled;
|
||||
VolumeDisplay.Default.MainColor = MainColor;
|
||||
VolumeDisplay.Default.SecondaryColor = SecondaryColor;
|
||||
|
||||
Settings.VolumeDisplay.Default.Save();
|
||||
VolumeDisplay.Default.Save();
|
||||
}
|
||||
|
||||
public sealed override void ToDefault()
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using Artemis.Models;
|
||||
using Artemis.Managers;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Artemis.Modules.Overlays.VolumeDisplay
|
||||
@ -7,21 +7,21 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
|
||||
{
|
||||
private VolumeDisplaySettings _volumeDisplaySettings;
|
||||
|
||||
public VolumeDisplayViewModel(MainModel mainModel)
|
||||
public VolumeDisplayViewModel(MainManager mainManager)
|
||||
{
|
||||
MainModel = mainModel;
|
||||
MainManager = mainManager;
|
||||
|
||||
// Settings are loaded from file by class
|
||||
VolumeDisplaySettings = new VolumeDisplaySettings();
|
||||
|
||||
// Create effect model and add it to MainModel
|
||||
VolumeDisplayModel = new VolumeDisplayModel(mainModel, VolumeDisplaySettings);
|
||||
MainModel.EffectModels.Add(VolumeDisplayModel);
|
||||
// Create effect model and add it to MainManager
|
||||
VolumeDisplayModel = new VolumeDisplayModel(mainManager, VolumeDisplaySettings);
|
||||
MainManager.EffectManager.EffectModels.Add(VolumeDisplayModel);
|
||||
}
|
||||
|
||||
public static string Name => "Volume Display";
|
||||
|
||||
public MainModel MainModel { get; set; }
|
||||
public MainManager MainManager { get; set; }
|
||||
public VolumeDisplayModel VolumeDisplayModel { get; set; }
|
||||
|
||||
public VolumeDisplaySettings VolumeDisplaySettings
|
||||
|
||||
@ -18,8 +18,8 @@ namespace Artemis.Utilities.Memory
|
||||
|
||||
public static Process GetProcessIfRunning(string processName)
|
||||
{
|
||||
var rlProcess = Process.GetProcessesByName(processName);
|
||||
return rlProcess.Length >= 1 ? rlProcess[0] : null;
|
||||
var processes = Process.GetProcessesByName(processName);
|
||||
return processes.Length >= 1 ? processes[0] : null;
|
||||
}
|
||||
|
||||
public static IntPtr FindAddress(IntPtr pHandle, IntPtr baseAddress, IntPtr staticPointer, int[] offsets)
|
||||
|
||||
49
Artemis/Artemis/ViewModels/Abstract/EffectViewModel.cs
Normal file
49
Artemis/Artemis/ViewModels/Abstract/EffectViewModel.cs
Normal file
@ -0,0 +1,49 @@
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Artemis.ViewModels.Abstract
|
||||
{
|
||||
public abstract class EffectViewModel : Screen
|
||||
{
|
||||
private EffectSettings _effectSettings;
|
||||
|
||||
public EffectModel EffectModel { get; set; }
|
||||
public MainManager MainManager { get; set; }
|
||||
|
||||
public EffectSettings EffectSettings
|
||||
{
|
||||
get { return _effectSettings; }
|
||||
set
|
||||
{
|
||||
if (Equals(value, _effectSettings)) return;
|
||||
_effectSettings = value;
|
||||
NotifyOfPropertyChange(() => EffectSettings);
|
||||
}
|
||||
}
|
||||
|
||||
public bool EffectEnabled => MainManager.EffectManager.ActiveEffect == EffectModel;
|
||||
|
||||
public void ToggleEffect()
|
||||
{
|
||||
if (EffectEnabled)
|
||||
MainManager.EffectManager.ClearEffect();
|
||||
else
|
||||
MainManager.EffectManager.ChangeEffect(EffectModel);
|
||||
}
|
||||
|
||||
public void SaveSettings()
|
||||
{
|
||||
EffectSettings?.Save();
|
||||
}
|
||||
|
||||
public void ResetSettings()
|
||||
{
|
||||
// TODO: Confirmation dialog (Generic MVVM approach)
|
||||
EffectSettings.ToDefault();
|
||||
NotifyOfPropertyChange(() => EffectSettings);
|
||||
|
||||
SaveSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
using Artemis.Models;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Modules.Effects.AudioVisualizer;
|
||||
using Artemis.Modules.Effects.Debug;
|
||||
using Artemis.Modules.Effects.TypeHole;
|
||||
@ -14,12 +14,12 @@ namespace Artemis.ViewModels
|
||||
private readonly TypeHoleViewModel _typeHoleVm;
|
||||
private readonly TypeWaveViewModel _typeWaveVm;
|
||||
|
||||
public EffectsViewModel(MainModel mainModel)
|
||||
public EffectsViewModel(MainManager mainManager)
|
||||
{
|
||||
_typeWaveVm = new TypeWaveViewModel(mainModel) {DisplayName = "Type Waves"};
|
||||
//_typeHoleVm = new TypeHoleViewModel(mainModel) {DisplayName = "Type Holes (NYI)"};
|
||||
_audioVisualizerVm = new AudioVisualizerViewModel(mainModel) {DisplayName = "Audio Visualization"};
|
||||
_debugVm = new DebugEffectViewModel(mainModel) {DisplayName = "Debug Effect"};
|
||||
_typeWaveVm = new TypeWaveViewModel(mainManager) {DisplayName = "Type Waves"};
|
||||
//_typeHoleVm = new TypeHoleViewModel(MainManager) {DisplayName = "Type Holes (NYI)"};
|
||||
_audioVisualizerVm = new AudioVisualizerViewModel(mainManager) {DisplayName = "Audio Visualization"};
|
||||
_debugVm = new DebugEffectViewModel(mainManager) {DisplayName = "Debug Effect"};
|
||||
}
|
||||
|
||||
protected override void OnActivate()
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using Artemis.Events;
|
||||
using Artemis.Models;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Settings;
|
||||
using Caliburn.Micro;
|
||||
using MahApps.Metro.Controls;
|
||||
@ -14,14 +14,14 @@ namespace Artemis.ViewModels.Flyouts
|
||||
private GeneralSettings _generalSettings;
|
||||
private string _selectedKeyboardProvider;
|
||||
|
||||
public FlyoutSettingsViewModel(MainModel mainModel)
|
||||
public FlyoutSettingsViewModel(MainManager mainManager)
|
||||
{
|
||||
MainModel = mainModel;
|
||||
Header = "settings";
|
||||
MainManager = mainManager;
|
||||
Header = "Settings";
|
||||
Position = Position.Right;
|
||||
GeneralSettings = new GeneralSettings();
|
||||
|
||||
MainModel.Events.Subscribe(this);
|
||||
MainManager.Events.Subscribe(this);
|
||||
}
|
||||
|
||||
public GeneralSettings GeneralSettings
|
||||
@ -35,10 +35,10 @@ namespace Artemis.ViewModels.Flyouts
|
||||
}
|
||||
}
|
||||
|
||||
public MainModel MainModel { get; set; }
|
||||
public MainManager MainManager { get; set; }
|
||||
|
||||
public BindableCollection<string> KeyboardProviders
|
||||
=> new BindableCollection<string>(MainModel.KeyboardProviders.Select(k => k.Name));
|
||||
=> new BindableCollection<string>(MainManager.KeyboardManager.KeyboardProviders.Select(k => k.Name));
|
||||
|
||||
public string SelectedKeyboardProvider
|
||||
{
|
||||
@ -51,7 +51,8 @@ namespace Artemis.ViewModels.Flyouts
|
||||
if (value == null)
|
||||
return;
|
||||
|
||||
MainModel.ChangeKeyboard(MainModel.KeyboardProviders.First(k => k.Name == _selectedKeyboardProvider));
|
||||
MainManager.KeyboardManager.ChangeKeyboard(
|
||||
MainManager.KeyboardManager.KeyboardProviders.First(k => k.Name == _selectedKeyboardProvider));
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,9 +76,11 @@ namespace Artemis.ViewModels.Flyouts
|
||||
public void ToggleEnabled()
|
||||
{
|
||||
if (Enabled)
|
||||
MainModel.ShutdownEffects();
|
||||
MainManager.Stop();
|
||||
else if (MainManager.EffectManager.ActiveEffect != null)
|
||||
MainManager.Start();
|
||||
else
|
||||
MainModel.StartEffects();
|
||||
MainManager.Start(MainManager.EffectManager.GetLastEffect());
|
||||
}
|
||||
|
||||
public void ResetSettings()
|
||||
@ -98,7 +101,7 @@ namespace Artemis.ViewModels.Flyouts
|
||||
|
||||
protected override void HandleOpen()
|
||||
{
|
||||
SelectedKeyboardProvider = MainModel.ActiveKeyboard?.Name;
|
||||
SelectedKeyboardProvider = MainManager.KeyboardManager.ActiveKeyboard?.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
using Artemis.Models;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Modules.Games.CounterStrike;
|
||||
using Artemis.Modules.Games.Dota2;
|
||||
using Artemis.Modules.Games.RocketLeague;
|
||||
@ -14,12 +14,12 @@ namespace Artemis.ViewModels
|
||||
private readonly RocketLeagueViewModel _rocketLeagueVm;
|
||||
private readonly Witcher3ViewModel _witcher3Vm;
|
||||
|
||||
public GamesViewModel(MainModel mainModel)
|
||||
public GamesViewModel(MainManager mainManager)
|
||||
{
|
||||
_rocketLeagueVm = new RocketLeagueViewModel(mainModel) {DisplayName = "Rocket League"};
|
||||
_counterStrikeVm = new CounterStrikeViewModel(mainModel) {DisplayName = "CS:GO"};
|
||||
//_dota2Vm = new Dota2ViewModel(mainModel) {DisplayName = "Dota 2 (NYI)"};
|
||||
_witcher3Vm = new Witcher3ViewModel(mainModel) {DisplayName = "The Witcher 3"};
|
||||
_rocketLeagueVm = new RocketLeagueViewModel(mainManager) {DisplayName = "Rocket League"};
|
||||
_counterStrikeVm = new CounterStrikeViewModel(mainManager) {DisplayName = "CS:GO"};
|
||||
//_dota2Vm = new Dota2ViewModel(MainManager) {DisplayName = "Dota 2 (NYI)"};
|
||||
_witcher3Vm = new Witcher3ViewModel(mainManager) {DisplayName = "The Witcher 3"};
|
||||
}
|
||||
|
||||
protected override void OnActivate()
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using Artemis.Models;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Modules.Overlays.VolumeDisplay;
|
||||
using Caliburn.Micro;
|
||||
|
||||
@ -6,12 +6,12 @@ namespace Artemis.ViewModels
|
||||
{
|
||||
public class OverlaysViewModel : Conductor<IScreen>.Collection.OneActive
|
||||
{
|
||||
private readonly MainModel _mainModel;
|
||||
private readonly MainManager _mainManager;
|
||||
private VolumeDisplayViewModel _volumeDisplayVm;
|
||||
|
||||
public OverlaysViewModel(MainModel mainModel)
|
||||
public OverlaysViewModel(MainManager mainManager)
|
||||
{
|
||||
_mainModel = mainModel;
|
||||
_mainManager = mainManager;
|
||||
}
|
||||
|
||||
protected override void OnActivate()
|
||||
@ -21,7 +21,7 @@ namespace Artemis.ViewModels
|
||||
Items.Clear();
|
||||
|
||||
// This VM appears to be going out of scope, so recreating it every time just to be sure.
|
||||
_volumeDisplayVm = new VolumeDisplayViewModel(_mainModel) { DisplayName = "Volume Display" };
|
||||
_volumeDisplayVm = new VolumeDisplayViewModel(_mainManager) {DisplayName = "Volume Display"};
|
||||
ActivateItem(_volumeDisplayVm);
|
||||
ActiveItem = _volumeDisplayVm;
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using Artemis.Models;
|
||||
using Artemis.Managers;
|
||||
using Artemis.ViewModels.Flyouts;
|
||||
using Caliburn.Micro;
|
||||
|
||||
@ -17,21 +17,21 @@ namespace Artemis.ViewModels
|
||||
public ShellViewModel()
|
||||
{
|
||||
IEventAggregator events = new EventAggregator();
|
||||
MainModel = new MainModel(events);
|
||||
MainManager = new MainManager(events);
|
||||
DisplayName = "Artemis";
|
||||
|
||||
_welcomeVm = new WelcomeViewModel {DisplayName = "Welcome"};
|
||||
_effectsVm = new EffectsViewModel(MainModel) {DisplayName = "Effects"};
|
||||
_gamesVm = new GamesViewModel(MainModel) {DisplayName = "Games"};
|
||||
_overlaysVm = new OverlaysViewModel(MainModel) {DisplayName = "Overlays"};
|
||||
_effectsVm = new EffectsViewModel(MainManager) {DisplayName = "Effects"};
|
||||
_gamesVm = new GamesViewModel(MainManager) {DisplayName = "Games"};
|
||||
_overlaysVm = new OverlaysViewModel(MainManager) {DisplayName = "Overlays"};
|
||||
|
||||
Flyouts.Add(new FlyoutSettingsViewModel(MainModel));
|
||||
Flyouts.Add(new FlyoutSettingsViewModel(MainManager));
|
||||
}
|
||||
|
||||
public IObservableCollection<FlyoutBaseViewModel> Flyouts { get; set; } =
|
||||
new BindableCollection<FlyoutBaseViewModel>();
|
||||
|
||||
public MainModel MainModel { get; set; }
|
||||
public MainManager MainManager { get; set; }
|
||||
|
||||
protected override void OnActivate()
|
||||
{
|
||||
@ -47,7 +47,7 @@ namespace Artemis.ViewModels
|
||||
|
||||
public void OnClose(EventArgs e)
|
||||
{
|
||||
MainModel.ShutdownEffects();
|
||||
MainManager.Stop();
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
|
||||
|
||||
@ -24,14 +24,7 @@ namespace Artemis.ViewModels
|
||||
{
|
||||
_windowManager = windowManager;
|
||||
_shellViewModel = shellViewModel;
|
||||
_shellViewModel.MainModel.Events.Subscribe(this);
|
||||
|
||||
/*
|
||||
* By now Effects are added to the MainModel so we can savely start
|
||||
* This is done from here to make sure all UI elements listening to
|
||||
* events will receive the first ToggleEnabled event
|
||||
* */
|
||||
_shellViewModel.MainModel.StartEffects();
|
||||
_shellViewModel.MainManager.Events.Subscribe(this);
|
||||
|
||||
// TODO: Check if show on startup is enabled, if so, show window.
|
||||
}
|
||||
@ -72,9 +65,9 @@ namespace Artemis.ViewModels
|
||||
public void ToggleEnabled()
|
||||
{
|
||||
if (Enabled)
|
||||
_shellViewModel.MainModel.ShutdownEffects();
|
||||
_shellViewModel.MainManager.Stop();
|
||||
else
|
||||
_shellViewModel.MainModel.StartEffects();
|
||||
_shellViewModel.MainManager.Start();
|
||||
}
|
||||
|
||||
protected override void OnActivate()
|
||||
@ -110,7 +103,7 @@ namespace Artemis.ViewModels
|
||||
|
||||
public void ExitApplication()
|
||||
{
|
||||
_shellViewModel.MainModel.ShutdownEffects();
|
||||
_shellViewModel.MainManager.Stop();
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,8 +32,7 @@
|
||||
Content="Enable Artemis:" />
|
||||
<controls:ToggleSwitch Grid.Row="0" Grid.Column="1" Margin="5" OnLabel="Yes" OffLabel="No"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Right" Width="125"
|
||||
IsChecked="{Binding Path=Enabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Unchecked] = [Action ToggleEnabled]; [Event Checked] = [Action ToggleEnabled]" />
|
||||
IsChecked="{Binding Path=Enabled, Mode=OneWay}" />
|
||||
|
||||
<!-- Startup with Windows -->
|
||||
<Label Grid.Row="1" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
|
||||
@ -82,7 +81,7 @@
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="Artemis 1.0.0" VerticalAlignment="Center"
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="Artemis 1.0.1" VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left" />
|
||||
<Button Grid.Row="0" Grid.Column="1" Focusable="False" Style="{StaticResource AccentedSquareButtonStyle}"
|
||||
cal:Message.Attach="[Action NavigateTo('https://github.com/SpoinkyNL/Artemis')]"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user