コード例 #1
0
ファイル: HeroKitEditor.cs プロジェクト: antfitch/HeroKit
 /// <summary>
 /// Draw the menu window inside the hero kit editor (hero object).
 /// </summary>
 /// <param name="id">ID assigned to the GUI Window</param>
 private void DrawMenuWindowItem(int id)
 {
     scrollPosMenu = EditorGUILayout.BeginScrollView(scrollPosMenu, GUILayout.Width(windowMenu.width), GUILayout.Height((int)(Instance.position.height - titleHeight)));
     SimpleLayout.BeginVertical(Box.StyleMenu2, (int)(Instance.position.height - titleHeight));
     HeroKitMenuBlock.Block(heroObject, this);
     SimpleLayout.EndVertical();
     EditorGUILayout.EndScrollView();
 }
コード例 #2
0
ファイル: HeroKitEditor.cs プロジェクト: antfitch/HeroKit
        /// <summary>
        /// Display the contents of the hero kit editor.
        /// </summary>
        public void OnGUI()
        {
            EventType eventType = Event.current.type;

            // main menu (no left window)
            if (typeID == 0)
            {
                windowTitle  = new Rect(0, 0, Instance.position.width - 3, titleHeight);
                windowCanvas = new Rect(0, windowTitle.height, Instance.position.width - 3, (int)Instance.position.height);

                BeginWindows();
                windowTitle  = GUILayout.Window(3, windowTitle, DrawTitleWindowItem, "", Box.StyleDefault);
                windowCanvas = GUILayout.Window(2, windowCanvas, DrawCanvasWindowItem, "", Box.StyleDefault);
                EndWindows();
            }
            // items database, etc (left and right window)
            else if (typeID >= 1)
            {
                windowTitle  = new Rect(0, 0, Instance.position.width - 3, titleHeight);
                windowMenu   = new Rect(0, windowTitle.height, windowMenu.width, (int)Instance.position.height);
                windowCanvas = new Rect(windowMenu.width, windowTitle.height, Instance.position.width - windowMenu.width, (int)Instance.position.height);

                BeginWindows();
                windowTitle  = GUILayout.Window(3, windowTitle, DrawTitleWindowItem, "", Box.StyleDefault);
                windowMenu   = HorizResizer(windowMenu, eventType);        //right
                windowMenu   = HorizResizer(windowMenu, eventType, false); //left
                windowMenu   = GUILayout.Window(1, windowMenu, DrawMenuWindowItem, "", Box.StyleMenu);
                windowCanvas = GUILayout.Window(2, windowCanvas, DrawCanvasWindowItem, "", Box.StyleDefault);
                EndWindows();
            }


            // check for key down events for main menu
            if (Event.current.type == EventType.KeyDown)
            {
                HeroKitMenuBlock.changeSelection();
            }

            // update GUI if it has changed
            if (GUI.changed)
            {
                if (heroObject != null)
                {
                    EditorUtility.SetDirty(heroObject);
                }
            }
        }