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


C# SerializedProperty.AppendFoldoutPPtrValue方法代碼示例

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


在下文中一共展示了SerializedProperty.AppendFoldoutPPtrValue方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: DefaultPropertyField


//.........這裏部分代碼省略.........
							GUI.changed = false;
						}
					}
					GUI.changed |= changed;
					break;
				}
				case SerializedPropertyType.AnimationCurve:
				{
					int controlID = GUIUtility.GetControlID(EditorGUI.s_CurveHash, EditorGUIUtility.native, position);
					EditorGUI.DoCurveField(EditorGUI.PrefixLabel(position, controlID, label), controlID, null, EditorGUI.kCurveColor, default(Rect), property);
					break;
				}
				case SerializedPropertyType.Bounds:
					EditorGUI.BoundsField(position, property, label);
					break;
				case SerializedPropertyType.Gradient:
				{
					int controlID2 = GUIUtility.GetControlID(EditorGUI.s_CurveHash, EditorGUIUtility.native, position);
					EditorGUI.DoGradientField(EditorGUI.PrefixLabel(position, controlID2, label), controlID2, null, property);
					break;
				}
				default:
				{
					int controlID3 = GUIUtility.GetControlID(EditorGUI.s_GenericField, FocusType.Keyboard, position);
					EditorGUI.PrefixLabel(position, controlID3, label);
					break;
				}
				}
			}
			else
			{
				Event @event = new Event(Event.current);
				flag = property.isExpanded;
				EditorGUI.BeginDisabledGroup(!property.editable);
				GUIStyle style = (DragAndDrop.activeControlID != -10) ? EditorStyles.foldout : EditorStyles.foldoutPreDrop;
				bool flag3 = EditorGUI.Foldout(position, flag, EditorGUI.s_PropertyFieldTempContent, true, style);
				EditorGUI.EndDisabledGroup();
				if (flag3 != flag)
				{
					if (Event.current.alt)
					{
						EditorGUI.SetExpandedRecurse(property, flag3);
					}
					else
					{
						property.isExpanded = flag3;
					}
				}
				flag = flag3;
				int s_LastControlID = EditorGUIUtility.s_LastControlID;
				EventType type = @event.type;
				if (type != EventType.DragUpdated && type != EventType.DragPerform)
				{
					if (type == EventType.DragExited)
					{
						if (GUI.enabled)
						{
							HandleUtility.Repaint();
						}
					}
				}
				else
				{
					if (position.Contains(@event.mousePosition) && GUI.enabled)
					{
						UnityEngine.Object[] objectReferences = DragAndDrop.objectReferences;
						UnityEngine.Object[] array = new UnityEngine.Object[1];
						bool flag4 = false;
						UnityEngine.Object[] array2 = objectReferences;
						for (int i = 0; i < array2.Length; i++)
						{
							UnityEngine.Object @object = array2[i];
							array[0] = @object;
							UnityEngine.Object object2 = EditorGUI.ValidateObjectFieldAssignment(array, null, property);
							if (object2 != null)
							{
								DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
								if (@event.type == EventType.DragPerform)
								{
									property.AppendFoldoutPPtrValue(object2);
									flag4 = true;
									DragAndDrop.activeControlID = 0;
								}
								else
								{
									DragAndDrop.activeControlID = s_LastControlID;
								}
							}
						}
						if (flag4)
						{
							GUI.changed = true;
							DragAndDrop.AcceptDrag();
						}
					}
				}
			}
			EditorGUI.EndProperty();
			return flag;
		}
開發者ID:guozanhua,項目名稱:UnityDecompiled,代碼行數:101,代碼來源:EditorGUI.cs

示例2: DefaultPropertyField


//.........這裏部分代碼省略.........
         }
         break;
       case SerializedPropertyType.Character:
         char[] chArray = new char[1]
         {
           (char) property.intValue
         };
         bool changed = GUI.changed;
         GUI.changed = false;
         string str2 = EditorGUI.TextField(position, label, new string(chArray));
         if (GUI.changed)
         {
           if (str2.Length == 1)
             property.intValue = (int) str2[0];
           else
             GUI.changed = false;
         }
         GUI.changed |= changed;
         break;
       case SerializedPropertyType.AnimationCurve:
         int controlId1 = GUIUtility.GetControlID(EditorGUI.s_CurveHash, EditorGUIUtility.native, position);
         EditorGUI.DoCurveField(EditorGUI.PrefixLabel(position, controlId1, label), controlId1, (AnimationCurve) null, EditorGUI.kCurveColor, new Rect(), property);
         break;
       case SerializedPropertyType.Bounds:
         EditorGUI.BoundsField(position, property, label);
         break;
       case SerializedPropertyType.Gradient:
         int controlId2 = GUIUtility.GetControlID(EditorGUI.s_CurveHash, EditorGUIUtility.native, position);
         EditorGUI.DoGradientField(EditorGUI.PrefixLabel(position, controlId2, label), controlId2, (Gradient) null, property);
         break;
       default:
         int controlId3 = GUIUtility.GetControlID(EditorGUI.s_GenericField, FocusType.Keyboard, position);
         EditorGUI.PrefixLabel(position, controlId3, label);
         break;
     }
   }
   else
   {
     Event @event = new Event(Event.current);
     bool isExpanded = property.isExpanded;
     EditorGUI.BeginDisabledGroup(!property.editable);
     GUIStyle style = DragAndDrop.activeControlID != -10 ? EditorStyles.foldout : EditorStyles.foldoutPreDrop;
     bool expanded = EditorGUI.Foldout(position, isExpanded, EditorGUI.s_PropertyFieldTempContent, true, style);
     EditorGUI.EndDisabledGroup();
     if (expanded != isExpanded)
     {
       if (Event.current.alt)
         EditorGUI.SetExpandedRecurse(property, expanded);
       else
         property.isExpanded = expanded;
     }
     flag1 = expanded;
     int lastControlId = EditorGUIUtility.s_LastControlID;
     switch (@event.type)
     {
       case EventType.DragUpdated:
       case EventType.DragPerform:
         if (position.Contains(@event.mousePosition) && GUI.enabled)
         {
           UnityEngine.Object[] objectReferences = DragAndDrop.objectReferences;
           UnityEngine.Object[] references = new UnityEngine.Object[1];
           bool flag3 = false;
           foreach (UnityEngine.Object object1 in objectReferences)
           {
             references[0] = object1;
             UnityEngine.Object object2 = EditorGUI.ValidateObjectFieldAssignment(references, (System.Type) null, property);
             if (object2 != (UnityEngine.Object) null)
             {
               DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
               if (@event.type == EventType.DragPerform)
               {
                 property.AppendFoldoutPPtrValue(object2);
                 flag3 = true;
                 DragAndDrop.activeControlID = 0;
               }
               else
                 DragAndDrop.activeControlID = lastControlId;
             }
           }
           if (flag3)
           {
             GUI.changed = true;
             DragAndDrop.AcceptDrag();
             break;
           }
           break;
         }
         break;
       case EventType.DragExited:
         if (GUI.enabled)
         {
           HandleUtility.Repaint();
           break;
         }
         break;
     }
   }
   EditorGUI.EndProperty();
   return flag1;
 }
開發者ID:BlakeTriana,項目名稱:unity-decompiled,代碼行數:101,代碼來源:EditorGUI.cs

示例3: SinglePropertyField


//.........這裏部分代碼省略.........
         }
         int controlID3 = GetControlID(s_GenericField, FocusType.Keyboard, position);
         EditorGUI.PrefixLabel(position, controlID3, label);
     IL_326: ;
     }
     else
     {
         int controlID4 = GetControlID(s_FoldoutHash, FocusType.Passive, position);
         EventType type = Event.current.type;
         if (type != EventType.DragUpdated && type != EventType.DragPerform)
         {
             if (type == EventType.DragExited)
             {
                 if (GUI.enabled)
                 {
                     HandleUtility.Repaint();
                 }
             }
         }
         else
         {
             if (position.Contains(Event.current.mousePosition) && GUI.enabled)
             {
                 Object[] objectReferences = DragAndDrop.objectReferences;
                 Object[] array = new Object[1];
                 bool flag2 = false;
                 Object[] array2 = objectReferences;
                 for (int i = 0; i < array2.Length; i++)
                 {
                     Object @object = array2[i];
                     array[0] = @object;
                     Object object2 = ValidateObjectFieldAssignment(array, null, property);
                     if (object2 != null)
                     {
                         DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
                         if (Event.current.type == EventType.DragPerform)
                         {
                             property.AppendFoldoutPPtrValue(object2);
                             flag2 = true;
                             DragAndDrop.activeControlID = 0;
                         }
                         else
                         {
                             DragAndDrop.activeControlID = controlID4;
                         }
                     }
                 }
                 if (flag2)
                 {
                     GUI.changed = true;
                     DragAndDrop.AcceptDrag();
                     Event.current.Use();
                 }
             }
         }
         flag = property.isExpanded;
         if (lookLikeInspector)
         {
             int num = EditorStyles.foldout.padding.left - EditorStyles.label.padding.left;
             position.x -= (float)num;
             position.width += (float)num;
         }
         GUI.enabled &= property.editable;
         GUIStyle style = (DragAndDrop.activeControlID != -10) ? EditorStyles.foldout : EditorStyles.foldoutPreDrop;
         bool flag3 = EditorGUI.Foldout(position, flag, s_PropertyFieldTempContent, true, style);
         if (flag3 != flag)
         {
             if (Event.current.alt)
             {
                 SetExpandedRecurse(property, flag3);
             }
             else
             {
                 property.isExpanded = flag3;
             }
         }
         flag = flag3;
     }
     EditorGUI.EndProperty();
     if (Event.current.type == EventType.ExecuteCommand || Event.current.type == EventType.ValidateCommand)
     {
         if (GUIUtility.keyboardControl == lastControlID && (Event.current.commandName == "Delete" || Event.current.commandName == "SoftDelete"))
         {
             if (Event.current.type == EventType.ExecuteCommand)
             {
                 property.DeleteCommand();
             }
             Event.current.Use();
         }
         if (GUIUtility.keyboardControl == lastControlID && Event.current.commandName == "Duplicate")
         {
             if (Event.current.type == EventType.ExecuteCommand)
             {
                 property.DuplicateCommand();
             }
             Event.current.Use();
         }
     }
     return flag;
 }
開發者ID:QuantumCD,項目名稱:unity-tooltips,代碼行數:101,代碼來源:TooltipDrawer.cs


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