BluetoothStatus.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class BluetoothStatus
  5. {
  6. // return textID, Color
  7. public static (int, Color) GetStatusInfo(BluetoothStatusEnum status)
  8. {
  9. if (status == BluetoothStatusEnum.Connecting) {
  10. //return (15, Color.blue);
  11. return (15, new Color(255f / 255f, 165f / 255f, 0));
  12. } else if (status == BluetoothStatusEnum.ConnectSuccess) {
  13. //return (16, Color.new Color32(255,215,0,0));
  14. return (16, new Color(255f / 255f, 215f / 255f, 0));
  15. } else if (status == BluetoothStatusEnum.ConnectFail) {
  16. return (17, Color.red);
  17. }
  18. return (14, Color.white);
  19. }
  20. public static bool IsAllConnected()
  21. {
  22. if (!BluetoothAim.ins || !BluetoothShoot.ins) return false;
  23. return BluetoothAim.ins.status == BluetoothStatusEnum.ConnectSuccess &&
  24. BluetoothShoot.ins.status == BluetoothStatusEnum.ConnectSuccess;
  25. }
  26. }
  27. public enum BluetoothStatusEnum
  28. {
  29. None,
  30. Connect,
  31. Connecting,
  32. ConnectSuccess,
  33. ConnectFail
  34. }