mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Merged branch development into development
This commit is contained in:
commit
1d174a1aa7
@ -1,4 +1,5 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Artemis.Models.Interfaces;
|
||||
using Artemis.Profiles.Layers.Interfaces;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
@ -11,7 +12,17 @@ namespace Artemis.Profiles.Layers.Conditions
|
||||
{
|
||||
lock (layerModel.Properties.Conditions)
|
||||
{
|
||||
return layerModel.Properties.Conditions.All(cm => cm.ConditionMet(dataModel));
|
||||
switch (layerModel.Properties.ConditionType)
|
||||
{
|
||||
case ConditionType.AnyMet:
|
||||
return layerModel.Properties.Conditions.Any(cm => cm.ConditionMet(dataModel));
|
||||
case ConditionType.AllMet:
|
||||
return layerModel.Properties.Conditions.All(cm => cm.ConditionMet(dataModel));
|
||||
case ConditionType.NoneMet:
|
||||
return !layerModel.Properties.Conditions.Any(cm => cm.ConditionMet(dataModel));
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Artemis.Models.Interfaces;
|
||||
using Artemis.Profiles.Layers.Interfaces;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
@ -11,7 +12,19 @@ namespace Artemis.Profiles.Layers.Conditions
|
||||
{
|
||||
lock (layerModel.Properties.Conditions)
|
||||
{
|
||||
var conditionsMet = layerModel.Properties.Conditions.All(cm => cm.ConditionMet(dataModel));
|
||||
var conditionsMet = false;
|
||||
switch (layerModel.Properties.ConditionType)
|
||||
{
|
||||
case ConditionType.AnyMet:
|
||||
conditionsMet = layerModel.Properties.Conditions.Any(cm => cm.ConditionMet(dataModel));
|
||||
break;
|
||||
case ConditionType.AllMet:
|
||||
conditionsMet = layerModel.Properties.Conditions.All(cm => cm.ConditionMet(dataModel));
|
||||
break;
|
||||
case ConditionType.NoneMet:
|
||||
conditionsMet = !layerModel.Properties.Conditions.Any(cm => cm.ConditionMet(dataModel));
|
||||
break;
|
||||
}
|
||||
layerModel.EventProperties.Update(layerModel, conditionsMet);
|
||||
|
||||
if (conditionsMet && layerModel.EventProperties.CanTrigger)
|
||||
|
||||
@ -387,7 +387,7 @@ namespace Artemis.Profiles.Layers.Models
|
||||
get { return Profile; }
|
||||
set { Profile = value; }
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using Artemis.Utilities.Converters;
|
||||
@ -24,6 +25,7 @@ namespace Artemis.Profiles.Layers.Models
|
||||
Opacity = source.Opacity;
|
||||
AnimationSpeed = source.AnimationSpeed;
|
||||
Conditions = source.Conditions;
|
||||
ConditionType = source.ConditionType;
|
||||
DynamicProperties = source.DynamicProperties;
|
||||
Brush = source.Brush;
|
||||
HeightEase = source.HeightEase;
|
||||
@ -47,6 +49,7 @@ namespace Artemis.Profiles.Layers.Models
|
||||
public string WidthEase { set; get; }
|
||||
public string HeightEase { get; set; }
|
||||
public string OpacityEase { get; set; }
|
||||
public ConditionType ConditionType { get; set; }
|
||||
public List<LayerConditionModel> Conditions { get; set; } = new List<LayerConditionModel>();
|
||||
public List<DynamicPropertiesModel> DynamicProperties { get; set; } = new List<DynamicPropertiesModel>();
|
||||
|
||||
@ -80,4 +83,11 @@ namespace Artemis.Profiles.Layers.Models
|
||||
return new Rect(X*scale, Y*scale, Width*scale, Height*scale);
|
||||
}
|
||||
}
|
||||
|
||||
public enum ConditionType
|
||||
{
|
||||
[Description("All met")] AllMet,
|
||||
[Description("Any met")] AnyMet,
|
||||
[Description("None met")] NoneMet
|
||||
}
|
||||
}
|
||||
@ -118,7 +118,7 @@ namespace Artemis.ViewModels.Profiles
|
||||
NotifyOfPropertyChange(() => SelectedLayerType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void PreSelect()
|
||||
{
|
||||
SelectedLayerType = LayerTypes.FirstOrDefault(t => t.Name == ProposedLayer.LayerType.Name);
|
||||
|
||||
@ -44,7 +44,6 @@
|
||||
Style="{StaticResource MahApps.Metro.Styles.ToggleSwitchButton.Win10}"
|
||||
HorizontalAlignment="Right" />
|
||||
|
||||
|
||||
<!-- Show on startup -->
|
||||
<Label Grid.Row="2" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
|
||||
Content="Show on startup:" />
|
||||
|
||||
@ -9,8 +9,18 @@
|
||||
mc:Ignorable="d"
|
||||
Title="Artemis | Edit Layer" Height="820" Width="630"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
xmlns:converters="clr-namespace:Artemis.Utilities.Converters"
|
||||
xmlns:models="clr-namespace:Artemis.Profiles.Layers.Models"
|
||||
GlowBrush="{DynamicResource AccentColorBrush}" Icon="../../Resources/bow.png"
|
||||
ResizeMode="NoResize">
|
||||
<controls:MetroWindow.Resources>
|
||||
<converters:EnumDescriptionConverter x:Key="HEnumDescriptionConverter" />
|
||||
<ObjectDataProvider MethodName="GetValues" ObjectType="{x:Type sys:Enum}" x:Key="ConditionTypeValues">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="models:ConditionType" />
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
</controls:MetroWindow.Resources>
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<Grid Margin="10,0">
|
||||
<Grid.RowDefinitions>
|
||||
@ -68,7 +78,22 @@
|
||||
</Grid>
|
||||
|
||||
<!-- Condition editor -->
|
||||
<Label Grid.Row="2" Grid.Column="0" FontSize="20" Content="Display if.." />
|
||||
<Grid Grid.Row="2" Grid.Column="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label FontSize="20" Content="Display if.." Grid.Column="0" />
|
||||
<ComboBox SelectedItem="{Binding Path=ProposedLayer.Properties.ConditionType}" Grid.Column="1"
|
||||
ItemsSource="{Binding Source={StaticResource ConditionTypeValues}}" Margin="10,0"
|
||||
VerticalAlignment="Center" Height="22">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Converter={StaticResource HEnumDescriptionConverter}}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
<Border Grid.Row="3" Grid.Column="0" BorderThickness="1" BorderBrush="{StaticResource GrayBrush7}"
|
||||
Margin="10,0" SnapsToDevicePixels="True">
|
||||
<ListBox Height="138" x:Name="LayerConditionVms" ScrollViewer.VerticalScrollBarVisibility="Visible">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user