mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Merge pull request #105 from DarthAffe/master
Added Bouncing-Bubbles-Effect
This commit is contained in:
commit
cc60c1e7e9
@ -3,6 +3,7 @@
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<section name="Artemis.Modules.Effects.Bubbles.Bubbles" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<section name="Artemis.Modules.Effects.WindowsProfile.WindowsProfile" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<section name="Artemis.Modules.Games.Overwatch.Overwatch" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<section name="Artemis.Modules.Games.TheDivision.TheDivision" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
@ -254,6 +255,29 @@
|
||||
<value>4</value>
|
||||
</setting>
|
||||
</Artemis.Settings.TypeWave>
|
||||
<Artemis.Modules.Effects.Bubbles.Bubbles>
|
||||
<setting name="IsRandomColors" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="BubbleColor" serializeAs="String">
|
||||
<value>#FFFF0000</value>
|
||||
</setting>
|
||||
<setting name="IsShiftColors" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="BubbleSize" serializeAs="String">
|
||||
<value>100</value>
|
||||
</setting>
|
||||
<setting name="MoveSpeed" serializeAs="String">
|
||||
<value>16</value>
|
||||
</setting>
|
||||
<setting name="ShiftColorSpeed" serializeAs="String">
|
||||
<value>12</value>
|
||||
</setting>
|
||||
<setting name="BubbleCount" serializeAs="String">
|
||||
<value>14</value>
|
||||
</setting>
|
||||
</Artemis.Modules.Effects.Bubbles.Bubbles>
|
||||
<Artemis.Settings.General>
|
||||
<setting name="LastEffect" serializeAs="String">
|
||||
<value>TypeWave</value>
|
||||
|
||||
@ -318,6 +318,18 @@
|
||||
<Compile Include="Modules\Effects\AudioVisualizer\AudioVisualizerModel.cs" />
|
||||
<Compile Include="Modules\Effects\AudioVisualizer\Utilities\FftEventArgs.cs" />
|
||||
<Compile Include="Modules\Effects\AudioVisualizer\Utilities\SampleAggregator.cs" />
|
||||
<Compile Include="Modules\Effects\Bubbles\Bubble.cs" />
|
||||
<Compile Include="Modules\Effects\Bubbles\Bubbles.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>Bubbles.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Modules\Effects\Bubbles\BubblesSettings.cs" />
|
||||
<Compile Include="Modules\Effects\Bubbles\BubblesModel.cs" />
|
||||
<Compile Include="Modules\Effects\Bubbles\BubblesView.xaml.cs">
|
||||
<DependentUpon>BubblesView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Modules\Effects\Bubbles\BubblesViewModel.cs" />
|
||||
<Compile Include="Modules\Effects\WindowsProfile\WindowsProfile.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
@ -564,6 +576,10 @@
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>AudioVisualization.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="Modules\Effects\Bubbles\Bubbles.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Bubbles.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="Modules\Effects\TypeWave\TypeWave.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>TypeWave.Designer.cs</LastGenOutput>
|
||||
@ -650,6 +666,10 @@
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="Modules\Effects\Bubbles\BubblesView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Modules\Effects\WindowsProfile\WindowsProfileView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
@ -3,6 +3,7 @@ using Artemis.DeviceProviders.Corsair;
|
||||
using Artemis.DeviceProviders.Logitech;
|
||||
using Artemis.DeviceProviders.Razer;
|
||||
using Artemis.Modules.Effects.AudioVisualizer;
|
||||
using Artemis.Modules.Effects.Bubbles;
|
||||
using Artemis.Modules.Effects.TypeWave;
|
||||
using Artemis.Modules.Effects.WindowsProfile;
|
||||
using Artemis.Modules.Games.CounterStrike;
|
||||
@ -26,6 +27,7 @@ namespace Artemis.InjectionModules
|
||||
// Effects
|
||||
Bind<EffectViewModel>().To<AudioVisualizerViewModel>().InSingletonScope();
|
||||
Bind<EffectViewModel>().To<TypeWaveViewModel>().InSingletonScope();
|
||||
Bind<EffectViewModel>().To<BubblesViewModel>().InSingletonScope();
|
||||
Bind<EffectViewModel>().To<WindowsProfileViewModel>().InSingletonScope();
|
||||
|
||||
// Games
|
||||
|
||||
65
Artemis/Artemis/Modules/Effects/Bubbles/Bubble.cs
Normal file
65
Artemis/Artemis/Modules/Effects/Bubbles/Bubble.cs
Normal file
@ -0,0 +1,65 @@
|
||||
using System.Drawing;
|
||||
using System.Windows;
|
||||
using Point = System.Windows.Point;
|
||||
|
||||
namespace Artemis.Modules.Effects.Bubbles
|
||||
{
|
||||
public class Bubble
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private Brush _brush;
|
||||
|
||||
private Color _color;
|
||||
public Color Color
|
||||
{
|
||||
get { return _color; }
|
||||
set
|
||||
{
|
||||
_color = value;
|
||||
_brush = new SolidBrush(_color);
|
||||
}
|
||||
}
|
||||
|
||||
public int Radius { get; set; }
|
||||
public Point Position { get; private set; }
|
||||
public Vector Direction { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public Bubble(Color color, int radius, Point position, Vector direction)
|
||||
{
|
||||
this.Color = color;
|
||||
this.Radius = radius;
|
||||
this.Position = position;
|
||||
this.Direction = direction;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public void CheckCollision(Rect border)
|
||||
{
|
||||
if (Position.X - Radius < border.X || Position.X + Radius > border.X + border.Width)
|
||||
Direction = new Vector(Direction.X * -1, Direction.Y);
|
||||
|
||||
if (Position.Y - Radius < border.Y || Position.Y + Radius > border.Y + border.Height)
|
||||
Direction = new Vector(Direction.X, Direction.Y * -1);
|
||||
}
|
||||
|
||||
public void Move()
|
||||
{
|
||||
Position += Direction;
|
||||
}
|
||||
|
||||
public void Draw(Graphics g)
|
||||
{
|
||||
g.FillEllipse(_brush, (float)Position.X - Radius, (float)Position.Y - Radius, Radius * 2, Radius * 2);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
110
Artemis/Artemis/Modules/Effects/Bubbles/Bubbles.Designer.cs
generated
Normal file
110
Artemis/Artemis/Modules/Effects/Bubbles/Bubbles.Designer.cs
generated
Normal file
@ -0,0 +1,110 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <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.Effects.Bubbles {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
||||
internal sealed partial class Bubbles : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Bubbles defaultInstance = ((Bubbles)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Bubbles())));
|
||||
|
||||
public static Bubbles Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool IsRandomColors {
|
||||
get {
|
||||
return ((bool)(this["IsRandomColors"]));
|
||||
}
|
||||
set {
|
||||
this["IsRandomColors"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("#FFFF0000")]
|
||||
public global::System.Windows.Media.Color BubbleColor {
|
||||
get {
|
||||
return ((global::System.Windows.Media.Color)(this["BubbleColor"]));
|
||||
}
|
||||
set {
|
||||
this["BubbleColor"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool IsShiftColors {
|
||||
get {
|
||||
return ((bool)(this["IsShiftColors"]));
|
||||
}
|
||||
set {
|
||||
this["IsShiftColors"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("100")]
|
||||
public int BubbleSize {
|
||||
get {
|
||||
return ((int)(this["BubbleSize"]));
|
||||
}
|
||||
set {
|
||||
this["BubbleSize"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("16")]
|
||||
public int MoveSpeed {
|
||||
get {
|
||||
return ((int)(this["MoveSpeed"]));
|
||||
}
|
||||
set {
|
||||
this["MoveSpeed"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("12")]
|
||||
public int ShiftColorSpeed {
|
||||
get {
|
||||
return ((int)(this["ShiftColorSpeed"]));
|
||||
}
|
||||
set {
|
||||
this["ShiftColorSpeed"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("14")]
|
||||
public int BubbleCount {
|
||||
get {
|
||||
return ((int)(this["BubbleCount"]));
|
||||
}
|
||||
set {
|
||||
this["BubbleCount"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
27
Artemis/Artemis/Modules/Effects/Bubbles/Bubbles.settings
Normal file
27
Artemis/Artemis/Modules/Effects/Bubbles/Bubbles.settings
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Modules.Effects.Bubbles" GeneratedClassName="Bubbles">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="IsRandomColors" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="BubbleColor" Type="System.Windows.Media.Color" Scope="User">
|
||||
<Value Profile="(Default)">#FFFF0000</Value>
|
||||
</Setting>
|
||||
<Setting Name="IsShiftColors" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="BubbleSize" Type="System.Int32" Scope="User">
|
||||
<Value Profile="(Default)">100</Value>
|
||||
</Setting>
|
||||
<Setting Name="MoveSpeed" Type="System.Int32" Scope="User">
|
||||
<Value Profile="(Default)">16</Value>
|
||||
</Setting>
|
||||
<Setting Name="ShiftColorSpeed" Type="System.Int32" Scope="User">
|
||||
<Value Profile="(Default)">12</Value>
|
||||
</Setting>
|
||||
<Setting Name="BubbleCount" Type="System.Int32" Scope="User">
|
||||
<Value Profile="(Default)">14</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
107
Artemis/Artemis/Modules/Effects/Bubbles/BubblesModel.cs
Normal file
107
Artemis/Artemis/Modules/Effects/Bubbles/BubblesModel.cs
Normal file
@ -0,0 +1,107 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq.Dynamic;
|
||||
using System.Windows;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Models.Profiles;
|
||||
using Artemis.Utilities;
|
||||
using Brush = System.Windows.Media.Brush;
|
||||
|
||||
namespace Artemis.Modules.Effects.Bubbles
|
||||
{
|
||||
public class BubblesModel : EffectModel
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private static readonly Random _random = new Random();
|
||||
|
||||
private const int SCALE = 100;
|
||||
|
||||
private readonly List<Bubble> _bubbles = new List<Bubble>();
|
||||
|
||||
public BubblesSettings Settings { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public BubblesModel(MainManager mainManager, BubblesSettings settings)
|
||||
: base(mainManager, null)
|
||||
{
|
||||
Name = "Bubbles";
|
||||
Settings = settings;
|
||||
Initialized = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
Rect rect = MainManager.DeviceManager.ActiveKeyboard.KeyboardRectangle(SCALE);
|
||||
|
||||
for (int i = 0; i < Settings.BubbleCount; i++)
|
||||
{
|
||||
Color color = Settings.IsRandomColors ? ColorHelpers.GetRandomRainbowColor() : ColorHelpers.ToDrawingColor(Settings.BubbleColor);
|
||||
// -Settings.MoveSpeed because we want to spawn at least one move away from borders
|
||||
double initialPositionX = ((rect.Width - (Settings.BubbleSize * 2) - Settings.MoveSpeed) * _random.NextDouble()) + Settings.BubbleSize;
|
||||
double initialPositionY = ((rect.Height - (Settings.BubbleSize * 2) - Settings.MoveSpeed) * _random.NextDouble()) + Settings.BubbleSize;
|
||||
double initialDirectionX = (Settings.MoveSpeed * _random.NextDouble()) * (_random.Next(1) == 0 ? -1 : 1);
|
||||
double initialDirectionY = (Settings.MoveSpeed - Math.Abs(initialDirectionX)) * (_random.Next(1) == 0 ? -1 : 1);
|
||||
|
||||
_bubbles.Add(new Bubble(color, Settings.BubbleSize, new System.Windows.Point(initialPositionX, initialPositionY), new Vector(initialDirectionX, initialDirectionY)));
|
||||
}
|
||||
|
||||
Initialized = true;
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
_bubbles.Clear();
|
||||
Initialized = false;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
Rect keyboardRectangle = MainManager.DeviceManager.ActiveKeyboard.KeyboardRectangle(SCALE);
|
||||
foreach (Bubble bubble in _bubbles)
|
||||
{
|
||||
if (Settings.IsShiftColors)
|
||||
bubble.Color = ColorHelpers.ShiftColor(bubble.Color, Settings.IsRandomColors ? (int)Math.Round(Settings.ShiftColorSpeed * _random.NextDouble()) : Settings.ShiftColorSpeed);
|
||||
|
||||
bubble.CheckCollision(keyboardRectangle);
|
||||
bubble.Move();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Render(out Bitmap keyboard, out Brush mouse, out Brush headset, bool renderMice, bool renderHeadsets)
|
||||
{
|
||||
keyboard = null;
|
||||
mouse = null;
|
||||
headset = null;
|
||||
|
||||
if (!_bubbles.Any()) return;
|
||||
|
||||
keyboard = MainManager.DeviceManager.ActiveKeyboard.KeyboardBitmap(SCALE);
|
||||
using (Graphics g = Graphics.FromImage(keyboard))
|
||||
{
|
||||
g.Clear(Color.Transparent);
|
||||
g.SmoothingMode = SmoothingMode.HighQuality;
|
||||
|
||||
foreach (Bubble bubble in _bubbles)
|
||||
bubble.Draw(g);
|
||||
}
|
||||
}
|
||||
|
||||
public override List<LayerModel> GetRenderLayers(bool renderMice, bool renderHeadsets)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
56
Artemis/Artemis/Modules/Effects/Bubbles/BubblesSettings.cs
Normal file
56
Artemis/Artemis/Modules/Effects/Bubbles/BubblesSettings.cs
Normal file
@ -0,0 +1,56 @@
|
||||
using System.Windows.Media;
|
||||
using Artemis.Models;
|
||||
|
||||
namespace Artemis.Modules.Effects.Bubbles
|
||||
{
|
||||
public class BubblesSettings : EffectSettings
|
||||
{
|
||||
public BubblesSettings()
|
||||
{
|
||||
Load();
|
||||
}
|
||||
|
||||
public bool IsRandomColors { get; set; }
|
||||
public Color BubbleColor { get; set; }
|
||||
public bool IsShiftColors { get; set; }
|
||||
public int ShiftColorSpeed { get; set; }
|
||||
public int BubbleSize { get; set; }
|
||||
public int MoveSpeed { get; set; }
|
||||
public int BubbleCount { get; set; }
|
||||
|
||||
public sealed override void Load()
|
||||
{
|
||||
IsRandomColors = Bubbles.Default.IsRandomColors;
|
||||
BubbleColor = Bubbles.Default.BubbleColor;
|
||||
IsShiftColors = Bubbles.Default.IsShiftColors;
|
||||
ShiftColorSpeed = Bubbles.Default.ShiftColorSpeed;
|
||||
BubbleSize = Bubbles.Default.BubbleSize;
|
||||
MoveSpeed = Bubbles.Default.MoveSpeed;
|
||||
BubbleCount = Bubbles.Default.BubbleCount;
|
||||
}
|
||||
|
||||
public sealed override void Save()
|
||||
{
|
||||
Bubbles.Default.IsRandomColors = IsRandomColors;
|
||||
Bubbles.Default.BubbleColor = BubbleColor;
|
||||
Bubbles.Default.IsShiftColors = IsShiftColors;
|
||||
Bubbles.Default.ShiftColorSpeed = ShiftColorSpeed;
|
||||
Bubbles.Default.BubbleSize = BubbleSize;
|
||||
Bubbles.Default.MoveSpeed = MoveSpeed;
|
||||
Bubbles.Default.BubbleCount = BubbleCount;
|
||||
|
||||
Bubbles.Default.Save();
|
||||
}
|
||||
|
||||
public sealed override void ToDefault()
|
||||
{
|
||||
IsRandomColors = true;
|
||||
BubbleColor = Color.FromArgb(255, 255, 0, 0);
|
||||
IsShiftColors = true;
|
||||
ShiftColorSpeed = 12;
|
||||
BubbleSize = 100;
|
||||
MoveSpeed = 16;
|
||||
BubbleCount = 14;
|
||||
}
|
||||
}
|
||||
}
|
||||
133
Artemis/Artemis/Modules/Effects/Bubbles/BubblesView.xaml
Normal file
133
Artemis/Artemis/Modules/Effects/Bubbles/BubblesView.xaml
Normal file
@ -0,0 +1,133 @@
|
||||
<UserControl x:Class="Artemis.Modules.Effects.Bubbles.BubblesView"
|
||||
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:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="476.986" d:DesignWidth="538.772">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||
<Grid Margin="15, 5, 15, 5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<Label FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap" Text="Let random Bubbles float around the keyboard" />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
<StackPanel Orientation="Horizontal" 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"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
|
||||
<Popup PlacementTarget="{Binding ElementName=EffectEnabled}"
|
||||
IsOpen="{Binding Path=ShowDisabledPopup, Mode=TwoWay}" Placement="Left" VerticalOffset="-10"
|
||||
PopupAnimation="Fade" StaysOpen="False">
|
||||
<Border Margin="1">
|
||||
<TextBlock Background="{DynamicResource AccentColorBrush}"
|
||||
Foreground="{DynamicResource IdealForegroundColorBrush}"
|
||||
Text="You can't enable an effect when Artemis is disabled" Padding="4" />
|
||||
</Border>
|
||||
</Popup>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Color -->
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"
|
||||
Height="16" Margin="0,8">
|
||||
Bubble color
|
||||
</TextBlock>
|
||||
<xctk:ColorPicker x:Name="MiddleColor"
|
||||
SelectedColor="{Binding Path=EffectSettings.BubbleColor, Mode=TwoWay}"
|
||||
Grid.Row="1" Grid.Column="1" Width="110" HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
|
||||
|
||||
<!-- Random colors -->
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"
|
||||
Height="16" Margin="0,8">
|
||||
Use random colors
|
||||
</TextBlock>
|
||||
<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" />
|
||||
|
||||
<!-- Shift color -->
|
||||
<TextBlock Grid.Row="3" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"
|
||||
Height="16" Margin="0,8">
|
||||
Shift through colors as the bubble moves
|
||||
</TextBlock>
|
||||
<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" />
|
||||
|
||||
<!-- Shift speed -->
|
||||
<TextBlock Grid.Row="4" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"
|
||||
Height="16" Margin="0,8">
|
||||
Speed to shift colors at
|
||||
</TextBlock>
|
||||
<Slider x:Name="ColorShiftSpeed" Grid.Row="4" Grid.Column="1" VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right" Width="110" TickPlacement="None" TickFrequency="1"
|
||||
Value="{Binding Path=EffectSettings.ShiftColorSpeed, Mode=TwoWay}" Minimum="1" Maximum="200"
|
||||
SmallChange="45" IsSnapToTickEnabled="True" />
|
||||
|
||||
<!-- coun -->
|
||||
<TextBlock Grid.Row="6" Grid.Column="0" HorizontalAlignment="Left" Width="116" VerticalAlignment="Center"
|
||||
Height="16" Margin="0,9,0,10">
|
||||
Bubble count
|
||||
</TextBlock>
|
||||
<Slider x:Name="BubbleCount" Grid.Row="6" Grid.Column="1" VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right" Width="110" TickPlacement="None" TickFrequency="1"
|
||||
Value="{Binding Path=EffectSettings.BubbleCount, Mode=TwoWay}" Minimum="1" Maximum="40"
|
||||
SmallChange="1" IsSnapToTickEnabled="True" />
|
||||
|
||||
<!-- size -->
|
||||
<TextBlock Grid.Row="7" Grid.Column="0" HorizontalAlignment="Left" Width="116" VerticalAlignment="Center"
|
||||
Height="16" Margin="0,9,0,10">
|
||||
Bubble size
|
||||
</TextBlock>
|
||||
<Slider x:Name="Size" Grid.Row="7" Grid.Column="1" VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right" Width="110" TickPlacement="None" TickFrequency="1"
|
||||
Value="{Binding Path=EffectSettings.BubbleSize, Mode=TwoWay}" Minimum="40" Maximum="180"
|
||||
SmallChange="10" IsSnapToTickEnabled="True" />
|
||||
|
||||
<!-- speed -->
|
||||
<TextBlock Grid.Row="8" Grid.Column="0" HorizontalAlignment="Left" Width="116" VerticalAlignment="Center"
|
||||
Height="16" Margin="0,9,0,10">
|
||||
Bubble move speed
|
||||
</TextBlock>
|
||||
<Slider x:Name="MoveSpeed" Grid.Row="8" Grid.Column="1" VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right" Width="110" TickPlacement="None" TickFrequency="1"
|
||||
Value="{Binding Path=EffectSettings.MoveSpeed, Mode=TwoWay}" Minimum="1" Maximum="50"
|
||||
SmallChange="10" IsSnapToTickEnabled="True" />
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="9" 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>
|
||||
12
Artemis/Artemis/Modules/Effects/Bubbles/BubblesView.xaml.cs
Normal file
12
Artemis/Artemis/Modules/Effects/Bubbles/BubblesView.xaml.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Artemis.Modules.Effects.Bubbles
|
||||
{
|
||||
public partial class BubblesView : UserControl
|
||||
{
|
||||
public BubblesView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
25
Artemis/Artemis/Modules/Effects/Bubbles/BubblesViewModel.cs
Normal file
25
Artemis/Artemis/Modules/Effects/Bubbles/BubblesViewModel.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using Artemis.Events;
|
||||
using Artemis.Managers;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Artemis.Modules.Effects.Bubbles
|
||||
{
|
||||
public class BubblesViewModel : EffectViewModel, IHandle<ActiveEffectChanged>
|
||||
{
|
||||
public BubblesViewModel(MainManager main, IEventAggregator events)
|
||||
: base(main, new BubblesModel(main, new BubblesSettings()))
|
||||
{
|
||||
DisplayName = "Bubbles";
|
||||
events.Subscribe(this);
|
||||
|
||||
MainManager.EffectManager.EffectModels.Add(EffectModel);
|
||||
EffectSettings = ((BubblesModel)EffectModel).Settings;
|
||||
}
|
||||
|
||||
public void Handle(ActiveEffectChanged message)
|
||||
{
|
||||
NotifyOfPropertyChange(() => EffectEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7,6 +7,8 @@ namespace Artemis.Utilities
|
||||
{
|
||||
public static class ColorHelpers
|
||||
{
|
||||
private static readonly Random _rand = new Random();
|
||||
|
||||
/// <summary>
|
||||
/// Comes up with a 'pure' psuedo-random color
|
||||
/// </summary>
|
||||
@ -14,9 +16,8 @@ namespace Artemis.Utilities
|
||||
public static Color GetRandomRainbowColor()
|
||||
{
|
||||
var colors = new List<int>();
|
||||
var rand = new Random();
|
||||
for (var i = 0; i < 3; i++)
|
||||
colors.Add(rand.Next(0, 256));
|
||||
colors.Add(_rand.Next(0, 256));
|
||||
|
||||
var highest = colors.Max();
|
||||
var lowest = colors.Min();
|
||||
@ -31,9 +32,8 @@ namespace Artemis.Utilities
|
||||
public static System.Windows.Media.Color GetRandomRainbowMediaColor()
|
||||
{
|
||||
var colors = new List<byte>();
|
||||
var rand = new Random();
|
||||
for (var i = 0; i < 3; i++)
|
||||
colors.Add((byte) rand.Next(0, 256));
|
||||
colors.Add((byte)_rand.Next(0, 256));
|
||||
|
||||
var highest = colors.Max();
|
||||
var lowest = colors.Min();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user