mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Event condition - Added toggle off mode
Profile editor - Added element copy/pasting Shared UI - Fix namespaces
This commit is contained in:
1 parent
8c7bbc3f0f
commit
52f2338154
84 files changed
+1059
-608
No files matched your search
+13
-3
@@ -2,8 +2,8 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:dataModelPicker="clr-namespace:Artemis.UI.Shared.Controls.DataModelPicker;assembly=Artemis.UI.Shared"
|
||||
xmlns:conditionTypes="clr-namespace:Artemis.UI.Screens.ProfileEditor.DisplayCondition.ConditionTypes"
|
||||
xmlns:dataModelPicker="clr-namespace:Artemis.UI.Shared.DataModelPicker;assembly=Artemis.UI.Shared"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Artemis.UI.Screens.ProfileEditor.DisplayCondition.ConditionTypes.EventConditionView"
|
||||
x:DataType="conditionTypes:EventConditionViewModel">
|
||||
@@ -17,9 +17,9 @@
|
||||
<dataModelPicker:DataModelPickerButton Placeholder="Select an event"
|
||||
DockPanel.Dock="Top"
|
||||
HorizontalAlignment="Stretch"
|
||||
FilterTypes="{CompiledBinding FilterTypes}"
|
||||
DataModelPath="{CompiledBinding EventPath}"
|
||||
ShowFullPath="{CompiledBinding ShowFullPaths.Value}"/>
|
||||
ShowFullPath="{CompiledBinding ShowFullPaths.Value}"
|
||||
IsEventPicker="True"/>
|
||||
|
||||
<TextBlock DockPanel.Dock="Top">When the event fires..</TextBlock>
|
||||
<ComboBox PlaceholderText="Select a play mode" HorizontalAlignment="Stretch" DockPanel.Dock="Top" SelectedIndex="{CompiledBinding SelectedTriggerMode}">
|
||||
@@ -48,6 +48,16 @@
|
||||
</ComboBoxItem>
|
||||
</ComboBox>
|
||||
|
||||
<TextBlock DockPanel.Dock="Top" IsVisible="{CompiledBinding ShowToggleOffOptions}">When toggling off..</TextBlock>
|
||||
<ComboBox PlaceholderText="Select a play mode"
|
||||
HorizontalAlignment="Stretch"
|
||||
DockPanel.Dock="Top"
|
||||
SelectedIndex="{CompiledBinding SelectedToggleOffMode}"
|
||||
IsVisible="{CompiledBinding ShowToggleOffOptions}">
|
||||
<ComboBoxItem>Finish the main segment</ComboBoxItem>
|
||||
<ComboBoxItem>Skip forward to the end segment</ComboBoxItem>
|
||||
</ComboBox>
|
||||
|
||||
<Button DockPanel.Dock="Bottom"
|
||||
ToolTip.Tip="Open editor"
|
||||
Margin="0 15 0 5"
|
||||
|
||||
+17
-7
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Reactive;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core;
|
||||
@@ -19,11 +17,13 @@ public class EventConditionViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private readonly EventCondition _eventCondition;
|
||||
private readonly IProfileEditorService _profileEditorService;
|
||||
private readonly ObservableAsPropertyHelper<bool> _showOverlapOptions;
|
||||
private readonly IWindowService _windowService;
|
||||
private readonly ISettingsService _settingsService;
|
||||
private readonly ObservableAsPropertyHelper<bool> _showOverlapOptions;
|
||||
private readonly ObservableAsPropertyHelper<bool> _showToggleOffOptions;
|
||||
private readonly IWindowService _windowService;
|
||||
private ObservableAsPropertyHelper<DataModelPath?>? _eventPath;
|
||||
private ObservableAsPropertyHelper<int>? _selectedOverlapMode;
|
||||
private ObservableAsPropertyHelper<int>? _selectedToggleOffMode;
|
||||
private ObservableAsPropertyHelper<int>? _selectedTriggerMode;
|
||||
|
||||
public EventConditionViewModel(EventCondition eventCondition, IProfileEditorService profileEditorService, IWindowService windowService, ISettingsService settingsService)
|
||||
@@ -35,20 +35,24 @@ public class EventConditionViewModel : ActivatableViewModelBase
|
||||
_showOverlapOptions = this.WhenAnyValue(vm => vm.SelectedTriggerMode)
|
||||
.Select(m => m == 0)
|
||||
.ToProperty(this, vm => vm.ShowOverlapOptions);
|
||||
_showToggleOffOptions = this.WhenAnyValue(vm => vm.SelectedTriggerMode)
|
||||
.Select(m => m == 1)
|
||||
.ToProperty(this, vm => vm.ShowToggleOffOptions);
|
||||
|
||||
this.WhenActivated(d =>
|
||||
{
|
||||
_eventPath = eventCondition.WhenAnyValue(c => c.EventPath).ToProperty(this, vm => vm.EventPath).DisposeWith(d);
|
||||
_selectedTriggerMode = eventCondition.WhenAnyValue(c => c.TriggerMode).Select(m => (int) m).ToProperty(this, vm => vm.SelectedTriggerMode).DisposeWith(d);
|
||||
_selectedOverlapMode = eventCondition.WhenAnyValue(c => c.OverlapMode).Select(m => (int) m).ToProperty(this, vm => vm.SelectedOverlapMode).DisposeWith(d);
|
||||
_selectedToggleOffMode = eventCondition.WhenAnyValue(c => c.OverlapMode).Select(m => (int) m).ToProperty(this, vm => vm.SelectedOverlapMode).DisposeWith(d);
|
||||
});
|
||||
|
||||
OpenEditor = ReactiveCommand.CreateFromTask(ExecuteOpenEditor);
|
||||
}
|
||||
|
||||
public ObservableCollection<Type> FilterTypes { get; } = new() {typeof(IDataModelEvent)};
|
||||
public ReactiveCommand<Unit, Unit> OpenEditor { get; }
|
||||
public bool ShowOverlapOptions => _showOverlapOptions.Value;
|
||||
public bool ShowToggleOffOptions => _showToggleOffOptions.Value;
|
||||
public bool IsConditionForLayer => _eventCondition.ProfileElement is Layer;
|
||||
public PluginSetting<bool> ShowFullPaths => _settingsService.GetSetting("ProfileEditor.ShowFullPaths", false);
|
||||
|
||||
@@ -69,7 +73,13 @@ public class EventConditionViewModel : ActivatableViewModelBase
|
||||
get => _selectedOverlapMode?.Value ?? 0;
|
||||
set => _profileEditorService.ExecuteCommand(new UpdateEventOverlapMode(_eventCondition, (EventOverlapMode) value));
|
||||
}
|
||||
|
||||
|
||||
public int SelectedToggleOffMode
|
||||
{
|
||||
get => _selectedToggleOffMode?.Value ?? 0;
|
||||
set => _profileEditorService.ExecuteCommand(new UpdateEventToggleOffMode(_eventCondition, (EventToggleOffMode) value));
|
||||
}
|
||||
|
||||
private async Task ExecuteOpenEditor()
|
||||
{
|
||||
await _windowService.ShowDialogAsync<NodeScriptWindowViewModel, bool>(("nodeScript", _eventCondition.NodeScript));
|
||||
|
||||
Reference in new issue
Block a user