diff --git a/src/Artemis.Core/Artemis.Core.csproj.DotSettings b/src/Artemis.Core/Artemis.Core.csproj.DotSettings
index 224b124a9..535046f29 100644
--- a/src/Artemis.Core/Artemis.Core.csproj.DotSettings
+++ b/src/Artemis.Core/Artemis.Core.csproj.DotSettings
@@ -44,6 +44,7 @@
True
True
True
+ True
True
True
True
diff --git a/src/Artemis.Core/Models/Profile/Conditions/EventCondition.cs b/src/Artemis.Core/Models/Profile/Conditions/EventCondition.cs
new file mode 100644
index 000000000..ad7913b54
--- /dev/null
+++ b/src/Artemis.Core/Models/Profile/Conditions/EventCondition.cs
@@ -0,0 +1,98 @@
+using System;
+using Artemis.Storage.Entities.Profile.Conditions;
+
+namespace Artemis.Core
+{
+ public class EventCondition : CorePropertyChanged, IDisposable, IStorageModel
+ {
+ private readonly string _displayName;
+ private readonly object? _context;
+ private DateTime _lastProcessedTrigger;
+ private DataModelPath _eventPath;
+
+ internal EventCondition(string displayName, object? context)
+ {
+ _displayName = displayName;
+ _context = context;
+
+ Entity = new EventConditionEntity();
+ Script = new NodeScript($"Activate {displayName}", $"Whether or not the event should activate the {displayName}", context);
+ }
+
+ internal EventCondition(EventConditionEntity entity, string displayName, object? context)
+ {
+ _displayName = displayName;
+ _context = context;
+
+ Entity = entity;
+ Script = null!;
+
+ Load();
+ }
+
+ ///
+ /// Gets the script that drives the event condition
+ ///
+ public NodeScript Script { get; private set; }
+
+ ///
+ /// Gets or sets the path to the event that drives this event condition
+ ///
+ public DataModelPath EventPath
+ {
+ set => SetAndNotify(ref _eventPath, value);
+ get => _eventPath;
+ }
+
+ internal EventConditionEntity Entity { get; }
+
+ internal bool Evaluate()
+ {
+ if (EventPath.GetValue() is not DataModelEvent dataModelEvent || dataModelEvent.LastTrigger <= _lastProcessedTrigger)
+ return false;
+
+ // TODO: Place dataModelEvent.LastEventArgumentsUntyped; in the start node
+ Script.Run();
+
+ _lastProcessedTrigger = dataModelEvent.LastTrigger;
+
+ return Script.Result;
+ }
+
+ #region IDisposable
+
+ ///
+ public void Dispose()
+ {
+ Script.Dispose();
+ EventPath.Dispose();
+ }
+
+ #endregion
+
+ internal void LoadNodeScript()
+ {
+ Script.Load();
+ }
+
+ #region Implementation of IStorageModel
+
+ ///
+ public void Load()
+ {
+ EventPath = new DataModelPath(null, Entity.EventPath);
+ Script = new NodeScript($"Activate {_displayName}", $"Whether or not the event should activate the {_displayName}", Entity.Script, _context);
+ }
+
+ ///
+ public void Save()
+ {
+ EventPath.Save();
+ Entity.EventPath = EventPath.Entity;
+ Script.Save();
+ Entity.Script = Script.Entity;
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.Core/Models/Profile/Conditions/EventsCondition.cs b/src/Artemis.Core/Models/Profile/Conditions/EventsCondition.cs
new file mode 100644
index 000000000..8f8af3ad9
--- /dev/null
+++ b/src/Artemis.Core/Models/Profile/Conditions/EventsCondition.cs
@@ -0,0 +1,174 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Artemis.Storage.Entities.Profile.Abstract;
+using Artemis.Storage.Entities.Profile.Conditions;
+
+namespace Artemis.Core
+{
+ public class EventsCondition : CorePropertyChanged, INodeScriptCondition
+ {
+ private readonly EventsConditionEntity _entity;
+ private readonly List _eventsList;
+ private TimeLineEventOverlapMode _eventOverlapMode;
+
+ public EventsCondition(ProfileElement profileElement)
+ {
+ _entity = new EventsConditionEntity();
+ _eventsList = new List();
+
+ ProfileElement = profileElement;
+ Events = new List(_eventsList);
+ }
+
+ internal EventsCondition(EventsConditionEntity entity, ProfileElement profileElement)
+ {
+ _entity = entity;
+ _eventsList = new List();
+
+ ProfileElement = profileElement;
+ Events = new List(_eventsList);
+
+ Load();
+ }
+
+ ///
+ /// Gets a list of events this condition reacts to
+ ///
+ public IReadOnlyCollection Events { get; }
+
+ ///
+ /// Gets or sets how the condition behaves when events trigger before the timeline finishes
+ ///
+ public TimeLineEventOverlapMode EventOverlapMode
+ {
+ get => _eventOverlapMode;
+ set => SetAndNotify(ref _eventOverlapMode, value);
+ }
+
+ ///
+ public IConditionEntity Entity => _entity;
+
+ ///
+ public ProfileElement ProfileElement { get; }
+
+ ///
+ public bool IsMet { get; private set; }
+
+ ///
+ /// Adds a new event condition
+ ///
+ /// The newly created event condition
+ public EventCondition AddEventCondition()
+ {
+ EventCondition eventCondition = new(ProfileElement.GetType().Name.ToLower(), ProfileElement.Profile);
+ lock (_eventsList)
+ {
+ _eventsList.Add(eventCondition);
+ }
+
+ return eventCondition;
+ }
+
+ ///
+ /// Removes the provided event condition
+ ///
+ /// The event condition to remove
+ public void RemoveEventCondition(EventCondition eventCondition)
+ {
+ lock (_eventsList)
+ {
+ _eventsList.Remove(eventCondition);
+ }
+ }
+
+ ///
+ public void Update()
+ {
+ lock (_eventsList)
+ {
+ if (EventOverlapMode == TimeLineEventOverlapMode.Toggle)
+ {
+ if (_eventsList.Any(c => c.Evaluate()))
+ IsMet = !IsMet;
+ }
+ else
+ {
+ IsMet = _eventsList.Any(c => c.Evaluate());
+ }
+ }
+ }
+
+ ///
+ public void ApplyToTimeline(bool isMet, bool wasMet, Timeline timeline)
+ {
+ if (!isMet)
+ return;
+
+ // Event overlap mode doesn't apply in this case
+ if (timeline.IsFinished)
+ {
+ timeline.JumpToStart();
+ return;
+ }
+
+ // If the timeline was already running, look at the event overlap mode
+ if (EventOverlapMode == TimeLineEventOverlapMode.Restart)
+ timeline.JumpToStart();
+ else if (EventOverlapMode == TimeLineEventOverlapMode.Copy)
+ timeline.AddExtraTimeline();
+ else if (EventOverlapMode == TimeLineEventOverlapMode.Toggle && !wasMet)
+ timeline.JumpToStart();
+
+ // The remaining overlap mode is 'ignore' which requires no further action
+ }
+
+ ///
+ public void Dispose()
+ {
+ foreach (EventCondition eventCondition in Events)
+ eventCondition.Dispose();
+ }
+
+ #region Storage
+
+ ///
+ public void Load()
+ {
+ EventOverlapMode = (TimeLineEventOverlapMode) _entity.EventOverlapMode;
+ lock (_eventsList)
+ {
+ _eventsList.Clear();
+ foreach (EventConditionEntity eventCondition in _entity.Events)
+ _eventsList.Add(new EventCondition(eventCondition, ProfileElement.GetType().Name.ToLower(), ProfileElement.Profile));
+ }
+ }
+
+ ///
+ public void Save()
+ {
+ _entity.EventOverlapMode = (int) EventOverlapMode;
+ _entity.Events.Clear();
+ lock (_eventsList)
+ {
+ foreach (EventCondition eventCondition in _eventsList)
+ {
+ eventCondition.Save();
+ _entity.Events.Add(eventCondition.Entity);
+ }
+ }
+ }
+
+ ///
+ public void LoadNodeScript()
+ {
+ lock (_eventsList)
+ {
+ foreach (EventCondition eventCondition in _eventsList)
+ eventCondition.LoadNodeScript();
+ }
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.Core/Models/Profile/Conditions/ICondition.cs b/src/Artemis.Core/Models/Profile/Conditions/ICondition.cs
new file mode 100644
index 000000000..e62d21617
--- /dev/null
+++ b/src/Artemis.Core/Models/Profile/Conditions/ICondition.cs
@@ -0,0 +1,51 @@
+using System;
+using Artemis.Storage.Entities.Profile.Abstract;
+
+namespace Artemis.Core
+{
+ ///
+ /// Represents a condition applied to a
+ ///
+ public interface ICondition : IDisposable, IStorageModel
+ {
+ ///
+ /// Gets the entity used to store this condition
+ ///
+ public IConditionEntity Entity { get; }
+
+ ///
+ /// Gets the profile element this condition applies to
+ ///
+ public ProfileElement ProfileElement { get; }
+
+ ///
+ /// Gets a boolean indicating whether the condition is currently met
+ ///
+
+ bool IsMet { get; }
+
+ ///
+ /// Updates the condition
+ ///
+ void Update();
+
+ ///
+ /// Applies the display condition to the provided timeline
+ ///
+ ///
+ ///
+ /// The timeline to apply the display condition to
+ void ApplyToTimeline(bool isMet, bool wasMet, Timeline timeline);
+ }
+
+ ///
+ /// Represents a condition applied to a using a
+ ///
+ public interface INodeScriptCondition : ICondition
+ {
+ ///
+ /// Loads the node script this node script condition uses
+ ///
+ void LoadNodeScript();
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.Core/Models/Profile/Conditions/StaticCondition.cs b/src/Artemis.Core/Models/Profile/Conditions/StaticCondition.cs
new file mode 100644
index 000000000..f0a8d9e0b
--- /dev/null
+++ b/src/Artemis.Core/Models/Profile/Conditions/StaticCondition.cs
@@ -0,0 +1,101 @@
+using System;
+using System.Linq;
+using Artemis.Storage.Entities.Profile.Abstract;
+using Artemis.Storage.Entities.Profile.Conditions;
+
+namespace Artemis.Core
+{
+ public class StaticCondition : CorePropertyChanged, INodeScriptCondition
+ {
+ private readonly StaticConditionEntity _entity;
+
+ public StaticCondition(ProfileElement profileElement)
+ {
+ _entity = new StaticConditionEntity();
+
+ ProfileElement = profileElement;
+ string typeDisplayName = profileElement.GetType().Name.ToLower();
+ Script = new NodeScript($"Activate {typeDisplayName}", $"Whether or not this {typeDisplayName} should be active", profileElement.Profile);
+ }
+
+ internal StaticCondition(StaticConditionEntity entity, ProfileElement profileElement)
+ {
+ _entity = entity;
+
+ ProfileElement = profileElement;
+ Script = null!;
+
+ Load();
+ }
+
+ ///
+ /// Gets the script that drives the static condition
+ ///
+ public NodeScript Script { get; private set; }
+
+ ///
+ public IConditionEntity Entity => _entity;
+
+ ///
+ public ProfileElement ProfileElement { get; }
+
+ ///
+ public bool IsMet { get; private set; }
+
+ ///
+ public void Update()
+ {
+ if (!Script.HasNodes)
+ {
+ IsMet = true;
+ return;
+ }
+
+ Script.Run();
+ IsMet = Script.Result;
+ }
+
+ ///
+ public void ApplyToTimeline(bool isMet, bool wasMet, Timeline timeline)
+ {
+ if (isMet && !wasMet && timeline.IsFinished)
+ timeline.JumpToStart();
+ else if (!isMet && wasMet && timeline.StopMode == TimelineStopMode.SkipToEnd)
+ timeline.JumpToEndSegment();
+ }
+
+ #region IDisposable
+
+ ///
+ public void Dispose()
+ {
+ Script.Dispose();
+ }
+
+ #endregion
+
+ #region Storage
+
+ ///
+ public void Load()
+ {
+ string typeDisplayName = ProfileElement.GetType().Name.ToLower();
+ Script = new NodeScript($"Activate {typeDisplayName}", $"Whether or not this {typeDisplayName} should be active", _entity.Script, ProfileElement.Profile);
+ }
+
+ ///
+ public void Save()
+ {
+ Script.Save();
+ _entity.Script = Script.Entity;
+ }
+
+ ///
+ public void LoadNodeScript()
+ {
+ Script.Load();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.Core/Models/Profile/RenderProfileElement.cs b/src/Artemis.Core/Models/Profile/RenderProfileElement.cs
index 37f5d8f8c..dbe3f785c 100644
--- a/src/Artemis.Core/Models/Profile/RenderProfileElement.cs
+++ b/src/Artemis.Core/Models/Profile/RenderProfileElement.cs
@@ -18,17 +18,13 @@ namespace Artemis.Core
{
private SKRectI _bounds;
private SKPath? _path;
- private readonly string _typeDisplayName;
internal RenderProfileElement(Profile profile) : base(profile)
{
- _typeDisplayName = this is Layer ? "layer" : "folder";
- _displayCondition = new NodeScript($"Activate {_typeDisplayName}", $"Whether or not this {_typeDisplayName} should be active", Profile);
-
Timeline = new Timeline();
ExpandedPropertyGroups = new List();
LayerEffectsList = new List();
- LayerEffects = new(LayerEffectsList);
+ LayerEffects = new ReadOnlyCollection(LayerEffectsList);
LayerEffectStore.LayerEffectAdded += LayerEffectStoreOnLayerEffectAdded;
LayerEffectStore.LayerEffectRemoved += LayerEffectStoreOnLayerEffectRemoved;
@@ -64,7 +60,8 @@ namespace Artemis.Core
foreach (BaseLayerEffect baseLayerEffect in LayerEffects)
baseLayerEffect.Dispose();
- DisplayCondition.Dispose();
+ if (DisplayCondition is IDisposable disposable)
+ disposable.Dispose();
base.Dispose(disposing);
}
@@ -97,11 +94,9 @@ namespace Artemis.Core
layerEffect.BaseProperties?.ApplyToEntity();
}
- // Conditions
+ // Condition
DisplayCondition?.Save();
- RenderElementEntity.NodeScript = DisplayCondition?.Entity;
- // RenderElementEntity.DisplayCondition = DisplayCondition?.Entity;
- // DisplayCondition?.Save();
+ RenderElementEntity.DisplayCondition = DisplayCondition?.Entity;
// Timeline
RenderElementEntity.Timeline = Timeline?.Entity;
@@ -110,11 +105,10 @@ namespace Artemis.Core
internal void LoadNodeScript()
{
- DisplayCondition = RenderElementEntity.NodeScript != null
- ? new NodeScript($"Activate {_typeDisplayName}", $"Whether or not this {_typeDisplayName} should be active", RenderElementEntity.NodeScript, Profile)
- : new NodeScript($"Activate {_typeDisplayName}", $"Whether or not this {_typeDisplayName} should be active", Profile);
+ if (DisplayCondition is INodeScriptCondition scriptCondition)
+ scriptCondition.LoadNodeScript();
- foreach (ILayerProperty layerProperty in GetAllLayerProperties())
+ foreach (ILayerProperty layerProperty in GetAllLayerProperties())
layerProperty.BaseDataBinding.LoadNodeScript();
}
@@ -367,20 +361,19 @@ namespace Artemis.Core
protected set => SetAndNotify(ref _displayConditionMet, value);
}
- private NodeScript _displayCondition;
private bool _displayConditionMet;
- private bool _toggledOnByEvent = false;
-
///
- /// Gets or sets the root display condition group
+ /// Gets the display condition used to determine whether this element is active or not
///
- public NodeScript DisplayCondition
+ public ICondition? DisplayCondition
{
get => _displayCondition;
- set => SetAndNotify(ref _displayCondition, value);
+ private set => SetAndNotify(ref _displayCondition, value);
}
+ private ICondition? _displayCondition;
+
///
/// Evaluates the display conditions on this element and applies any required changes to the
///
@@ -392,63 +385,30 @@ namespace Artemis.Core
return;
}
- if (!DisplayCondition.HasNodes)
+ if (DisplayCondition == null)
{
DisplayConditionMet = true;
return;
}
- if (Timeline.EventOverlapMode != TimeLineEventOverlapMode.Toggle)
- _toggledOnByEvent = false;
+ DisplayCondition.Update();
+ DisplayCondition.ApplyToTimeline(DisplayCondition.IsMet, DisplayConditionMet, Timeline);
+ DisplayConditionMet = DisplayCondition.IsMet;
+ }
- DisplayCondition.Run();
+ ///
+ /// Replaces the current with the provided or
+ ///
+ ///
+ /// The condition to change the to
+ public void ChangeDisplayCondition(ICondition? condition)
+ {
+ if (condition == DisplayCondition)
+ return;
- // TODO: Handle this nicely, right now when there's only an exit node we assume true
- bool conditionMet = DisplayCondition.Nodes.Count() == 1 || DisplayCondition.Result;
- if (Parent is RenderProfileElement parent && !parent.DisplayConditionMet)
- conditionMet = false;
-
- // if (!DisplayCondition.ContainsEvents)
- {
- // Regular conditions reset the timeline whenever their condition is met and was not met before that
- if (conditionMet && !DisplayConditionMet && Timeline.IsFinished)
- Timeline.JumpToStart();
- // If regular conditions are no longer met, jump to the end segment if stop mode requires it
- if (!conditionMet && Timeline.StopMode == TimelineStopMode.SkipToEnd)
- Timeline.JumpToEndSegment();
- }
- // else if (conditionMet)
- // {
- // if (Timeline.EventOverlapMode == TimeLineEventOverlapMode.Toggle)
- // {
- // _toggledOnByEvent = !_toggledOnByEvent;
- // if (_toggledOnByEvent)
- // Timeline.JumpToStart();
- // }
- // else
- // {
- // // Event conditions reset if the timeline finished
- // if (Timeline.IsFinished)
- // {
- // Timeline.JumpToStart();
- // }
- // // and otherwise apply their overlap mode
- // else
- // {
- // if (Timeline.EventOverlapMode == TimeLineEventOverlapMode.Restart)
- // Timeline.JumpToStart();
- // else if (Timeline.EventOverlapMode == TimeLineEventOverlapMode.Copy)
- // Timeline.AddExtraTimeline();
- // // The third option is ignore which is handled below:
- //
- // // done
- // }
- // }
- // }
-
- DisplayConditionMet = Timeline.EventOverlapMode == TimeLineEventOverlapMode.Toggle
- ? _toggledOnByEvent
- : conditionMet;
+ ICondition? old = DisplayCondition;
+ DisplayCondition = condition;
+ old?.Dispose();
}
#endregion
diff --git a/src/Artemis.Storage/Entities/Profile/Abstract/RenderElementEntity.cs b/src/Artemis.Storage/Entities/Profile/Abstract/RenderElementEntity.cs
index 8dc4c6044..26f1d9c53 100644
--- a/src/Artemis.Storage/Entities/Profile/Abstract/RenderElementEntity.cs
+++ b/src/Artemis.Storage/Entities/Profile/Abstract/RenderElementEntity.cs
@@ -14,7 +14,7 @@ namespace Artemis.Storage.Entities.Profile.Abstract
public List PropertyEntities { get; set; }
public List ExpandedPropertyGroups { get; set; }
- public DataModelConditionGroupEntity DisplayCondition { get; set; }
+ public IConditionEntity DisplayCondition { get; set; }
public TimelineEntity Timeline { get; set; }
public NodeScriptEntity NodeScript { get; set; }
diff --git a/src/Artemis.Storage/Entities/Profile/AdaptionHints/CategoryAdaptionHintEntity.cs b/src/Artemis.Storage/Entities/Profile/AdaptionHints/CategoryAdaptionHintEntity.cs
index bd5fb6f08..64dcc669a 100644
--- a/src/Artemis.Storage/Entities/Profile/AdaptionHints/CategoryAdaptionHintEntity.cs
+++ b/src/Artemis.Storage/Entities/Profile/AdaptionHints/CategoryAdaptionHintEntity.cs
@@ -8,6 +8,4 @@
public int Skip { get; set; }
public int Amount { get; set; }
}
-
-
}
\ No newline at end of file
diff --git a/src/Artemis.Storage/Entities/Profile/Conditions/DataModelConditionEventEntity.cs b/src/Artemis.Storage/Entities/Profile/Conditions/DataModelConditionEventEntity.cs
deleted file mode 100644
index 141f5bb08..000000000
--- a/src/Artemis.Storage/Entities/Profile/Conditions/DataModelConditionEventEntity.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System.Collections.Generic;
-using Artemis.Storage.Entities.Profile.Abstract;
-
-namespace Artemis.Storage.Entities.Profile.Conditions
-{
- public class DataModelConditionEventEntity : DataModelConditionPartEntity
- {
- public DataModelConditionEventEntity()
- {
- Children = new List();
- }
-
- public DataModelPathEntity EventPath { get; set; }
- }
-}
\ No newline at end of file
diff --git a/src/Artemis.Storage/Entities/Profile/Conditions/DataModelConditionEventPredicateEntity.cs b/src/Artemis.Storage/Entities/Profile/Conditions/DataModelConditionEventPredicateEntity.cs
deleted file mode 100644
index fee134489..000000000
--- a/src/Artemis.Storage/Entities/Profile/Conditions/DataModelConditionEventPredicateEntity.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace Artemis.Storage.Entities.Profile.Conditions
-{
- public class DataModelConditionEventPredicateEntity : DataModelConditionPredicateEntity
- {
- }
-}
\ No newline at end of file
diff --git a/src/Artemis.Storage/Entities/Profile/Conditions/DataModelConditionGeneralPredicateEntity.cs b/src/Artemis.Storage/Entities/Profile/Conditions/DataModelConditionGeneralPredicateEntity.cs
deleted file mode 100644
index 1a0fa93ea..000000000
--- a/src/Artemis.Storage/Entities/Profile/Conditions/DataModelConditionGeneralPredicateEntity.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace Artemis.Storage.Entities.Profile.Conditions
-{
- public class DataModelConditionGeneralPredicateEntity : DataModelConditionPredicateEntity
- {
- }
-}
\ No newline at end of file
diff --git a/src/Artemis.Storage/Entities/Profile/Conditions/DataModelConditionGroupEntity.cs b/src/Artemis.Storage/Entities/Profile/Conditions/DataModelConditionGroupEntity.cs
deleted file mode 100644
index 90f84494e..000000000
--- a/src/Artemis.Storage/Entities/Profile/Conditions/DataModelConditionGroupEntity.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System.Collections.Generic;
-using Artemis.Storage.Entities.Profile.Abstract;
-
-namespace Artemis.Storage.Entities.Profile.Conditions
-{
- public class DataModelConditionGroupEntity : DataModelConditionPartEntity
- {
- public DataModelConditionGroupEntity()
- {
- Children = new List();
- }
-
- public int BooleanOperator { get; set; }
- }
-}
\ No newline at end of file
diff --git a/src/Artemis.Storage/Entities/Profile/Conditions/DataModelConditionListEntity.cs b/src/Artemis.Storage/Entities/Profile/Conditions/DataModelConditionListEntity.cs
deleted file mode 100644
index fd812cc41..000000000
--- a/src/Artemis.Storage/Entities/Profile/Conditions/DataModelConditionListEntity.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System.Collections.Generic;
-using Artemis.Storage.Entities.Profile.Abstract;
-
-namespace Artemis.Storage.Entities.Profile.Conditions
-{
- public class DataModelConditionListEntity : DataModelConditionPartEntity
- {
- public DataModelConditionListEntity()
- {
- Children = new List();
- }
-
- public DataModelPathEntity ListPath { get; set; }
- public int ListOperator { get; set; }
- }
-}
\ No newline at end of file
diff --git a/src/Artemis.Storage/Entities/Profile/Conditions/DataModelConditionListPredicateEntity.cs b/src/Artemis.Storage/Entities/Profile/Conditions/DataModelConditionListPredicateEntity.cs
deleted file mode 100644
index cfc4b5372..000000000
--- a/src/Artemis.Storage/Entities/Profile/Conditions/DataModelConditionListPredicateEntity.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace Artemis.Storage.Entities.Profile.Conditions
-{
- public class DataModelConditionListPredicateEntity : DataModelConditionPredicateEntity
- {
- }
-}
\ No newline at end of file
diff --git a/src/Artemis.Storage/Entities/Profile/Conditions/DataModelConditionPredicateEntity.cs b/src/Artemis.Storage/Entities/Profile/Conditions/DataModelConditionPredicateEntity.cs
deleted file mode 100644
index c913a6a3c..000000000
--- a/src/Artemis.Storage/Entities/Profile/Conditions/DataModelConditionPredicateEntity.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System;
-using Artemis.Storage.Entities.Profile.Abstract;
-
-namespace Artemis.Storage.Entities.Profile.Conditions
-{
- public abstract class DataModelConditionPredicateEntity : DataModelConditionPartEntity
- {
- public int PredicateType { get; set; }
- public DataModelPathEntity LeftPath { get; set; }
- public DataModelPathEntity RightPath { get; set; }
-
- public string OperatorType { get; set; }
- public Guid? OperatorPluginGuid { get; set; }
-
- // Stored as a string to be able to control serialization and deserialization ourselves
- public string RightStaticValue { get; set; }
- }
-}
\ No newline at end of file
diff --git a/src/Artemis.Storage/Entities/Profile/Conditions/EventsConditionEntity.cs b/src/Artemis.Storage/Entities/Profile/Conditions/EventsConditionEntity.cs
new file mode 100644
index 000000000..05404882d
--- /dev/null
+++ b/src/Artemis.Storage/Entities/Profile/Conditions/EventsConditionEntity.cs
@@ -0,0 +1,18 @@
+using System.Collections.Generic;
+using Artemis.Storage.Entities.Profile.Abstract;
+using Artemis.Storage.Entities.Profile.Nodes;
+
+namespace Artemis.Storage.Entities.Profile.Conditions
+{
+ public class EventsConditionEntity : IConditionEntity
+ {
+ public int EventOverlapMode { get; set; }
+ public List Events { get; set; } = new();
+ }
+
+ public class EventConditionEntity
+ {
+ public DataModelPathEntity EventPath { get; set; }
+ public NodeScriptEntity Script { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.Storage/Entities/Profile/Conditions/IConditionEntity.cs b/src/Artemis.Storage/Entities/Profile/Conditions/IConditionEntity.cs
new file mode 100644
index 000000000..34d5ca589
--- /dev/null
+++ b/src/Artemis.Storage/Entities/Profile/Conditions/IConditionEntity.cs
@@ -0,0 +1,6 @@
+namespace Artemis.Storage.Entities.Profile.Abstract
+{
+ public interface IConditionEntity
+ {
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.Storage/Entities/Profile/Conditions/StaticConditionEntity.cs b/src/Artemis.Storage/Entities/Profile/Conditions/StaticConditionEntity.cs
new file mode 100644
index 000000000..38a938c9a
--- /dev/null
+++ b/src/Artemis.Storage/Entities/Profile/Conditions/StaticConditionEntity.cs
@@ -0,0 +1,10 @@
+using Artemis.Storage.Entities.Profile.Abstract;
+using Artemis.Storage.Entities.Profile.Nodes;
+
+namespace Artemis.Storage.Entities.Profile.Conditions
+{
+ public class StaticConditionEntity : IConditionEntity
+ {
+ public NodeScriptEntity Script { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/ProfileEditor/DisplayConditions/DisplayConditionsViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/DisplayConditions/DisplayConditionsViewModel.cs
index 640d283cd..4936bf68d 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/DisplayConditions/DisplayConditionsViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/DisplayConditions/DisplayConditionsViewModel.cs
@@ -121,7 +121,7 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
if (RenderProfileElement == null)
return;
- _windowManager.ShowDialog(_nodeVmFactory.NodeScriptWindowViewModel(RenderProfileElement.DisplayCondition));
+ // _windowManager.ShowDialog(_nodeVmFactory.NodeScriptWindowViewModel(RenderProfileElement.DisplayCondition));
_profileEditorService.SaveSelectedProfileElement();
}