From d563d172704b45c700e0de1c6f9ae609a3a62984 Mon Sep 17 00:00:00 2001 From: Robert Date: Sat, 28 May 2022 19:24:37 +0200 Subject: [PATCH] Profile settigns - Added activation condition visual scripting --- src/.idea/.idea.Artemis/.idea/avalonia.xml | 4 +- .../ProfileConfiguration.cs | 12 +- .../VisualScripting/NodeScript.cs | 5 - src/Artemis.UI.Shared/Styles/Border.axaml | 4 +- .../ProfileConfigurationEditView.axaml | 159 ++++++++++-------- .../ProfileConfigurationEditViewModel.cs | 44 ++++- .../Screens/Workshop/WorkshopView.axaml | 7 - .../Screens/Workshop/WorkshopViewModel.cs | 117 +++++-------- 8 files changed, 173 insertions(+), 179 deletions(-) diff --git a/src/.idea/.idea.Artemis/.idea/avalonia.xml b/src/.idea/.idea.Artemis/.idea/avalonia.xml index 5e6d28ea6..8ad483249 100644 --- a/src/.idea/.idea.Artemis/.idea/avalonia.xml +++ b/src/.idea/.idea.Artemis/.idea/avalonia.xml @@ -27,6 +27,7 @@ + @@ -54,7 +55,7 @@ - + @@ -65,6 +66,7 @@ + diff --git a/src/Artemis.Core/Models/ProfileConfiguration/ProfileConfiguration.cs b/src/Artemis.Core/Models/ProfileConfiguration/ProfileConfiguration.cs index 942f1af4c..d07241c1b 100644 --- a/src/Artemis.Core/Models/ProfileConfiguration/ProfileConfiguration.cs +++ b/src/Artemis.Core/Models/ProfileConfiguration/ProfileConfiguration.cs @@ -134,7 +134,7 @@ namespace Artemis.Core /// Gets the data model condition that must evaluate to for this profile to be activated /// alongside any activation requirements of the , if set /// - public NodeScript ActivationCondition { get; set; } + public NodeScript ActivationCondition { get; } /// /// Gets or sets the module this profile uses @@ -241,11 +241,7 @@ namespace Artemis.Core Icon.Load(); - ActivationCondition.Dispose(); - ActivationCondition = Entity.ActivationCondition != null - ? new NodeScript("Activate profile", "Whether or not the profile should be active", Entity.ActivationCondition, this) - : new NodeScript("Activate profile", "Whether or not the profile should be active", this); - + ActivationCondition.LoadFromEntity(Entity.ActivationCondition); EnableHotkey = Entity.EnableHotkey != null ? new Hotkey(Entity.EnableHotkey) : null; DisableHotkey = Entity.DisableHotkey != null ? new Hotkey(Entity.DisableHotkey) : null; } @@ -265,8 +261,8 @@ namespace Artemis.Core Icon.Save(); - ActivationCondition?.Save(); - Entity.ActivationCondition = ActivationCondition?.Entity; + ActivationCondition.Save(); + Entity.ActivationCondition = ActivationCondition.Entity; EnableHotkey?.Save(); Entity.EnableHotkey = EnableHotkey?.Entity; diff --git a/src/Artemis.Core/VisualScripting/NodeScript.cs b/src/Artemis.Core/VisualScripting/NodeScript.cs index dc7b4e0cf..067df1f79 100644 --- a/src/Artemis.Core/VisualScripting/NodeScript.cs +++ b/src/Artemis.Core/VisualScripting/NodeScript.cs @@ -276,13 +276,8 @@ namespace Artemis.Core { Entity.Name = Name; Entity.Description = Description; - Entity.Nodes.Clear(); - // No need to save the exit node if that's all there is - if (Nodes.Count() == 1) - return; - foreach (INode node in Nodes) { NodeEntity nodeEntity = new() diff --git a/src/Artemis.UI.Shared/Styles/Border.axaml b/src/Artemis.UI.Shared/Styles/Border.axaml index 59afbcfef..76fccda64 100644 --- a/src/Artemis.UI.Shared/Styles/Border.axaml +++ b/src/Artemis.UI.Shared/Styles/Border.axaml @@ -36,7 +36,7 @@