當前位置: 首頁>>代碼示例>>C#>>正文


C# UnityEditor.Editor類代碼示例

本文整理匯總了C#中UnityEditor.Editor的典型用法代碼示例。如果您正苦於以下問題:C# Editor類的具體用法?C# Editor怎麽用?C# Editor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Editor類屬於UnityEditor命名空間,在下文中一共展示了Editor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Init

		private bool Init(UnityEngine.Object obj, EditorFeatures requirements)
		{
			this.editor = Editor.CreateEditor(obj);
			if (this.editor == null)
			{
				return false;
			}
			if ((requirements & EditorFeatures.PreviewGUI) > EditorFeatures.None && !this.editor.HasPreviewGUI())
			{
				return false;
			}
			Type type = this.editor.GetType();
			MethodInfo method = type.GetMethod("OnSceneDrag", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (method != null)
			{
				this.OnSceneDrag = (EditorWrapper.VoidDelegate)Delegate.CreateDelegate(typeof(EditorWrapper.VoidDelegate), this.editor, method);
			}
			else
			{
				if ((requirements & EditorFeatures.OnSceneDrag) > EditorFeatures.None)
				{
					return false;
				}
				this.OnSceneDrag = new EditorWrapper.VoidDelegate(this.DefaultOnSceneDrag);
			}
			return true;
		}
開發者ID:guozanhua,項目名稱:UnityDecompiled,代碼行數:27,代碼來源:EditorWrapper.cs

示例2: OnEditModeStart

		protected void OnEditModeStart(Editor editor, EditMode.SceneViewEditMode mode)
		{
			if (mode == EditMode.SceneViewEditMode.Collider && editor == this)
			{
				this.OnEditStart();
			}
		}
開發者ID:guozanhua,項目名稱:UnityDecompiled,代碼行數:7,代碼來源:ColliderEditorBase.cs

示例3: DoEditModeInspectorModeButton

 public static void DoEditModeInspectorModeButton(SceneViewEditMode mode, string label, GUIContent icon, Bounds bounds, Editor caller)
 {
     if (!EditorUtility.IsPersistent(caller.target))
     {
         DetectMainToolChange();
         if (s_EditColliderButtonStyle == null)
         {
             s_EditColliderButtonStyle = new GUIStyle("Button");
             s_EditColliderButtonStyle.padding = new RectOffset(0, 0, 0, 0);
             s_EditColliderButtonStyle.margin = new RectOffset(0, 0, 0, 0);
         }
         Rect rect = EditorGUILayout.GetControlRect(true, 23f, new GUILayoutOption[0]);
         Rect position = new Rect(rect.xMin + EditorGUIUtility.labelWidth, rect.yMin, 33f, 23f);
         GUIContent content = new GUIContent(label);
         Vector2 vector = GUI.skin.label.CalcSize(content);
         Rect rect3 = new Rect(position.xMax + 5f, rect.yMin + ((rect.height - vector.y) * 0.5f), vector.x, rect.height);
         int instanceID = caller.GetInstanceID();
         bool flag = (editMode == mode) && (ownerID == instanceID);
         EditorGUI.BeginChangeCheck();
         bool flag2 = GUI.Toggle(position, flag, icon, s_EditColliderButtonStyle);
         GUI.Label(rect3, label);
         if (EditorGUI.EndChangeCheck())
         {
             ChangeEditMode(!flag2 ? SceneViewEditMode.None : mode, bounds, caller);
         }
     }
 }
開發者ID:demelev,項目名稱:projectHL,代碼行數:27,代碼來源:EditMode.cs

示例4: OnEditModeEnd

		protected void OnEditModeEnd(Editor editor)
		{
			if (editor == this)
			{
				this.OnEditEnd();
			}
		}
開發者ID:guozanhua,項目名稱:UnityDecompiled,代碼行數:7,代碼來源:ColliderEditorBase.cs

示例5: OnEnable

 internal virtual void OnEnable()
 {
   this.m_ActiveEditorIndex = EditorPrefs.GetInt(this.GetType().Name + "ActiveEditorIndex", 0);
   if (!((UnityEngine.Object) this.m_ActiveEditor == (UnityEngine.Object) null))
     return;
   this.m_ActiveEditor = Editor.CreateEditor(this.targets, this.m_SubEditorTypes[this.m_ActiveEditorIndex]);
 }
開發者ID:BlakeTriana,項目名稱:unity-decompiled,代碼行數:7,代碼來源:TabbedEditor.cs

示例6: OnEditModeStart

 protected void OnEditModeStart(Editor editor, UnityEditorInternal.EditMode.SceneViewEditMode mode)
 {
     if ((mode == UnityEditorInternal.EditMode.SceneViewEditMode.Collider) && (editor == this))
     {
         this.OnEditStart();
     }
 }
開發者ID:randomize,項目名稱:VimConfig,代碼行數:7,代碼來源:ColliderEditorBase.cs

示例7: OnGUI

 void OnGUI()
 {
     InspectorTools.DrawLogoAndName(InspectorTools.GetLogo(), "Loot manager v1.0.0");
     EditorGUILayout.BeginHorizontal();
     EditorGUILayout.BeginVertical(GUILayout.Width(130));
     ScrollElements = EditorGUILayout.BeginScrollView(ScrollElements);
     CurrentItem = InspectorTools.DrawButtonsByList<LootItem>(LootData.Instance.Items, (x) => { }, CurrentItem);
     EditorGUILayout.EndScrollView();
     EditorGUILayout.EndVertical();
     EditorGUILayout.BeginVertical();
     if (CurrentItem >= 0)
     {
         LootData.Instance.Items[CurrentItem].Image = EditorGUILayout.ObjectField("UI Image", LootData.Instance.Items[CurrentItem].Image, typeof(Sprite), GUILayout.MaxHeight(200)) as Sprite;
         LootData.Instance.Items[CurrentItem].Name = EditorGUILayout.TextField("Name", LootData.Instance.Items[CurrentItem].Name);
         LootData.Instance.Items[CurrentItem].Description = EditorGUILayout.TextField("Description", LootData.Instance.Items[CurrentItem].Description,GUILayout.MaxHeight(200));
         LootData.Instance.Items[CurrentItem].Prefab = EditorGUILayout.ObjectField("Prefab", LootData.Instance.Items[CurrentItem].Prefab, typeof(GameObject)) as GameObject;
         if (LootData.Instance.Items[CurrentItem].Prefab != null)
         {
             if (gameObjectEditor == null)
                 gameObjectEditor = Editor.CreateEditor(LootData.Instance.Items[CurrentItem].Prefab);
             gameObjectEditor.OnPreviewGUI(GUILayoutUtility.GetRect(300, 400), null);
         }
     }
     EditorGUILayout.EndVertical();
     EditorGUILayout.EndHorizontal();
     this.ChangeHotControllByClick();
 }
開發者ID:OrangeShotman,項目名稱:MobDestroy,代碼行數:27,代碼來源:LootManager.cs

示例8: OnEnable

 internal virtual void OnEnable()
 {
     this.m_ActiveEditorIndex = EditorPrefs.GetInt(base.GetType().Name + "ActiveEditorIndex", 0);
     if (this.m_ActiveEditor == null)
     {
         this.m_ActiveEditor = Editor.CreateEditor(base.targets, this.m_SubEditorTypes[this.m_ActiveEditorIndex]);
     }
 }
開發者ID:CarlosHBC,項目名稱:UnityDecompiled,代碼行數:8,代碼來源:TabbedEditor.cs

示例9: StartDrag

 /// <summary>
 /// Starts a drag operation on a GUI element.
 /// </summary>
 /// <param name="editorWindow">Reference to the current editor drawing the GUI (used when a Repaint is needed)</param>
 /// <param name="draggableList">List containing the dragged item and all other relative draggable items</param>
 /// <param name="dragItem">Item being dragged</param>
 /// <param name="draggedItemIndex">DraggableList index of the item being dragged</param>
 /// <param name="optionalData">Optional data that can be retrieved via the <see cref="optionalDragData"/> static property</param>
 public static void StartDrag(EditorWindow editorWindow, IList draggableList, object dragItem, int draggedItemIndex, object optionalData = null)
 {
     if (_dragData != null) return;
     Reset();
     _editor = null;
     _editorWindow = editorWindow;
     _dragData = new GUIDragData(draggableList, dragItem, draggedItemIndex, optionalData);
 }
開發者ID:fergu00,項目名稱:hounitylibs,代碼行數:16,代碼來源:HOGUIDrag.cs

示例10: DrawInspector

		public static void DrawInspector(Editor wcEditor, System.Type baseType, List<string> ignoreClasses = null) {

			var so = new SerializedObject(wcEditor.targets);
			var target = wcEditor.target;
			
			so.Update();

			var baseTypes = new List<System.Type>();
			var baseTargetType = target.GetType();
			baseTypes.Add(baseTargetType);
			while (baseType != baseTargetType) {

				baseTargetType = baseTargetType.BaseType;
				baseTypes.Add(baseTargetType);

			}
			baseTypes.Reverse();

			SerializedProperty prop = so.GetIterator();
			var result = prop.NextVisible(true);

			EditorGUILayout.PropertyField(prop, false);

			if (result == true) {

				var currentType = EditorUtilitiesEx.FindTypeByProperty(baseTypes, prop);
				EditorGUILayout.BeginVertical();
				{

					while (prop.NextVisible(false) == true) {
						
						var cType = EditorUtilitiesEx.FindTypeByProperty(baseTypes, prop);
						if (cType != currentType) {
							
							currentType = cType;

							var name = cType.Name;
							if (ignoreClasses != null && ignoreClasses.Contains(name) == true) continue;

							EditorUtilitiesEx.DrawSplitter(name);

						}

						EditorGUILayout.PropertyField(prop, true);

					}

					prop.Reset();

				}
				EditorGUILayout.EndVertical();

			}

			so.ApplyModifiedProperties();

		}
開發者ID:Cyberbanan,項目名稱:Unity3d.UI.Windows,代碼行數:57,代碼來源:EditorUtilitiesEx.cs

示例11: OnGUI

 void OnGUI()
 {
     if (serverConfig != null) {
        if (serverConfigEditor == null) {
             serverConfigEditor = Editor.CreateEditor(serverConfig);
         }
         serverConfigEditor.OnInspectorGUI();
     }
 }
開發者ID:gamemachine,項目名稱:gamemachine,代碼行數:9,代碼來源:GameMachineEditor.cs

示例12: ObjectPreviewPopup

		public ObjectPreviewPopup(UnityEngine.Object previewObject)
		{
			if (previewObject == null)
			{
				Debug.LogError("ObjectPreviewPopup: Check object is not null, before trying to show it!");
				return;
			}
			this.m_ObjectName = new GUIContent(previewObject.name, AssetDatabase.GetAssetPath(previewObject));
			this.m_Editor = Editor.CreateEditor(previewObject);
		}
開發者ID:guozanhua,項目名稱:UnityDecompiled,代碼行數:10,代碼來源:ObjectPreviewPopup.cs

示例13: OnGUI

		private void OnGUI(){
			if (database != null) {
				if (editor == null || editor.target != database) {
					editor = Editor.CreateEditor (database);
				}
				scroll=EditorGUILayout.BeginScrollView(scroll);
				editor.OnInspectorGUI ();
				EditorGUILayout.EndScrollView();
			}
		}
開發者ID:gloowa,項目名稱:mstest,代碼行數:10,代碼來源:LoginSystemEditor.cs

示例14: CreateCachedEditor

 public static void CreateCachedEditor(UnityEngine.Object[] targetObjects, System.Type editorType, ref Editor previousEditor)
 {
     if ((previousEditor == null) || !ArrayUtility.ArrayEquals<UnityEngine.Object>(previousEditor.m_Targets, targetObjects))
     {
         if (previousEditor != null)
         {
             UnityEngine.Object.DestroyImmediate(previousEditor);
         }
         previousEditor = CreateEditor(targetObjects, editorType);
     }
 }
開發者ID:randomize,項目名稱:VimConfig,代碼行數:11,代碼來源:Editor.cs

示例15: ObjectPreviewPopup

 public ObjectPreviewPopup(Object previewObject)
 {
   if (previewObject == (Object) null)
   {
     Debug.LogError((object) "ObjectPreviewPopup: Check object is not null, before trying to show it!");
   }
   else
   {
     this.m_ObjectName = new GUIContent(previewObject.name, AssetDatabase.GetAssetPath(previewObject));
     this.m_Editor = Editor.CreateEditor(previewObject);
   }
 }
開發者ID:BlakeTriana,項目名稱:unity-decompiled,代碼行數:12,代碼來源:ObjectPreviewPopup.cs


注:本文中的UnityEditor.Editor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。