Exemple #1
0
    // implement build methods here
    public override void SetFields(string[] fields, GameObject Field)
    {
        Section = Field.AddComponent(typeof(PropertySection)) as PropertySection;

        Section.Position = ParseInt(fields[0]);
        Section.Id       = fields[1];
        // [2] is blank
        Section.Group = fields[3];
        // [4] is action
        // [5] is canBeBought which is stored
        // [6] is blank
        Section.Price = ParseInt(fields[7]);
        section.Rent  = ParseInt(fields[8]);
        // [9] is blank
        Section.OneHouse   = ParseInt(fields[10]);
        Section.TwoHouse   = ParseInt(fields[11]);
        Section.ThreeHouse = ParseInt(fields[12]);
        Section.FourHouse  = ParseInt(fields[13]);
        Section.OneHotel   = ParseInt(fields[14]);
    }
        public bool Equals(ContentTypeProperty input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     Name == input.Name ||
                     (Name != null && Name.Equals(input.Name))
                     ) &&
                 (
                     RootPropertyName == input.RootPropertyName ||
                     (RootPropertyName != null && RootPropertyName.Equals(input.RootPropertyName))
                 ) &&
                 (
                     ReadableName == input.ReadableName ||
                     (ReadableName != null && ReadableName.Equals(input.ReadableName))
                 ) &&
                 (
                     Value == input.Value ||
                     (Value != null && Value.Equals(input.Value))
                 ) &&
                 (
                     PropertyDescription == input.PropertyDescription ||
                     (PropertyDescription != null && PropertyDescription.Equals(input.PropertyDescription))
                 ) &&
                 (
                     Localizable == input.Localizable ||
                     (Localizable != null && Localizable.Equals(input.Localizable))
                 ) &&
                 (
                     Fallback == input.Fallback ||
                     (Fallback != null && Fallback.Equals(input.Fallback))
                 ) &&
                 (
                     Enabled == input.Enabled ||
                     (Enabled != null && Enabled.Equals(input.Enabled))
                 ) &&
                 (
                     Order == input.Order ||
                     (Order.Equals(input.Order))
                 ) &&
                 (
                     Visible == input.Visible ||
                     (Visible != null && Visible.Equals(input.Visible))
                 ) &&
                 (
                     IsTitle == input.IsTitle ||
                     (IsTitle != null && IsTitle.Equals(input.IsTitle))
                 ) &&
                 (
                     Required == input.Required ||
                     (Required != null && Required.Equals(input.Required))
                 ) &&
                 (
                     MaxLength == input.MaxLength ||
                     (MaxLength.Equals(input.MaxLength))
                 ) &&
                 (
                     MaxByteLength == input.MaxByteLength ||
                     (MaxByteLength.Equals(input.MaxByteLength))
                 ) &&
                 (
                     MaxFileSize == input.MaxFileSize ||
                     (MaxFileSize.Equals(input.MaxFileSize))
                 ) &&
                 (
                     Regexp == input.Regexp ||
                     (Regexp != null && Regexp.Equals(input.Regexp))
                 ) &&
                 (
                     ValidateAs == input.ValidateAs ||
                     (ValidateAs != null && ValidateAs.Equals(input.ValidateAs))
                 ) &&
                 (
                     RssAttribute == input.RssAttribute ||
                     (RssAttribute != null && RssAttribute.Equals(input.RssAttribute))
                 ) &&
                 (
                     VisibleDependency == input.VisibleDependency ||
                     (VisibleDependency != null && VisibleDependency.Equals(input.VisibleDependency))
                 ) &&
                 (
                     VisibleOn == input.VisibleOn ||
                     (VisibleOn != null && VisibleOn.Equals(input.VisibleOn))
                 ) &&
                 (
                     Datatype == input.Datatype ||
                     (Datatype != null && Datatype.Equals(input.Datatype))
                 ) &&
                 (
                     Attributes == input.Attributes ||
                     (Attributes != null && Attributes.SequenceEqual(input.Attributes))
                 ) &&
                 (
                     ChildProperties == input.ChildProperties ||
                     (ChildProperties != null && ChildProperties.SequenceEqual(input.ChildProperties))
                 ) &&
                 (
                     ContentTypeAllowed == input.ContentTypeAllowed ||
                     (ContentTypeAllowed != null && ContentTypeAllowed.Equals(input.ContentTypeAllowed))
                 ) &&
                 (
                     BindToProperty == input.BindToProperty ||
                     (BindToProperty != null && BindToProperty.Equals(input.BindToProperty))
                 ) &&
                 (
                     BoundRegex == input.BoundRegex ||
                     (BoundRegex != null && BoundRegex.Equals(input.BoundRegex))
                 ) &&
                 (
                     RepresentationSelection == input.RepresentationSelection ||
                     (RepresentationSelection != null && RepresentationSelection.SequenceEqual(input.RepresentationSelection))
                 ) &&
                 (
                     DefaultValues == input.DefaultValues ||
                     (DefaultValues != null && DefaultValues.SequenceEqual(input.DefaultValues))
                 ) &&
                 (
                     IsExternalAllowed == input.IsExternalAllowed ||
                     (IsExternalAllowed != null && IsExternalAllowed.Equals(input.IsExternalAllowed))
                 ) &&
                 (
                     PropertySection == input.PropertySection ||
                     (PropertySection != null && PropertySection.Equals(input.PropertySection))
                 ) &&
                 (
                     Weight == input.Weight ||
                     (Weight.Equals(input.Weight))
                 ) &&
                 (
                     Entitytype == input.Entitytype ||
                     (Entitytype != null && Entitytype.Equals(input.Entitytype))
                 ) &&
                 (
                     IsCombo == input.IsCombo ||
                     (IsCombo != null && IsCombo.Equals(input.IsCombo))
                 ) &&
                 (
                     SuppressProperty == input.SuppressProperty ||
                     (SuppressProperty != null && SuppressProperty.Equals(input.SuppressProperty))
                 ) &&
                 (
                     LegalContentTypes == input.LegalContentTypes ||
                     (LegalContentTypes != null && LegalContentTypes.SequenceEqual(input.LegalContentTypes))
                 ) &&
                 (
                     RepresentationValidationString == input.RepresentationValidationString ||
                     (RepresentationValidationString != null && RepresentationValidationString.Equals(input.RepresentationValidationString))
                 ) &&
                 (
                     MinWidth == input.MinWidth ||
                     (MinWidth.Equals(input.MinWidth))
                 ) &&
                 (
                     MaxWidth == input.MaxWidth ||
                     (MaxWidth.Equals(input.MaxWidth))
                 ) &&
                 (
                     MinHeight == input.MinHeight ||
                     (MinHeight.Equals(input.MinHeight))
                 ) &&
                 (
                     MaxHeight == input.MaxHeight ||
                     (MaxHeight.Equals(input.MaxHeight))
                 ) &&
                 (
                     IsVideo == input.IsVideo ||
                     (IsVideo != null && IsVideo.Equals(input.IsVideo))
                 ) &&
                 (
                     IsImage == input.IsImage ||
                     (IsImage != null && IsImage.Equals(input.IsImage))
                 ));
        }
        void CreateProperties()
        {
            var props = node.GetType().GetProperties();

            Dictionary <string, List <PropertyInfo> > sections = new Dictionary <string, List <PropertyInfo> >();

            foreach (var p in props)
            {
                var s = p.GetCustomAttribute <SectionAttribute>();

                if ((!p.PropertyType.Equals(typeof(float)) &&
                     !p.PropertyType.Equals(typeof(int)) &&
                     !p.PropertyType.Equals(typeof(bool)) &&
                     !p.PropertyType.IsEnum &&
                     !p.PropertyType.Equals(typeof(string[])) &&
                     p.CustomAttributes.Count() == 0) ||
                    p.GetCustomAttribute <HidePropertyAttribute>() != null)
                {
                    continue;
                }

                string section = null;
                if (s == null)
                {
                    section = "Default";
                }
                else
                {
                    section = s.Section;
                }

                List <PropertyInfo> sectionProps = null;

                if (sections.TryGetValue(section, out sectionProps))
                {
                    sectionProps.Add(p);
                }
                else
                {
                    sectionProps = new List <PropertyInfo>();
                    sectionProps.Add(p);
                    sections[section] = sectionProps;
                }
            }

            foreach (var s in sections.Keys)
            {
                List <PropertyInfo> list = sections[s];

                PropertySection st = new PropertySection()
                {
                    Title = s
                };

                Stack.Children.Add(st);
                labels.Add(st);

                foreach (var p in list)
                {
                    string name = p.Name;
                    propertyLookup[name] = p;
                    CreateUIElement(p.PropertyType, p, name);
                }
            }
        }