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


C# UnityEngine.GetTooltip方法代码示例

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


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

示例1: OnGUI

		public static void OnGUI(UnityEngine.Object targetObject){
			EditorGUI.BeginChangeCheck ();
			SerializedObject serializedObject = new SerializedObject (targetObject);
			serializedObject.Update ();
			FieldInfo[] fields;
			if(!fieldsLookup.TryGetValue (targetObject.GetType (),out fields)){
				fields=targetObject.GetPublicFields().OrderBy(field => field.MetadataToken).ToArray();

				fieldsLookup.Add(targetObject.GetType(),fields);
			}
			if(PreferencesEditor.GetBool(Preference.ShowActionTooltips) && !string.IsNullOrEmpty(targetObject.GetTooltip())){
				GUILayout.BeginVertical((GUIStyle)"hostview");

				GUILayout.Label(targetObject.GetTooltip(),FsmEditorStyles.wrappedLabelLeft);
				GUILayout.EndVertical();
			}


			for (int i=0; i< fields.Length; i++) {
				FieldInfo field=fields[i];
				if(field.HasAttribute(typeof(HideInInspector))){
					continue;
				}
				PropertyDrawer drawer=GUIDrawer.GetDrawer(field);
				GUIContent content = field.GetInspectorGUIContent ();
				SerializedProperty property=serializedObject.FindProperty(field.Name);
				if(PreferencesEditor.GetBool(Preference.ShowVariableTooltips) && !string.IsNullOrEmpty(field.GetTooltip())){
					GUILayout.BeginVertical("box");
					GUILayout.Label(field.GetTooltip(),FsmEditorStyles.wrappedLabelLeft);
					GUILayout.EndVertical();
				}

				if(drawer != null){
					drawer.fieldInfo=field;
					drawer.OnGUI(property,content);
				}else{
					int indentLevel=EditorGUI.indentLevel;
					EditorGUI.indentLevel=	typeof(IList).IsAssignableFrom(field.FieldType)?indentLevel+1:indentLevel;
					EditorGUILayout.PropertyField (property, content,true);
					EditorGUI.indentLevel=indentLevel;
				}
			}


			if (EditorGUI.EndChangeCheck()) {
				serializedObject.ApplyModifiedProperties();
				ErrorChecker.CheckForErrors();
			}
		}
开发者ID:AlexGam,项目名称:TowerIsland,代码行数:49,代码来源:GUIDrawer.cs

示例2: ObjectTitlebar

		public static bool ObjectTitlebar(UnityEngine.Object targetObject, bool foldout ,ref bool enabled, GenericMenu settings){
			int controlID = EditorGUIUtility.GetControlID (FocusType.Passive);
			GUIContent content = new GUIContent (targetObject.name.Replace("/","."), targetObject.GetTooltip());
			
			Rect position= GUILayoutUtility.GetRect(GUIContent.none, FsmEditorStyles.inspectorTitle);
			Rect rect = new Rect(position.x + (float)FsmEditorStyles.inspectorTitle.padding.left, position.y + (float)FsmEditorStyles.inspectorTitle.padding.top, 16f, 16f);
			Rect rect1 = new Rect(position.xMax - (float)FsmEditorStyles.inspectorTitle.padding.right - 2f - 16f, rect.y, 16f, 16f);
			Rect rect4 = rect1;
			rect4.x = rect4.x - 18f;
			
			Rect rect2 = new Rect(position.x + 2f + 2f + 16f*2, rect.y, 100f, rect.height)
			{
				xMax = rect4.xMin - 2f
			};
			Rect rect3 = new Rect(position.x + 16f, rect.y, 16f, 16f);
			
			enabled=GUI.Toggle (rect3, enabled,GUIContent.none);
			string url=targetObject.GetHelpUrl();
			
			if (ErrorChecker.HasErrors (targetObject)) {
				Rect rect5 = rect4;
				rect5.y += 1.0f;
				if(!string.IsNullOrEmpty(url)){
					rect5.x = rect5.x - 18f;
					rect2.xMax=rect5.x;
				}
				
				GUI.Label (rect5, FsmEditorStyles.errorIcon, FsmEditorStyles.inspectorTitleText);
			}
			
			if (GUI.Button(rect1, FsmEditorStyles.popupIcon,FsmEditorStyles.inspectorTitleText))
			{
				settings.ShowAsContext();
			}
			
			if (!string.IsNullOrEmpty(url) && GUI.Button(rect4, FsmEditorStyles.helpIcon,FsmEditorStyles.inspectorTitleText))
			{
				Application.OpenURL(url);
			}
			
			EventType eventType = Event.current.type;
			if (eventType != EventType.MouseDown) {
				if (eventType == EventType.Repaint)
				{
					FsmEditorStyles.inspectorTitle.Draw (position, GUIContent.none, controlID, foldout);
					Color color = GUI.contentColor;
					if (FsmEditor.Active != null && FsmEditor.Active.Owner != null) {
						
						ICodeBehaviour behaviour=FsmEditor.Active.Owner;
						if(behaviour.ActiveNode is State && (behaviour.ActiveNode as State).ActiveAction==targetObject){
							GUI.contentColor = Color.green;
						}
					}
					FsmEditorStyles.inspectorTitleText.Draw (rect2, content, controlID, foldout);	
					GUI.contentColor = color;
				}
			}
			position.width = 15;

			bool flag = FsmGUIUtility.DoToggleForward(position,controlID, foldout,GUIContent.none,GUIStyle.none);

			return flag;
		}
开发者ID:AlexGam,项目名称:TowerIsland,代码行数:63,代码来源:GUIDrawer.cs


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