示例#1
0
        /// <summary>
        /// Draw the menu window inside the hero kit editor (hero property).
        /// </summary>
        /// <param name="id">ID assigned to the GUI Window</param>
        private void DrawMenuWindowHeroProperty(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));
            HeroPropertyMenuBlock.Block(heroKitProperty, this);
            SimpleLayout.EndVertical();

            EditorGUILayout.EndScrollView();
        }
示例#2
0
        /// <summary>
        /// Display the contents of the hero kit editor.
        /// </summary>
        public void OnGUI()
        {
            EventType eventType = Event.current.type;

            // show hero object in window
            if (heroType == 0)
            {
                if (heroObject == null)
                {
                    // attempt to retreive last hero object we worked with
                    heroObject = HeroKitCommon.LoadHeroSessionHeroObject();

                    // if nothing found, exit
                    if (heroObject == null)
                    {
                        return;
                    }
                }

                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, DrawTitleWindowHeroObject, "", Box.StyleDefault);
                windowMenu   = HorizResizer(windowMenu, eventType);        //right
                windowMenu   = HorizResizer(windowMenu, eventType, false); //left
                windowMenu   = GUILayout.Window(1, windowMenu, DrawMenuWindowHeroObject, "", Box.StyleMenu);
                windowCanvas = GUILayout.Window(2, windowCanvas, DrawCanvasWindowHeroObject, "", Box.StyleDefault);
                EndWindows();

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

                // update GUI if it has changed
                if (GUI.changed)
                {
                    EditorUtility.SetDirty(heroObject);
                    HeroKitCommon.SaveHeroSession(heroObject);
                    HeroKitCommon.SaveGlobals();
                }
            }

            // show hero action in window
            else if (heroType == 1)
            {
                if (heroKitAction != null)
                {
                    windowTitle  = new Rect(0, 0, Instance.position.width - 3, titleHeight);
                    windowCanvas = new Rect(0, windowTitle.height, Instance.position.width, (int)Instance.position.height);

                    BeginWindows();
                    windowTitle  = GUILayout.Window(3, windowTitle, DrawTitleWindowHeroAction, "", Box.StyleDefault);
                    windowCanvas = GUILayout.Window(2, windowCanvas, DrawCanvasWindowHeroAction, "", Box.StyleDefault);
                    EndWindows();
                }

                // update GUI if it has changed
                if (GUI.changed)
                {
                    EditorUtility.SetDirty(heroKitAction);
                }
            }

            // show hero property in window
            if (heroType == 2)
            {
                if (heroKitProperty != null)
                {
                    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, DrawTitleWindowHeroProperty, "", Box.StyleDefault);

                    windowMenu = HorizResizer(windowMenu, eventType);        //right
                    windowMenu = HorizResizer(windowMenu, eventType, false); //left
                    windowMenu = GUILayout.Window(1, windowMenu, DrawMenuWindowHeroProperty, "", Box.StyleMenu);

                    windowCanvas = GUILayout.Window(2, windowCanvas, DrawCanvasWindowHeroProperty, "", Box.StyleDefault);
                    EndWindows();

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

                // update GUI if it has changed
                if (GUI.changed)
                {
                    EditorUtility.SetDirty(heroKitProperty);
                }
            }
        }