using System; using UnityEditor.UIElements; using UnityEngine.Perception.Randomization.Randomizers; using UnityEngine.UIElements; namespace UnityEditor.Perception.Randomization { class RandomizerElement : VisualElement { const string k_CollapsedParameterClass = "collapsed"; SerializedProperty m_Collapsed; VisualElement m_PropertiesContainer; SerializedProperty m_Property; public RandomizerElement(SerializedProperty property, RandomizerList randomizerList) { m_Property = property; this.randomizerList = randomizerList; m_Collapsed = property.FindPropertyRelative("collapsed"); collapsed = m_Collapsed.boolValue; AssetDatabase.LoadAssetAtPath( $"{StaticData.uxmlDir}/Randomizer/RandomizerElement.uxml").CloneTree(this); var classNameLabel = this.Q("class-name"); var splitType = property.managedReferenceFullTypename.Split(' ', '.'); classNameLabel.text = splitType[splitType.Length - 1]; m_PropertiesContainer = this.Q("properties"); var collapseToggle = this.Q("collapse"); collapseToggle.RegisterCallback(evt => collapsed = !collapsed); var enabledToggle = this.Q("enabled"); enabledToggle.BindProperty(property.FindPropertyRelative("k__BackingField")); var removeButton = this.Q