/// <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(); }