ScheduleData.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. namespace PlayerStatus
  5. {
  6. public class ScheduleData
  7. {
  8. public void Serialize(BinaryWriter binary)
  9. {
  10. binary.Write(this.maid_guid);
  11. binary.Write((int)this.noon_success_level);
  12. binary.Write((int)this.night_success_level);
  13. binary.Write(this.noon_communication);
  14. binary.Write(this.night_communication);
  15. int count = this.backup_status_dic.Count;
  16. binary.Write(count);
  17. foreach (KeyValuePair<string, int> keyValuePair in this.backup_status_dic)
  18. {
  19. binary.Write(keyValuePair.Key);
  20. binary.Write(keyValuePair.Value);
  21. }
  22. }
  23. public void Deserialize(BinaryReader binary, int version)
  24. {
  25. this.maid_guid = binary.ReadString();
  26. this.noon_success_level = (ScheduleData.WorkSuccessLv)binary.ReadInt32();
  27. this.night_success_level = (ScheduleData.WorkSuccessLv)binary.ReadInt32();
  28. this.noon_communication = binary.ReadBoolean();
  29. if (200 < version)
  30. {
  31. this.night_communication = binary.ReadBoolean();
  32. }
  33. int num = binary.ReadInt32();
  34. this.backup_status_dic.Clear();
  35. for (int i = 0; i < num; i++)
  36. {
  37. string key = binary.ReadString();
  38. this.backup_status_dic.Add(key, binary.ReadInt32());
  39. }
  40. }
  41. public string maid_guid = string.Empty;
  42. public ScheduleData.WorkSuccessLv noon_success_level;
  43. public ScheduleData.WorkSuccessLv night_success_level;
  44. public bool communication;
  45. public bool noon_communication;
  46. public bool night_communication;
  47. public Dictionary<string, int> backup_status_dic = new Dictionary<string, int>();
  48. public enum WorkSuccessLv
  49. {
  50. Miss,
  51. Success,
  52. Perfect,
  53. Unexecuted
  54. }
  55. }
  56. }