예제 #1
0
 private void OnEnable()
 {
     this.m_InspectedTypes.Clear();
     UnityEngine.Object[] targets = base.targets;
     for (int i = 0; i < targets.Length; i++)
     {
         UnityEngine.Object @object            = targets[i];
         Preset             preset             = (Preset)@object;
         string             targetFullTypeName = preset.GetTargetFullTypeName();
         if (!this.m_InspectedTypes.ContainsKey(targetFullTypeName))
         {
             this.m_InspectedTypes.Add(targetFullTypeName, new List <UnityEngine.Object>());
         }
         this.m_InspectedTypes[targetFullTypeName].Add(@object);
     }
     if (this.m_InspectedTypes.Count == 1)
     {
         Preset preset2 = (Preset)base.target;
         if (preset2.IsValid())
         {
             this.m_SelectedPresetTypeName = preset2.GetTargetFullTypeName();
             this.GenerateInternalEditor();
         }
         else
         {
             this.m_SelectedPresetTypeName = "Invalid";
             this.m_DisplayErrorPreset     = true;
         }
     }
 }
예제 #2
0
 private UnityEngine.Object PresetFieldDropValidator(UnityEngine.Object[] references, Type objType, SerializedProperty property, EditorGUI.ObjectFieldValidatorOptions options)
 {
     UnityEngine.Object result;
     if (references.Length == 1)
     {
         Preset preset       = references[0] as Preset;
         string propertyPath = property.propertyPath;
         int    num          = propertyPath.IndexOf("[") + 1;
         int    length       = propertyPath.IndexOf("]") - num;
         int    index        = int.Parse(propertyPath.Substring(num, length));
         if (preset != null && this.target.GetPresetTypeNameAtIndex(index) == preset.GetTargetFullTypeName())
         {
             result = references[0];
             return(result);
         }
     }
     result = null;
     return(result);
 }