暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

ValueInputWidget.cs 1.1KB

1234567891011121314151617181920212223242526272829303132333435
  1. using UnityEngine;
  2. namespace Unity.VisualScripting
  3. {
  4. [Widget(typeof(ValueInput))]
  5. public class ValueInputWidget : UnitInputPortWidget<ValueInput>
  6. {
  7. public ValueInputWidget(FlowCanvas canvas, ValueInput port) : base(canvas, port)
  8. {
  9. color = ValueConnectionWidget.DetermineColor(port.type);
  10. }
  11. protected override bool showInspector => port.hasDefaultValue && !port.hasValidConnection;
  12. protected override bool colorIfActive => !BoltFlow.Configuration.animateControlConnections || !BoltFlow.Configuration.animateValueConnections;
  13. public override Color color { get; }
  14. protected override Texture handleTextureConnected => BoltFlow.Icons.valuePortConnected?[12];
  15. protected override Texture handleTextureUnconnected => BoltFlow.Icons.valuePortUnconnected?[12];
  16. public override Metadata FetchInspectorMetadata()
  17. {
  18. if (port.hasDefaultValue)
  19. {
  20. return metadata["_defaultValue"].Cast(port.type);
  21. }
  22. else
  23. {
  24. return null;
  25. }
  26. }
  27. }
  28. }