mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Updated Rocket League to use the profile editor
This commit is contained in:
parent
3e47ffeff7
commit
ddc63473a3
@ -1,12 +1,9 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Media;
|
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
using Artemis.Utilities;
|
|
||||||
using Artemis.Utilities.GameState;
|
using Artemis.Utilities.GameState;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Color = System.Windows.Media.Color;
|
|
||||||
|
|
||||||
namespace Artemis.Modules.Games.CounterStrike
|
namespace Artemis.Modules.Games.CounterStrike
|
||||||
{
|
{
|
||||||
@ -68,8 +65,6 @@ namespace Artemis.Modules.Games.CounterStrike
|
|||||||
if (!jsonString.Contains("Counter-Strike: Global Offensive"))
|
if (!jsonString.Contains("Counter-Strike: Global Offensive"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
Debug.WriteLine("Got data");
|
|
||||||
// Parse the JSON
|
// Parse the JSON
|
||||||
GameDataModel = JsonConvert.DeserializeObject<CounterStrikeDataModel>(jsonString);
|
GameDataModel = JsonConvert.DeserializeObject<CounterStrikeDataModel>(jsonString);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,9 @@
|
|||||||
using System.Collections.Generic;
|
using Artemis.Models.Interfaces;
|
||||||
using Artemis.Models.Interfaces;
|
|
||||||
using Artemis.Utilities;
|
|
||||||
|
|
||||||
namespace Artemis.Modules.Games.RocketLeague
|
namespace Artemis.Modules.Games.RocketLeague
|
||||||
{
|
{
|
||||||
internal class RocketLeagueDataModel : IGameDataModel
|
public class RocketLeagueDataModel : IGameDataModel
|
||||||
{
|
{
|
||||||
public int Boost { get; set; }
|
public int Boost { get; set; }
|
||||||
public List<GeneralHelpers.PropertyCollection> Properties { get; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,15 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
using Artemis.Settings;
|
using Artemis.Settings;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
using Artemis.Utilities.Keyboard;
|
|
||||||
using Artemis.Utilities.Memory;
|
using Artemis.Utilities.Memory;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
@ -17,13 +12,8 @@ namespace Artemis.Modules.Games.RocketLeague
|
|||||||
{
|
{
|
||||||
public class RocketLeagueModel : GameModel
|
public class RocketLeagueModel : GameModel
|
||||||
{
|
{
|
||||||
private int _boostAmount;
|
|
||||||
private bool _boostGrowing;
|
|
||||||
private KeyboardRectangle _boostRect;
|
|
||||||
private bool _contextualColor;
|
|
||||||
private Memory _memory;
|
private Memory _memory;
|
||||||
private GamePointersCollection _pointer;
|
private GamePointersCollection _pointer;
|
||||||
private int _previousBoost;
|
|
||||||
|
|
||||||
public RocketLeagueModel(MainManager mainManager, RocketLeagueSettings settings) : base(mainManager)
|
public RocketLeagueModel(MainManager mainManager, RocketLeagueSettings settings) : base(mainManager)
|
||||||
{
|
{
|
||||||
@ -49,105 +39,44 @@ namespace Artemis.Modules.Games.RocketLeague
|
|||||||
{
|
{
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
|
|
||||||
_contextualColor = Settings.ContextualColor;
|
|
||||||
|
|
||||||
_boostRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color>
|
|
||||||
{
|
|
||||||
ColorHelpers.ToDrawingColor(Settings.MainColor),
|
|
||||||
ColorHelpers.ToDrawingColor(Settings.SecondaryColor)
|
|
||||||
}, LinearGradientMode.Horizontal);
|
|
||||||
|
|
||||||
Updater.GetPointers();
|
Updater.GetPointers();
|
||||||
_pointer = JsonConvert.DeserializeObject<GamePointersCollection>(Offsets.Default.RocketLeague);
|
_pointer = JsonConvert.DeserializeObject<GamePointersCollection>(Offsets.Default.RocketLeague);
|
||||||
|
|
||||||
var tempProcess = MemoryHelpers.GetProcessIfRunning(ProcessName);
|
var tempProcess = MemoryHelpers.GetProcessIfRunning(ProcessName);
|
||||||
_memory = new Memory(tempProcess);
|
_memory = new Memory(tempProcess);
|
||||||
|
GameDataModel = new RocketLeagueDataModel();
|
||||||
|
|
||||||
Initialized = true;
|
Initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
if (_boostGrowing)
|
if (Profile == null || GameDataModel == null || _memory == null)
|
||||||
return;
|
|
||||||
if (_memory == null)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var offsets = _pointer.GameAddresses.First(ga => ga.Description == "Boost").ToString();
|
var offsets = _pointer.GameAddresses.First(ga => ga.Description == "Boost").ToString();
|
||||||
var boostAddress = _memory.GetAddress("\"RocketLeague.exe\"" + offsets);
|
var boostAddress = _memory.GetAddress("\"RocketLeague.exe\"" + offsets);
|
||||||
var boostFloat = _memory.ReadFloat(boostAddress)*100/3;
|
var boostFloat = _memory.ReadFloat(boostAddress)*100/3;
|
||||||
|
|
||||||
_previousBoost = _boostAmount;
|
((RocketLeagueDataModel) GameDataModel).Boost = (int) Math.Ceiling(boostFloat);
|
||||||
_boostAmount = (int) Math.Ceiling(boostFloat);
|
|
||||||
|
|
||||||
// Take care of any reading errors resulting in an OutOfMemory on draw
|
// Take care of any reading errors resulting in an OutOfMemory on draw
|
||||||
if (_boostAmount < 0)
|
if (((RocketLeagueDataModel) GameDataModel).Boost < 0)
|
||||||
_boostAmount = 0;
|
((RocketLeagueDataModel) GameDataModel).Boost = 0;
|
||||||
if (_boostAmount > 100)
|
if (((RocketLeagueDataModel) GameDataModel).Boost > 100)
|
||||||
_boostAmount = 100;
|
((RocketLeagueDataModel) GameDataModel).Boost = 100;
|
||||||
|
|
||||||
_boostRect.Width =
|
foreach (var layerModel in Profile.Layers)
|
||||||
(int) Math.Ceiling(MainManager.KeyboardManager.ActiveKeyboard.Width*Scale/100.00*_boostAmount);
|
layerModel.Update<RocketLeagueDataModel>(GameDataModel);
|
||||||
|
|
||||||
if (_contextualColor)
|
|
||||||
{
|
|
||||||
if (_boostAmount < 33)
|
|
||||||
_boostRect.Colors = new List<Color> {Color.Red};
|
|
||||||
else if (_boostAmount >= 33 && _boostAmount < 66)
|
|
||||||
_boostRect.Colors = new List<Color> {Color.Yellow};
|
|
||||||
else if (_boostAmount >= 66)
|
|
||||||
_boostRect.Colors = new List<Color> {Color.Lime};
|
|
||||||
}
|
|
||||||
|
|
||||||
Task.Run(() => GrowIfHigher());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void GrowIfHigher()
|
|
||||||
{
|
|
||||||
if (_boostAmount <= _previousBoost || _boostGrowing)
|
|
||||||
return;
|
|
||||||
|
|
||||||
_boostGrowing = true;
|
|
||||||
const int amountOfSteps = 6;
|
|
||||||
|
|
||||||
var difference = _boostAmount - _previousBoost;
|
|
||||||
var differenceStep = difference/amountOfSteps;
|
|
||||||
var differenceStepRest = difference%amountOfSteps;
|
|
||||||
_boostAmount = _previousBoost;
|
|
||||||
_boostRect.Width =
|
|
||||||
(int) Math.Ceiling(MainManager.KeyboardManager.ActiveKeyboard.Width*Scale/100.00*_boostAmount);
|
|
||||||
|
|
||||||
for (var i = 0; i < amountOfSteps; i++)
|
|
||||||
{
|
|
||||||
if (differenceStepRest > 0)
|
|
||||||
{
|
|
||||||
differenceStepRest -= 1;
|
|
||||||
_boostAmount += 1;
|
|
||||||
_boostRect.Width =
|
|
||||||
(int) Math.Ceiling(MainManager.KeyboardManager.ActiveKeyboard.Width*Scale/100.00*_boostAmount);
|
|
||||||
}
|
|
||||||
_boostAmount += differenceStep;
|
|
||||||
_boostRect.Width =
|
|
||||||
(int) Math.Ceiling(MainManager.KeyboardManager.ActiveKeyboard.Width*Scale/100.00*_boostAmount);
|
|
||||||
|
|
||||||
Thread.Sleep(50);
|
|
||||||
}
|
|
||||||
|
|
||||||
_boostGrowing = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Bitmap GenerateBitmap()
|
public override Bitmap GenerateBitmap()
|
||||||
{
|
{
|
||||||
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
if (Profile == null || GameDataModel == null)
|
||||||
if (_boostRect == null)
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
using (var g = Graphics.FromImage(bitmap))
|
var keyboardRect = MainManager.KeyboardManager.ActiveKeyboard.KeyboardRectangle(Scale);
|
||||||
{
|
return Profile.GenerateBitmap<RocketLeagueDataModel>(keyboardRect, GameDataModel);
|
||||||
g.Clear(Color.Transparent);
|
|
||||||
_boostRect.Draw(g);
|
|
||||||
}
|
|
||||||
return bitmap;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -40,46 +40,8 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Main color -->
|
<!-- Profile editor -->
|
||||||
<TextBlock Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"
|
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-30,0" />
|
||||||
Height="16" Margin="0,8">
|
|
||||||
Main boost display color
|
|
||||||
</TextBlock>
|
|
||||||
<xctk:ColorPicker x:Name="MainColor"
|
|
||||||
SelectedColor="{Binding Path=GameSettings.MainColor, Mode=TwoWay}"
|
|
||||||
Grid.Row="1" Grid.Column="1" Width="110" HorizontalAlignment="Right"
|
|
||||||
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
|
|
||||||
|
|
||||||
<!-- Secondary color -->
|
|
||||||
<TextBlock Grid.Row="2" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"
|
|
||||||
Height="16" Margin="0,8">
|
|
||||||
Secondary boost display color
|
|
||||||
</TextBlock>
|
|
||||||
<xctk:ColorPicker x:Name="SecondaryColor"
|
|
||||||
SelectedColor="{Binding Path=GameSettings.SecondaryColor, Mode=TwoWay}"
|
|
||||||
Grid.Row="2" Grid.Column="1" Width="110" HorizontalAlignment="Right"
|
|
||||||
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
|
|
||||||
|
|
||||||
<!-- Secondary color -->
|
|
||||||
<TextBlock Grid.Row="3" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"
|
|
||||||
Height="16" Margin="0,8">
|
|
||||||
Color bar according to boost amount
|
|
||||||
</TextBlock>
|
|
||||||
<controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.ContextualColor, Mode=TwoWay}"
|
|
||||||
Grid.Row="3" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No"
|
|
||||||
Margin="0,0,-5,0" Width="114" />
|
|
||||||
|
|
||||||
<!-- Info text -->
|
|
||||||
<TextBlock Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" Margin="0,8"
|
|
||||||
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold"
|
|
||||||
MaxWidth="510" TextAlignment="Justify">
|
|
||||||
Tip: To find a color combination you like, start an exhibition match, pickup 100 boost and play around with the colors.
|
|
||||||
They'll appear on your keyboard immediately! Once you're satisfied don't forget to click save changes.
|
|
||||||
</TextBlock>
|
|
||||||
<TextBlock x:Name="VersionText" Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center"
|
|
||||||
Margin="0,8"
|
|
||||||
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold"
|
|
||||||
Foreground="{DynamicResource HighlightBrush}" MaxWidth="510" TextAlignment="Justify" />
|
|
||||||
|
|
||||||
<!-- Buttons -->
|
<!-- Buttons -->
|
||||||
<StackPanel Grid.Column="0" Grid.Row="9" Orientation="Horizontal" VerticalAlignment="Bottom">
|
<StackPanel Grid.Column="0" Grid.Row="9" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
using Artemis.Managers;
|
using System.ComponentModel;
|
||||||
|
using Artemis.Managers;
|
||||||
using Artemis.Settings;
|
using Artemis.Settings;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
using Artemis.Utilities.Memory;
|
using Artemis.Utilities.Memory;
|
||||||
|
using Artemis.ViewModels;
|
||||||
using Artemis.ViewModels.Abstract;
|
using Artemis.ViewModels.Abstract;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
@ -21,10 +23,15 @@ namespace Artemis.Modules.Games.RocketLeague
|
|||||||
// Create effect model and add it to MainManager
|
// Create effect model and add it to MainManager
|
||||||
GameModel = new RocketLeagueModel(mainManager, (RocketLeagueSettings) GameSettings);
|
GameModel = new RocketLeagueModel(mainManager, (RocketLeagueSettings) GameSettings);
|
||||||
MainManager.EffectManager.EffectModels.Add(GameModel);
|
MainManager.EffectManager.EffectModels.Add(GameModel);
|
||||||
|
|
||||||
SetVersionText();
|
SetVersionText();
|
||||||
|
|
||||||
|
ProfileEditor = new ProfileEditorViewModel<RocketLeagueDataModel>(MainManager, GameModel);
|
||||||
|
ProfileEditor.PropertyChanged += ProfileUpdater;
|
||||||
|
GameModel.Profile = ProfileEditor.SelectedProfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ProfileEditorViewModel<RocketLeagueDataModel> ProfileEditor { get; set; }
|
||||||
|
|
||||||
public static string Name => "Rocket League";
|
public static string Name => "Rocket League";
|
||||||
|
|
||||||
public string VersionText
|
public string VersionText
|
||||||
@ -40,6 +47,12 @@ namespace Artemis.Modules.Games.RocketLeague
|
|||||||
|
|
||||||
public RocketLeagueModel RocketLeagueModel { get; set; }
|
public RocketLeagueModel RocketLeagueModel { get; set; }
|
||||||
|
|
||||||
|
private void ProfileUpdater(object sender, PropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.PropertyName == "SelectedProfile")
|
||||||
|
GameModel.Profile = ProfileEditor.SelectedProfile;
|
||||||
|
}
|
||||||
|
|
||||||
private void SetVersionText()
|
private void SetVersionText()
|
||||||
{
|
{
|
||||||
if (!General.Default.EnablePointersUpdate)
|
if (!General.Default.EnablePointersUpdate)
|
||||||
|
|||||||
@ -43,7 +43,7 @@
|
|||||||
</TextBlock>
|
</TextBlock>
|
||||||
|
|
||||||
<!-- Profile editor -->
|
<!-- Profile editor -->
|
||||||
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" />
|
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-30,0" />
|
||||||
|
|
||||||
<!-- Buttons -->
|
<!-- Buttons -->
|
||||||
<StackPanel Grid.Column="0" Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Bottom">
|
<StackPanel Grid.Column="0" Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||||
|
|||||||
@ -135,6 +135,7 @@ namespace Artemis.Utilities
|
|||||||
_layerModel.CalcProps.Animation == LayerAnimation.SlideRight ||
|
_layerModel.CalcProps.Animation == LayerAnimation.SlideRight ||
|
||||||
_layerModel.CalcProps.Animation == LayerAnimation.SlideUp)
|
_layerModel.CalcProps.Animation == LayerAnimation.SlideUp)
|
||||||
{
|
{
|
||||||
|
// TODO: if (_layerModel.CalcProps.ContainedBrush)
|
||||||
c.PushClip(new RectangleGeometry(_rectangle));
|
c.PushClip(new RectangleGeometry(_rectangle));
|
||||||
c.DrawRectangle(brush, null, _firstRect);
|
c.DrawRectangle(brush, null, _firstRect);
|
||||||
c.DrawRectangle(brush, null, _secondRect);
|
c.DrawRectangle(brush, null, _secondRect);
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using Artemis.Managers;
|
using System.ComponentModel;
|
||||||
|
using Artemis.Managers;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
|
|
||||||
|
|||||||
@ -12,6 +12,9 @@ namespace Artemis.ViewModels.LayerEditor
|
|||||||
private string _name;
|
private string _name;
|
||||||
private GeneralHelpers.PropertyCollection _selectedSource;
|
private GeneralHelpers.PropertyCollection _selectedSource;
|
||||||
private GeneralHelpers.PropertyCollection _selectedTarget;
|
private GeneralHelpers.PropertyCollection _selectedTarget;
|
||||||
|
private bool _sourcesIsVisible;
|
||||||
|
private bool _userSourceIsVisible;
|
||||||
|
private LayerPropertyType _layerPropertyType;
|
||||||
|
|
||||||
public LayerDynamicPropertiesViewModel(string property,
|
public LayerDynamicPropertiesViewModel(string property,
|
||||||
BindableCollection<GeneralHelpers.PropertyCollection> dataModelProps, LayerModel layer)
|
BindableCollection<GeneralHelpers.PropertyCollection> dataModelProps, LayerModel layer)
|
||||||
@ -37,6 +40,21 @@ namespace Artemis.ViewModels.LayerEditor
|
|||||||
Sources.AddRange(dataModelProps.Where(p => p.Type == "Int32"));
|
Sources.AddRange(dataModelProps.Where(p => p.Type == "Int32"));
|
||||||
|
|
||||||
PropertyChanged += OnPropertyChanged;
|
PropertyChanged += OnPropertyChanged;
|
||||||
|
|
||||||
|
SelectedTarget = dataModelProps.FirstOrDefault(p => p.Path == LayerDynamicPropertiesModel.GameProperty);
|
||||||
|
SelectedSource = dataModelProps.FirstOrDefault(p => p.Path == LayerDynamicPropertiesModel.PercentageSource);
|
||||||
|
LayerPropertyType = LayerDynamicPropertiesModel.LayerPropertyType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LayerPropertyType LayerPropertyType
|
||||||
|
{
|
||||||
|
get { return _layerPropertyType; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == _layerPropertyType) return;
|
||||||
|
_layerPropertyType = value;
|
||||||
|
NotifyOfPropertyChange(() => LayerPropertyType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
@ -87,17 +105,40 @@ namespace Artemis.ViewModels.LayerEditor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public bool SourcesIsVisible
|
||||||
/// Updates the underlying model
|
{
|
||||||
/// </summary>
|
get { return _sourcesIsVisible; }
|
||||||
/// <param name="sender"></param>
|
set
|
||||||
/// <param name="e"></param>
|
{
|
||||||
|
if (value == _sourcesIsVisible) return;
|
||||||
|
_sourcesIsVisible = value;
|
||||||
|
NotifyOfPropertyChange(() => SourcesIsVisible);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool UserSourceIsVisible
|
||||||
|
{
|
||||||
|
get { return _userSourceIsVisible; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == _userSourceIsVisible) return;
|
||||||
|
_userSourceIsVisible = value;
|
||||||
|
NotifyOfPropertyChange(() => UserSourceIsVisible);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
|
private void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.PropertyName == "SelectedTarget")
|
if (e.PropertyName == "SelectedTarget")
|
||||||
LayerDynamicPropertiesModel.GameProperty = SelectedTarget.Path;
|
LayerDynamicPropertiesModel.GameProperty = SelectedTarget.Path;
|
||||||
if (e.PropertyName == "SelectedSource")
|
if (e.PropertyName == "SelectedSource")
|
||||||
LayerDynamicPropertiesModel.PercentageSource = SelectedSource.Path;
|
LayerDynamicPropertiesModel.PercentageSource = SelectedSource.Path;
|
||||||
|
if (e.PropertyName == "LayerPropertyType")
|
||||||
|
{
|
||||||
|
LayerDynamicPropertiesModel.LayerPropertyType = LayerPropertyType;
|
||||||
|
UserSourceIsVisible = (LayerPropertyType == LayerPropertyType.PercentageOf);
|
||||||
|
SourcesIsVisible = (LayerPropertyType == LayerPropertyType.PercentageOfProperty);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7,6 +7,7 @@
|
|||||||
xmlns:utilities="clr-namespace:Artemis.Utilities"
|
xmlns:utilities="clr-namespace:Artemis.Utilities"
|
||||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||||
xmlns:profileEnumerations="clr-namespace:Artemis.Models.Profiles"
|
xmlns:profileEnumerations="clr-namespace:Artemis.Models.Profiles"
|
||||||
|
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="40" d:DesignWidth="500">
|
d:DesignHeight="40" d:DesignWidth="500">
|
||||||
|
|
||||||
@ -49,7 +50,7 @@
|
|||||||
</ComboBox>
|
</ComboBox>
|
||||||
|
|
||||||
<!-- Dynamic type -->
|
<!-- Dynamic type -->
|
||||||
<ComboBox SelectedItem="{Binding Path=LayerDynamicPropertiesModel.LayerPropertyType}" Grid.Column="2"
|
<ComboBox SelectedItem="{Binding Path=LayerPropertyType}" Grid.Column="2"
|
||||||
ItemsSource="{Binding Source={StaticResource DynamicPropertyValues}}"
|
ItemsSource="{Binding Source={StaticResource DynamicPropertyValues}}"
|
||||||
Margin="10,0" VerticalAlignment="Center" Height="22">
|
Margin="10,0" VerticalAlignment="Center" Height="22">
|
||||||
<ComboBox.ItemTemplate>
|
<ComboBox.ItemTemplate>
|
||||||
@ -59,22 +60,28 @@
|
|||||||
</ComboBox.ItemTemplate>
|
</ComboBox.ItemTemplate>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
|
|
||||||
<!-- PercentageOf property -->
|
<!-- PercentageOfProperty -->
|
||||||
<ComboBox x:Name="Sources" Grid.Column="3" Margin="10,0" MaxDropDownHeight="125"
|
<StackPanel Grid.Column="3" x:Name="SourcesIsVisible" VerticalAlignment="Center">
|
||||||
VerticalAlignment="Center" Height="22">
|
<ComboBox x:Name="Sources" Margin="10,0" MaxDropDownHeight="125" Height="22">
|
||||||
<ComboBox.ItemTemplate>
|
<ComboBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Grid MinWidth="522">
|
<Grid MinWidth="522">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock Grid.Column="0" Text="{Binding Path=Display}" HorizontalAlignment="Left" />
|
<TextBlock Grid.Column="0" Text="{Binding Path=Display}" HorizontalAlignment="Left" />
|
||||||
<TextBlock Grid.Column="1" FontWeight="Bold" Text="{Binding Path=DisplayType}"
|
<TextBlock Grid.Column="1" FontWeight="Bold" Text="{Binding Path=DisplayType}"
|
||||||
HorizontalAlignment="Right" />
|
HorizontalAlignment="Right" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ComboBox.ItemTemplate>
|
</ComboBox.ItemTemplate>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- PercentageOf -->
|
||||||
|
<StackPanel Grid.Column="3" x:Name="UserSourceIsVisible" VerticalAlignment="Center">
|
||||||
|
<controls:NumericUpDown Margin="10,0" Height="22" Value="{Binding Path=LayerDynamicPropertiesModel.PercentageSource, Mode=TwoWay}" />
|
||||||
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
Loading…
x
Reference in New Issue
Block a user