public override VisualElement CreatePropertyGUI(SerializedProperty property) { string styleSheetPath = this.GetAssetPath() + STYLE_SHEET_NAME; string treePath = this.GetAssetPath() + TREE_NAME; var container = ROJOEditor.LoadAssetTree(treePath); container.LoadStyleSheet(styleSheetPath); var eventsContainer = container.Q <VisualElement>(name: "Events"); var animationContainer = container.Q <VisualElement>(name: "Animations"); eventsContainer.AddProperty(property.FindPropertyRelative("OnStart")); eventsContainer.AddProperty(property.FindPropertyRelative("OnComplete")); animationContainer.AddProperty(property.FindPropertyRelative("move")); animationContainer.AddProperty(property.FindPropertyRelative("scale")); animationContainer.AddProperty(property.FindPropertyRelative("rotate")); animationContainer.AddProperty(property.FindPropertyRelative("animatedProperty")); animationContainer.AddProperty(property.FindPropertyRelative("animatedProperty2")); animationContainer.AddProperty(property.FindPropertyRelative("animatedProperty3")); ToggleView toggleView = container.Q <ToggleView>(name: "toggleView"); toggleView.Init(); return(container); }
public override VisualElement CreatePropertyGUI(SerializedProperty property) { string path = this.GetAssetPath() + TREE_NAME; _container = ROJOEditor.LoadAssetTree(path); string stylePath = this.GetAssetPath() + STYLE_NAME; _container.LoadStyleSheet(stylePath); var enabledToggle = _container.Q <Toggle>(name: "enabledToggle"); enabledToggle.RegisterValueChangedCallback(OnToggleEnabled); enabledToggle.BindProperty(property.FindPropertyRelative("Enabled")); _behaviourName = _container.Q <TextElement>(name: "behaviourName"); _behaviourName.text = property.name; _mainContainer = _container.Q <VisualElement>(name: "mainContainer"); _animationContainer = _container.Q <VisualElement>(name: "Animations"); _eventsContainer = _container.Q <VisualElement>(name: "Events"); ToggleView toggleView = _container.Q <ToggleView>(name: "toggleView"); toggleView.Init(); var moveProperty = property.FindPropertyRelative("move"); var scaleProperty = property.FindPropertyRelative("scale"); var rotateProperty = property.FindPropertyRelative("rotate"); var propertiesProperty = property.FindPropertyRelative("animatedProperty"); var onStartProperty = property.FindPropertyRelative("OnStart"); var onEndProperty = property.FindPropertyRelative("OnComplete"); _animationContainer.Add(new PropertyField(moveProperty)); _animationContainer.Add(new PropertyField(scaleProperty)); _animationContainer.Add(new PropertyField(rotateProperty)); _animationContainer.Add(new PropertyField(propertiesProperty)); _eventsContainer.Add(new PropertyField(onStartProperty)); _eventsContainer.Add(new PropertyField(onEndProperty)); SetEnable(enabledToggle.value); return(_container); }
public override VisualElement CreatePropertyGUI(SerializedProperty property) { string treePath = this.GetAssetPath() + TREE_NAME; string stylePath = this.GetAssetPath() + STYLE_NAME; VisualElement container = ROJOEditor.LoadAssetTree(treePath); container.LoadStyleSheet(stylePath); container.AddToClassList("animation-field"); Toggle enabledToggle = container.Q <Toggle>("enabledToggle"); enabledToggle.BindProperty(property.FindPropertyRelative("Enabled")); enabledToggle.RegisterValueChangedCallback(OnEnabledToggle); _propertiesContainer = container.Q <VisualElement>("propertiesContainer"); _propertiesContainer.Add(new PropertyField(property.FindPropertyRelative("property"))); SetEnabled(enabledToggle.value); return(container); }
public override VisualElement CreatePropertyGUI(SerializedProperty property) { _container = ROJOEditor.LoadAssetTree(treePath); _container.AddToClassList("animation-field"); _container.LoadStyleSheet(stylePath); _propertiesContainer = _container.Q <VisualElement>(name: "propertiesContainer"); _punchOptions = _container.Q <VisualElement>(name: "punchOptions"); var ease = _container.Q <EnumField>(name: "ease"); var typeField = _container.Q <EnumField>(name: "typeField"); ease.BindProperty(property.FindPropertyRelative("ease")); typeField.BindProperty(property.FindPropertyRelative("AnimationType")); typeField.RegisterValueChangedCallback(OnChangeType); var enabledToggle = _container.Q <Toggle>("enabledToggle"); enabledToggle.BindProperty(property.FindPropertyRelative("Enabled")); enabledToggle.RegisterValueChangedCallback(OnEnbledToggle); var startDelayField = _container.Q <FloatField>(name: "startDelay"); var durationField = _container.Q <FloatField>(name: "duration"); var elasticityField = _container.Q <FloatField>(name: "elasticity"); var vibratoField = _container.Q <IntegerField>(name: "vibrato"); var byField = _container.Q <Vector3Field>(name: "by"); startDelayField.BindProperty(property.FindPropertyRelative("startDelay")); durationField.BindProperty(property.FindPropertyRelative("duration")); elasticityField.BindProperty(property.FindPropertyRelative("Elasticity")); vibratoField.BindProperty(property.FindPropertyRelative("Vibrato")); byField.BindProperty(property.FindPropertyRelative("By")); _propertiesContainer.EnableInClassList("hidden", !enabledToggle.value); SetAnimationType((AnimationType)typeField.value); return(_container); }
public override VisualElement CreatePropertyGUI(SerializedProperty property) { /// _property = property; _valueProperty = property.FindPropertyRelative("floatValue"); _colorProperty = property.FindPropertyRelative("colorValue"); _propertyTypeProperty = property.FindPropertyRelative("propertyType"); var treePath = this.GetAssetPath() + TREE_NAME; var styleSheetPath = this.GetAssetPath() + STYLE_SHEET; _mainContainer = ROJOEditor.LoadAssetTree(treePath); _mainContainer.name = _mainContainer.GetHashCode().ToString(); _mainContainer.LoadStyleSheet(styleSheetPath); _propertyName = property.FindPropertyRelative("propertyName"); var component = property.serializedObject.targetObject as MonoBehaviour; _targetObject = component.gameObject; var typeField = _mainContainer.Q <EnumField>(name: "typeField"); typeField.Init(AnimationType.Punch); typeField.BindProperty(property.FindPropertyRelative("AnimationType")); _shaderPropertiesField = _mainContainer.Q <DropdownList>(name: "shaderPropertiesField"); _valueContainer = _mainContainer.Q <VisualElement>(name: "valueContainer"); var durationField = _mainContainer.Q <FloatField>(name: "duration"); durationField.BindProperty(property.FindPropertyRelative("duration")); GetShader(_propertyName.stringValue); InitShaderPropertiesField(_enumValue); SetShaderProperty(_shaderPropertiesField.value); return(_mainContainer); }