PrivateMaid.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. using System;
  2. using System.IO;
  3. namespace PrivateMaidMode
  4. {
  5. public class PrivateMaid
  6. {
  7. public Maid Maid
  8. {
  9. get
  10. {
  11. return this.m_privateMaid;
  12. }
  13. }
  14. public DataBase.BG BG
  15. {
  16. get
  17. {
  18. return this.m_privateBG;
  19. }
  20. }
  21. public DataBase.BG.Location Location
  22. {
  23. get
  24. {
  25. return this.m_privateLocation;
  26. }
  27. }
  28. public void SetPrivateMaid(Maid maid)
  29. {
  30. this.m_privateMaid = maid;
  31. if (maid != null)
  32. {
  33. this.m_maidGUID = maid.status.guid;
  34. }
  35. else
  36. {
  37. this.m_maidGUID = string.Empty;
  38. }
  39. }
  40. public void SetPrivateBG(DataBase.BG bg)
  41. {
  42. this.m_privateBG = bg;
  43. this.m_uniqueNameBG = bg.uniqueName;
  44. }
  45. public void SetPrivateLocation(DataBase.BG.Location location)
  46. {
  47. this.m_privateLocation = location;
  48. if (location != null)
  49. {
  50. this.m_locationName = location.drawName;
  51. }
  52. }
  53. public void Serialize(BinaryWriter bw)
  54. {
  55. bw.Write(this.m_maidGUID);
  56. bw.Write(this.m_uniqueNameBG);
  57. bw.Write(this.m_locationName);
  58. }
  59. public void Deserialize(BinaryReader br)
  60. {
  61. this.m_maidGUID = br.ReadString();
  62. this.m_privateMaid = GameMain.Instance.CharacterMgr.GetStockMaid(this.m_maidGUID);
  63. this.m_uniqueNameBG = br.ReadString();
  64. this.m_privateBG = DataBase.GetBGData(this.m_uniqueNameBG);
  65. this.m_locationName = br.ReadString();
  66. if (this.m_locationName != null && this.m_locationName != string.Empty)
  67. {
  68. this.m_privateLocation = this.m_privateBG.GetLocation(this.m_locationName);
  69. }
  70. }
  71. private string m_maidGUID = string.Empty;
  72. private Maid m_privateMaid;
  73. private string m_uniqueNameBG = string.Empty;
  74. private DataBase.BG m_privateBG;
  75. private string m_locationName = string.Empty;
  76. private DataBase.BG.Location m_privateLocation;
  77. }
  78. }