/// <summary>
    /// Draw the list of all items
    /// </summary>
    void DrawList()
    {
        itsScrollPosition = GUILayout.BeginScrollView(itsScrollPosition);
        {
            KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBoxInvisible);
            {
                foreach (ListItem aListItem in itsData)
                {
                    if (aListItem.itsFiltered)
                    {
                        continue;
                    }

                    bool aValue = KGFGUIUtility.Toggle(aListItem.itsSelected, aListItem.GetString(), KGFGUIUtility.eStyleToggl.eTogglSuperCompact);
                    if (aValue != aListItem.itsSelected)
                    {
                        aListItem.itsSelected = aValue;
                        if (EventItemChanged != null)
                        {
                            EventItemChanged(this, null);
                        }
                    }
                }
            }
            KGFGUIUtility.EndVerticalBox();
        }
        GUILayout.EndScrollView();
    }
    /// <summary>
    /// Render a custom gui for each object
    /// </summary>
    /// <param name="theTarget"></param>
    /// <param name="theIsPrefab"></param>
    static void RenderObjectCustomGui(UnityEngine.Object theTarget, bool theIsPrefab)
    {
        KGFICustomInspectorGUI anObjectScript = theTarget as KGFICustomInspectorGUI;

        if (anObjectScript != null)
        {
            KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBoxMiddleVertical, GUILayout.ExpandWidth(true));
            anObjectScript.DrawInspectorGUI(theTarget, theIsPrefab);
            KGFGUIUtility.EndVerticalBox();
        }
    }
Exemple #3
0
    void OnGUI()
    {
        int aWidth  = 300;
        int aHeight = 250;

        Rect aRect = new Rect((Screen.width - aWidth) / 2, (Screen.height - aHeight) / 2, aWidth, aHeight);

        GUILayout.BeginArea(aRect);
        {
            KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBoxInvisible, GUILayout.ExpandHeight(true));
            {
                KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxDarkTop);
                {
                    GUILayout.FlexibleSpace();
                    KGFGUIUtility.Label("KGFGUIUtility Tutorial", KGFGUIUtility.eStyleLabel.eLabel);
                    GUILayout.FlexibleSpace();
                }
                KGFGUIUtility.EndHorizontalBox();

                KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBoxMiddleVertical, GUILayout.ExpandHeight(true));
                {
                    GUILayout.FlexibleSpace();

                    KGFGUIUtility.BeginHorizontalPadding();
                    {
                        KGFGUIUtility.Button("Top", KGFGUIUtility.eStyleButton.eButtonTop, GUILayout.ExpandWidth(true));
                        KGFGUIUtility.Button("Middle", KGFGUIUtility.eStyleButton.eButtonMiddle, GUILayout.ExpandWidth(true));
                        KGFGUIUtility.Button("Bottom", KGFGUIUtility.eStyleButton.eButtonBottom, GUILayout.ExpandWidth(true));
                    }
                    KGFGUIUtility.EndHorizontalPadding();

                    GUILayout.FlexibleSpace();
                }
                KGFGUIUtility.EndVerticalBox();

                KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxDarkBottom);
                {
                    KGFGUIUtility.BeginVerticalPadding();
                    {
                        KGFGUIUtility.Button("Left", KGFGUIUtility.eStyleButton.eButtonLeft, GUILayout.ExpandWidth(true));
                        KGFGUIUtility.Button("Center", KGFGUIUtility.eStyleButton.eButtonMiddle, GUILayout.ExpandWidth(true));
                        KGFGUIUtility.Button("Right", KGFGUIUtility.eStyleButton.eButtonRight, GUILayout.ExpandWidth(true));
                    }
                    KGFGUIUtility.EndVerticalPadding();
                }
                KGFGUIUtility.EndHorizontalBox();
            }
            KGFGUIUtility.EndVerticalBox();
        }
        GUILayout.EndArea();
    }
    public void Render()
    {
        GUILayout.BeginVertical();
        {
            KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBoxDarkTop);
            {
                DrawButtons();
            }
            KGFGUIUtility.EndVerticalBox();
            KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBoxMiddleVertical);
            {
                DrawList();
            }
            KGFGUIUtility.EndVerticalBox();
            KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxDarkMiddleVertical);
            {
                KGFGUIUtility.Label("", GUILayout.ExpandWidth(true));
            }
            KGFGUIUtility.EndHorizontalBox();
            KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBoxDarkBottom);
            {
                DrawSearch();
            }
            KGFGUIUtility.EndVerticalBox();
        }
        GUILayout.EndVertical();

        if (GUI.GetNameOfFocusedControl().Equals(itsControlSearchName))
        {
            if (itsSearch.Equals(itsTextSearch))
            {
                itsSearch = string.Empty;
            }
        }

        if (!GUI.GetNameOfFocusedControl().Equals(itsControlSearchName))
        {
            if (itsSearch.Equals(string.Empty))
            {
                itsSearch = itsTextSearch;
            }
        }
    }
Exemple #5
0
    private void DrawCurrentCustomGUI(float aCustomGuiWidth)
    {
        if (itsCurrentSelectedGUI == null)
        {
            return;
        }

        float aHeight = KGFGUIUtility.GetSkinHeight() + KGFGUIUtility.GetStyleButton(KGFGUIUtility.eStyleButton.eButton).margin.vertical + KGFGUIUtility.GetStyleBox(KGFGUIUtility.eStyleBox.eBoxDecorated).padding.vertical;

        GUILayout.BeginArea(new Rect(aHeight, aHeight, Screen.width - aCustomGuiWidth - aHeight, Screen.height - aHeight * 2.0f));
        {
            KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBox);
            {
                if (itsCurrentSelectedGUI.GetIcon() == null)
                {
                    KGFGUIUtility.BeginWindowHeader(itsCurrentSelectedGUI.GetHeaderName(), itsDataModuleCustomGUI.itsUnknownIcon);
                }
                else
                {
                    KGFGUIUtility.BeginWindowHeader(itsCurrentSelectedGUI.GetHeaderName(), itsCurrentSelectedGUI.GetIcon());
                }
                GUILayout.FlexibleSpace();
                bool aClose = KGFGUIUtility.EndWindowHeader(true);

                //Draw the content
                if (!aClose)
                {
                    // hack to keep the window in min size
                    GUILayout.Space(0);
                    itsCurrentSelectedGUI.Render();
                }
                else
                {
                    itsCurrentSelectedGUI = null;
                }
            }
            KGFGUIUtility.EndVerticalBox();
        }
        GUILayout.EndArea();
    }
Exemple #6
0
    void OnGUI()
    {
//		GUILayout.BeginVertical();
//		{
//			KGFGUIUtility.SpaceSmall();
//			GUILayout.BeginHorizontal();
//			{
//				KGFGUIUtility.SpaceSmall();
        KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBoxDecorated);
        {
            KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxDarkTop);
            {
                DrawIcon();
                KGFGUIUtility.Label(itsTitle);
                GUILayout.FlexibleSpace();
            }
            KGFGUIUtility.EndHorizontalBox();
            KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBoxMiddleVertical);
            {
                GUIStyle aWrapStyle = new GUIStyle(KGFGUIUtility.GetStyleLabel(KGFGUIUtility.eStyleLabel.eLabel));
                aWrapStyle.wordWrap    = true;
                aWrapStyle.fixedHeight = 0;
                GUILayout.Label(itsInfo, aWrapStyle, GUILayout.ExpandWidth(true));
                GUILayout.FlexibleSpace();
            }
            KGFGUIUtility.EndVerticalBox();
            KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxDarkBottom);
            {
                DrawButtons();
            }
            KGFGUIUtility.EndHorizontalBox();
        }
        KGFGUIUtility.EndVerticalBox();
//				KGFGUIUtility.SpaceSmall();
//			}
//			GUILayout.EndHorizontal();
//			KGFGUIUtility.SpaceSmall();
//		}
//		GUILayout.EndVertical();
    }
    /// <summary>
    /// Render this control
    /// </summary>
    public void Render()
    {
        if (itsUpdateWish)
        {
            UpdateList();
        }

        int itsNumberOfPages = (int)Math.Ceiling((float)itsData.Rows.Count / (float)itsItemsPerPage);

        if (itsCurrentPage >= itsNumberOfPages)
        {
            itsCurrentPage = 0;
        }

        itsRepaintWish = false;
        itsGuiData.SetDisplayRowCount((uint)itsItemsPerPage);

        KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxDecorated);
        {
            // categories view
            GUILayout.BeginVertical(GUILayout.Width(180));
            {
                itsListViewCategories.Render();
            }
            GUILayout.EndVertical();

            KGFGUIUtility.SpaceSmall();

            GUILayout.BeginVertical();
            {
                // item table
                itsGuiData.SetStartRow((uint)(itsCurrentPage * (uint)itsItemsPerPage));
                itsGuiData.Render();

                KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxMiddleVerticalInteractive);
                {
                    // enum filter boxes
                    int aColumnNo = 0;
//						KGFGUIUtility.SpaceSmall();
                    foreach (KGFObjectListColumnItem anItem in itsListFieldCache)
                    {
                        aColumnNo++;

                        if (!anItem.itsDisplay)
                        {
                            continue;
                        }
                        if (!itsGuiData.GetColumnVisible(aColumnNo))
                        {
                            continue;
                        }

                        if (anItem.itsSearchable && (anItem.GetReturnType().IsEnum ||
                                                     anItem.GetReturnType() == typeof(bool) ||
                                                     anItem.GetReturnType() == typeof(string)))
                        {
                            GUILayout.BeginHorizontal(GUILayout.Width(itsGuiData.GetColumnWidth(aColumnNo)));
                            {
                                KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBoxInvisible);
                                DrawFilterBox(anItem, itsGuiData.GetColumnWidth(aColumnNo) - 4);
                                KGFGUIUtility.EndVerticalBox();
                            }
                            GUILayout.EndHorizontal();
                            KGFGUIUtility.Separator(KGFGUIUtility.eStyleSeparator.eSeparatorVerticalFitInBox);
                        }
                        else
                        {
                            GUILayout.BeginHorizontal(GUILayout.Width(itsGuiData.GetColumnWidth(aColumnNo)));
                            {
                                GUILayout.Label(" ");
                            }
                            GUILayout.EndHorizontal();
                            KGFGUIUtility.Separator(KGFGUIUtility.eStyleSeparator.eSeparatorVerticalFitInBox);
                            continue;
                        }
                    }
                    GUILayout.FlexibleSpace();
                }
                KGFGUIUtility.EndHorizontalBox();

                KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxDarkMiddleVertical);
                {
                    GUILayout.Label("");
                    GUILayout.FlexibleSpace();
                }
                KGFGUIUtility.EndHorizontalBox();

                KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBoxDarkBottom);
                {
                    GUILayout.BeginHorizontal();
                    {
                        if (!Application.isPlaying)
                        {
                            if (EventNew != null)
                            {
                                if (KGFGUIUtility.Button("New", KGFGUIUtility.eStyleButton.eButton, GUILayout.Width(75)))
                                {
                                    EventNew(this, null);
                                }
                            }
                            if (EventDelete != null)
                            {
                                if (KGFGUIUtility.Button("Delete", KGFGUIUtility.eStyleButton.eButton, GUILayout.Width(75)))
                                {
                                    EventDelete(this, null);
                                }
                            }

                            GUILayout.FlexibleSpace();
                        }

                        // full text search box
                        if (itsDisplayFullTextSearch)
                        {
                            GUI.SetNextControlName(itsControlSearchName);
                            string aNewString = KGFGUIUtility.TextField(itsFulltextSearch, KGFGUIUtility.eStyleTextField.eTextField, GUILayout.Width(200));
                            if (aNewString != itsFulltextSearch)
                            {
                                itsFulltextSearch = aNewString;
                                UpdateList();
                            }
                        }

                        KGFGUIUtility.Space();

                        bool anIncludeAll = KGFGUIUtility.Toggle(itsIncludeAll, "all Tags", KGFGUIUtility.eStyleToggl.eTogglSuperCompact, GUILayout.Width(70));
                        if (anIncludeAll != itsIncludeAll)
                        {
                            itsIncludeAll = anIncludeAll;
                            UpdateList();
                        }

                        if (KGFGUIUtility.Button("clear filters", KGFGUIUtility.eStyleButton.eButton, GUILayout.Width(100)))
                        {
                            itsFulltextSearch = "";
                            ClearFilters();
                            UpdateList();
                        }

                        GUILayout.FlexibleSpace();

                        KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxInvisible);
                        {
                            if (GetDisplayEntriesPerPage())
                            {
                                //number of items in List
                                if (KGFGUIUtility.Button("<", KGFGUIUtility.eStyleButton.eButtonLeft, GUILayout.Width(25)))
                                {
                                    switch (itsItemsPerPage)
                                    {
                                    case KGFeItemsPerPage.e25:
                                        itsItemsPerPage = KGFeItemsPerPage.e10;
                                        break;

                                    case KGFeItemsPerPage.e50:
                                        itsItemsPerPage = KGFeItemsPerPage.e25;
                                        break;

                                    case KGFeItemsPerPage.e100:
                                        itsItemsPerPage = KGFeItemsPerPage.e50;
                                        break;

                                    case KGFeItemsPerPage.e250:
                                        itsItemsPerPage = KGFeItemsPerPage.e100;
                                        break;

                                    case KGFeItemsPerPage.e500:
                                        itsItemsPerPage = KGFeItemsPerPage.e250;
                                        break;

                                    default:
                                        break;
                                    }
                                }

                                KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBoxMiddleHorizontal);
                                {
                                    string aLogsPerPageString = itsItemsPerPage.ToString().Substring(1) + " entries per page";
                                    KGFGUIUtility.Label(aLogsPerPageString, KGFGUIUtility.eStyleLabel.eLabelFitIntoBox);
                                }
                                KGFGUIUtility.EndVerticalBox();

                                if (KGFGUIUtility.Button(">", KGFGUIUtility.eStyleButton.eButtonRight, GUILayout.Width(25)))
                                {
                                    switch (itsItemsPerPage)
                                    {
                                    case KGFeItemsPerPage.e10:
                                        itsItemsPerPage = KGFeItemsPerPage.e25;
                                        break;

                                    case KGFeItemsPerPage.e25:
                                        itsItemsPerPage = KGFeItemsPerPage.e50;
                                        break;

                                    case KGFeItemsPerPage.e50:
                                        itsItemsPerPage = KGFeItemsPerPage.e100;
                                        break;

                                    case KGFeItemsPerPage.e100:
                                        itsItemsPerPage = KGFeItemsPerPage.e250;
                                        break;

                                    case KGFeItemsPerPage.e250:
                                        itsItemsPerPage = KGFeItemsPerPage.e500;
                                        break;

                                    default:
                                        break;
                                    }
                                }
                            }

                            GUILayout.Space(10.0f);

                            // page control
                            if (KGFGUIUtility.Button("<", KGFGUIUtility.eStyleButton.eButtonLeft, GUILayout.Width(25)) && itsCurrentPage > 0)
                            {
                                itsCurrentPage--;
                            }

                            KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBoxMiddleHorizontal);
                            {
                                string aString = string.Format("page {0}/{1}", itsCurrentPage + 1, Math.Max(itsNumberOfPages, 1));
                                KGFGUIUtility.Label(aString, KGFGUIUtility.eStyleLabel.eLabelFitIntoBox);
                            }
                            KGFGUIUtility.EndVerticalBox();

                            if (KGFGUIUtility.Button(">", KGFGUIUtility.eStyleButton.eButtonRight, GUILayout.Width(25)) && itsData.Rows.Count > ((itsCurrentPage + 1) * (int)itsItemsPerPage))
                            {
                                itsCurrentPage++;
                            }
                        }
                        KGFGUIUtility.EndHorizontalBox();
                    }
                    GUILayout.EndHorizontal();
                }
                KGFGUIUtility.EndVerticalBox();
            }
            GUILayout.EndVertical();
        }
        KGFGUIUtility.EndHorizontalBox();

        if (GUI.GetNameOfFocusedControl().Equals(itsControlSearchName))
        {
            if (itsFulltextSearch.Equals(itsTextSearch))
            {
                itsFulltextSearch = string.Empty;
            }
        }

        if (!GUI.GetNameOfFocusedControl().Equals(itsControlSearchName))
        {
            if (itsFulltextSearch.Equals(string.Empty))
            {
                itsFulltextSearch = itsTextSearch;
            }
        }
    }
    /// <summary>
    /// renders the default Kolmich game framework inspector window (TitleBar, Default Unity Inspector, Infobox, Buttons)
    /// </summary>
    /// <param name="theEditor">
    ///     <see cref="System.String"/>
    /// </param>
    public static void RenderKGFInspector(KGFEditor theEditor, Type theType, Action theHandler)
    {
//		// use fixed skin
//		KGFGUIUtility.SetSkinPath("KGFSkins/default/skins/skin_default_16");

        #region icon loading
        if (itsIconHelp == null)
        {
            itsIconHelp = Resources.Load("KGFCore/textures/help") as Texture2D;
        }

        if (itsIconInfo == null)
        {
            itsIconInfo = Resources.Load("KGFCore/textures/info") as Texture2D;
        }

        if (itsIconWarning == null)
        {
            itsIconWarning = Resources.Load("KGFCore/textures/warning") as Texture2D;
        }

        if (itsIconError == null)
        {
            itsIconError = Resources.Load("KGFCore/textures/error") as Texture2D;
        }

        if (itsIconOK == null)
        {
            itsIconOK = Resources.Load("KGFCore/textures/ok") as Texture2D;
        }
        #endregion

        //set the look to Unity default
        EditorGUIUtility.LookLikeControls();

        KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBoxDecorated, GUILayout.ExpandHeight(false), GUILayout.ExpandWidth(true));
        {
            //render the title of the Inspector
            RenderTitle(theEditor.target);

            //render the path and the reference id
            RenderPath(theEditor);

            KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBoxMiddleVertical);
            {
                KGFGUIUtility.BeginHorizontalPadding();
                {
//					DrawCustomInspector(theEditor);
//					DrawCustomInspectorReflection(theEditor.target,theEditor.target,0);
                    theEditor.DrawDefaultInspector();
                    if (theHandler != null)
                    {
                        theHandler();
                    }
                }
                KGFGUIUtility.EndHorizontalPadding();
            }
            KGFGUIUtility.EndVerticalBox();

            // check if the object is a prefab
            PrefabType aPrefabType = PrefabUtility.GetPrefabType(theEditor.target);
            bool       theIsPrefab = !(aPrefabType == PrefabType.PrefabInstance || aPrefabType == PrefabType.None || aPrefabType == PrefabType.DisconnectedPrefabInstance);

            // draw custom inspector gui
            RenderObjectCustomGui(theEditor.target, theIsPrefab);

            // draw error checking gui
            KGFIValidator aValidator = theEditor.target as KGFIValidator;
            if (aValidator == null)
            {
                KGFMessageList aMessageList = new KGFMessageList();
                aMessageList.AddWarning("Cannot validate: " + theEditor.target.name + " cause it is does not implemet a KGFIValidator");
                RenderInspectorErrorChecking(aMessageList);
            }
            else
            {
                KGFMessageList anEditorMessageList = KGFEditor.ValidateEditor(theEditor.target);
                KGFMessageList aTotalMessageList   = aValidator.Validate();
                aTotalMessageList.AddMessages(anEditorMessageList.GetAllMessagesArray());

                RenderInspectorErrorChecking(aTotalMessageList);
            }

            // help button
            KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxDarkBottom);
            {
                if (KGFGUIUtility.Button(itsIconHelp, "documentation", KGFGUIUtility.eStyleButton.eButton, GUILayout.ExpandWidth(true)))
                {
                    Application.OpenURL("http://www.kolmich.at/documentation/");
                }

                if (KGFGUIUtility.Button(itsIconHelp, "forum", KGFGUIUtility.eStyleButton.eButton, GUILayout.ExpandWidth(true)))
                {
                    Application.OpenURL("http://www.kolmich.at/forum");
                }

                if (KGFGUIUtility.Button(itsIconHelp, "homepage", KGFGUIUtility.eStyleButton.eButton, GUILayout.ExpandWidth(true)))
                {
                    Application.OpenURL("http://www.kolmich.at/");
                }
            }
            KGFGUIUtility.EndHorizontalBox();
        }
        KGFGUIUtility.EndVerticalBox();
    }
    /// <summary>
    /// renders a section for found errors in the inspector
    /// </summary>
    /// <param name="theTarget">the currently displayed data object</param>
    public static void RenderInspectorErrorChecking(KGFMessageList theMessageList)
    {
//		KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBoxMiddleVertical, GUILayout.ExpandWidth(true));
        {
            if (theMessageList != null)
            {
                // render infos
                bool aShowOK = true;

                KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBoxInvisible, GUILayout.ExpandWidth(true));
                {
                    #region render info

                    /*
                     * string[] aInfoList = aMessageList.GetInfoArray();
                     *
                     * if (aInfoList.Length > 0)
                     * {
                     *      aShowOK = false;
                     *
                     *      foreach (string aMessage in aInfoList)
                     *      {
                     *              RenderWarning(aMessage);
                     *      }
                     * }
                     */

                    #endregion

                    #region render errors
                    string[] anErrorList = theMessageList.GetErrorArray();
                    if (anErrorList.Length > 0)
                    {
                        aShowOK = false;

                        foreach (string aMessage in anErrorList)
                        {
                            RenderError(aMessage);
                        }
                    }
                    #endregion

                    #region render warnings
                    anErrorList = theMessageList.GetWarningArray();
                    if (anErrorList.Length > 0)
                    {
                        aShowOK = false;
                        foreach (string aMessage in anErrorList)
                        {
                            RenderWarning(aMessage);
                        }
                    }
                    #endregion

                    if (aShowOK)
                    {
                        RenderOK();
                    }
                }
                KGFGUIUtility.EndVerticalBox();
            }
            else
            {
                RenderError("the module doesn`t implement the KGFIValidator interface");
            }
        }
//		KGFGUIUtility.EndVerticalBox();
    }
Exemple #10
0
    public static void Render()
    {
        if (itsInstance != null && itsInstance.itsDataModuleCustomGUI.itsBarVisible)
        {
            if (itsCustomGUIImplementations.Count == 0)
            {
                return;
            }

            GUIStyle aTogglStyle = KGFGUIUtility.GetStyleToggl(KGFGUIUtility.eStyleToggl.eTogglRadioStreched);
            GUIStyle aBoxStyle   = KGFGUIUtility.GetStyleBox(KGFGUIUtility.eStyleBox.eBoxDecorated);
            int      aWidth      = (int)(aTogglStyle.contentOffset.x + aTogglStyle.padding.horizontal + (KGFGUIUtility.GetSkinHeight() - aTogglStyle.padding.vertical));
            int      aHeight     = (int)(aBoxStyle.margin.top + aBoxStyle.margin.bottom + aBoxStyle.padding.top + aBoxStyle.padding.bottom
                                         + (aTogglStyle.fixedHeight + aTogglStyle.margin.top) * itsCustomGUIImplementations.Count);
            //(int)(aTogglStyle.margin.bottom + aBoxStyle.margin.vertical + aBoxStyle.padding.vertical);
            //(aTogglStyle.fixedHeight + aTogglStyle.margin.top) * itsCustomGUIImplementations.Count)

            GUILayout.BeginArea(new Rect(Screen.width - aWidth, (Screen.height - aHeight) / 2, aWidth, aHeight));
            {
                KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBoxDecorated, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
                {
                    GUILayout.FlexibleSpace();

                    foreach (KGFICustomGUI aCustomGUI in itsCustomGUIImplementations)
                    {
                        bool aValue;

                        if (itsCurrentSelectedGUI != null && itsCurrentSelectedGUI == aCustomGUI)
                        {
                            aValue = true;
                        }
                        else
                        {
                            aValue = false;
                        }

                        Texture2D aIcon = aCustomGUI.GetIcon();

                        if (aIcon == null)
                        {
                            aIcon = itsInstance.itsDataModuleCustomGUI.itsUnknownIcon;
                        }

                        if (aValue != KGFGUIUtility.Toggle(aValue, aIcon, KGFGUIUtility.eStyleToggl.eTogglRadioStreched))
                        {
                            if (aValue)
                            {
                                itsCurrentSelectedGUI = null;
                            }
                            else
                            {
                                itsCurrentSelectedGUI = aCustomGUI;
                            }
                        }
                    }

                    GUILayout.FlexibleSpace();
                }
                KGFGUIUtility.EndVerticalBox();

                //Draw the Custom GUI
                if (itsCurrentSelectedGUI != null)
                {
                    itsWindowRectangle = KGFGUIUtility.Window(0, itsWindowRectangle, itsInstance.DrawCurrentCustomGUI, itsCurrentSelectedGUI.GetName(), GUILayout.MinHeight(200), GUILayout.MinWidth(300));

                    // check if the window is still visible in screen
                    if (itsWindowRectangle.x < -itsWindowRectangle.width + 20)
                    {
                        itsWindowRectangle.x = -itsWindowRectangle.width + 20;
                    }
                    else if (itsWindowRectangle.x > Screen.width - 20)
                    {
                        itsWindowRectangle.x = Screen.width - 20;
                    }

                    if (itsWindowRectangle.y < -itsWindowRectangle.height + 20)
                    {
                        itsWindowRectangle.y = -itsWindowRectangle.height + 20;
                    }
                    else if (itsWindowRectangle.y > Screen.height - 20)
                    {
                        itsWindowRectangle.y = Screen.height - 20;
                    }
                }
            }
            GUILayout.EndArea();

            #region old render code

            /*
             *
             * float aButtonSpaceHorizontal = Math.Max(KGFGUIUtility.GetStyleButton(KGFGUIUtility.eStyleButton.eButton).fixedHeight, 16);
             * float aButtonSpaceVertical = Math.Max(KGFGUIUtility.GetStyleButton(KGFGUIUtility.eStyleButton.eButton).fixedHeight, 16);
             * int aBoxSpaceHorizontal = Math.Max(KGFGUIUtility.GetStyleBox(KGFGUIUtility.eStyleBox.eBoxDecorated).margin.horizontal + KGFGUIUtility.GetStyleBox(KGFGUIUtility.eStyleBox.eBoxDecorated).padding.horizontal, 24);
             * int aBoxSpaceVertical = Math.Max(KGFGUIUtility.GetStyleBox(KGFGUIUtility.eStyleBox.eBoxDecorated).margin.vertical + KGFGUIUtility.GetStyleBox(KGFGUIUtility.eStyleBox.eBoxDecorated).padding.vertical, 24);
             *
             * GUILayout.BeginArea(new Rect(Screen.width - (aBoxSpaceHorizontal + aButtonSpaceHorizontal / 2),
             *                           Screen.height / 2 - ((itsCustomGUIImplementations.Count * aButtonSpaceVertical) + aBoxSpaceHorizontal) / 2,
             *                           aButtonSpaceHorizontal + aBoxSpaceHorizontal,
             *                           (itsCustomGUIImplementations.Count * aButtonSpaceVertical) + aBoxSpaceVertical));
             *
             * {
             *      KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBoxDecorated, GUILayout.MinWidth(24));
             *      {
             *              foreach(KGFICustomGUI aCustomGUI in itsCustomGUIImplementations)
             *              {
             *                      bool selected = false;
             *                      float aWidth = Mathf.Max(KGFGUIUtility.GetStyleButton(KGFGUIUtility.eStyleButton.eButton).fixedHeight, 16);
             *
             *                      if(aCustomGUI.GetIcon() != null)
             *                      {
             *                              if(KGFGUIUtility.Button(aCustomGUI.GetIcon(), KGFGUIUtility.eStyleButton.eButton, GUILayout.Width(aWidth), GUILayout.Height(aWidth)))
             *                              {
             *                                      selected = true;
             *                              }
             *                      }
             *                      else
             *                      {
             *                              if(itsUnknownIcon != null)
             *                              {
             *                                      if(KGFGUIUtility.Button(itsUnknownIcon, KGFGUIUtility.eStyleButton.eButton, GUILayout.Width(aWidth), GUILayout.Height(aWidth)))
             *                                      {
             *                                              selected = true;
             *                                      }
             *                              }
             *                              else
             *                              {
             *                                      if(KGFGUIUtility.Button("?", KGFGUIUtility.eStyleButton.eButton, GUILayout.Width(aWidth), GUILayout.Height(aWidth)))
             *                                      {
             *                                              selected = true;
             *                                      }
             *                              }
             *                      }
             *
             *                      // check if one of the Buttons was clicked
             *                      if(selected && aCustomGUI != itsCurrentSelectedGUI)
             *                      {
             *                              itsCurrentSelectedGUI = aCustomGUI;
             *                      }
             *                      else if(selected && aCustomGUI == itsCurrentSelectedGUI)
             *                      {
             *                              itsCurrentSelectedGUI = null;
             *                      }
             *              }
             *      }
             *      KGFGUIUtility.EndVerticalBox();
             * }
             * GUILayout.EndArea();
             *
             * //Draw the Custom GUI
             * if(itsCurrentSelectedGUI != null)
             * {
             *      itsWindowRectangle = KGFGUIUtility.Window(0, itsWindowRectangle, itsInstance.DrawCurrentCustomGUI,string.Empty, GUILayout.MinHeight(200), GUILayout.MinWidth(300));
             *
             *      // check if the window is still visible in screen
             *      if(itsWindowRectangle.x < -itsWindowRectangle.width + 20)
             *      {
             *              itsWindowRectangle.x = -itsWindowRectangle.width + 20;
             *      }
             *      else if(itsWindowRectangle.x > Screen.width - 20)
             *      {
             *              itsWindowRectangle.x = Screen.width - 20;
             *      }
             *
             *      if(itsWindowRectangle.y < -itsWindowRectangle.height + 20)
             *      {
             *              itsWindowRectangle.y = -itsWindowRectangle.height + 20;
             *      }
             *      else if(itsWindowRectangle.y > Screen.height - 20)
             *      {
             *              itsWindowRectangle.y = Screen.height - 20;
             *      }
             * }
             * }
             */
            #endregion
        }
    }
Exemple #11
0
    /// <summary>
    /// Draw buttons
    /// </summary>
    void OnGUI()
    {
        float aButtonWidth = 130.0f;

        KGFGUIUtility.SetSkinIndex(1);
        GUILayout.BeginArea(itsRectButtons);
        {
            GUILayout.BeginHorizontal();
            {
                KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBoxDecorated);
                {
                    GUILayout.BeginHorizontal();
                    {
                        KGFGUIUtility.Label("TEST HERE! ->");
                        GUILayout.FlexibleSpace();
                        GUI.color = new Color(0.5f, 1.0f, 0.5f, 1.0f);
                        if (KGFGUIUtility.Button("follow rot.", KGFGUIUtility.eStyleButton.eButton, GUILayout.Width(aButtonWidth)))
                        {
                            itsEventSwitchToFollow.Apply();
                            itsCurrentCameraRoot = eCameraRoot.eFollow;
                            itsCutScene.StopCutscene();
                        }
                        if (KGFGUIUtility.Button("follow pos.", KGFGUIUtility.eStyleButton.eButton, GUILayout.Width(aButtonWidth)))
                        {
                            itsEventSwitchToFollow1.Apply();
                            itsCurrentCameraRoot = eCameraRoot.eFollowPosition;
                            itsCutScene.StopCutscene();
                        }
                        if (KGFGUIUtility.Button("pan + borders", KGFGUIUtility.eStyleButton.eButton, GUILayout.Width(aButtonWidth)))
                        {
                            itsEventSwitchToPanning.Apply();
                            itsCurrentCameraRoot = eCameraRoot.ePanning;
                            itsCutScene.StopCutscene();
                        }
                        if (KGFGUIUtility.Button("pan world space", KGFGUIUtility.eStyleButton.eButton, GUILayout.Width(aButtonWidth)))
                        {
                            itsEventSwitchToPanningCameraSpace.Apply();
                            itsCurrentCameraRoot = eCameraRoot.ePanningCamera;
                            itsCutScene.StopCutscene();
                        }
                        if (KGFGUIUtility.Button("lookat", KGFGUIUtility.eStyleButton.eButton, GUILayout.Width(aButtonWidth)))
                        {
                            itsEventSwitchToInnerCity.Apply();
                            itsCurrentCameraRoot = eCameraRoot.eLake;
                            itsCutScene.StopCutscene();
                        }
                        if (KGFGUIUtility.Button("up side down", KGFGUIUtility.eStyleButton.eButton, GUILayout.Width(aButtonWidth)))
                        {
                            itsEventSwitchToUpSideDown.Apply();
                            itsCurrentCameraRoot = eCameraRoot.eUpSideDown;
                            itsCutScene.StopCutscene();
                        }
                        GUI.color = new Color(1.0f, 1.0f, 1.0f, 1.0f);
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.BeginHorizontal();
                    {
                        KGFGUIUtility.Label("AND HERE! ->");
                        GUILayout.FlexibleSpace();
                        GUI.color = new Color(0.5f, 1.0f, 0.5f, 1.0f);
                        if (KGFGUIUtility.Button("cutscene", KGFGUIUtility.eStyleButton.eButton, GUILayout.Width(aButtonWidth)))
                        {
                            itsCutScene.StartCutscene();
                        }
                        if (KGFGUIUtility.Button("char. 3rd pers.", KGFGUIUtility.eStyleButton.eButton, GUILayout.Width(aButtonWidth)))
                        {
                            itsEventSwitchToCapsule.Apply();
                            itsCurrentCameraRoot = eCameraRoot.eCharacter;
                            itsCutScene.StopCutscene();
                        }
                        if (KGFGUIUtility.Button("char. observe", KGFGUIUtility.eStyleButton.eButton, GUILayout.Width(aButtonWidth)))
                        {
                            itsEventSwitchToObserve.Apply();
                            itsCurrentCameraRoot = eCameraRoot.eObserve;
                            itsCutScene.StopCutscene();
                        }
                        if (KGFGUIUtility.Button("char. isometric", KGFGUIUtility.eStyleButton.eButton, GUILayout.Width(aButtonWidth)))
                        {
                            itsEventIsometric.Apply();
                            itsCurrentCameraRoot = eCameraRoot.eIsometric;
                            itsCutScene.StopCutscene();
                        }
                        if (KGFGUIUtility.Button("collide", KGFGUIUtility.eStyleButton.eButton, GUILayout.Width(aButtonWidth)))
                        {
                            itsEventSwitchToCollisions.Apply();
                            itsCurrentCameraRoot = eCameraRoot.eCollision;
                            itsCutScene.StopCutscene();
                        }
                        if (KGFGUIUtility.Button("field of view", KGFGUIUtility.eStyleButton.eButton, GUILayout.Width(aButtonWidth)))
                        {
                            itsEventSwitchToFishEye.Apply();
                            itsCurrentCameraRoot = eCameraRoot.eFishEye;
                            itsCutScene.StopCutscene();
                        }
                        GUI.color = new Color(1.0f, 1.0f, 1.0f, 1.0f);
                    }
                    GUILayout.EndHorizontal();
                }
                KGFGUIUtility.EndVerticalBox();
            }
            GUILayout.EndHorizontal();
        }
        GUILayout.EndArea();

        KGFGUIUtility.SetSkinIndex(0);
        GUILayout.BeginArea(itsRect);
        {
            GUILayout.BeginVertical();
            {
                GUILayout.FlexibleSpace();
                GUILayout.BeginHorizontal();
                {
                    KGFGUIUtility.Space();
                    GUILayout.Label(itsKOLMICHTexture);
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                {
                    KGFGUIUtility.Space();
                    KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBoxDecorated);
                    {
                        KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxDarkTop);
                        GUILayout.FlexibleSpace();
                        KGFGUIUtility.Label("CURRENT CAMERA SETTINGS:");
                        GUILayout.FlexibleSpace();
                        KGFGUIUtility.EndHorizontalBox();

                        //target
                        KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxMiddleVertical);
                        KGFGUIUtility.Label("Target:");
                        GUILayout.FlexibleSpace();
                        KGFGUIUtility.EndHorizontalBox();
                        GUILayout.BeginHorizontal();
                        KGFGUIUtility.Label("- gameObject: ");
                        GUILayout.FlexibleSpace();
                        KGFGUIUtility.Label(itsOrbitCam.GetTarget().gameObject.name);
                        GUILayout.EndHorizontal();
                        float aFollowPositionSpeed = DrawFloat("- follow pos. speed:", itsOrbitCam.GetTargetFollowPositionSpeed(), true, 1.0f, 20.0f);
                        float aFollowRotationSpeed = DrawFloat("- follow rot. speed:", itsOrbitCam.GetTargetFollowRotationSpeed(), true, 1.0f, 20.0f);
                        itsOrbitCam.SetTargetFollowPositionSpeed(aFollowPositionSpeed);
                        itsOrbitCam.SetTargetFollowRotationSpeed(aFollowRotationSpeed);

                        //zoom
                        KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxMiddleVertical);
                        KGFGUIUtility.Label("Zoom:");
                        GUILayout.FlexibleSpace();
                        KGFGUIUtility.EndHorizontalBox();
                        bool anEnabled = DrawBoolean("- enabled: ", itsOrbitCam.GetZoomEnable());
                        itsOrbitCam.SetZoomEnable(anEnabled);
                        float aMinLimit = DrawFloat("- min limit:", itsOrbitCam.GetZoomMinLimit(), itsOrbitCam.GetZoomUseLimits(), 0.5f, 20.0f);
                        float aMaxLimit = DrawFloat("- max limit:", itsOrbitCam.GetZoomMaxLimit(), itsOrbitCam.GetZoomUseLimits(), 0.5f, 20.0f);
                        if (itsOrbitCam.GetZoomUseLimits())
                        {
                            itsOrbitCam.SetZoomMinLimit(aMinLimit);
                            itsOrbitCam.SetZoomMaxLimit(aMaxLimit);
                        }

                        //rotation horizontal
                        KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxMiddleVertical);
                        KGFGUIUtility.Label("Horizontal rotation:");
                        GUILayout.FlexibleSpace();
                        KGFGUIUtility.EndHorizontalBox();
                        anEnabled = DrawBoolean("- enabled: ", itsOrbitCam.GetRotationHorizontalEnable());
                        itsOrbitCam.SetRotationHorizontalEnable(anEnabled);
                        float aLeftLimit  = DrawFloat("- left limit:", itsOrbitCam.GetRotationHorizontalLeftLimit(), itsOrbitCam.GetRotationHorizontalUseLimits(), 0.0f, 180.0f);
                        float aRightLimit = DrawFloat("- right limit:", itsOrbitCam.GetRotationHorizontalRightLimit(), itsOrbitCam.GetRotationHorizontalUseLimits(), 0.0f, 180.0f);
                        if (itsOrbitCam.GetRotationHorizontalUseLimits())
                        {
                            itsOrbitCam.SetRotationHorizontalLeftLimit(aLeftLimit);
                            itsOrbitCam.SetRotationHorizontalRightLimit(aRightLimit);
                        }

                        //rotation vertical
                        KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxMiddleVertical);
                        KGFGUIUtility.Label("Vertical rotation:");
                        GUILayout.FlexibleSpace();
                        KGFGUIUtility.EndHorizontalBox();
                        anEnabled = DrawBoolean("- enabled: ", itsOrbitCam.GetRotationVerticalEnable());
                        itsOrbitCam.SetRotationVerticalEnable(anEnabled);
                        float anUpLimit  = DrawFloat("- up limit:", itsOrbitCam.GetRotationVerticalUpLimit(), itsOrbitCam.GetRotationVerticalUseLimits(), 0.0f, 180.0f);
                        float aDownLimit = DrawFloat("- down limit:", itsOrbitCam.GetRotationVerticalDownLimit(), itsOrbitCam.GetRotationVerticalUseLimits(), 0.0f, 180.0f);
                        if (itsOrbitCam.GetRotationVerticalUseLimits())
                        {
                            itsOrbitCam.SetRotationVerticalUpLimit(anUpLimit);
                            itsOrbitCam.SetRotationVerticalDownLimit(aDownLimit);
                        }

                        //panning left right
                        KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxMiddleVertical);
                        KGFGUIUtility.Label("Panning:");
                        GUILayout.FlexibleSpace();
                        KGFGUIUtility.EndHorizontalBox();

                        float aSpeed = DrawFloat("- speed: ", itsOrbitCam.GetPanningSpeed(), true, 1.0f, 10.0f);
                        itsOrbitCam.SetPanningSpeed(aSpeed);
                        anEnabled = DrawBoolean("- left right enabled: ", itsOrbitCam.GetPanningLeftRightEnable());
//						itsOrbitCam.SetPanningLeftRightEnable(anEnabled);
                        anEnabled = DrawBoolean("- forward backward enabled: ", itsOrbitCam.GetPanningForwardBackwardEnable());
//						itsOrbitCam.SetPanningForwardBackwardEnable(anEnabled);
                        anEnabled = DrawBoolean("- up down enabled: ", itsOrbitCam.GetPanningUpDownEnable());
//						itsOrbitCam.SetPanningUpDownEnable(anEnabled);

                        //camera
                        KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxMiddleVertical);
                        KGFGUIUtility.Label("Camera:");
                        GUILayout.FlexibleSpace();
                        KGFGUIUtility.EndHorizontalBox();
                        float aFieldOfView = DrawFloat("- field of view: ", itsOrbitCam.GetCameraFieldOfView(), true, 45.0f, 179.0f);
                        itsOrbitCam.SetCameraFieldOfView(aFieldOfView);

                        //lookat target
                        KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxMiddleVertical);
                        KGFGUIUtility.Label("Lookat:");
                        GUILayout.FlexibleSpace();
                        KGFGUIUtility.EndHorizontalBox();
                        GUILayout.BeginHorizontal();
                        KGFGUIUtility.Label("- target: ");
                        GUILayout.FlexibleSpace();
                        if (itsOrbitCam.GetLookatTarget() != null)
                        {
                            KGFGUIUtility.Label(itsOrbitCam.GetLookatTarget().gameObject.name);
                        }
                        else
                        {
                            KGFGUIUtility.Label("NO TARGET");
                        }
                        GUILayout.EndHorizontal();
                        GUILayout.BeginHorizontal();
                        KGFGUIUtility.Label("- up vector target: ");
                        GUILayout.FlexibleSpace();
                        if (itsOrbitCam.GetLookatUpVectorSource() != null)
                        {
                            KGFGUIUtility.Label(itsOrbitCam.GetLookatUpVectorSource().gameObject.name);
                        }
                        else
                        {
                            KGFGUIUtility.Label("NO TARGET");
                        }
                        GUILayout.EndHorizontal();
                    }
                    KGFGUIUtility.EndVerticalBox();
                }
                GUILayout.EndHorizontal();
            }
            KGFGUIUtility.Space();
            GUILayout.EndVertical();
        }
        GUILayout.EndArea();
    }
    private static void RenderHelpWindowMethod(int theWindowID)
    {
        GUILayout.BeginHorizontal();
        {
            GUILayout.FlexibleSpace();
            KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBoxInvisible, GUILayout.ExpandHeight(true));
            {
                KGFGUIUtility.BeginHorizontalPadding();
                {
                    KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxDarkTop, GUILayout.ExpandWidth(true));
                    {
                        GUILayout.FlexibleSpace();
                        GUILayout.Label(KGFGUIUtility.GetLogo(), GUILayout.Height(50));
                        GUILayout.FlexibleSpace();
                    }
                    KGFGUIUtility.EndHorizontalBox();

                    KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxBottom, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
                    {
                        GUILayout.Label(itsCopyrightText, GUILayout.ExpandWidth(true));
                    }
                    KGFGUIUtility.EndHorizontalBox();

                    GUILayout.Space(KGFGUIUtility.GetSkinHeight());

                    KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxDarkTop, GUILayout.ExpandWidth(true));
                    {
                        KGFGUIUtility.Label(itsOpenModule.GetName() + " version:", KGFGUIUtility.eStyleLabel.eLabelFitIntoBox);
                        KGFGUIUtility.Label(itsOpenModule.GetCurrentVersion().ToString(), KGFGUIUtility.eStyleLabel.eLabelFitIntoBox);
                        GUILayout.FlexibleSpace();
                        KGFGUIUtility.Label("req. KGFCore version:", KGFGUIUtility.eStyleLabel.eLabelFitIntoBox);
                        KGFGUIUtility.Label(itsOpenModule.GetRequiredCoreVersion().ToString(), KGFGUIUtility.eStyleLabel.eLabelFitIntoBox);
                    }
                    KGFGUIUtility.EndHorizontalBox();

                    KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxDarkBottom, GUILayout.ExpandWidth(true));
                    {
                        KGFGUIUtility.BeginVerticalPadding();
                        {
                            if (KGFGUIUtility.Button(KGFGUIUtility.GetHelpIcon(), "documentation", KGFGUIUtility.eStyleButton.eButtonLeft, GUILayout.ExpandWidth(true)))
                            {
                                Application.OpenURL("http://www.kolmich.at/documentation/" + itsOpenModule.GetDocumentationPath());
                                itsOpenModule = null;
                            }

                            /*
                             * if(KGFGUIUtility.Button("user documentation", KGFGUIUtility.eStyleButton.eButtonMiddle, GUILayout.ExpandWidth(true)))
                             * {
                             *      Application.OpenURL("http://www.kolmich.at/documentation/frames.html");
                             *      itsOpenModule = null;
                             * }
                             */
                            if (KGFGUIUtility.Button(KGFGUIUtility.GetHelpIcon(), "forum", KGFGUIUtility.eStyleButton.eButtonMiddle, GUILayout.ExpandWidth(true)))
                            {
                                Application.OpenURL("http://www.kolmich.at/forum/" + itsOpenModule.GetForumPath());
                                itsOpenModule = null;
                            }
                            if (KGFGUIUtility.Button(KGFGUIUtility.GetHelpIcon(), "homepage", KGFGUIUtility.eStyleButton.eButtonRight, GUILayout.ExpandWidth(true)))
                            {
                                Application.OpenURL("http://www.kolmich.at");
                                itsOpenModule = null;
                            }
                        }
                        KGFGUIUtility.EndVerticalPadding();
                    }
                    KGFGUIUtility.EndHorizontalBox();
                }
                KGFGUIUtility.EndHorizontalPadding();
            }
            KGFGUIUtility.EndVerticalBox();
            GUILayout.FlexibleSpace();
        }
        GUILayout.EndHorizontal();
    }
Exemple #13
0
    /// <summary>
    /// renders the default Kolmich game framework inspector window (TitleBar, Default Unity Inspector, Infobox, Buttons)
    /// </summary>
    /// <param name="theEditor">
    ///     <see cref="System.String"/>
    /// </param>
    public static void RenderKGFInspector(Editor theEditor, Type theType, Action theHandler)
    {
        #region icon loading
        if (itsIconHelp == null)
        {
            itsIconHelp = Resources.Load("KGFCore/textures/help") as Texture2D;
        }

        if (itsIconInfo == null)
        {
            itsIconInfo = Resources.Load("KGFCore/textures/info") as Texture2D;
        }

        if (itsIconWarning == null)
        {
            itsIconWarning = Resources.Load("KGFCore/textures/warning") as Texture2D;
        }

        if (itsIconError == null)
        {
            itsIconError = Resources.Load("KGFCore/textures/error") as Texture2D;
        }

        if (itsIconOK == null)
        {
            itsIconOK = Resources.Load("KGFCore/textures/ok") as Texture2D;
        }
        #endregion

        //set the look to Unity default
        EditorGUIUtility.LookLikeControls();

        KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBoxDecorated, GUILayout.ExpandHeight(false), GUILayout.ExpandWidth(true));
        {
            //render the title of the Inspector
            RenderTitle(theEditor.target);

            //render the path and the reference id
            RenderPath(theEditor);

            KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBoxMiddleVertical);
            {
                KGFGUIUtility.BeginHorizontalPadding();
                {
                    DrawCustomInspector(theEditor);
//					DrawCustomInspectorReflection(theEditor.target,theEditor.target,0);
//					theEditor.DrawDefaultInspector();
                    if (theHandler != null)
                    {
                        theHandler();
                    }
                }
                KGFGUIUtility.EndHorizontalPadding();
            }
            KGFGUIUtility.EndVerticalBox();

            // check if the object is a prefab
            PrefabType aPrefabType = PrefabUtility.GetPrefabType(theEditor.target);
            bool       theIsPrefab = !(aPrefabType == PrefabType.PrefabInstance || aPrefabType == PrefabType.None || aPrefabType == PrefabType.DisconnectedPrefabInstance);

            // draw custom inspector gui
            RenderObjectCustomGui(theEditor.target, theIsPrefab);

            // draw error checking gui
            RenderInspectorErrorChecking(theEditor.target);

            // help button
            KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxDarkBottom);
            {
                if (KGFGUIUtility.Button(itsIconHelp, "documentation", KGFGUIUtility.eStyleButton.eButton, GUILayout.ExpandWidth(true)))
                {
                    Application.OpenURL("http://www.kolmich.at/documentation/");
                }

                if (KGFGUIUtility.Button(itsIconHelp, "forum", KGFGUIUtility.eStyleButton.eButton, GUILayout.ExpandWidth(true)))
                {
                    Application.OpenURL("http://www.kolmich.at/forum");
                }

                if (KGFGUIUtility.Button(itsIconHelp, "homepage", KGFGUIUtility.eStyleButton.eButton, GUILayout.ExpandWidth(true)))
                {
                    Application.OpenURL("http://www.kolmich.at/");
                }
            }
            KGFGUIUtility.EndHorizontalBox();
        }
        KGFGUIUtility.EndVerticalBox();
    }