| 123456789101112131415161718192021222324252627282930313233343536 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- /* 蓝牙状态信息获取接口 */
- public class BluetoothStatus
- {
- // return textID, Color
- public static (int, Color) GetStatusInfo(BluetoothStatusEnum status)
- {
- if (status == BluetoothStatusEnum.Connecting) {
- //return (15, Color.blue);
- return (15,new Color(255f / 255f, 165f / 255f, 0));
- } else if (status == BluetoothStatusEnum.ConnectSuccess) {
- //return (16, Color.new Color32(255,215,0,0));
- return (16,new Color(255f / 255f, 215f / 255f, 0));
- } else if (status == BluetoothStatusEnum.ConnectFail) {
- return (17, Color.red);
- }
- return (14, 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
- }
|