示例#1
0
        public void     OpenAddComponentWizard()
        {
            GenericTypesSelectorWizard wizard = GenericTypesSelectorWizard.Start(NGHubWindow.Title + " - Add Component", typeof(HubComponent), this.OnCreateComponent, true, true);

            wizard.EnableCategories = true;
            wizard.position         = new Rect(this.position.x, this.position.y + 60F, wizard.position.width, wizard.position.height);
        }
示例#2
0
        private static void     DrawComponentType(Rect rect, int index, bool isActive, bool isFocused)
        {
            float w = rect.width;

            rect.width = 60F;
            if (GUI.Button(rect, "Type") == true)
            {
                pickTypeIndex = index;
                GenericTypesSelectorWizard.Start("Pick Type", typeof(Component), OnCreate, true, true);
            }
            rect.x    += rect.width;
            rect.width = w - 180F;

            GUI.Label(rect, NGHierarchyEnhancer.colors[index].type == null ? "None" : NGHierarchyEnhancer.colors[index].type.Name, GeneralStyles.VerticalCenterLabel);
            rect.x += rect.width;

            rect.width = 60F;
            EditorGUI.BeginChangeCheck();
            NGHierarchyEnhancer.colors[pickTypeIndex].color = EditorGUI.ColorField(rect, NGHierarchyEnhancer.colors[pickTypeIndex].color);
            if (EditorGUI.EndChangeCheck() == true)
            {
                NGHierarchyEnhancer.SerializeComponentColors();
            }

            rect.x += rect.width;
            EditorGUI.BeginChangeCheck();
            NGHierarchyEnhancer.colors[pickTypeIndex].icon = EditorGUI.ObjectField(rect, NGHierarchyEnhancer.colors[pickTypeIndex].icon, typeof(Texture2D), false) as Texture2D;
            if (EditorGUI.EndChangeCheck() == true)
            {
                NGHierarchyEnhancer.SerializeComponentColors();
            }
        }
        private static void     PickType(int i)
        {
            FullscreenBindingsSettings settings = HQ.Settings.Get <FullscreenBindingsSettings>();
            GenericTypesSelectorWizard wizard   = GenericTypesSelectorWizard.Start(NGFullscreenBindingsWindow.Title, typeof(EditorWindow), (t) =>
            {
                if (t != null)
                {
                    settings.bindings[i].type = t.GetShortAssemblyType();
                }
                else
                {
                    settings.bindings[i].type = string.Empty;
                }
                HQ.InvalidateSettings();
                Utility.RepaintEditorWindow(typeof(NGSettingsWindow));
            }, true, true);

            wizard.EnableNullValue = true;
            wizard.SelectedType    = Type.GetType(settings.bindings[i].type);
        }