Ejemplo n.º 1
0
        internal static void GetAttributes(FieldInfo field, out SectionAttribute section, out NameAttribute name,
                                           out DescriptionAttribute description, out SliderAttribute slider, out ChoiceAttribute choice)
        {
            // Must be assigned at least once, so assign to null first
            section     = null;
            name        = null;
            description = null;
            slider      = null;
            choice      = null;

            object[] attributes = field.GetCustomAttributes(true);
            foreach (object attribute in attributes)
            {
                if (attribute is SectionAttribute sectionAttribute)
                {
                    section = sectionAttribute;
                }
                else if (attribute is NameAttribute nameAttribute)
                {
                    name = nameAttribute;
                }
                else if (attribute is DescriptionAttribute descriptionAttribute)
                {
                    description = descriptionAttribute;
                }
                else if (attribute is SliderAttribute sliderAttribute)
                {
                    slider = sliderAttribute;
                }
                else if (attribute is ChoiceAttribute choiceAttribute)
                {
                    choice = choiceAttribute;
                }
            }
        }
Ejemplo n.º 2
0
        private void AddHeader(SectionAttribute section)
        {
            GameObject padding = NGUITools.AddChild(uiGrid.gameObject);
            GameObject header  = NGUITools.AddChild(uiGrid.gameObject);
            GameObject label   = NGUITools.AddChild(header, headerLabelPrefab);

            label.SetActive(true);
            label.transform.localPosition = new Vector2(-70, 0);
            label.name = "Custom Header (" + section.Title + ")";
            SetLabelText(label.transform, section.Title, section.Localize);

            lastHeader = new Header(header, padding);
        }