File size: 1,138 Bytes
18a519f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using UnityEngine;

namespace Unity.VisualScripting
{
    [Widget(typeof(ValueInput))]
    public class ValueInputWidget : UnitInputPortWidget<ValueInput>
    {
        public ValueInputWidget(FlowCanvas canvas, ValueInput port) : base(canvas, port)
        {
            color = ValueConnectionWidget.DetermineColor(port.type);
        }

        protected override bool showInspector => port.hasDefaultValue && !port.hasValidConnection;

        protected override bool colorIfActive => !BoltFlow.Configuration.animateControlConnections || !BoltFlow.Configuration.animateValueConnections;

        public override Color color { get; }

        protected override Texture handleTextureConnected => BoltFlow.Icons.valuePortConnected?[12];

        protected override Texture handleTextureUnconnected => BoltFlow.Icons.valuePortUnconnected?[12];

        public override Metadata FetchInspectorMetadata()
        {
            if (port.hasDefaultValue)
            {
                return metadata["_defaultValue"].Cast(port.type);
            }
            else
            {
                return null;
            }
        }
    }
}