protected override EditorGUIElement CreateAssetInfoElement(AssetInfo info) { EditorGUIElement_Container_Flow_Line container = new EditorGUIElement_Container_Flow_Line(); container.AddWeightedChild(0.8f, new EditorGUIElement_Button(info.GetName(), delegate() { info.Resolve <AudioClip>().PlaySample(); })); container.AddWeightedChild(0.2f, new EditorGUIElement_Button("Select", delegate() { GetProperty().SetContentValues(info.Resolve <AudioClip>()); })); return(container); }
protected override EditorGUIElement CreateAssetInfoElement(AssetInfo info) { EditorGUIElement_Container_Flow_Line container = new EditorGUIElement_Container_Flow_Line(); container.AddWeightedChild(1.0f, new EditorGUIElement_Button(info.GetName(), delegate() { GetProperty().SetContentValues(info.Resolve <TyonAsset>()); })); return(container); }
protected override EditorGUIElement PushState() { EditTarget value; EditProperty_Single_Object property = GetEditPropertyObject(); EditorGUIElement_Container_Auto container = new EditorGUIElement_Container_Auto_Simple_VerticalStrip(); if (property.HasCustomAttributeOfType <PolymorphicFieldAttribute>(true)) { EditorGUIElement_Container_Flow_Line strip = container.AddChild(new EditorGUIElement_Container_Flow_Line()); strip.AddWeightedChild(1.0f, new EditorGUIElement_Popup_ProcessOperation <Type>( Types.GetFilteredTypes( Filterer_Type.CanBeTreatedAs(property.GetPropertyType()), Filterer_Type.IsConcreteClass() ).NaturalSort(t => t.FullName), t => property.CreateContents(t, true), (out Type t) => property.TryGetContentsType(out t) ) ); strip.AddFixedChild(20.0f, new EditorGUIElement_Button("X", delegate() { property.ClearContents(true); }) ); } else if (property.HasCustomAttributeOfType <MonomorphicFieldAttribute>(true)) { property.EnsureContents( property.GetCustomAttributeOfType <MonomorphicFieldAttribute>(true) .GetTargetType(), false ); } if (property.TryGetContents(out value)) { container.AddChild(new EditorGUIElement_Complex_EditTarget(value)); } return(container); }
protected override EditorGUIElement PushState() { CustomAsset asset; EditProperty_Single_Value property = GetProperty(); Type field_type = property.GetPropertyType(); EditorGUIElement_Container_Auto container = new EditorGUIElement_Container_Auto_Simple_VerticalStrip(); EditorGUIElement_Container_Flow_Line type_container = container.AddChild(new EditorGUIElement_Container_Flow_Line()); if (property.TryGetContentValues <CustomAsset>(out asset, true)) { switch (asset.GetAssetType()) { case AssetType.None: case AssetType.External: type_container.AddWeightedChild(1.0f, new EditorGUIElement_EditPropertySingleValue_Selector_Asset(property, false) ); break; case AssetType.Internal: type_container.AddWeightedChild(1.0f, new EditorGUIElement_Popup_ProcessOperation <Type>( GetInternalCustomAssetTypes(field_type), t => property.SetContentValues(CustomAssets.CreateInternalCustomAsset(t)), (out Type t) => property.TryGetContentsType(out t) ) ); break; } type_container.AddFixedChild(64.0f, new EditorGUIElement_Process(delegate(Rect rect) { AssetType new_type = EditorGUIExtensions.EnumPopup(rect, asset.GetAssetType()); if (asset.GetAssetType() != new_type) { switch (new_type) { case AssetType.None: property.SetContentValues(null); break; case AssetType.External: property.SetContentValues( CustomAssets.GetExternalCustomAssetsOfType(field_type) .GetFirst() ); break; case AssetType.Internal: property.SetContentValues( CustomAssets.CreateInternalCustomAsset( GetInternalCustomAssetTypes(field_type) .GetFirst() ) ); break; } } })); if (asset != null && asset.IsInternalAsset()) { container.AddChild(new EditorGUIElement_Complex_EditTarget(new EditTarget(asset))); } } return(container); }
protected override EditorGUIElement PushState() { int number_elements; EditProperty_Array property = GetEditPropertyArray(); EditorGUIElement_Container_Auto container = new EditorGUIElement_Container_Auto_Simple_VerticalStrip(); Type array_type = property.GetPropertyType().GetIEnumerableType(); if (property.TryGetNumberElements(out number_elements)) { EditorGUIElement_Container_Flow_Line length_strip = container.AddChild(new EditorGUIElement_Container_Flow_Line()) .LabelWithGUIContent("Length"); length_strip.AddWeightedChild(0.6f, new EditorGUIElement_EditPropertyArray_ArraySize(property)); length_strip.AddWeightedChild(0.4f, new EditorGUIElement_Button("+", delegate() { property.InsertElement(0); })); if (number_elements <= 0) { if (array_type.CanBeTreatedAs <UnityEngine.Object>()) { length_strip.AddWeightedChild(0.6f, new EditorGUIElement_DropZone("Drag + Drop", array_type, l => property.ForceContentValues(l) )); } } else { for (int i = 0; i < number_elements; i++) { EditProperty sub_property = property.GetElement(i); EditorGUIElement control = sub_property.CreateEditorGUIElement(); EditorGUIElement_Container_Auto_Simple_HorizontalStrip buttons = new EditorGUIElement_Container_Auto_Simple_HorizontalStrip(); buttons.AddChild(new EditorGUIElement_Button("+v", delegate() { property.InsertElementAfter(sub_property); })); buttons.AddChild(new EditorGUIElement_Button("+^", delegate() { property.InsertElementBefore(sub_property); })); buttons.AddChild(new EditorGUIElement_Button("-", delegate() { property.RemoveElement(sub_property); })); container.AddChild(new EditorGUIElement_Sideboard( new EditorGUIFlowElement(control, EditorGUIElementDimension.Weighted(1.0f)), new EditorGUIFlowElement(buttons, EditorGUIElementDimension.Fixed(100.0f)) )).LabelWithIndex(property, i, () => ForceRecreation()); } } } else { container.AddChild(new EditorGUIElement_Text("--Disabled(Array lengths are not unified)--")); } return(container); }