ClientData.cs 907 B

1234567891011121314151617181920212223242526272829
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using Sirenix.OdinInspector;
  5. namespace KairoEngine.Multiplayer
  6. {
  7. [System.Serializable]
  8. public class ClientData
  9. {
  10. [FoldoutGroup("@ToString()")] public int connectionId = -1;
  11. [FoldoutGroup("@ToString()")] public string playerName = "";
  12. [FoldoutGroup("@ToString()")] public bool isConnected = false;
  13. public ClientData(int connectionId, string playerName, bool isConnected)
  14. {
  15. this.connectionId = connectionId;
  16. this.playerName = playerName;
  17. this.isConnected = isConnected;
  18. }
  19. public override string ToString()
  20. {
  21. string idText = connectionId < 10 ? $"0{connectionId.ToString()}" : $"{connectionId}";
  22. if(!isConnected) idText = "XX";
  23. return $"{idText} : {playerName}";
  24. }
  25. }
  26. }