public override void Update() { if (m_CompressionQuality != null) { m_CompressionQuality.SetEnabled((TextureFormatType)m_DefaultFormatType.value == TextureFormatType.WebP); if ((TextureFormatType)m_DefaultFormatType.value == TextureFormatType.WebP) { if (m_CompressionQuality.value > 100) { m_CompressionQuality.value = 100; } else if (m_CompressionQuality.value < 0) { m_CompressionQuality.value = 0; } } } if (m_lossless != null) { m_lossless.SetEnabled((TextureFormatType)m_DefaultFormatType.value == TextureFormatType.WebP); if (m_lossless.value && m_CompressionQuality != null) { m_CompressionQuality.SetEnabled(false); } } }
private void RefreshScenarioScoreView() { scenarioScoreView.Clear(); if (!EditorApplication.isPlaying) { scenarioScoreView.Add(new Label("Please enter play mode")); return; } var stateManager = ((GameManager)target).GameStateManager; var values = stateManager.ScenarioScoreDict; foreach (var kvp in values) { var field = new FloatField(kvp.Key.ScenarioName) { value = kvp.Value }; field.SetEnabled(false); if (kvp.Key == stateManager.TopScenario()) { field.style.color = Color.red; } scenarioScoreView.Add(field); } }
static void AddDistanceFloatField(string name, string label, VisualElement root) { var field = new FloatField(label) { name = name }; field.SetEnabled(false); root.Add(field); }
public override VisualElement CreatePropertyGUI(SerializedProperty property) { //return base.CreatePropertyGUI(property); FloatField floatField = new FloatField(property.displayName) { value = property.floatValue, }; floatField.SetEnabled(true); return(floatField); }
internal override void Apply(VisualElement container) { /// <sample> // Get a reference to the field from UXML and assign it its value. var uxmlField = container.Q <FloatField>("the-uxml-field"); uxmlField.value = 42.4f; // Create a new field, disable it, and give it a style class. var csharpField = new FloatField("C# Field"); csharpField.SetEnabled(false); csharpField.AddToClassList("some-styled-field"); csharpField.value = uxmlField.value; container.Add(csharpField); // Mirror value of uxml field into the C# field. uxmlField.RegisterCallback <ChangeEvent <float> >((evt) => { csharpField.value = evt.newValue; }); /// </sample> }