using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.SceneManagement; /* PK模式的角色选择界面 */ public class RoleSelectView : JCUnityLib.ViewBase, MenuBackInterface { bool[] inited = {false, false}; void Start() { PersistenHandler.ins?.menuBackCtr.views.Add(this); TopBarView.NeedShowIt(this); GlobalData.localPK_playerRoleIDs[0] = LoginMgr.myUserInfo.avatarID; RenderPlayer(0); RenderPlayer(1); } void OnDestroy() { PersistenHandler.ins?.menuBackCtr.views.Remove(this); TopBarView.DontNeedShowIt(this); } public bool OnMenuBack() { ViewMgr.Instance.DestroyView(); 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