ClientData.cs 895 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. public class ClientData
  6. {
  7. public static Action onClientDataUpdate;
  8. public static List<ulong> clientIPList = new List<ulong>();
  9. public static bool AddClientID(ulong clientID)
  10. {
  11. if(!clientIPList.Contains(clientID))
  12. {
  13. clientIPList.Add(clientID);
  14. if(onClientDataUpdate != null)
  15. {
  16. onClientDataUpdate();
  17. }
  18. return true;
  19. }
  20. return false;
  21. }
  22. public static bool RemoveClientID(ulong clientID)
  23. {
  24. if(clientIPList.Contains(clientID))
  25. {
  26. clientIPList.Remove(clientID);
  27. if(onClientDataUpdate != null)
  28. {
  29. onClientDataUpdate();
  30. }
  31. return true;
  32. }
  33. return false;
  34. }
  35. }