powerfun-unity/Assets/Scripts/UI/Prefab/Rower/RowerDevicePanel.cs

51 lines
1.4 KiB
C#

using Assets.Scripts;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class RowerDevicePanel : PFUIPanel
{
protected override void Awake()
{
UIManager.AddEvent(transform.Find("Container/Tools/Back").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
Close();
});
}
// Start is called before the first frame update
void Start()
{
}
public override void Show()
{
base.Show();
print("开启扫描");
#if UNITY_ANDROID || UNITY_IOS
App.MainDeviceAdapter.StartScan();
#if UNITY_ANDROID
Utils.CallAndroidMethod("OpenLocationService");
#endif
#endif
}
float timer = 1f;
// Update is called once per frame
void Update()
{
timer -= Time.deltaTime;
if (timer <= 0)
{
if (App.MainDeviceAdapter.GetState(Assets.Scripts.Devices.ConnectionInterface.BLE) == Assets.Scripts.Devices.DeviceAdapterState.On)
{
transform.Find("Container/Tools/BlueTooth").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/RowerNew/ICON_bluetooth_44_on");
}
else
{
transform.Find("Container/Tools/BlueTooth").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/RowerNew/ICON_bluetooth_44");
}
timer += 1f;
}
}
}