mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Adjust Overwatch colors
Add slider creation method Add slider changed event Add minimum and maximum to slider Show slider ticks Snap to slider ticks
This commit is contained in:
parent
a09649e9d0
commit
75a556f07d
@ -573,6 +573,7 @@
|
||||
<Compile Include="Profiles\Lua\Modules\Gui\LuaCheckBox.cs" />
|
||||
<Compile Include="Profiles\Lua\Modules\Gui\LuaComboBox.cs" />
|
||||
<Compile Include="Profiles\Lua\Modules\Gui\LuaLabel.cs" />
|
||||
<Compile Include="Profiles\Lua\Modules\Gui\LuaSlider.cs" />
|
||||
<Compile Include="Profiles\Lua\Modules\Gui\LuaTextBox.cs" />
|
||||
<Compile Include="Profiles\Lua\Modules\Gui\LuaWindowView.xaml.cs">
|
||||
<DependentUpon>LuaWindowView.xaml</DependentUpon>
|
||||
|
||||
@ -77,8 +77,8 @@ namespace Artemis.Modules.Games.Overwatch
|
||||
new CharacterColor {Character = OverwatchCharacter.Zenyatta, Color = Color.FromRgb(248, 218, 26)},
|
||||
new CharacterColor {Character = OverwatchCharacter.Ana, Color = Color.FromRgb(16, 36, 87)},
|
||||
new CharacterColor {Character = OverwatchCharacter.Sombra, Color = Color.FromRgb(20, 5, 101)},
|
||||
new CharacterColor {Character = OverwatchCharacter.Orisa, Color = Color.FromRgb(194,233,78)},
|
||||
new CharacterColor {Character = OverwatchCharacter.Doomfist, Color = Color.FromRgb(207, 137, 77)}
|
||||
new CharacterColor {Character = OverwatchCharacter.Orisa, Color = Color.FromRgb(1,40,0)},
|
||||
new CharacterColor {Character = OverwatchCharacter.Doomfist, Color = Color.FromRgb(33, 3, 1)}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using Artemis.Managers;
|
||||
using MoonSharp.Interpreter;
|
||||
using MoonSharp.Interpreter.Interop;
|
||||
@ -8,20 +9,22 @@ using MoonSharp.Interpreter.Interop;
|
||||
namespace Artemis.Profiles.Lua.Modules.Gui
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
class LuaSlider
|
||||
public class LuaSlider
|
||||
{
|
||||
private readonly LuaManager _luaManager;
|
||||
|
||||
public LuaSlider(LuaManager luaManager, int interval, double intialValue, double x, double y, double? width, double? height)
|
||||
public LuaSlider(LuaManager luaManager, int interval, double intialValue, double minimum, double maximum, double x, double y, double? width, double? height)
|
||||
{
|
||||
_luaManager = luaManager;
|
||||
|
||||
Slider = new Slider { Value = intialValue, Interval = interval };
|
||||
Slider = new Slider { Value = intialValue, TickFrequency = interval, Minimum = minimum, Maximum = maximum, TickPlacement = TickPlacement.BottomRight, IsSnapToTickEnabled = true};
|
||||
|
||||
if (width != null)
|
||||
Slider.Width = width.Value;
|
||||
if (height != null)
|
||||
Slider.Height = height.Value;
|
||||
|
||||
Slider.ValueChanged += SliderOnValueChanged;
|
||||
}
|
||||
|
||||
[MoonSharpVisible(false)]
|
||||
@ -38,5 +41,17 @@ namespace Artemis.Profiles.Lua.Modules.Gui
|
||||
get => Slider.Dispatcher.Invoke(() => (int) Slider.Interval);
|
||||
set => Slider.Dispatcher.Invoke(() => Slider.Interval = value);
|
||||
}
|
||||
|
||||
private void SliderOnValueChanged(object sender, RoutedPropertyChangedEventArgs<double> routedPropertyChangedEventArgs)
|
||||
{
|
||||
_luaManager.EventsModule.LuaInvoke(_luaManager.ProfileModel, () => OnValueChanged(this));
|
||||
}
|
||||
|
||||
public event EventHandler<EventArgs> ValueChanged;
|
||||
|
||||
protected virtual void OnValueChanged(LuaSlider slider)
|
||||
{
|
||||
ValueChanged?.Invoke(slider, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -83,6 +83,18 @@ namespace Artemis.Profiles.Lua.Modules.Gui
|
||||
return element;
|
||||
}
|
||||
|
||||
public LuaSlider CreateSlider(int interval, double initialValue, double minimum, double maximum, double x, double y, double? width = 200.0, double? height = 20.0)
|
||||
{
|
||||
LuaSlider element = null;
|
||||
Execute.OnUIThread(() =>
|
||||
{
|
||||
element = new LuaSlider(_luaManager, interval, initialValue, minimum, maximum, x, y, width, height);
|
||||
AddControl(element.Slider, x, y);
|
||||
});
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
private void AddControl(UIElement uiElement, double x, double y)
|
||||
{
|
||||
Canvas.Children.Add(uiElement);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user