@@ -3,6 +3,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using FlaxEditor.GUI;
|
using FlaxEditor.GUI;
|
||||||
using FlaxEditor.Scripting;
|
using FlaxEditor.Scripting;
|
||||||
|
using FlaxEngine;
|
||||||
using FlaxEngine.Utilities;
|
using FlaxEngine.Utilities;
|
||||||
|
|
||||||
namespace FlaxEditor.CustomEditors.Editors
|
namespace FlaxEditor.CustomEditors.Editors
|
||||||
@@ -81,9 +82,13 @@ namespace FlaxEditor.CustomEditors.Editors
|
|||||||
|
|
||||||
private OptionType[] _options;
|
private OptionType[] _options;
|
||||||
private ScriptType _type;
|
private ScriptType _type;
|
||||||
|
private Elements.PropertiesListElement _typeItem;
|
||||||
|
|
||||||
private ScriptType Type => Values[0] == null ? Values.Type : TypeUtils.GetObjectType(Values[0]);
|
private ScriptType Type => Values[0] == null ? Values.Type : TypeUtils.GetObjectType(Values[0]);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override bool RevertValueWithChildren => false; // Always revert value for a whole object
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void Initialize(LayoutElementsContainer layout)
|
public override void Initialize(LayoutElementsContainer layout)
|
||||||
{
|
{
|
||||||
@@ -98,7 +103,8 @@ namespace FlaxEditor.CustomEditors.Editors
|
|||||||
_type = type;
|
_type = type;
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
var typeEditor = layout.ComboBox(TypeComboBoxName, "Type of the object value. Use it to change the object.");
|
_typeItem = layout.AddPropertyItem(TypeComboBoxName, "Type of the object value. Use it to change the object.");
|
||||||
|
var typeEditor = _typeItem.ComboBox();
|
||||||
for (int i = 0; i < _options.Length; i++)
|
for (int i = 0; i < _options.Length; i++)
|
||||||
{
|
{
|
||||||
typeEditor.ComboBox.AddItem(_options[i].Name);
|
typeEditor.ComboBox.AddItem(_options[i].Name);
|
||||||
@@ -126,6 +132,8 @@ namespace FlaxEditor.CustomEditors.Editors
|
|||||||
|
|
||||||
// Value
|
// Value
|
||||||
var values = new CustomValueContainer(type, (instance, index) => instance);
|
var values = new CustomValueContainer(type, (instance, index) => instance);
|
||||||
|
if (Values.HasReferenceValue)
|
||||||
|
values.SetReferenceValue(Values.ReferenceValue);
|
||||||
values.AddRange(Values);
|
values.AddRange(Values);
|
||||||
var editor = CustomEditorsUtil.CreateEditor(type);
|
var editor = CustomEditorsUtil.CreateEditor(type);
|
||||||
var style = editor.Style;
|
var style = editor.Style;
|
||||||
@@ -170,6 +178,12 @@ namespace FlaxEditor.CustomEditors.Editors
|
|||||||
{
|
{
|
||||||
base.Refresh();
|
base.Refresh();
|
||||||
|
|
||||||
|
// Show prefab diff when reference value type is different
|
||||||
|
var color = Color.Transparent;
|
||||||
|
if (Values.HasReferenceValue && CanRevertReferenceValue && Values[0].GetType() != Values.ReferenceValue.GetType())
|
||||||
|
color = FlaxEngine.GUI.Style.Current.BackgroundSelected;
|
||||||
|
_typeItem.Labels[0].HighlightStripColor = color;
|
||||||
|
|
||||||
// Check if type has been modified outside the editor (eg. from code)
|
// Check if type has been modified outside the editor (eg. from code)
|
||||||
if (Type != _type)
|
if (Type != _type)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace FlaxEngine.GUI
|
namespace FlaxEngine.GUI
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Implementation of <see cref="IBrush"/> for <see cref="FlaxEngine.GPUTexture"/>.
|
/// Implementation of <see cref="IBrush"/> for <see cref="FlaxEngine.GPUTexture"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <seealso cref="IBrush" />
|
/// <seealso cref="IBrush" />
|
||||||
public sealed class GPUTextureBrush : IBrush
|
public sealed class GPUTextureBrush : IBrush, IEquatable<GPUTextureBrush>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The GPU texture.
|
/// The GPU texture.
|
||||||
@@ -47,5 +49,29 @@ namespace FlaxEngine.GUI
|
|||||||
else
|
else
|
||||||
Render2D.DrawTexture(Texture, rect, color);
|
Render2D.DrawTexture(Texture, rect, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public bool Equals(GPUTextureBrush other)
|
||||||
|
{
|
||||||
|
return other != null && Texture == other.Texture && Filter == other.Filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
return obj is GPUTextureBrush other && Equals(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return HashCode.Combine(Texture, (int)Filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
return Equals(obj) ? 1 : 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace FlaxEngine.GUI
|
namespace FlaxEngine.GUI
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -23,7 +25,7 @@ namespace FlaxEngine.GUI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interface that unifies input source textures, sprites, render targets, and any other brushes to be used in a more generic way.
|
/// Interface that unifies input source textures, sprites, render targets, and any other brushes to be used in a more generic way.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IBrush
|
public interface IBrush : IComparable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the size of the image brush in pixels (if relevant).
|
/// Gets the size of the image brush in pixels (if relevant).
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace FlaxEngine.GUI
|
namespace FlaxEngine.GUI
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Implementation of <see cref="IBrush"/> for linear color gradient (made of 2 color).
|
/// Implementation of <see cref="IBrush"/> for linear color gradient (made of 2 color).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <seealso cref="IBrush" />
|
/// <seealso cref="IBrush" />
|
||||||
public sealed class LinearGradientBrush : IBrush
|
public sealed class LinearGradientBrush : IBrush, IEquatable<LinearGradientBrush>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The brush start color.
|
/// The brush start color.
|
||||||
@@ -50,5 +52,29 @@ namespace FlaxEngine.GUI
|
|||||||
var endColor = EndColor * color;
|
var endColor = EndColor * color;
|
||||||
Render2D.FillRectangle(rect, startColor, startColor, endColor, endColor);
|
Render2D.FillRectangle(rect, startColor, startColor, endColor, endColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public bool Equals(LinearGradientBrush other)
|
||||||
|
{
|
||||||
|
return other != null && StartColor == other.StartColor && EndColor == other.EndColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
return obj is LinearGradientBrush other && Equals(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return HashCode.Combine(StartColor, EndColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
return Equals(obj) ? 1 : 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace FlaxEngine.GUI
|
namespace FlaxEngine.GUI
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Implementation of <see cref="IBrush"/> for <see cref="FlaxEngine.MaterialBase"/> rendering.
|
/// Implementation of <see cref="IBrush"/> for <see cref="FlaxEngine.MaterialBase"/> rendering.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <seealso cref="IBrush" />
|
/// <seealso cref="IBrush" />
|
||||||
public sealed class MaterialBrush : IBrush
|
public sealed class MaterialBrush : IBrush, IEquatable<MaterialBrush>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The material.
|
/// The material.
|
||||||
@@ -38,5 +40,29 @@ namespace FlaxEngine.GUI
|
|||||||
{
|
{
|
||||||
Render2D.DrawMaterial(Material, rect, color);
|
Render2D.DrawMaterial(Material, rect, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public bool Equals(MaterialBrush other)
|
||||||
|
{
|
||||||
|
return other != null && Material == other.Material;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
return obj is MaterialBrush other && Equals(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return HashCode.Combine(Material);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
return Equals(obj) ? 1 : 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace FlaxEngine.GUI
|
namespace FlaxEngine.GUI
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Implementation of <see cref="IBrush"/> for single color fill.
|
/// Implementation of <see cref="IBrush"/> for single color fill.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <seealso cref="IBrush" />
|
/// <seealso cref="IBrush" />
|
||||||
public sealed class SolidColorBrush : IBrush
|
public sealed class SolidColorBrush : IBrush, IEquatable<SolidColorBrush>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The brush color.
|
/// The brush color.
|
||||||
@@ -39,5 +41,29 @@ namespace FlaxEngine.GUI
|
|||||||
{
|
{
|
||||||
Render2D.FillRectangle(rect, Color * color);
|
Render2D.FillRectangle(rect, Color * color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public bool Equals(SolidColorBrush other)
|
||||||
|
{
|
||||||
|
return other != null && Color == other.Color;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
return obj is SolidColorBrush other && Equals(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return HashCode.Combine(Color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
return Equals(obj) ? 1 : 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace FlaxEngine.GUI
|
namespace FlaxEngine.GUI
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Implementation of <see cref="IBrush"/> for <see cref="FlaxEngine.Sprite"/>.
|
/// Implementation of <see cref="IBrush"/> for <see cref="FlaxEngine.Sprite"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <seealso cref="IBrush" />
|
/// <seealso cref="IBrush" />
|
||||||
public sealed class SpriteBrush : IBrush
|
public sealed class SpriteBrush : IBrush, IEquatable<SpriteBrush>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The sprite.
|
/// The sprite.
|
||||||
@@ -47,6 +49,30 @@ namespace FlaxEngine.GUI
|
|||||||
else
|
else
|
||||||
Render2D.DrawSprite(Sprite, rect, color);
|
Render2D.DrawSprite(Sprite, rect, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public bool Equals(SpriteBrush other)
|
||||||
|
{
|
||||||
|
return other != null && Sprite == other.Sprite && Filter == other.Filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
return obj is SpriteBrush other && Equals(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return HashCode.Combine(Sprite, (int)Filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
return Equals(obj) ? 1 : 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -121,5 +147,29 @@ namespace FlaxEngine.GUI
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public bool Equals(Sprite9SlicingBrush other)
|
||||||
|
{
|
||||||
|
return other != null && Sprite == other.Sprite && Filter == other.Filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
return obj is Sprite9SlicingBrush other && Equals(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return HashCode.Combine(Sprite, (int)Filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
return Equals(obj) ? 1 : 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace FlaxEngine.GUI
|
namespace FlaxEngine.GUI
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Implementation of <see cref="IBrush"/> for <see cref="FlaxEngine.Texture"/>.
|
/// Implementation of <see cref="IBrush"/> for <see cref="FlaxEngine.Texture"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <seealso cref="IBrush" />
|
/// <seealso cref="IBrush" />
|
||||||
public sealed class TextureBrush : IBrush
|
public sealed class TextureBrush : IBrush, IEquatable<TextureBrush>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The texture.
|
/// The texture.
|
||||||
@@ -47,13 +49,37 @@ namespace FlaxEngine.GUI
|
|||||||
else
|
else
|
||||||
Render2D.DrawTexture(Texture, rect, color);
|
Render2D.DrawTexture(Texture, rect, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public bool Equals(TextureBrush other)
|
||||||
|
{
|
||||||
|
return other != null && Texture == other.Texture && Filter == other.Filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
return obj is TextureBrush other && Equals(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return HashCode.Combine(Texture, (int)Filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
return Equals(obj) ? 1 : 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Implementation of <see cref="IBrush"/> for <see cref="FlaxEngine.Texture"/> using 9-slicing.
|
/// Implementation of <see cref="IBrush"/> for <see cref="FlaxEngine.Texture"/> using 9-slicing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <seealso cref="IBrush" />
|
/// <seealso cref="IBrush" />
|
||||||
public sealed class Texture9SlicingBrush : IBrush
|
public sealed class Texture9SlicingBrush : IBrush, IEquatable<Texture9SlicingBrush>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The texture.
|
/// The texture.
|
||||||
@@ -130,5 +156,29 @@ namespace FlaxEngine.GUI
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public bool Equals(Texture9SlicingBrush other)
|
||||||
|
{
|
||||||
|
return other != null && Texture == other.Texture && Filter == other.Filter && BorderSize == other.BorderSize && Border == other.Border;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
return obj is Texture9SlicingBrush other && Equals(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return HashCode.Combine(Texture, (int)Filter, BorderSize, Border.GetHashCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
return Equals(obj) ? 1 : 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace FlaxEngine.GUI
|
namespace FlaxEngine.GUI
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -20,7 +22,7 @@ namespace FlaxEngine.GUI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <seealso cref="IBrush" />
|
/// <seealso cref="IBrush" />
|
||||||
/// <seealso cref="UIBrushAsset" />
|
/// <seealso cref="UIBrushAsset" />
|
||||||
public sealed class UIBrush : IBrush
|
public sealed class UIBrush : IBrush, IEquatable<UIBrush>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The UI Brush asset to use.
|
/// The UI Brush asset to use.
|
||||||
@@ -71,5 +73,29 @@ namespace FlaxEngine.GUI
|
|||||||
if (asset != null && asset.Brush != null)
|
if (asset != null && asset.Brush != null)
|
||||||
asset.Brush.Draw(rect, color);
|
asset.Brush.Draw(rect, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public bool Equals(UIBrush other)
|
||||||
|
{
|
||||||
|
return other != null && Asset == other.Asset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
return obj is UIBrush other && Equals(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return HashCode.Combine(Asset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
return Equals(obj) ? 1 : 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace FlaxEngine.GUI
|
namespace FlaxEngine.GUI
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Implementation of <see cref="IBrush"/> for <see cref="FlaxEngine.VideoPlayer"/> frame displaying.
|
/// Implementation of <see cref="IBrush"/> for <see cref="FlaxEngine.VideoPlayer"/> frame displaying.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <seealso cref="IBrush" />
|
/// <seealso cref="IBrush" />
|
||||||
public sealed class VideoBrush : IBrush
|
public sealed class VideoBrush : IBrush, IEquatable<VideoBrush>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The video player to display frame from it.
|
/// The video player to display frame from it.
|
||||||
@@ -57,5 +59,29 @@ namespace FlaxEngine.GUI
|
|||||||
else
|
else
|
||||||
Render2D.DrawTexture(texture, rect, color);
|
Render2D.DrawTexture(texture, rect, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public bool Equals(VideoBrush other)
|
||||||
|
{
|
||||||
|
return other != null && Player == other.Player && Filter == other.Filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
return obj is VideoBrush other && Equals(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return HashCode.Combine(Player, (int)Filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
return Equals(obj) ? 1 : 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user