using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.SceneManagement; public class HomeView : MonoBehaviour { [SerializeField] Text nickNameText; [SerializeField] GameObject[] genders; [SerializeField] GameObject btnConnectBow; [SerializeField] GameObject btnConnectArrow; public static HomeView ins; void Start() { ins = this; if (GameObject.Find("Bluetooth") == null) { GameObject bluetooth = new GameObject("Bluetooth"); // bluetooth.AddComponent(); // bluetooth.AddComponent(); // bluetooth.AddComponent(); DontDestroyOnLoad(bluetooth); } if (!BluetoothHolder.ins) { GameObject bluetoothHolder = Resources.Load("Prefabs/BluetoothHolder"); GameObject.Instantiate(bluetoothHolder); } AudioMgr.init(); RenderNameOrGender(); InitBtnForConnect(); } void FixedUpdate() { UpdateBtnForConnect(); } public void RenderNameOrGender() { nickNameText.text = LoginMgr.myUserInfo.nickname; genders[LoginMgr.myUserInfo.gender == "男" ? 0 : 1].SetActive(true); genders[LoginMgr.myUserInfo.gender == "男" ? 1 : 0].SetActive(false); LayoutRebuilder.ForceRebuildLayoutImmediate(nickNameText.transform.parent.GetComponent()); } void InitBtnForConnect() { btnConnectBow.GetComponent