OneFrameInputs.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. using System;
  2. using System.Collections.Generic;
  3. namespace ET
  4. {
  5. public partial class OneFrameInputs
  6. {
  7. protected bool Equals(OneFrameInputs other)
  8. {
  9. return Equals(this.Inputs, other.Inputs);
  10. }
  11. public void CopyTo(OneFrameInputs to)
  12. {
  13. to.Inputs.Clear();
  14. foreach (var kv in this.Inputs)
  15. {
  16. to.Inputs.Add(kv.Key, kv.Value);
  17. }
  18. }
  19. public override bool Equals(object obj)
  20. {
  21. if (ReferenceEquals(null, obj))
  22. {
  23. return false;
  24. }
  25. if (ReferenceEquals(this, obj))
  26. {
  27. return true;
  28. }
  29. if (obj.GetType() != this.GetType())
  30. {
  31. return false;
  32. }
  33. return Equals((OneFrameInputs) obj);
  34. }
  35. public override int GetHashCode()
  36. {
  37. return HashCode.Combine(this.Inputs);
  38. }
  39. public OneFrameInputs()
  40. {
  41. this.Inputs = new Dictionary<long, LSInput>(LSConstValue.MatchCount);
  42. }
  43. public static bool operator==(OneFrameInputs a, OneFrameInputs b)
  44. {
  45. if (a is null || b is null)
  46. {
  47. if (a is null && b is null)
  48. {
  49. return true;
  50. }
  51. return false;
  52. }
  53. if (a.Inputs.Count != b.Inputs.Count)
  54. {
  55. return false;
  56. }
  57. foreach (var kv in a.Inputs)
  58. {
  59. if (!b.Inputs.TryGetValue(kv.Key, out LSInput inputInfo))
  60. {
  61. return false;
  62. }
  63. if (kv.Value != inputInfo)
  64. {
  65. return false;
  66. }
  67. }
  68. return true;
  69. }
  70. public static bool operator !=(OneFrameInputs a, OneFrameInputs b)
  71. {
  72. return !(a == b);
  73. }
  74. }
  75. public partial class Room2C_Start
  76. {
  77. public Room2C_Start()
  78. {
  79. this.UnitInfo = new List<LockStepUnitInfo>(LSConstValue.MatchCount);
  80. }
  81. }
  82. }