Codestyle fix #1262
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
|
||||
using System;
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
@@ -22,22 +22,15 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
{
|
||||
var dropdownElement = layout.Custom<Dropdown>();
|
||||
_dropdown = dropdownElement.CustomControl;
|
||||
var eventNames = new List<LocalizedString>();
|
||||
var names = new List<LocalizedString>();
|
||||
foreach (var mapping in Input.ActionMappings)
|
||||
{
|
||||
if (eventNames.Contains(mapping.Name))
|
||||
continue;
|
||||
eventNames.Add(mapping.Name);
|
||||
if (!names.Contains(mapping.Name))
|
||||
names.Add(mapping.Name);
|
||||
}
|
||||
_dropdown.Items = eventNames;
|
||||
if (Values[0] is InputEvent value)
|
||||
{
|
||||
if (eventNames.Contains(value.Name))
|
||||
{
|
||||
_dropdown.SelectedItem = value.Name;
|
||||
}
|
||||
}
|
||||
|
||||
_dropdown.Items = names;
|
||||
if (Values[0] is InputEvent inputEvent && names.Contains(inputEvent.Name))
|
||||
_dropdown.SelectedItem = inputEvent.Name;
|
||||
_dropdown.SelectedIndexChanged += OnSelectedIndexChanged;
|
||||
}
|
||||
|
||||
@@ -53,17 +46,11 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
|
||||
if (HasDifferentValues)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Values[0] is InputEvent eventValue)
|
||||
{
|
||||
if (_dropdown.Items.Contains(eventValue.Name) && string.Equals(_dropdown.SelectedItem, eventValue.Name, StringComparison.Ordinal))
|
||||
{
|
||||
_dropdown.SelectedItem = eventValue.Name;
|
||||
}
|
||||
}
|
||||
if (Values[0] is InputEvent inputEvent && _dropdown.Items.Contains(inputEvent.Name))
|
||||
_dropdown.SelectedItem = inputEvent.Name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +60,6 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
if (_dropdown != null)
|
||||
_dropdown.SelectedIndexChanged -= OnSelectedIndexChanged;
|
||||
_dropdown = null;
|
||||
base.Deinitialize();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,21 +79,15 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
{
|
||||
var dropdownElement = layout.Custom<Dropdown>();
|
||||
_dropdown = dropdownElement.CustomControl;
|
||||
var axisNames = new List<LocalizedString>();
|
||||
var names = new List<LocalizedString>();
|
||||
foreach (var mapping in Input.AxisMappings)
|
||||
{
|
||||
if (axisNames.Contains(mapping.Name))
|
||||
continue;
|
||||
axisNames.Add(mapping.Name);
|
||||
}
|
||||
_dropdown.Items = axisNames;
|
||||
if (Values[0] is InputAxis value)
|
||||
{
|
||||
if (axisNames.Contains(value.Name))
|
||||
{
|
||||
_dropdown.SelectedItem = value.Name;
|
||||
}
|
||||
if (!names.Contains(mapping.Name))
|
||||
names.Add(mapping.Name);
|
||||
}
|
||||
_dropdown.Items = names;
|
||||
if (Values[0] is InputAxis inputAxis && names.Contains(inputAxis.Name))
|
||||
_dropdown.SelectedItem = inputAxis.Name;
|
||||
_dropdown.SelectedIndexChanged += OnSelectedIndexChanged;
|
||||
}
|
||||
|
||||
@@ -123,17 +103,11 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
|
||||
if (HasDifferentValues)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Values[0] is InputAxis axisValue)
|
||||
{
|
||||
if (_dropdown.Items.Contains(axisValue.Name) && string.Equals(_dropdown.SelectedItem, axisValue.Name, StringComparison.Ordinal))
|
||||
{
|
||||
_dropdown.SelectedItem = axisValue.Name;
|
||||
}
|
||||
}
|
||||
if (Values[0] is InputAxis inputAxis && _dropdown.Items.Contains(inputAxis.Name))
|
||||
_dropdown.SelectedItem = inputAxis.Name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +117,6 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
if (_dropdown != null)
|
||||
_dropdown.SelectedIndexChanged -= OnSelectedIndexChanged;
|
||||
_dropdown = null;
|
||||
base.Deinitialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user