| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using UnityEngine.EventSystems;
- public class HomeViewRenderBow : MonoBehaviour
- {
- [SerializeField] GameObject prefabRenderBowCamera;
- [SerializeField] GameObject btnConnectBow;
- GameObject renderBowCamera;
- Transform sphere;
- void Start()
- {
- renderBowCamera = Instantiate(prefabRenderBowCamera);
- sphere = renderBowCamera.transform.Find("Sphere");
- btnConnectBow.GetComponent<Button>().onClick.AddListener(delegate() {
- BluetoothAim.ins.DoConnect();
- });
- }
- void Update()
- {
- sphere.Rotate(Vector3.up, Time.deltaTime * 60);
- UpdateBtnForConnect();
- }
- BluetoothStatusEnum bowStatus;
- void UpdateBtnForConnect() {
- if (BluetoothAim.ins && bowStatus != BluetoothAim.ins.status) {
- bowStatus = BluetoothAim.ins.status;
- (int textID, Color color) = BluetoothStatus.GetStatusInfo(BluetoothAim.ins.status);
- btnConnectBow.GetComponentInChildren<TextAutoLanguage>().SetText(textID);
- btnConnectBow.GetComponentInChildren<Text>().color = color;
- btnConnectBow.transform.Find("Check").gameObject.SetActive(bowStatus == BluetoothStatusEnum.ConnectSuccess);
- }
- }
- public void OnClick_ShowDeviceView() {
- AudioMgr.ins.PlayBtn();
- GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/DeviceView 1"));
- }
- }
|