Gradient
This commit is contained in:
@@ -272,6 +272,80 @@ namespace Ichni.Editor
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public CompositeParameterWindow SetAsGradientColorKeys()
|
||||
{
|
||||
void GenerateUnit(GradientColorKey content)
|
||||
{
|
||||
DynamicUIGradientColorKeyUnit unit = Instantiate(unitPrefab, windowRect).GetComponent<DynamicUIGradientColorKeyUnit>();
|
||||
unitList.Add(unit);
|
||||
unit.SetUnit(this, content);
|
||||
}
|
||||
|
||||
unitPrefab = EditorManager.instance.basePrefabs.gradientColorKeyUnit;
|
||||
Gradient gradient = connectedBaseElement.GetType().GetField(parameterName).GetValue(connectedBaseElement) as Gradient;
|
||||
List<GradientColorKey> colorKeys = gradient.colorKeys.ToList();
|
||||
foreach (GradientColorKey colorKey in colorKeys)
|
||||
{
|
||||
GenerateUnit(colorKey);
|
||||
}
|
||||
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
|
||||
|
||||
addNewUnitButton.onClick.AddListener(() =>
|
||||
{
|
||||
GenerateUnit(new GradientColorKey(Color.white, 1));
|
||||
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
|
||||
});
|
||||
|
||||
ApplyParameters = () =>
|
||||
{
|
||||
List<GradientColorKey> newColorKeys = new List<GradientColorKey>();
|
||||
foreach (var unit in unitList)
|
||||
{
|
||||
newColorKeys.Add((unit as DynamicUIGradientColorKeyUnit).GetValue());
|
||||
}
|
||||
(connectedBaseElement.GetType().GetField(parameterName).GetValue(connectedBaseElement) as Gradient).colorKeys = newColorKeys.ToArray();
|
||||
};
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public CompositeParameterWindow SetAsGradientAlphaKeys()
|
||||
{
|
||||
void GenerateUnit(GradientAlphaKey content)
|
||||
{
|
||||
DynamicUIGradientAlphaKeyUnit unit = Instantiate(unitPrefab, windowRect).GetComponent<DynamicUIGradientAlphaKeyUnit>();
|
||||
unitList.Add(unit);
|
||||
unit.SetUnit(this, content);
|
||||
}
|
||||
|
||||
unitPrefab = EditorManager.instance.basePrefabs.gradientAlphaKeyUnit;
|
||||
Gradient gradient = connectedBaseElement.GetType().GetField(parameterName).GetValue(connectedBaseElement) as Gradient;
|
||||
List<GradientAlphaKey> alphaKeys = gradient.alphaKeys.ToList();
|
||||
foreach (GradientAlphaKey alphaKey in alphaKeys)
|
||||
{
|
||||
GenerateUnit(alphaKey);
|
||||
}
|
||||
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
|
||||
|
||||
addNewUnitButton.onClick.AddListener(() =>
|
||||
{
|
||||
GenerateUnit(new GradientAlphaKey(1, 1));
|
||||
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
|
||||
});
|
||||
|
||||
ApplyParameters = () =>
|
||||
{
|
||||
List<GradientAlphaKey> newAlphaKeys = new List<GradientAlphaKey>();
|
||||
foreach (var unit in unitList)
|
||||
{
|
||||
newAlphaKeys.Add((unit as DynamicUIGradientAlphaKeyUnit).GetValue());
|
||||
}
|
||||
(connectedBaseElement.GetType().GetField(parameterName).GetValue(connectedBaseElement) as Gradient).alphaKeys = newAlphaKeys.ToArray();
|
||||
};
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public CompositeParameterWindow SetAsStringIntDictionary()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user