예제 #1
0
        void OnGUI()
        {
            Event  e        = Event.current;
            string newTitle = tgt.title;

            newTitle = EditorGUILayout.TextField(tgt.title);

            if (tgt.title != newTitle)
            {
                if (tgt.GetType() == typeof(EditorPlusHotbar))
                {
                    EditorPlusHotbar casted = ((EditorPlusHotbar)tgt);
                    if (casted.useAutoSave)
                    {
                        casted.ClearSave(tgt.title);
                        tgt.title = newTitle;
                        casted.SaveHotbar();
                    }
                }
                tgt.title = newTitle;
                tgt.Repaint();
            }

            if (e.isKey)
            {
                if (e.keyCode == KeyCode.Return)
                {
                    Close();
                }
            }
        }
예제 #2
0
        public static void Init()
        {
            EditorPlusHotbar w = CreateInstance <EditorPlusHotbar>();

            //window = (EditorPlusHotbar)EditorWindow.GetWindow(typeof(EditorPlusHotbar));
            w.title = "Hotbar";
            w.LoadHotbar("Hotbar");
            w.minSize = new Vector2(StartMargin.x + ButtonSize.x + ButtonMargin.x, StartMargin.y + ButtonSize.y + ButtonMargin.y);

            w.Show();
        }