using UnityEngine;
using System.Collections;
using System.ComponentModel;
using UIWidgets;
namespace UIWidgetsSamples.Shops {
///
/// Item.
///
public class Item : IObservable, INotifyPropertyChanged {
///
/// The name.
///
public string Name;
int count;
///
/// Occurs when data changed.
///
public event OnChange OnChange;
///
/// Occurs when a property value changes.
///
public event PropertyChangedEventHandler PropertyChanged;
///
/// Gets or sets the count. -1 for infinity count.
///
/// The count.
public int Count {
get {
return count;
}
set {
if (count==-1)
{
Changed();
return ;
}
count = value;
Changed();
}
}
///
/// Initializes a new instance of the class.
///
/// Name.
/// Count.
public Item(string name, int count)
{
Name = name;
Count = count;
}
void Changed()
{
if (PropertyChanged!=null)
{
PropertyChanged(this, null);
}
if (OnChange!=null)
{
OnChange();
}
}
}
}