1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Added LightFX module

This commit is contained in:
SpoinkyNL 2016-12-21 14:34:40 +01:00
parent 3e9a86d893
commit c73c671f01
8 changed files with 190 additions and 1 deletions

View File

@ -379,6 +379,13 @@
<DependentUpon>GtaVView.xaml</DependentUpon>
</Compile>
<Compile Include="Modules\Games\GtaV\GtaVViewModel.cs" />
<Compile Include="Modules\Games\LightFx\LightFxDataModel.cs" />
<Compile Include="Modules\Games\LightFx\LightFxModel.cs" />
<Compile Include="Modules\Games\LightFx\LightFxSettings.cs" />
<Compile Include="Modules\Games\LightFx\LightFxView.xaml.cs">
<DependentUpon>LightFxView.xaml</DependentUpon>
</Compile>
<Compile Include="Modules\Games\LightFx\LightFxViewModel.cs" />
<Compile Include="Modules\Games\ProjectCars\Data\_eNums\eAPIStructLengths.cs" />
<Compile Include="Modules\Games\ProjectCars\Data\_eNums\eCarFlags.cs" />
<Compile Include="Modules\Games\ProjectCars\Data\_eNums\eCrashDamageState.cs" />
@ -834,6 +841,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Modules\Games\LightFx\LightFxView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Modules\Games\Overwatch\OverwatchView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

View File

@ -0,0 +1,15 @@
using Artemis.Models.Interfaces;
using MoonSharp.Interpreter;
namespace Artemis.Modules.Games.LightFx
{
[MoonSharpUserData]
public class LightFxDataModel : IDataModel
{
public LightFxDataModel()
{
}
}
}

View File

@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using Artemis.DAL;
using Artemis.Managers;
using Artemis.Models;
using Artemis.Profiles.Layers.Models;
using Artemis.Utilities.GameState;
namespace Artemis.Modules.Games.LightFx
{
public class LightFxModel : GameModel
{
public LightFxModel(DeviceManager deviceManager, GameStateWebServer gameStateWebServer)
: base(deviceManager, SettingsProvider.Load<LightFxSettings>(), new LightFxDataModel())
{
Name = "LightFX";
ProcessName = "LoL";
Scale = 4;
Enabled = Settings.Enabled;
Initialized = false;
// This model can enable itself by changing its process name to the currently running Light FX game.
gameStateWebServer.GameDataReceived += GameStateWebServerOnGameDataReceived;
}
private void GameStateWebServerOnGameDataReceived(object sender, GameDataReceivedEventArgs e)
{
var jsonString = e.Json.ToString();
// Ensure it's Light FX JSON
if (!jsonString.Contains("lightFxState"))
return;
// Deserialize and data
// Setup process name
}
public int Scale { get; set; }
public override void Dispose()
{
Initialized = false;
base.Dispose();
}
public override void Enable()
{
Initialized = true;
}
public override void Update()
{
}
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
{
return Profile.GetRenderLayers(DataModel, keyboardOnly);
}
}
}

View File

@ -0,0 +1,8 @@
using Artemis.Settings;
namespace Artemis.Modules.Games.LightFx
{
public class LightFxSettings : GameSettings
{
}
}

View File

@ -0,0 +1,60 @@
<UserControl x:Class="Artemis.Modules.Games.LightFx.LightFxView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:cal="http://www.caliburnproject.org"
mc:Ignorable="d"
d:DesignHeight="559.725" d:DesignWidth="882.696">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<Grid Margin="15,5,5,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.ColumnSpan="2" FontSize="20" HorizontalAlignment="Left">
<Label.Content>
<AccessText TextWrapping="Wrap"
Text="Mirrors Light FX lighting to your RGB devices" />
</Label.Content>
</Label>
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right">
<Label Content="Enable effect" Margin="0 3 0 0" HorizontalAlignment="Right" />
<ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25"
IsChecked="{Binding Path=GameSettings.Enabled, Mode=TwoWay}"
Style="{DynamicResource MetroCircleToggleButtonStyle}"
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
</StackPanel>
</Grid>
<!-- Profile editor -->
<ContentControl Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-20,0" />
<!-- Buttons -->
<StackPanel Grid.Column="0" Grid.Row="3" Orientation="Horizontal" VerticalAlignment="Bottom">
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
Style="{DynamicResource SquareButtonStyle}" />
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
Margin="10,0,0,0"
Style="{DynamicResource SquareButtonStyle}" />
</StackPanel>
</Grid>
</ScrollViewer>
</UserControl>

View File

@ -0,0 +1,18 @@
using System.Windows.Controls;
using System.Windows.Navigation;
namespace Artemis.Modules.Games.LightFx
{
public partial class LightFxView : UserControl
{
public LightFxView()
{
InitializeComponent();
}
private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
{
System.Diagnostics.Process.Start(e.Uri.ToString());
}
}
}

View File

@ -0,0 +1,16 @@
using Artemis.Managers;
using Artemis.Models;
using Artemis.ViewModels.Abstract;
using Ninject;
namespace Artemis.Modules.Games.LightFx
{
public sealed class LightFxViewModel : GameViewModel
{
public LightFxViewModel(MainManager main, IKernel kernel,
[Named("LightFxModel")] GameModel model) : base(main, model, kernel)
{
DisplayName = "Light FX";
}
}
}

View File

@ -21,7 +21,7 @@ namespace Artemis.Profiles.Layers.Conditions
case ConditionType.NoneMet:
return !layerModel.Properties.Conditions.Any(cm => cm.ConditionMet(dataModel));
default:
throw new ArgumentOutOfRangeException();
return false;
}
}
}