LSInput.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System;
  2. using MemoryPack;
  3. namespace ET
  4. {
  5. [MemoryPackable]
  6. public partial struct LSInput
  7. {
  8. [MemoryPackOrder(0)]
  9. public TrueSync.TSVector2 V;
  10. [MemoryPackOrder(1)]
  11. public int Button;
  12. public bool Equals(LSInput other)
  13. {
  14. return this.V == other.V && this.Button == other.Button;
  15. }
  16. public override bool Equals(object obj)
  17. {
  18. return obj is LSInput other && Equals(other);
  19. }
  20. public override int GetHashCode()
  21. {
  22. return HashCode.Combine(this.V, this.Button);
  23. }
  24. public static bool operator==(LSInput a, LSInput b)
  25. {
  26. if (a.V != b.V)
  27. {
  28. return false;
  29. }
  30. if (a.Button != b.Button)
  31. {
  32. return false;
  33. }
  34. return true;
  35. }
  36. public static bool operator !=(LSInput a, LSInput b)
  37. {
  38. return !(a == b);
  39. }
  40. }
  41. }