PlayerInput.cs 542 B

1234567891011121314151617181920212223242526272829303132
  1. using System.Collections.Generic;
  2. using System.Text.Json;
  3. namespace BubbleSocketCore.Input
  4. {
  5. public class PlayerInput
  6. {
  7. public int type;
  8. public int value;
  9. public PlayerInput(int type, int value)
  10. {
  11. this.type = type;
  12. this.value = value;
  13. }
  14. override public string ToString()
  15. {
  16. return JsonSerializer.Serialize(Serialize());
  17. }
  18. public List<string> Serialize()
  19. {
  20. return new List<string> { $"{type}", $"{value}" };
  21. }
  22. internal PlayerInput Clone()
  23. {
  24. return new PlayerInput(this.type, this.value);
  25. }
  26. }
  27. }