| 12345678910111213141516171819202122232425262728293031323334 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- /* 蓝牙状态信息获取接口 */
- public class BluetoothStatus
- {
- // return textID, Color
- public static (string, Color) GetStatusInfo(BluetoothStatusEnum status)
- {
- if (status == BluetoothStatusEnum.Connecting) {
- return ("正在连接", new Color(255f / 255f, 165f / 255f, 0));
- } else if (status == BluetoothStatusEnum.ConnectSuccess) {
- return ("连接成功", new Color(255 / 255f, 243 / 255f, 103 / 255f));
- } else if (status == BluetoothStatusEnum.ConnectFail) {
- return ("连接断开", Color.red);
- }
- return ("连接模块", Color.white);
- }
- public static bool IsAllConnected()
- {
- if (!BluetoothAim.ins) return false;
- return BluetoothAim.ins.status == BluetoothStatusEnum.ConnectSuccess;
- }
- }
- public enum BluetoothStatusEnum
- {
- None,
- Connect,
- Connecting,
- ConnectSuccess,
- ConnectFail
- }
|