当前位置: 首页>>代码示例>>C#>>正文


C# Editor.GetOptimizedGUIBlock方法代码示例

本文整理汇总了C#中UnityEditor.Editor.GetOptimizedGUIBlock方法的典型用法代码示例。如果您正苦于以下问题:C# Editor.GetOptimizedGUIBlock方法的具体用法?C# Editor.GetOptimizedGUIBlock怎么用?C# Editor.GetOptimizedGUIBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEditor.Editor的用法示例。


在下文中一共展示了Editor.GetOptimizedGUIBlock方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawEditor

 private void DrawEditor(Editor editor, int editorIndex, bool rebuildOptimizedGUIBlock, ref bool showImportedObjectBarNext, ref Rect importedObjectBarRect)
 {
   if ((UnityEngine.Object) editor == (UnityEngine.Object) null)
     return;
   UnityEngine.Object target = editor.target;
   GUIUtility.GetControlID(target.GetInstanceID(), FocusType.Passive);
   EditorGUIUtility.ResetGUIState();
   GUILayoutGroup topLevel = GUILayoutUtility.current.topLevel;
   int visible = this.m_Tracker.GetVisible(editorIndex);
   bool flag1;
   if (visible == -1)
   {
     flag1 = InternalEditorUtility.GetIsInspectorExpanded(target);
     this.m_Tracker.SetVisible(editorIndex, !flag1 ? 0 : 1);
   }
   else
     flag1 = visible == 1;
   rebuildOptimizedGUIBlock |= editor.isInspectorDirty;
   if (Event.current.type == EventType.Repaint)
     editor.isInspectorDirty = false;
   ScriptAttributeUtility.propertyHandlerCache = editor.propertyHandlerCache;
   bool flag2 = AssetDatabase.IsMainAsset(target) || AssetDatabase.IsSubAsset(target) || editorIndex == 0 || target is Material;
   if (flag2)
   {
     string message = string.Empty;
     bool flag3 = editor.IsOpenForEdit(out message);
     if (showImportedObjectBarNext)
     {
       showImportedObjectBarNext = false;
       GUILayout.Space(15f);
       importedObjectBarRect = GUILayoutUtility.GetRect(16f, 16f);
       importedObjectBarRect.height = 17f;
     }
     flag1 = true;
     EditorGUI.BeginDisabledGroup(!flag3);
     editor.DrawHeader();
     EditorGUI.EndDisabledGroup();
   }
   if (editor.target is AssetImporter)
     showImportedObjectBarNext = true;
   bool flag4 = false;
   if (editor is GenericInspector && CustomEditorAttributes.FindCustomEditorType(target, false) != null && this.m_InspectorMode != InspectorMode.DebugInternal)
   {
     if (this.m_InspectorMode == InspectorMode.Normal)
       flag4 = true;
     else if (target is AssetImporter)
       flag4 = true;
   }
   if (!flag2)
   {
     EditorGUI.BeginDisabledGroup(!editor.IsEnabled());
     bool isExpanded = EditorGUILayout.InspectorTitlebar(flag1, editor.targets, editor.CanBeExpandedViaAFoldout());
     if (flag1 != isExpanded)
     {
       this.m_Tracker.SetVisible(editorIndex, !isExpanded ? 0 : 1);
       InternalEditorUtility.SetIsInspectorExpanded(target, isExpanded);
       if (isExpanded)
         this.m_LastInteractedEditor = editor;
       else if ((UnityEngine.Object) this.m_LastInteractedEditor == (UnityEngine.Object) editor)
         this.m_LastInteractedEditor = (Editor) null;
     }
     EditorGUI.EndDisabledGroup();
   }
   if (flag4 && flag1)
   {
     GUILayout.Label("Multi-object editing not supported.", EditorStyles.helpBox, new GUILayoutOption[0]);
   }
   else
   {
     EditorGUIUtility.ResetGUIState();
     EditorGUI.BeginDisabledGroup(!editor.IsEnabled());
     GenericInspector genericInspector = editor as GenericInspector;
     if ((bool) ((UnityEngine.Object) genericInspector))
       genericInspector.m_InspectorMode = this.m_InspectorMode;
     EditorGUIUtility.hierarchyMode = true;
     EditorGUIUtility.wideMode = (double) this.position.width > 330.0;
     ScriptAttributeUtility.propertyHandlerCache = editor.propertyHandlerCache;
     Rect rect = new Rect();
     OptimizedGUIBlock block;
     float height;
     if (editor.GetOptimizedGUIBlock(rebuildOptimizedGUIBlock, flag1, out block, out height))
     {
       rect = GUILayoutUtility.GetRect(0.0f, !flag1 ? 0.0f : height);
       this.HandleLastInteractedEditor(rect, editor);
       if (Event.current.type == EventType.Layout)
         return;
       if (block.Begin(rebuildOptimizedGUIBlock, rect) && flag1)
       {
         GUI.changed = false;
         editor.OnOptimizedInspectorGUI(rect);
       }
       block.End();
     }
     else
     {
       if (flag1)
       {
         rect = EditorGUILayout.BeginVertical(!editor.UseDefaultMargins() ? GUIStyle.none : EditorStyles.inspectorDefaultMargins, new GUILayoutOption[0]);
         this.HandleLastInteractedEditor(rect, editor);
         GUI.changed = false;
//.........这里部分代码省略.........
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:101,代码来源:InspectorWindow.cs

示例2: DrawEditor


//.........这里部分代码省略.........
			{
				EditorGUI.BeginDisabledGroup(!editor.IsEnabled());
				bool flag6 = EditorGUILayout.InspectorTitlebar(flag, editor.targets);
				if (flag != flag6)
				{
					this.m_Tracker.SetVisible(editorIndex, (!flag6) ? 0 : 1);
					InternalEditorUtility.SetIsInspectorExpanded(target, flag6);
					if (flag6)
					{
						this.m_LastInteractedEditor = editor;
					}
					else
					{
						if (this.m_LastInteractedEditor == editor)
						{
							this.m_LastInteractedEditor = null;
						}
					}
				}
				EditorGUI.EndDisabledGroup();
			}
			if (flag5 && flag)
			{
				GUILayout.Label("Multi-object editing not supported.", EditorStyles.helpBox, new GUILayoutOption[0]);
				return;
			}
			EditorGUIUtility.ResetGUIState();
			EditorGUI.BeginDisabledGroup(!editor.IsEnabled());
			GenericInspector genericInspector = editor as GenericInspector;
			if (genericInspector)
			{
				genericInspector.m_InspectorMode = this.m_InspectorMode;
			}
			EditorGUIUtility.hierarchyMode = true;
			EditorGUIUtility.wideMode = (base.position.width > 330f);
			ScriptAttributeUtility.propertyHandlerCache = editor.propertyHandlerCache;
			Rect rect = default(Rect);
			OptimizedGUIBlock optimizedGUIBlock;
			float num;
			if (editor.GetOptimizedGUIBlock(flag2, flag, out optimizedGUIBlock, out num))
			{
				rect = GUILayoutUtility.GetRect(0f, (!flag) ? 0f : num);
				this.HandleLastInteractedEditor(rect, editor);
				if (Event.current.type == EventType.Layout)
				{
					return;
				}
				if (optimizedGUIBlock.Begin(flag2, rect) && flag)
				{
					GUI.changed = false;
					editor.OnOptimizedInspectorGUI(rect);
				}
				optimizedGUIBlock.End();
			}
			else
			{
				if (flag)
				{
					GUIStyle style = (!editor.UseDefaultMargins()) ? GUIStyle.none : EditorStyles.inspectorDefaultMargins;
					rect = EditorGUILayout.BeginVertical(style, new GUILayoutOption[0]);
					this.HandleLastInteractedEditor(rect, editor);
					GUI.changed = false;
					try
					{
						editor.OnInspectorGUI();
					}
					catch (Exception ex)
					{
						if (ex is ExitGUIException)
						{
							throw;
						}
						Debug.LogException(ex);
					}
					EditorGUILayout.EndVertical();
				}
				if (Event.current.type == EventType.Used)
				{
					return;
				}
			}
			EditorGUI.EndDisabledGroup();
			if (GUILayoutUtility.current.topLevel != topLevel)
			{
				if (!GUILayoutUtility.current.layoutGroups.Contains(topLevel))
				{
					Debug.LogError("Expected top level layout group missing! Too many GUILayout.EndScrollView/EndVertical/EndHorizontal?");
					GUIUtility.ExitGUI();
				}
				else
				{
					Debug.LogWarning("Unexpected top level layout group! Missing GUILayout.EndScrollView/EndVertical/EndHorizontal?");
					while (GUILayoutUtility.current.topLevel != topLevel)
					{
						GUILayoutUtility.EndLayoutGroup();
					}
				}
			}
			this.HandleComponentScreenshot(rect, editor);
		}
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:101,代码来源:InspectorWindow.cs

示例3: FlushOptimizedGUIBlock

 private static void FlushOptimizedGUIBlock(Editor editor)
 {
   OptimizedGUIBlock block;
   float height;
   if ((UnityEngine.Object) editor == (UnityEngine.Object) null || !editor.GetOptimizedGUIBlock(false, false, out block, out height))
     return;
   block.valid = false;
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:8,代码来源:InspectorWindow.cs


注:本文中的UnityEditor.Editor.GetOptimizedGUIBlock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。