using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.SceneManagement; /* PK模式的角色选择界面 */ public class RoleSelectView : MonoBehaviour, MenuBackInterface { bool[] inited = {false, false}; void Start() { HomeMgr.CacheView(this); PersistenHandler.ins?.menuBackCtr.views.Add(this); TopBarView.NeedShowIt(this); GlobalData.localPK_playerRoleIDs[0] = LoginMgr.myUserInfo.avatarID; RenderPlayer(0); RenderPlayer(1); } void OnDestroy() { HomeMgr.RemoveCacheView(this); PersistenHandler.ins?.menuBackCtr.views.Remove(this); TopBarView.DontNeedShowIt(this); } public bool OnMenuBack() { Destroy(gameObject); return true; } void RenderPlayer(int playerIndex) { Transform root = this.transform.Find("Player" + (playerIndex + 1)); int roleID = GlobalData.localPK_playerRoleIDs[playerIndex]; if (!inited[playerIndex]) { inited[playerIndex] = true; Button left = root.Find("Left").GetComponent