Default gameplay global type selection to last selected type.

This commit is contained in:
Chandler Cox
2024-05-01 13:54:41 -05:00
parent c59bce3b58
commit 0c86a900da

View File

@@ -302,8 +302,17 @@ namespace FlaxEditor.Windows.Assets
// TODO: improve the UI
layout.Space(40);
var addParamType = layout.ComboBox().ComboBox;
addParamType.Items = AllowedTypes.Select(CustomEditorsUtil.GetTypeNameUI).ToList();
addParamType.SelectedIndex = 0;
object lastValue = null;
foreach (var e in _proxy.DefaultValues)
lastValue = e.Value;
var allowedTypes = AllowedTypes.Select(CustomEditorsUtil.GetTypeNameUI).ToList();
int index = 0;
if (lastValue != null)
index = allowedTypes.FindIndex(x => x.Equals(CustomEditorsUtil.GetTypeNameUI(lastValue.GetType()), StringComparison.Ordinal));
addParamType.Items = allowedTypes;
addParamType.SelectedIndex = index;
_addParamType = addParamType;
var addParamButton = layout.Button("Add").Button;
addParamButton.Clicked += OnAddParamButtonClicked;