ClassData.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using System;
  2. using System.IO;
  3. namespace MaidStatus
  4. {
  5. public class ClassData<T>
  6. {
  7. public ClassData(Action onLevelChangeEvent)
  8. {
  9. this.onLevelChangeEvent = onLevelChangeEvent;
  10. this.expSystem.onChangeLevelEvent = delegate(SimpleExperienceSystem SimpleExperienceSystem)
  11. {
  12. if (this.onLevelChangeEvent != null)
  13. {
  14. this.onLevelChangeEvent();
  15. }
  16. };
  17. }
  18. public int level
  19. {
  20. get
  21. {
  22. return (!this.levelLock) ? this.expSystem.GetCurrentLevel() : 10;
  23. }
  24. }
  25. public int cur_exp
  26. {
  27. get
  28. {
  29. return this.expSystem.GetCurrentExp();
  30. }
  31. }
  32. public int next_exp
  33. {
  34. get
  35. {
  36. return this.expSystem.GetNextLevelExp(this.level);
  37. }
  38. }
  39. public void Clear()
  40. {
  41. this.expSystem.SetLevel(0);
  42. }
  43. public void Serialize(BinaryWriter binary)
  44. {
  45. this.expSystem.Serialize(binary);
  46. }
  47. public void Deserialize(BinaryReader binary, int version)
  48. {
  49. this.expSystem.Deserialize(binary, version);
  50. }
  51. public T data;
  52. public SimpleExperienceSystem expSystem = new SimpleExperienceSystem();
  53. public bool levelLock;
  54. private Action onLevelChangeEvent;
  55. }
  56. }