public GameDataAttributeRule(SF.Tong.Schema.Property property)
 {
     SchemaProperty = property;
 }
 public GameDataChildRule(SF.Tong.Schema.Property property)
 {
     SchemaProperty = property;
 }
        void AddProperty(DomNodeType domNodeType, SF.Tong.Schema.Property prop, PropertyDescriptorCollection newDescs)
        {
            if (prop.Type == SF.Tong.Schema.PropertyType.Enum)
            {
                SF.Tong.Schema.EnumTypeInfo enumInfo;
                if (!m_EnumDefines.TryGetValue(prop.TypeName, out enumInfo))
                {
                    Outputs.WriteLine(OutputMessageType.Error, "Invalid enum type {1} for property {0}", prop.Name, prop.TypeName);
                    return;
                }

                AttributeInfo newAttr = null;
                if (prop.IsArray)
                {
                    newAttr = new AttributeInfo(prop.Name, enumInfo.ArrayValueType);
                }
                else
                {
                    newAttr = new AttributeInfo(prop.Name, enumInfo.SingleValueType);
                }

                if (prop.Default == null)
                {
                    newAttr.DefaultValue = enumInfo.Value[0];
                }
                else
                {
                    newAttr.DefaultValue = prop.Default;
                }
                newAttr.AddRule(enumInfo.EnumRule);
                var newDesc = new AttributePropertyDescriptor(newAttr.Name, newAttr, "Node", newAttr.Name, false, new EnumUITypeEditor(enumInfo.Value), new EnumTypeConverter(enumInfo.Value));
                newDescs.Add(newDesc);
                domNodeType.Define(newAttr);
                return;
            }

            var propTypeInfo = m_PropertyInfos[(int)prop.Type];

            if (propTypeInfo.AttributeInfo != null)
            {
                AttributeInfo newAttr = null;
                if (prop.IsArray)
                {
                    newAttr = propTypeInfo.ListAttributeInfo.Clone(prop.Name);
                }
                else
                {
                    newAttr = propTypeInfo.AttributeInfo.Clone(prop.Name);
                }

                if (!string.IsNullOrEmpty(prop.Default))
                {
                    newAttr.DefaultValue = newAttr.Type.Convert(prop.Default);
                }

                newAttr.AddRule(new GameDataAttributeRule(prop));

                var newDesc = new AttributePropertyDescriptor(newAttr.Name, newAttr, "Node", newAttr.Name, false, propTypeInfo.Editor, propTypeInfo.Converter);
                newDescs.Add(newDesc);
                domNodeType.Define(newAttr);
            }
            else if (propTypeInfo.ChildInfo != null)
            {
                var newChild = propTypeInfo.ChildInfo.Clone(prop.Name, prop.IsArray);

                newChild.AddRule(new GameDataChildRule(prop));

                object editor  = m_ChildCollectionEditor;
                var    newDesc = new ChildPropertyDescriptor(newChild.Name, newChild, "Node", newChild.Name, false, editor, propTypeInfo.Converter);
                newDescs.Add(newDesc);
                domNodeType.Define(newChild);
            }
        }