コード例 #1
0
        public OdinAttributeExampleItem(Type attributeType, OdinRegisterAttributeAttribute registration)
        {
            if (attributeType == null)
            {
                throw new ArgumentNullException("attributeType");
            }

            this.attributeType   = attributeType;
            this.registration    = registration;
            this.Name            = this.attributeType.GetNiceName().SplitPascalCase();
            this.DrawCodeExample = true;

            var exampleInfos = AttributeExampleUtilities.GetAttributeExampleInfos(attributeType);

            this.examples = new AttributeExamplePreview[exampleInfos.Length];
            for (int i = 0; i < exampleInfos.Length; i++)
            {
                this.examples[i] = new AttributeExamplePreview(exampleInfos[i]);
            }

            this.tabGroup = new GUITabGroup()
            {
                ToolbarHeight = 30,
            };
            for (int i = 0; i < exampleInfos.Length; i++)
            {
                this.tabGroup.RegisterTab(exampleInfos[i].Name);
            }
        }
コード例 #2
0
        protected override void Initialize()
        {
            this.tabGroup    = SirenixEditorGUI.CreateAnimatedTabGroup(this.Property);
            this.currentPage = this.GetPersistentValue <int>("CurrentPage", 0);
            this.tabs        = new List <Tab>();
            var addLastTabs = new List <Tab>();

            for (int j = 0; j < this.Property.Children.Count; j++)
            {
                var child = this.Property.Children[j];
                var added = false;

                if (child.Info.PropertyType == PropertyType.Group)
                {
                    var attrType = child.GetAttribute <PropertyGroupAttribute>().GetType();

                    if (attrType.IsNested && attrType.DeclaringType == typeof(TabGroupAttribute))
                    {
                        // This is a tab subgroup; add all its children to a tab for that subgroup
                        var tab = new Tab();
                        tab.TabName = child.NiceName;
                        tab.Title   = new StringMemberHelper(this.Property, child.Name.TrimStart('#'));
                        for (int i = 0; i < child.Children.Count; i++)
                        {
                            tab.InspectorProperties.Add(child.Children[i]);
                        }

                        this.tabs.Add(tab);
                        added = true;
                    }
                }

                if (!added)
                {
                    // This is a group member of the tab group itself, so it gets its own tab
                    var tab = new Tab();
                    tab.TabName = child.NiceName;
                    tab.Title   = new StringMemberHelper(this.Property, child.Name.TrimStart('#'));
                    tab.InspectorProperties.Add(child);
                    addLastTabs.Add(tab);
                }
            }

            foreach (var tab in addLastTabs)
            {
                this.tabs.Add(tab);
            }

            for (int i = 0; i < this.tabs.Count; i++)
            {
                this.tabGroup.RegisterTab(this.tabs[i].TabName);
            }

            var currentTab       = this.tabs[this.currentPage.Value];
            var selectedTabGroup = this.tabGroup.RegisterTab(currentTab.TabName);

            this.tabGroup.SetCurrentPage(selectedTabGroup);
        }
コード例 #3
0
        public TrickOverViewItem(AExample_Base aExampleBase)
        {
            this.DrawCodeExample = true;
            if (aExampleBase == null)
            {
                Debug.LogError("AExampleBase数据为空,请检查类型");
                return;
            }
            m_Example = aExampleBase;

            this.m_TrickOverViewPreviewDrawer = new TrickOverViewPreview(m_Example);
            this.tabGroup = new GUITabGroup
            {
                ToolbarHeight = 30f
            };

            this.tabGroup.RegisterTab(m_Example.GetTrickOverViewInfo().Name);
        }
コード例 #4
0
        public TrickOverViewItem(Type type)
        {
            this.DrawCodeExample = true;
            AExample_Base aExampleBase =
                AllTrickOverViewUtilities.GetExampleByType(type);

            if (aExampleBase == null)
            {
                return;
            }

            TrickOverViewInfo trickOverViewInfo = aExampleBase.GetTrickOverViewInfo();

            this.Name        = trickOverViewInfo.Name;
            this.Description = trickOverViewInfo.Description;

            this.m_TrickOverViewPreviewDrawer = new TrickOverViewPreview(trickOverViewInfo);
            this.tabGroup = new GUITabGroup
            {
                ToolbarHeight = 30f
            };

            this.tabGroup.RegisterTab(trickOverViewInfo.Name);
        }