Beispiel #1
0
        protected virtual void DefinedPort(IUnitPort port, UnitPortDescription description)
        {
            var reflectedPortDescription = ReflectedPortDescription(port);

            if (reflectedPortDescription != null)
            {
                description.CopyFrom(reflectedPortDescription);
            }
        }
Beispiel #2
0
        public void DescribePort(IUnitPort port, UnitPortDescription description)
        {
            description.getMetadata = (unitMetadata) => unitMetadata.StaticObject(port);

            // Only defined units can have specific ports
            if (state == State.Defined)
            {
                DefinedPort(port, description);
            }
        }
        protected override void DefinedPort(IUnitPort port, UnitPortDescription description)
        {
            base.DefinedPort(port, description);

            var documentation = member.info.Documentation();

            if (port == unit.enter)
            {
                description.label   = "Invoke";
                description.summary = "The entry point to invoke the method.";

                if (member.isGettable)
                {
                    description.summary += " You can still get the return value without connecting this port.";
                }
            }
            else if (port == unit.exit)
            {
                description.summary = "The action to call once the method has been invoked.";
            }
            else if (port == unit.result)
            {
                if (member.isGettable)
                {
                    description.summary = documentation?.returns;
                }

                if (unit.supportsChaining && unit.chainable)
                {
                    description.showLabel = true;
                }
            }
            else if (port == unit.targetOutput)
            {
                if (member.isGettable)
                {
                    description.showLabel = true;
                }
            }
            else if (port is ValueInput && unit.inputParameters.ContainsValue((ValueInput)port))
            {
                var parameter = member.GetParameterInfos().Single(p => "%" + p.Name == port.key);

                description.label   = parameter.DisplayName();
                description.summary = documentation?.ParameterSummary(parameter);
            }
            else if (port is ValueOutput && unit.outputParameters.ContainsValue((ValueOutput)port))
            {
                var parameter = member.GetParameterInfos().Single(p => "&" + p.Name == port.key);

                description.label   = parameter.DisplayName();
                description.summary = documentation?.ParameterSummary(parameter);
            }
        }
        protected override void DefinedPort(IUnitPort port, UnitPortDescription description)
        {
            base.DefinedPort(port, description);

            foreach (var branch in unit.branches)
            {
                if (branch.Value == port)
                {
                    var enumValue = (Enum)branch.Key;

                    description.label   = enumValue.DisplayName();
                    description.summary = $"The value to return if the enum has the value '{enumValue}'.";
                }
            }
        }
Beispiel #5
0
        protected override void DefinedPort(IUnitPort port, UnitPortDescription description)
        {
            base.DefinedPort(port, description);

            if (port == unit.Target)
            {
                description.summary =
                    "A player input component used to list available actions and find the referenced InputAction";
            }
            if (port == unit.InputAction)
            {
                description.summary =
                    "An input action, either from the linked player input component or directly connected";
            }
        }
Beispiel #6
0
        protected override void DefinedPort(IUnitPort port, UnitPortDescription description)
        {
            base.DefinedPort(port, description);

            var definition = unit.graph.validPortDefinitions.OfType <IUnitInputPortDefinition>().SingleOrDefault(d => d.key == port.key);

            if (definition != null)
            {
                description.label   = definition.Label();
                description.summary = definition.summary;

                if (definition.hideLabel)
                {
                    description.showLabel = false;
                }
            }
        }