示例#1
0
        public static void CreateComponent()
        {
            var obj  = Selection.activeObject;
            var path = AssetDatabase.GetAssetPath(obj.GetInstanceID());

            WindowComponentLibraryChooser.Show((element) => {
                element.CopyTo(path);
            });
        }
        private static WindowComponentLibraryChooser GetInstance()
        {
            var editor = WindowComponentLibraryChooser.CreateInstance <WindowComponentLibraryChooser>();

            editor.title    = "UI.Windows Components Filter";
            editor.position = new Rect(0f, 0f, 1f, 1f);

            editor.ShowUtility();

            editor.UpdateSize();

            return(editor);
        }
示例#3
0
        public static void Show(System.Action <WindowComponentLibraryLinker.Item> onSelect)
        {
            var editor = WindowComponentLibraryChooser.GetInstance();

            editor.onSelect = (c) => {
                if (onSelect != null)
                {
                    onSelect(c);
                }
                editor.Close();
            };

            editor.Scan();
        }
示例#4
0
        private static WindowComponentLibraryChooser GetInstance()
        {
            var editor = WindowComponentLibraryChooser.CreateInstance <WindowComponentLibraryChooser>();
            var title  = "UI.Windows Components Filter";

                        #if !UNITY_4
            editor.titleContent = new GUIContent(title);
                        #else
            editor.title = title;
                        #endif
            editor.position = new Rect(0f, 0f, 1f, 1f);

            editor.ShowUtility();

            editor.UpdateSize();

            return(editor);
        }
示例#5
0
        public override void OnPreviewSettings()
        {
            base.OnPreviewSettings();

            var comp = this.selectedComponent;

            if (comp != null && comp.tag != LayoutTag.None)
            {
                EditorGUIUtility.labelWidth = 100f;

                comp.component = EditorGUILayout.ObjectField(comp.description.ToLower().UppercaseWords(), comp.component, typeof(WindowComponent), false) as WindowComponent;

                if (GUILayout.Button("...") == true)
                {
                    WindowComponentLibraryChooser.Show((element) => {
                        comp.component = element.mainComponent;
                        EditorUtility.SetDirty(comp.component);
                    });
                }

                EditorGUIUtility.LookLikeControls();
            }
        }