예제 #1
0
        public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
        {
            PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);

            for (int i = 0; i < ((Dictionary <string, object>)value).Count; i++)
            {
                CollectionPropertyDescriptor pd = new CollectionPropertyDescriptor(((Dictionary <string, object>)value), i);
                pds.Add(pd);
            }

            return(pds);
        }
예제 #2
0
        public PropertyDescriptorCollection GetProperties()
        {
            PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);
            Dictionary <string, object>  d   = new Dictionary <string, object>();

            for (int i = 0; i < this.List.Count; i++)
            {
                string n = this.List[i].GetType().Name;

                switch (this.List[i].GetType().Name)
                {
                case "Behavior":
                    Behavior b = (Behavior)this.List[i];
                    if (b.script != null)
                    {
                        n = b.script.name;
                    }
                    break;

                case "BlueprintBehavior":
                    BlueprintBehavior bb = (BlueprintBehavior)this.List[i];
                    if (bb.blueprint != null)
                    {
                        n = bb.blueprint.name;
                    }
                    break;
                }

                int it = 0;

                foreach (string k in d.Keys)
                {
                    if (k.Equals(n) || k.Equals(n + " (" + it.ToString() + ")"))
                    {
                        it += 1;
                    }
                }
                if (it > 0)
                {
                    n += " (" + it.ToString() + ")";
                }

                d.Add(n, this.List[i]);

                CollectionPropertyDescriptor pd = new CollectionPropertyDescriptor(d, i);
                pds.Add(pd);
            }

            return(pds);
        }
예제 #3
0
        public PropertyDescriptorCollection GetProperties()
        {
            PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);
            Dictionary<string, object> d = new Dictionary<string, object>();

            for (int i = 0; i < this.List.Count; i++)
            {
                string n = this.List[i].GetType().Name;

                switch (this.List[i].GetType().Name)
                {
                    case "Behavior":
                        Behavior b = (Behavior)this.List[i];
                        if (b.script != null)
                            n = b.script.name;
                        break;
                    case "BlueprintBehavior":
                        BlueprintBehavior bb = (BlueprintBehavior)this.List[i];
                        if (bb.blueprint != null)
                            n = bb.blueprint.name;
                        break;
                }

                int it = 0;

                foreach (string k in d.Keys)
                {
                    if (k.Equals(n) || k.Equals(n + " (" + it.ToString() + ")"))
                        it += 1;
                }
                if (it > 0)
                    n += " (" + it.ToString() + ")";

                d.Add(n, this.List[i]);

                CollectionPropertyDescriptor pd = new CollectionPropertyDescriptor(d, i);
                pds.Add(pd);
            }

            return pds;
        }
예제 #4
0
        public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
        {
            PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);

            for (int i = 0; i < ((Dictionary<string, object>)value).Count; i++)
            {
                CollectionPropertyDescriptor pd = new CollectionPropertyDescriptor(((Dictionary<string, object>)value), i);
                pds.Add(pd);
            }

            return pds;
        }