diff --git a/Source/Editor/GUI/EnumComboBox.cs b/Source/Editor/GUI/EnumComboBox.cs index 8ceae0bb0..34a2dae35 100644 --- a/Source/Editor/GUI/EnumComboBox.cs +++ b/Source/Editor/GUI/EnumComboBox.cs @@ -29,7 +29,7 @@ namespace FlaxEditor.GUI /// /// The cached value from the UI. /// - protected int _cachedValue; + protected ulong _cachedValue; /// /// True if has value cached, otherwise false. @@ -54,7 +54,7 @@ namespace FlaxEditor.GUI /// /// The value. /// - public int Value; + public ulong Value; /// /// Initializes a new instance of the struct. @@ -62,7 +62,7 @@ namespace FlaxEditor.GUI /// The name. /// The tooltip. /// The value. - public Entry(string name, int value, string tooltip = null) + public Entry(string name, ulong value, string tooltip = null) { Name = name; Tooltip = tooltip; @@ -88,13 +88,13 @@ namespace FlaxEditor.GUI public object EnumTypeValue { get => Enum.ToObject(_enumType, Value); - set => Value = Convert.ToInt32(value); + set => Value = Convert.ToUInt64(value); } /// /// Gets or sets the value. /// - public int Value + public ulong Value { get => _cachedValue; set @@ -209,13 +209,13 @@ namespace FlaxEditor.GUI /// protected void CacheValue() { - int value = 0; + ulong value = 0; if (IsFlags) { var selection = Selection; for (int i = 0; i < selection.Count; i++) { - int index = selection[i]; + var index = selection[i]; value |= _entries[index].Value; } } @@ -276,7 +276,7 @@ namespace FlaxEditor.GUI tooltip = tooltipAttr.Text; } - entries.Add(new Entry(name, Convert.ToInt32(field.GetRawConstantValue()), tooltip)); + entries.Add(new Entry(name, Convert.ToUInt64(field.GetRawConstantValue()), tooltip)); } } @@ -295,9 +295,9 @@ namespace FlaxEditor.GUI } // Calculate value that will be set after change - int valueAfter = 0; + ulong valueAfter = 0; bool isSelected = _selectedIndices.Contains(index); - int selectedValue = entries[index].Value; + ulong selectedValue = entries[index].Value; for (int i = 0; i < _selectedIndices.Count; i++) { int selectedIndex = _selectedIndices[i]; diff --git a/Source/Editor/Surface/Archetypes/Comparisons.cs b/Source/Editor/Surface/Archetypes/Comparisons.cs index d77fd5ff7..44c49925d 100644 --- a/Source/Editor/Surface/Archetypes/Comparisons.cs +++ b/Source/Editor/Surface/Archetypes/Comparisons.cs @@ -137,7 +137,7 @@ namespace FlaxEditor.Surface.Archetypes { int* dataValues = (int*)dataPtr; for (int i = 0; i < entries.Count; i++) - dataValues[i] = entries[i].Value; + dataValues[i] = (int)entries[i].Value; } } else diff --git a/Source/Editor/Surface/Archetypes/Flow.cs b/Source/Editor/Surface/Archetypes/Flow.cs index b8c426a5a..ffcfb719a 100644 --- a/Source/Editor/Surface/Archetypes/Flow.cs +++ b/Source/Editor/Surface/Archetypes/Flow.cs @@ -177,7 +177,7 @@ namespace FlaxEditor.Surface.Archetypes { int* dataValues = (int*)dataPtr; for (int i = 0; i < entries.Count; i++) - dataValues[i] = entries[i].Value; + dataValues[i] = (int)entries[i].Value; } } else diff --git a/Source/Editor/Surface/Elements/EnumValue.cs b/Source/Editor/Surface/Elements/EnumValue.cs index 9513abd78..a66031f35 100644 --- a/Source/Editor/Surface/Elements/EnumValue.cs +++ b/Source/Editor/Surface/Elements/EnumValue.cs @@ -32,13 +32,13 @@ namespace FlaxEditor.Surface.Elements Width = archetype.Size.X; ParentNode = parentNode; Archetype = archetype; - Value = (int)ParentNode.Values[Archetype.ValueIndex]; + Value = (ulong)(int)ParentNode.Values[Archetype.ValueIndex]; } /// protected override void OnValueChanged() { - if ((int)ParentNode.Values[Archetype.ValueIndex] != Value) + if ((int)ParentNode.Values[Archetype.ValueIndex] != (int)Value) { // Edit value ParentNode.SetValue(Archetype.ValueIndex, Value);