MehCode/Wrappers/3D/Tools/Panels/Node3dSpawnMenuButton.razor
@namespace Nodebox
<button style="@(ButtonColor.HasValue ? $"color: {ButtonColor.Value.Rgb}" : "")">
@Entry.Name
</button>
@code
{
public Library.Entry Entry { get; set; }
public Color? ButtonColor { get {
if (Entry.IsGenericType && Entry.Generics.Length > 0) {
return Entry.Generics[0].GetColor();
}
if (Entry.IsPolymorphic) {
return Color.White.Darken(0.1f);
}
var node = Entry.CreateNode();
if (node.InputPins.Count() > 0 && node.InputPins[0].Type != typeof(Polymorphic)) {
return node.InputPins[0].Type.GetColor();
}
if (node.OutputPins.Count() > 0 && node.OutputPins[0].Type != typeof(Polymorphic)) {
return node.OutputPins[0].Type.GetColor();
}
return null;
} }
protected override int BuildHash() => System.HashCode.Combine( Entry );
protected override void OnClick(MousePanelEvent e) {
var node3dTool = (Node3dTool)FindRootPanel().GetChild(0).UserData;
node3dTool.OnNodeSpawnRequested(Entry);
}
}