public void Init() { role = RoleSort.ManFirst; GameObject Login = null; GameObject SelectPer = null; Login = GameObject.Find("Login(Clone)").gameObject; SelectPer = GameObject.Find("SelectPer").gameObject; SetChildLayer(Login, 9); SetChildLayer(SelectPer, 0); ManRole = SelectPer.transform.Find("ManRole").transform; WomanRole = SelectPer.transform.Find("WomanRole").transform; int idx = 11010; foreach (Transform item in ManRole) { ManRoleList.Add(item.gameObject); RolePlayer.Add(idx, item.GetComponent <Animator>()); idx += 10; } foreach (Transform item in WomanRole) { RolePlayer.Add(idx, item.GetComponent <Animator>()); WomanRoleList.Add(item.gameObject); idx += 10; } Import_input.text = JsonMgr.GetSingleton().RandomName(isMan); }
/// <summary> /// 切换男女性角色 /// </summary> /// <param name="isMen">男女?</param> public void CutRole(bool isMen, GameObject s) { if (isRoleMan != isMen) { Import_input.text = ""; isRoleMan = isMen; } if (isMen) { if (isMan == 2) { isMan = 1; ManRole.gameObject.SetActive(isMen); WomanRole.gameObject.SetActive(!isMen); if (Man_tog.isOn) { scale = true; } else { scale = false; } } if (Man_tog.isOn) { if (role == RoleSort.ManFirst) { return; } role = RoleSort.ManFirst; Switch(ManRoleList, scale); scale = false; MoveAndPlay(); } else if (Man1_tog.isOn) { if (role == RoleSort.ManSecond) { return; } role = RoleSort.ManSecond; Switch(ManRoleList, scale); scale = true; MoveAndPlay(); } } else { if (isMan == 1) { isMan = 2; ManRole.gameObject.SetActive(isMen); WomanRole.gameObject.SetActive(!isMen); if (Woman_tog.isOn) { scale = true; } else { scale = false; } } if (Woman_tog.isOn) { if (role == RoleSort.WomanFirst) { return; } role = RoleSort.WomanFirst; Switch(WomanRoleList, scale); scale = false; MoveAndPlay(); } else if (Woman1_tog.isOn) { if (role == RoleSort.WomanSecond) { return; } role = RoleSort.WomanSecond; Switch(WomanRoleList, scale); scale = true; MoveAndPlay(); } } }