Shared UI - Renamed DataModelVisualizationService

Databindings - Started on some basic UI elements
This commit is contained in:
Robert committed 2020-08-27 20:46:20 +02:00
1 parent babd862b40
commit a177188ce7
31 files changed
+423 -185

No files matched your search

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using Artemis.Core.Events;
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
using Artemis.Storage.Entities.Profile;
@@ -71,6 +72,9 @@ namespace Artemis.Core.Models.Profile.LayerProperties
/// </summary>
public bool IsCoreProperty { get; internal set; }
/// <summary>
/// Gets the description attribute applied to this property
/// </summary>
public PropertyDescriptionAttribute PropertyDescription { get; internal set; }
/// <summary>
@@ -81,8 +85,21 @@ namespace Artemis.Core.Models.Profile.LayerProperties
internal PropertyEntity PropertyEntity { get; set; }
internal LayerPropertyGroup LayerPropertyGroup { get; set; }
/// <summary>
/// Overrides the property value with the default value
/// </summary>
public abstract void ApplyDefaultValue();
/// <summary>
/// Returns the type of the property
/// </summary>
public abstract Type GetPropertyType();
/// <summary>
/// Returns a list of properties to which data bindings can be applied
/// </summary>
/// <returns></returns>
public abstract List<PropertyInfo> GetDataBindingProperties();
/// <summary>
/// Applies the provided property entity to the layer property by deserializing the JSON base value and keyframe values
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using Artemis.Core.Exceptions;
using Artemis.Core.Utilities;
using Artemis.Storage.Entities.Profile;
@@ -166,12 +167,22 @@ namespace Artemis.Core.Models.Profile.LayerProperties
RemoveKeyframe(layerPropertyKeyframe);
}
/// <inheritdoc />
public override void ApplyDefaultValue()
{
BaseValue = DefaultValue;
CurrentValue = DefaultValue;
}
/// <inheritdoc />
public override Type GetPropertyType() => typeof(T);
/// <inheritdoc />
public override List<PropertyInfo> GetDataBindingProperties()
{
return new List<PropertyInfo> {GetType().GetProperty(nameof(CurrentValue))};
}
/// <summary>
/// Called every update (if keyframes are both supported and enabled) to determine the new <see cref="CurrentValue" />
/// based on the provided progress
@@ -206,8 +217,8 @@ namespace Artemis.Core.Models.Profile.LayerProperties
else
{
var timeDiff = NextKeyframe.Position - CurrentKeyframe.Position;
var keyframeProgress = (float)((ProfileElement.TimelinePosition - CurrentKeyframe.Position).TotalMilliseconds / timeDiff.TotalMilliseconds);
var keyframeProgressEased = (float)Easings.Interpolate(keyframeProgress, CurrentKeyframe.EasingFunction);
var keyframeProgress = (float) ((ProfileElement.TimelinePosition - CurrentKeyframe.Position).TotalMilliseconds / timeDiff.TotalMilliseconds);
var keyframeProgressEased = (float) Easings.Interpolate(keyframeProgress, CurrentKeyframe.EasingFunction);
UpdateCurrentValue(keyframeProgress, keyframeProgressEased);
}
@@ -245,7 +256,7 @@ namespace Artemis.Core.Models.Profile.LayerProperties
_keyframes.AddRange(entity.KeyframeEntities.Select(k => new LayerPropertyKeyframe<T>(
JsonConvert.DeserializeObject<T>(k.Value),
k.Position,
(Easings.Functions)k.EasingFunction,
(Easings.Functions) k.EasingFunction,
this
)));
}
@@ -274,7 +285,7 @@ namespace Artemis.Core.Models.Profile.LayerProperties
{
Value = JsonConvert.SerializeObject(k.Value),
Position = k.Position,
EasingFunction = (int)k.EasingFunction
EasingFunction = (int) k.EasingFunction
}));
}
}
@@ -1,4 +1,7 @@
using SkiaSharp;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using SkiaSharp;
namespace Artemis.Core.Models.Profile.LayerProperties.Types
{
@@ -20,5 +23,10 @@ namespace Artemis.Core.Models.Profile.LayerProperties.Types
var heightDiff = NextKeyframe.Value.Height - CurrentKeyframe.Value.Height;
CurrentValue = new SKSize(CurrentKeyframe.Value.Width + widthDiff * keyframeProgressEased, CurrentKeyframe.Value.Height + heightDiff * keyframeProgressEased);
}
public override List<PropertyInfo> GetDataBindingProperties()
{
return typeof(SKSize).GetProperties().ToList();
}
}
}
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
using Artemis.Core.Services.Interfaces;
namespace Artemis.Core.Services
{
public class DataBindingService : IDataBindingService
{
}
}
@@ -0,0 +1,6 @@
namespace Artemis.Core.Services.Interfaces
{
public interface IDataBindingService : IArtemisService
{
}
}