Example #1
0
    private void DrawCurrentCustomGUI(int theWindowID)
    {
        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();

            GUI.DragWindow();
            //GUI.DragWindow(new Rect(0, 0, itsWindowRectangle.width, KGFGUIUtility.GetWindowStyle().padding.top));
        }
        else
        {
            itsCurrentSelectedGUI = null;
        }
    }
    /// <summary>
    /// renders a title bar with image and title text
    /// </summary>
    /// <param name="theTitle">
    /// A <see cref="System.String"/>
    /// </param>
    public static void RenderTitle(UnityEngine.Object theTarget, string theTitle)
    {
        //get the icon of the module
        Texture2D aTexture = null;

        if (theTarget is KGFModule)
        {
            aTexture = (theTarget as KGFModule).GetIcon();
        }

        KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxDarkTop, GUILayout.ExpandWidth(true));
        {
            //ident the tile with a seperator right
            string aTitle = "\t";

            //check if the Target is null
            if (theTarget != null)
            {
                //append the type of the target to the title
                aTitle += theTarget.GetType().ToString();
            }

            if (theTitle != string.Empty)
            {
                //append the titlestring to the title
                aTitle += theTitle;
            }

            KGFGUIUtility.Label(aTitle, aTexture, KGFGUIUtility.eStyleLabel.eLabel, GUILayout.ExpandWidth(true));
        }
        KGFGUIUtility.EndHorizontalBox();
    }
Example #3
0
    private void RenderTableHeadings()
    {
        KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxDarkTop, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false));
        {
            foreach (KGFDataColumn aColumn in itsDataTable.Columns)
            {
                // check if visible is set to true
                if (itsColumnVisible[aColumn])
                {
                    // check if the width is fixed size
                    if (itsColumnWidth[aColumn] != 0)
                    {
                        KGFGUIUtility.Label(aColumn.ColumnName, KGFGUIUtility.eStyleLabel.eLabelFitIntoBox, GUILayout.Width(itsColumnWidth[aColumn]));
                    }
                    else
                    {
                        KGFGUIUtility.Label(aColumn.ColumnName, KGFGUIUtility.eStyleLabel.eLabelFitIntoBox, GUILayout.ExpandWidth(true));
                    }

                    KGFGUIUtility.Separator(KGFGUIUtility.eStyleSeparator.eSeparatorVerticalFitInBox);
                }
            }
        }
        KGFGUIUtility.EndHorizontalBox();
    }
Example #4
0
    /// <summary>
    /// Draw the input information (bottom right)
    /// </summary>
    public void DrawInput()
    {
        GUILayout.BeginArea(new Rect(0, 0, Screen.width, Screen.height));
        {
            KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBoxInvisible);
            {
                GUILayout.FlexibleSpace();

                GUILayout.BeginHorizontal();
                {
                    GUILayout.FlexibleSpace();

                    if (itsOrbiter.itsRoot.itsRoot == itsCharacter)
                    {
                        KGFGUIUtility.Box(itsKeys, KGFGUIUtility.eStyleBox.eBoxInvisible, GUILayout.Height(Screen.height / 10f), GUILayout.Width(Screen.width / 10f));
                        KGFGUIUtility.Box(itsMouseRotate, KGFGUIUtility.eStyleBox.eBoxInvisible, GUILayout.Height(Screen.height / 10f), GUILayout.Width(Screen.width / 10f));
                        KGFGUIUtility.Box(itsMouseZoom, KGFGUIUtility.eStyleBox.eBoxInvisible, GUILayout.Height(Screen.height / 10f), GUILayout.Width(Screen.width / 10f));
                    }
                    else
                    {
                        KGFGUIUtility.Box(itsMouseRotate, KGFGUIUtility.eStyleBox.eBoxInvisible, GUILayout.Height(Screen.height / 10f), GUILayout.Width(Screen.width / 10f));
                        KGFGUIUtility.Box(itsMouseZoom, KGFGUIUtility.eStyleBox.eBoxInvisible, GUILayout.Height(Screen.height / 10f), GUILayout.Width(Screen.width / 10f));
                    }
                }
                GUILayout.EndHorizontal();
                GUILayout.Space(32);
            }
            GUILayout.EndVertical();
        }
        GUILayout.EndArea();
    }
    /// <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>
    /// renders the gameobject path up to the root
    /// </summary>
    /// <param name="theComponent"></param>
    public static void RenderPath(Component theComponent)
    {
        GameObject aGameObject = theComponent.gameObject;

        // generate path for the gameObject
        string aPath = aGameObject.name;

        while (aGameObject.transform.parent != null)
        {
            aGameObject = aGameObject.transform.parent.gameObject;
            aPath       = string.Format("{0}/{1}", aGameObject.name, aPath);
        }

        KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxMiddleVertical);
        {
            KGFGUIUtility.Label("path", KGFGUIUtility.eStyleLabel.eLabel, GUILayout.ExpandWidth(false));

            if (PrefabUtility.GetPrefabType(theComponent) == PrefabType.Prefab)
            {
                KGFGUIUtility.TextField(AssetDatabase.GetAssetPath(theComponent), KGFGUIUtility.eStyleTextField.eTextField, GUILayout.ExpandWidth(true));
            }
            else
            {
                KGFGUIUtility.TextField(aPath, KGFGUIUtility.eStyleTextField.eTextField, GUILayout.ExpandWidth(true));
            }
        }
        KGFGUIUtility.EndHorizontalBox();
    }
    private void RenderTableHeadings()
    {
        if (itsTextureArrowDown == null)
        {
            LoadTextures();
        }

        KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxDarkTop, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false));
        {
            foreach (KGFDataColumn aColumn in itsDataTable.Columns)
            {
                // check if visible is set to true
                if (itsColumnVisible[aColumn])
                {
                    GUILayoutOption[] anOptions;

                    // check if the width is fixed size
                    if (itsColumnWidth[aColumn] != 0)
                    {
                        anOptions = new GUILayoutOption[] { GUILayout.Width(itsColumnWidth[aColumn]) };
                    }
                    else
                    {
                        anOptions = new GUILayoutOption[] { GUILayout.ExpandWidth(true) };
                    }

                    GUILayout.BeginHorizontal(anOptions);
                    {
                        KGFGUIUtility.Label(aColumn.ColumnName, KGFGUIUtility.eStyleLabel.eLabelFitIntoBox);

                        if (aColumn == itsSortColumn)
                        {
                            if (itsSortDirection)
                            {
                                KGFGUIUtility.Label("", itsTextureArrowDown, KGFGUIUtility.eStyleLabel.eLabelFitIntoBox, GUILayout.Width(14));
                            }
                            else
                            {
                                KGFGUIUtility.Label("", itsTextureArrowUp, KGFGUIUtility.eStyleLabel.eLabelFitIntoBox, GUILayout.Width(14));
                            }
                        }
                    }
                    GUILayout.EndHorizontal();

                    if (Event.current.type == EventType.MouseUp &&
                        GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition))
                    {
                        SortColumn(aColumn);
                    }

                    KGFGUIUtility.Separator(KGFGUIUtility.eStyleSeparator.eSeparatorVerticalFitInBox);
                }
            }
        }
        KGFGUIUtility.EndHorizontalBox();
    }
 /// <summary>
 /// renders error box in error color
 /// </summary>
 /// <param name="theError">
 /// A <see cref="System.String"/>
 /// </param>
 public static void RenderOK()
 {
     SetColorOK();
     KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBox, GUILayout.ExpandWidth(true));
     {
         KGFGUIUtility.Label("All component values are valid", itsIconOK, KGFGUIUtility.eStyleLabel.eLabel, GUILayout.ExpandWidth(true));
     }
     KGFGUIUtility.EndHorizontalBox();
     SetColorDefault();
 }
 /// <summary>
 /// renders error box in error color
 /// </summary>
 /// <param name="theError">
 /// A <see cref="System.String"/>
 /// </param>
 public static void RenderError(string theError)
 {
     SetColorError();
     KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBox, GUILayout.ExpandWidth(true));
     {
         GUILayout.Label(new GUIContent(theError, itsIconError), GetMultiLineStyle(), GUILayout.ExpandWidth(true));
     }
     KGFGUIUtility.EndHorizontalBox();
     SetColorDefault();
 }
Example #10
0
 /// <summary>
 /// renders error box in error color
 /// </summary>
 /// <param name="theError">
 /// A <see cref="System.String"/>
 /// </param>
 public static void RenderError(string theError)
 {
     SetColorError();
     KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBox, GUILayout.ExpandWidth(true));
     {
         KGFGUIUtility.Label(theError, itsIconError, KGFGUIUtility.eStyleLabel.eLabel, GUILayout.ExpandWidth(true));
     }
     KGFGUIUtility.EndHorizontalBox();
     SetColorDefault();
 }
    /// <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();
        }
    }
 public static void RenderPath(Editor theEditor)
 {
     KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBox);
     {
         if (theEditor.target is Component)
         {
             RenderPath((Component)theEditor.target);
         }
     }
     KGFGUIUtility.EndHorizontalBox();
 }
Example #13
0
    private bool DrawBoolean(string theTitle, bool theValue)
    {
        //rotation left limit
        GUILayout.BeginHorizontal();
        KGFGUIUtility.Label(theTitle);
        GUILayout.FlexibleSpace();
        bool aValue = KGFGUIUtility.Toggle(theValue, "", KGFGUIUtility.eStyleToggl.eTogglCompact);

        GUILayout.EndHorizontal();
        return(aValue);
    }
    /// <summary>
    /// Draw the full text search
    /// </summary>
    void DrawSearch()
    {
        GUI.SetNextControlName(itsControlSearchName);
        string aValue = KGFGUIUtility.TextField(itsSearch, KGFGUIUtility.eStyleTextField.eTextField);

        if (aValue != itsSearch)
        {
            itsSearch = aValue;
            UpdateItemFilter();
        }
    }
Example #15
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();
    }
Example #16
0
 void DrawButtons()
 {
     for (int i = 0; i < itsButtons.Count; i++)
     {
         if (KGFGUIUtility.Button(itsButtons[i], KGFGUIUtility.eStyleButton.eButton))
         {
             if (itsEventClosed != null)
             {
                 itsEventClosed(this, new KGFDialogWindowButtonClickEventArgs(i));
             }
             Close();
         }
     }
 }
    public static GUIStyle GetMultiLineStyle()
    {
        if (KGFGUIUtility.GetSkinIndex() == -1)
        {
            GUIStyle aStyle = new GUIStyle();
            aStyle.wordWrap = true;
            return(aStyle);
        }

        GUIStyle aWrapStyle = new GUIStyle(KGFGUIUtility.GetStyleLabel(KGFGUIUtility.eStyleLabel.eLabel));

        aWrapStyle.wordWrap    = true;
        aWrapStyle.fixedHeight = 0;
        return(aWrapStyle);
    }
 /// <summary>
 /// Draw the select all/none buttons
 /// </summary>
 void DrawButtons()
 {
     GUILayout.BeginHorizontal();
     {
         if (KGFGUIUtility.Button("All", KGFGUIUtility.eStyleButton.eButton))
         {
             SetSelectedAll(true);
         }
         if (KGFGUIUtility.Button("None", KGFGUIUtility.eStyleButton.eButton))
         {
             SetSelectedAll(false);
         }
     }
     GUILayout.EndHorizontal();
 }
Example #19
0
 /// <summary>
 /// renders a dark box top and a normal box bottom including two labels
 /// </summary>
 private void RenderControlCombination3()
 {
     KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxDarkTop, GUILayout.ExpandWidth(true));                     //render first row
     {
         GUILayout.FlexibleSpace();
         KGFGUIUtility.Label("box dark top", KGFGUIUtility.eStyleLabel.eLabelFitIntoBox);
         GUILayout.FlexibleSpace();
     }
     KGFGUIUtility.EndHorizontalBox();
     KGFGUIUtility.BeginHorizontalBox(KGFGUIUtility.eStyleBox.eBoxBottom, GUILayout.ExpandWidth(true));                      //render first row
     {
         KGFGUIUtility.Label("box bottom", KGFGUIUtility.eStyleLabel.eLabelFitIntoBox);
     }
     KGFGUIUtility.EndHorizontalBox();
 }
    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;
            }
        }
    }
    public void OnGUI()
    {
        GUILayout.BeginArea(itsRect);
        {
            KGFGUIUtility.BeginVerticalBox(KGFGUIUtility.eStyleBox.eBoxInvisible);
            {
                GUILayout.FlexibleSpace();

                GUILayout.BeginHorizontal();
                {
                    GUILayout.FlexibleSpace();

                    if (itsDemo.itsCurrentCameraRoot == KGFCameraSystemDemo.eCameraRoot.eCharacter)
                    {
                        KGFGUIUtility.Box(itsKeys, KGFGUIUtility.eStyleBox.eBoxInvisible, GUILayout.Height(Screen.height / 10f), GUILayout.Width(Screen.width / 10f));
//						KGFGUIUtility.Box(itsMouseMove,KGFGUIUtility.eStyleBox.eBoxInvisible, GUILayout.Height(Screen.height/10f), GUILayout.Width(Screen.width/10f));
                        KGFGUIUtility.Box(itsMouseRotate, KGFGUIUtility.eStyleBox.eBoxInvisible, GUILayout.Height(Screen.height / 10f), GUILayout.Width(Screen.width / 10f));
                        KGFGUIUtility.Box(itsMouseZoom, KGFGUIUtility.eStyleBox.eBoxInvisible, GUILayout.Height(Screen.height / 10f), GUILayout.Width(Screen.width / 10f));
                        //KGFGUIUtility.Box(itsMouseZoom,KGFGUIUtility.eStyleBox.eBoxInvisible, GUILayout.Height(Screen.height/10f), GUILayout.Width(Screen.width/10f));
                    }
                    else if (itsDemo.itsCurrentCameraRoot == KGFCameraSystemDemo.eCameraRoot.eObserve)
                    {
                        KGFGUIUtility.Box(itsKeys, KGFGUIUtility.eStyleBox.eBoxInvisible, GUILayout.Height(Screen.height / 10f), GUILayout.Width(Screen.width / 10f));
                    }
                    else if (itsDemo.itsCurrentCameraRoot == KGFCameraSystemDemo.eCameraRoot.ePanning || itsDemo.itsCurrentCameraRoot == KGFCameraSystemDemo.eCameraRoot.ePanningCamera)
                    {
                        KGFGUIUtility.Box(itsKeys, KGFGUIUtility.eStyleBox.eBoxInvisible, GUILayout.Height(Screen.height / 10f), GUILayout.Width(Screen.width / 10f));
                        KGFGUIUtility.Box(itsMouseRotate, KGFGUIUtility.eStyleBox.eBoxInvisible, GUILayout.Height(Screen.height / 10f), GUILayout.Width(Screen.width / 10f));
                    }
                    else
                    {
                        KGFGUIUtility.Box(itsMouseRotate, KGFGUIUtility.eStyleBox.eBoxInvisible, GUILayout.Height(Screen.height / 10f), GUILayout.Width(Screen.width / 10f));
                        KGFGUIUtility.Box(itsMouseZoom, KGFGUIUtility.eStyleBox.eBoxInvisible, GUILayout.Height(Screen.height / 10f), GUILayout.Width(Screen.width / 10f));
                    }
                }
                GUILayout.EndHorizontal();
                GUILayout.Space(32);
            }
            GUILayout.EndVertical();
        }
        GUILayout.EndArea();
    }
Example #22
0
    void DrawIcon()
    {
        switch (itsIconStyle)
        {
        case eIconStyle.Info:
            KGFGUIUtility.Label("", itsTextureInfo, KGFGUIUtility.eStyleLabel.eLabel);
            break;

        case eIconStyle.Question:
            KGFGUIUtility.Label("", itsTextureQuestion, KGFGUIUtility.eStyleLabel.eLabel);
            break;

        case eIconStyle.Warning:
            KGFGUIUtility.Label("", itsTextureWarning, KGFGUIUtility.eStyleLabel.eLabel);
            break;

        case eIconStyle.Error:
            KGFGUIUtility.Label("", itsTextureError, KGFGUIUtility.eStyleLabel.eLabel);
            break;
        }
    }
Example #23
0
    public static void RenderHelpWindow()
    {
        if (itsOpenModule != null)
        {
            int aWidth  = 512 + (int)KGFGUIUtility.GetSkinHeight() * 2;
            int aHeight = 256 + (int)KGFGUIUtility.GetSkinHeight() * 7;

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

            KGFGUIUtility.Window(12345689, aRect, RenderHelpWindowMethod, itsOpenModule.GetName() + " (part of KOLMICH Game Framework)");

            if (aRect.Contains(Event.current.mousePosition) && Event.current.type == EventType.MouseDown && Event.current.button == 0)
            {
                itsOpenModule = null;
            }
        }
        else
        {
            itsOpenModule = null;
        }
    }
Example #24
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();
    }
Example #25
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();
    }
Example #26
0
    private float DrawFloat(string theLimitTitle, float theLimitValue, bool theUseLimits, float theMinValue, float theMaxValue)
    {
        //rotation left limit
        GUILayout.BeginHorizontal();
        string aCurrentLimitString = "NO LIMIT SET";

        if (theUseLimits)
        {
            aCurrentLimitString = string.Format("{0:0.00}", theLimitValue);
        }
        KGFGUIUtility.Label(theLimitTitle);
        float aValue = 0.0f;

        if (theUseLimits)
        {
            GUILayout.FlexibleSpace();
            aValue = KGFGUIUtility.HorizontalSlider(theLimitValue, theMinValue, theMaxValue, GUILayout.Width(120.0f));
        }
        KGFGUIUtility.Label(aCurrentLimitString);
        GUILayout.EndHorizontal();
        return(aValue);
    }
Example #27
0
 /// <summary>
 /// We use here the KGFGUIUtility to render all the elements.
 /// </summary>
 /// <param name="windowID"></param>
 void RenderTutorialWindow(int windowID)
 {
     GUILayout.BeginHorizontal();
     {
         KGFGUIUtility.Space();
         GUILayout.BeginVertical();
         {
             KGFGUIUtility.Space();
             GUILayout.BeginHorizontal();
             {
                 RenderControlCombination1();                        //render textfield left and button right
                 KGFGUIUtility.Space();
                 RenderControlCombination2();                        //render button left button middle and button right
             }
             GUILayout.EndHorizontal();
             KGFGUIUtility.Space();
             RenderControlCombination3();                            //render box dark top and box bottom + labels
         }
         GUILayout.EndVertical();
         KGFGUIUtility.Space();
     }
     GUILayout.EndHorizontal();
 }
    void DrawFilterBox(KGFObjectListColumnItem theItem, uint theWidth)
    {
        if (theItem.GetReturnType().IsEnum || theItem.GetReturnType() == typeof(bool))
        {
            if (theItem.itsDropDown == null)
            {
                if (theItem.GetReturnType() == typeof(bool))
                {
                    theItem.itsDropDown = new KGFGUIDropDown((new List <string>(itsBoolValues)).InsertItem(NONE_STRING, 0), theWidth, 5, KGFGUIDropDown.eDropDirection.eUp);
                }
                else if (theItem.GetReturnType().IsEnum)
                {
                    theItem.itsDropDown = new KGFGUIDropDown(Enum.GetNames(theItem.GetReturnType()).InsertItem(NONE_STRING, 0), theWidth, 5, KGFGUIDropDown.eDropDirection.eUp);
                }

                theItem.itsDropDown.itsTitle = "";
                theItem.itsDropDown.SetSelectedItem(theItem.itsFilterString);
                theItem.itsDropDown.SelectedValueChanged += OnDropDownValueChanged;
            }
            theItem.itsDropDown.Render();
        }
        else if (theItem.GetReturnType() == typeof(string))
        {
            if (theItem.itsFilterString == null)
            {
                theItem.itsFilterString = "";
            }

            string aFilter = KGFGUIUtility.TextField(theItem.itsFilterString, KGFGUIUtility.eStyleTextField.eTextField, GUILayout.Width(theWidth));
            if (aFilter != theItem.itsFilterString)
            {
                theItem.itsFilterString = aFilter;
                UpdateList();
                OnSettingsChanged();
            }
        }
    }
    /// <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();
    }