Files
peng-zhihui 06ec2e469e Released.
2022-03-13 06:31:07 +08:00

88 lines
1.4 KiB
C#

namespace UIWidgets
{
using System;
using System.ComponentModel;
using UnityEngine;
/// <summary>
/// Scale mark.
/// </summary>
[Serializable]
public class ScaleMark : IObservable, INotifyPropertyChanged
{
[SerializeField]
float step;
/// <summary>
/// Step.
/// </summary>
public float Step
{
get
{
return step;
}
set
{
if (step != value)
{
step = value;
NotifyPropertyChanged("Step");
}
}
}
[SerializeField]
ScaleMarkTemplate template;
/// <summary>
/// Template.
/// </summary>
public ScaleMarkTemplate Template
{
get
{
return template;
}
set
{
if (template != value)
{
template = value;
NotifyPropertyChanged("Template");
}
}
}
/// <summary>
/// Occurs when a property value changes.
/// </summary>
public event OnChange OnChange;
/// <summary>
/// Occurs when a property value changes.
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Raise PropertyChanged event.
/// </summary>
/// <param name="propertyName">Property name.</param>
protected void NotifyPropertyChanged(string propertyName)
{
var c_handlers = OnChange;
if (c_handlers != null)
{
c_handlers();
}
var handlers = PropertyChanged;
if (handlers != null)
{
handlers(this, new PropertyChangedEventArgs(propertyName));
}
}
}
}