using System;
using System.IO;

namespace MaidStatus
{
	public class ClassData<T>
	{
		public ClassData(Action onLevelChangeEvent)
		{
			this.onLevelChangeEvent = onLevelChangeEvent;
			this.expSystem.onChangeLevelEvent = delegate(SimpleExperienceSystem SimpleExperienceSystem)
			{
				if (this.onLevelChangeEvent != null)
				{
					this.onLevelChangeEvent();
				}
			};
		}

		public int level
		{
			get
			{
				return (!this.levelLock) ? this.expSystem.GetCurrentLevel() : 10;
			}
		}

		public int cur_exp
		{
			get
			{
				return this.expSystem.GetCurrentExp();
			}
		}

		public int next_exp
		{
			get
			{
				return this.expSystem.GetNextLevelExp(this.level);
			}
		}

		public void Clear()
		{
			this.expSystem.SetLevel(0);
		}

		public void Serialize(BinaryWriter binary)
		{
			this.expSystem.Serialize(binary);
		}

		public void Deserialize(BinaryReader binary, int version)
		{
			this.expSystem.Deserialize(binary, version);
		}

		public T data;

		public SimpleExperienceSystem expSystem = new SimpleExperienceSystem();

		public bool levelLock;

		private Action onLevelChangeEvent;
	}
}
