mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
Profile editor - Performance improvements
This commit is contained in:
1 parent
447112729d
commit
1d789bf23c
13 files changed
+58
-83
No files matched your search
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
internal class PercentageOfModifierType : DataBindingModifierType
|
||||
{
|
||||
public PercentageOfModifierType()
|
||||
{
|
||||
PreferredParameterType = typeof(float);
|
||||
}
|
||||
|
||||
public override IReadOnlyCollection<Type> CompatibleTypes => Constants.NumberTypes;
|
||||
|
||||
public override string Description => "Percentage of";
|
||||
public override string Icon => "Percent";
|
||||
|
||||
public override object Apply(object currentValue, object parameterValue)
|
||||
{
|
||||
var parameter = Convert.ToSingle(parameterValue);
|
||||
// Ye ye none of that
|
||||
if (parameter == 0f)
|
||||
return 100f;
|
||||
|
||||
return 100f / Convert.ToSingle(parameterValue) * Convert.ToSingle(currentValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user