Inheritance: GraphItemConfiguration
コード例 #1
0
        private void LoadByRefelection()
        {
            AllAttributes = NodeType.GetPropertiesWithAttributeByType <GraphItemAttribute>().ToArray();
            foreach (var item in AllAttributes)
            {
                var proxy = item.Value as ConfigProxy;
                if (proxy != null)
                {
                    var c = new ConfigurationProxyConfiguration()
                    {
                        ReferenceType  = typeof(GraphItemConfiguration),
                        SourceType     = typeof(GraphItemConfiguration),
                        IsInput        = false,
                        IsOutput       = false,
                        OrderIndex     = proxy.OrderIndex,
                        Visibility     = proxy.Visibility,
                        ConfigSelector =
                            (node) => ((IEnumerable)item.Key.GetValue(node, null)).Cast <GraphItemConfiguration>()
                    };
                    GraphItemConfigurations.Add(c);
                    continue;
                }
                var slot = item.Value as Slot;
                if (slot != null)
                {
                    var result = CreateSlotConfiguration(item.Key, slot);
                    result.OrderIndex = item.Value.OrderIndex;
                    GraphItemConfigurations.Add(result);
                    Slots.Add(item.Key, slot);
                    if (result.IsOutput)
                    {
                        //Debug.Log(string.Format("Registering output {0} : {1}", result.ReferenceType, result.SourceType.Name));
                        // TODO ??

                        Container.RegisterConnectable(result.ReferenceType, result.SourceType);
                    }
                    else
                    {
                        // Debug.Log(string.Format("Registering input {0} : {1}", result.SourceType.Name, result.ReferenceType));

                        Container.RegisterConnectable(result.SourceType, result.ReferenceType);
                    }

                    continue;
                }

                var section = item.Value as Section;
                if (section != null)
                {
                    var property1 = item.Key;
                    var section1  = section;
                    var result    = CreateSectionConfiguration(property1, section1);
                    result.OrderIndex = section.OrderIndex;
                    GraphItemConfigurations.Add(result);
                }
            }

            SerializedProperties = NodeType.GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(p => p.GetCustomAttributes(typeof(JsonProperty), true).Any()).ToArray();
        }
コード例 #2
0
        private void LoadByRefelection()
        {

            AllAttributes = NodeType.GetPropertiesWithAttributeByType<GraphItemAttribute>().ToArray();
            foreach (var item in AllAttributes)
            {
                var proxy = item.Value as ConfigProxy;
                if (proxy != null)
                {
                    var c = new ConfigurationProxyConfiguration()
                    {
                        ReferenceType = typeof(GraphItemConfiguration),
                        SourceType = typeof(GraphItemConfiguration),
                        IsInput = false,
                        IsOutput =  false,
                        OrderIndex = proxy.OrderIndex,
                        Visibility = proxy.Visibility,
                        ConfigSelector =
                            (node) => ((IEnumerable) item.Key.GetValue(node, null)).Cast<GraphItemConfiguration>()
                    };
                    GraphItemConfigurations.Add(c);
                    continue;
                }
                var slot = item.Value as Slot;
                if (slot != null)
                {
                    var result = CreateSlotConfiguration(item.Key, slot);
                    result.OrderIndex = item.Value.OrderIndex;
                    GraphItemConfigurations.Add(result);
                    Slots.Add(item.Key, slot);
                    if (result.IsOutput) {
                        //Debug.Log(string.Format("Registering output {0} : {1}", result.ReferenceType, result.SourceType.Name));
                        // TODO ??

                        Container.RegisterConnectable(result.ReferenceType, result.SourceType);

                    }
                    else
                    {
                       // Debug.Log(string.Format("Registering input {0} : {1}", result.SourceType.Name, result.ReferenceType));

                        Container.RegisterConnectable(result.SourceType, result.ReferenceType);

                    }
                    
                    continue;
                }

                var section = item.Value as Section;
                if (section != null)
                {
                    var property1 = item.Key;
                    var section1 = section;
                    var result = CreateSectionConfiguration(property1, section1);
                    result.OrderIndex = section.OrderIndex;
                    GraphItemConfigurations.Add(result);

                }

            }

            SerializedProperties = NodeType.GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(p=>p.GetCustomAttributes(typeof(JsonProperty), true).Any()).ToArray();
        }