private void OnLogOnGameServerResponse(byte[] p) { RoleLogOnGameServerResponseProto proto = RoleLogOnGameServerResponseProto.GetProto(p); m_IsHaveRole = proto.RoleCount > 0; if (proto.RoleCount > 0) { DragTarget.rotation = new Quaternion(); m_IsSelectRoleView = false; SetPillarsActive(false); //有角色 进入 进入游戏界面 Debuger.Log("有角色 进入 进入游戏界面"); //m_SelectRoleView.SelectRoleContainer.gameObject.SetActive(true); m_SelectRoleView.CreateRoleContainer.gameObject.SetActive(false); int count = proto.RoleCount; m_SelectRoleItemList = new ToggleList <UISelectRoleItem>(); GameObject obj = ResourcesManager.Instance.LoadItem("SelectRoleHeadItem"); for (int i = 0; i < m_CreateCloneRoleGoList.Count; i++) { m_CreateCloneRoleGoList[i].SetActive(false); } for (int i = 0; i < count; i++) { UISelectRoleItem item = Instantiate(obj, m_SelectRoleView.SelectRoleContainer).GetComponent <UISelectRoleItem>(); JobEntity entity = JobDBModel.Instance.Get(proto.RoleList[i].RoleJob); UISelectRoleItemInfo itemInfo = new UISelectRoleItemInfo(); itemInfo.Index = i; itemInfo.AtalsName = "RoleIcon"; itemInfo.SpriteName = entity.HeadPic; itemInfo.RoleId = proto.RoleList[i].RoleId; itemInfo.RoleName = proto.RoleList[i].RoleNickName; itemInfo.Level = proto.RoleList[i].RoleLevel; itemInfo.JobName = entity.Name; //itemInfo.SpriteName = JobDBModel.Instance.get item.SetData(itemInfo, OnSelectCallBack); m_SelectRoleItemList.Add(item); item.transform.localPosition = new Vector3(0, 123 - 113 * i, 0); GameObject roleObj = AssetBundleManager.Instance.Load(string.Format("Download/Model/Player/{0}/{1}.assetbundle", entity.FloaderName, entity.PrefabName), entity.PrefabName); GameObject roleGameObject = Instantiate(roleObj, SelectRoleContainer); for (int j = 0; j < entity.WeaponPath.Length; j++) { GameObject weaponObj = AssetBundleManager.Instance.Load(string.Format("Download/Model/{0}/{1}.assetbundle", entity.WeaponFloader, entity.WeaponPath[j]), entity.WeaponPath[j]); Instantiate(weaponObj, roleGameObject.transform.GetChild(0).Find(entity.WeaponParent[j])); } roleGameObject.transform.localPosition = Vector3.zero; roleGameObject.transform.localRotation = Quaternion.Euler(Vector3.zero); roleGameObject.transform.localScale = Vector3.one; m_SelectRoleItemList.AddDepend(roleGameObject); roleGameObject.SetActive(i == 0); } OnSelectCallBack(0); } else { ShowCreateRoleView(); } }
public void ToggleInstances(int courseId) { if (!ToggleList.ContainsKey(courseId)) { ToggleList.Add(courseId, false); } ToggleList[courseId] = !ToggleList[courseId]; }