You're breathtaking!

This commit is contained in:
Wojtek Figat
2020-12-07 23:40:54 +01:00
commit 6fb9eee74c
5143 changed files with 1153594 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
// Copyright (c) 2012-2020 Wojciech Figat. All rights reserved.
using FlaxEditor.GUI;
namespace FlaxEditor.Surface.Elements
{
/// <summary>
/// Combo box for enum element.
/// </summary>
/// <seealso cref="EnumComboBox" />
/// <seealso cref="ISurfaceNodeElement" />
/// [HideInEditor]
public class EnumValue : EnumComboBox, ISurfaceNodeElement
{
/// <inheritdoc />
public SurfaceNode ParentNode { get; }
/// <inheritdoc />
public NodeElementArchetype Archetype { get; }
/// <summary>
/// Gets the surface.
/// </summary>
public VisjectSurface Surface => ParentNode.Surface;
/// <inheritdoc />
public EnumValue(SurfaceNode parentNode, NodeElementArchetype archetype)
: base(Scripting.TypeUtils.GetType(archetype.Text).Type)
{
X = archetype.ActualPositionX;
Y = archetype.ActualPositionY;
Width = archetype.Size.X;
ParentNode = parentNode;
Archetype = archetype;
Value = (int)ParentNode.Values[Archetype.ValueIndex];
}
/// <inheritdoc />
protected override void OnValueChanged()
{
if ((int)ParentNode.Values[Archetype.ValueIndex] != Value)
{
// Edit value
ParentNode.SetValue(Archetype.ValueIndex, Value);
}
base.OnValueChanged();
}
}
}