35 lines
1.2 KiB
C#
35 lines
1.2 KiB
C#
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using Kill.Managers;
|
||
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
namespace Kill.UI.Pages
|
||
{
|
||
public class HomePageDeviceState : MonoBehaviour
|
||
{
|
||
/// <summary>
|
||
/// 设备在线状态图标 0:离线 1:在线
|
||
/// </summary>
|
||
public Sprite[] onlineState;
|
||
public Image onlineStateIcon;
|
||
public Text onlineStateText;
|
||
/// <summary>
|
||
/// 设备连接状态背景颜色 0:未连接 1:已连接
|
||
/// </summary>
|
||
public Color[] stateBgColor;
|
||
public Image bluetoothStateIcon;
|
||
public GameObject bluetoothSearchIcon;
|
||
public Image wifiStateIcon;
|
||
|
||
public void UpdateDeviceState(bool isBluetooth,bool isWifi)
|
||
{
|
||
bluetoothStateIcon.color = stateBgColor[isBluetooth ? 1 : 0];
|
||
bluetoothSearchIcon.SetActive(!isBluetooth);
|
||
wifiStateIcon.color = stateBgColor[isWifi ? 1 : 0];
|
||
bool isOnline=isBluetooth||isWifi;
|
||
onlineStateIcon.sprite = onlineState[isOnline ? 1 : 0];
|
||
onlineStateText.text=isOnline?LanguageManager.Instance.GetLanguage("100098"):LanguageManager.Instance.GetLanguage("100097");
|
||
}
|
||
}
|
||
}
|