using System;
using UnityEngine;
namespace EditorAttributes
{
///
/// Attribute to add a button next to a property
///
[AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = true)]
public class InlineButtonAttribute : PropertyAttribute, IRepetableButton
{
public string FunctionName { get; private set; }
public string ButtonLabel { get; private set; }
public float ButtonWidth { get; private set; }
public bool IsRepetable { get; private set; }
public long PressDelay { get; private set; }
public long RepetitionInterval { get; private set; }
///
/// Attribute to add a button next to a property
///
/// The name of the function the button activates
/// The label displayed on the button
/// The width of the button in pixels
public InlineButtonAttribute(string functionName, string buttonLabel = "", float buttonWidth = 100f)
{
FunctionName = functionName;
ButtonLabel = buttonLabel;
ButtonWidth = buttonWidth;
}
///
/// Attribute to add a button next to a property
///
/// The name of the function the button activates
/// Makes the button repeat logic on hold
/// How many milliseconds to wait before the logic is executed on hold
/// The interval in milliseconds the logic will repeat
/// The label displayed on the button
/// The width of the button in pixels
public InlineButtonAttribute(string functionName, bool isRepetable, long pressDelay = 60, long repetitionInterval = 100, string buttonLabel = "", float buttonWidth = 100f)
{
FunctionName = functionName;
ButtonLabel = buttonLabel;
ButtonWidth = buttonWidth;
IsRepetable = isRepetable;
PressDelay = pressDelay;
RepetitionInterval = repetitionInterval;
}
}
}