Exemplo n.º 1
0
        /* Initialize port's properties from loaded template */
        public void InitializeFromTemplate(Node parent, PortDirection direction, api.PortTemplate template)
        {
            ParentNode = parent;
            Direction  = direction;

            // Note: This Id should be obtained from backend on save
            Id   = Guid.NewGuid().ToString();
            name = Id;

            Name = template.name;

            // Few steps to set Type
            var type = Utils.DataTypeFromString(template.kind);

            Type            = type;
            iconField.color = Utils.GetDataTypeColor(type);

            if (valueField && null == template.defaultValue)
            {
                valueField.enabled = false;
            }
            else if (valueField)
            {
                valueField.enabled = true;
                Value = template.defaultValue;
            }
        }
Exemplo n.º 2
0
        private void CreateIngressPortFromTemplate(api.PortTemplate template)
        {
            var port_obj = Instantiate(ingressPortPrefab, ingressContainer.transform);
            var port     = port_obj.GetComponent <Port>();

            port.InitializeFromTemplate(this, PortDirection.Ingress, template);

            IngressPorts.Add(port);
        }