This commit is contained in:
2021-06-13 10:28:03 +02:00
parent eb70603c85
commit df2d24cbd3
7487 changed files with 943244 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
namespace Unity.VisualScripting
{
[Descriptor(typeof(CustomEvent))]
public class CustomEventDescriptor : EventUnitDescriptor<CustomEvent>
{
public CustomEventDescriptor(CustomEvent @event) : base(@event) { }
protected override string DefinedSubtitle()
{
return null;
}
protected override void DefinedPort(IUnitPort port, UnitPortDescription description)
{
base.DefinedPort(port, description);
var index = unit.argumentPorts.IndexOf(port as ValueOutput);
if (index >= 0)
{
description.label = "Arg. " + index;
}
}
}
}

View File

@@ -0,0 +1,24 @@
using System.Collections.Generic;
namespace Unity.VisualScripting
{
[Descriptor(typeof(IEventUnit))]
public class EventUnitDescriptor<TEvent> : UnitDescriptor<TEvent>
where TEvent : class, IEventUnit
{
public EventUnitDescriptor(TEvent @event) : base(@event) { }
protected override string DefinedSubtitle()
{
return "Event";
}
protected override IEnumerable<EditorTexture> DefinedIcons()
{
if (unit.coroutine)
{
yield return BoltFlow.Icons.coroutine;
}
}
}
}

View File

@@ -0,0 +1,10 @@
namespace Unity.VisualScripting
{
[Widget(typeof(IEventUnit))]
public sealed class EventUnitWidget : UnitWidget<IEventUnit>
{
public EventUnitWidget(FlowCanvas canvas, IEventUnit unit) : base(canvas, unit) { }
protected override NodeColorMix baseColor => NodeColor.Green;
}
}

View File

@@ -0,0 +1,13 @@
using UnityEditor;
namespace Unity.VisualScripting
{
[CustomEditor(typeof(GlobalMessageListener), true)]
public class GlobalMessageListenerEditor : Editor
{
public override void OnInspectorGUI()
{
EditorGUILayout.HelpBox("This component is automatically added to relay Unity messages to Bolt.", MessageType.Info);
}
}
}

View File

@@ -0,0 +1,13 @@
using UnityEditor;
namespace Unity.VisualScripting
{
[CustomEditor(typeof(MessageListener), true)]
public class MessageListenerEditor : Editor
{
public override void OnInspectorGUI()
{
EditorGUILayout.HelpBox("This component is automatically added to relay Unity messages to Bolt.", MessageType.Info);
}
}
}

View File

@@ -0,0 +1,20 @@
namespace Unity.VisualScripting
{
[Descriptor(typeof(TriggerCustomEvent))]
public class TriggerCustomEventDescriptor : UnitDescriptor<TriggerCustomEvent>
{
public TriggerCustomEventDescriptor(TriggerCustomEvent trigger) : base(trigger) { }
protected override void DefinedPort(IUnitPort port, UnitPortDescription description)
{
base.DefinedPort(port, description);
var index = unit.arguments.IndexOf(port as ValueInput);
if (index >= 0)
{
description.label = "Arg. " + index;
}
}
}
}