public static void ShowSelectRoleEntity(this Hotfix.EntityComponent entityComponent, SelectRoleData data) { JobDBModel jobDBModel = GameEntry.DataTable.GetDataTable <JobDBModel>(); JobEntity jobEntity = jobDBModel.Get(data.JobId); if (jobEntity == null) { Log.Warning("Can not load createrole entity id '{0}' from data table.", data.JobId.ToString()); return; } SceneDBModel sceneDBModel = GameEntry.DataTable.GetDataTable <SceneDBModel>(); SceneEntity sceneEntity = sceneDBModel.Get((int)SceneType.SelectRole); if (sceneEntity == null) { Log.Warning("Can not load scene data id '{0}' from data table.", data.JobId.ToString()); return; } Vector3 postion = Vector3.zero; Quaternion rotation = Quaternion.identity; if (GameUtil.GetRoleBornPos(sceneEntity.RoleBirthPos, out postion, out rotation)) { data.Position = postion; data.Rotation = rotation; } entityComponent.ShowEntity(data.Id, typeof(SelectRoleEntity), ZJY.Framework.AssetUtility.GetRoleAsset(jobEntity.AssetName), "Role", Constant.AssetPriority.RolePlayerAsset, data); }
public override void OnShow(object userData) { base.OnShow(userData); m_SelectRoleData = userData as SelectRoleData; if (m_SelectRoleData == null) { Log.Error("SelectRole data is invalid."); return; } JobAvtarDBModel jobAvtarDBModel = GameEntry.DataTable.GetDataTable <JobAvtarDBModel>(); JobAvtarEntity jobAvtarEntity = jobAvtarDBModel.Get(m_SelectRoleData.JobId, m_SelectRoleData.AvtarId); if (jobAvtarEntity == null) { Log.Warning("Can not load jobavatar id '{0}' from data table.", m_SelectRoleData.JobId.ToString()); return; } GameEntry.Avtar.ChangeSkinnedMesh(Entity, ZJY.Framework.AssetUtility.GetRoleAsset(jobAvtarEntity.AssetName)); JobDBModel jobDBModel = GameEntry.DataTable.GetDataTable <JobDBModel>(); JobEntity jobEntity = jobDBModel.Get(m_SelectRoleData.JobId); if (jobEntity == null) { Log.Warning("Can not load job controller id '{0}' from data table.", m_SelectRoleData.JobId.ToString()); return; } GameEntry.Controller.SetController(m_Animator, ZJY.Framework.AssetUtility.GetRoleControllerAsset(jobEntity.RoleController)); GameEntry.Entity.ShowWing(Entity, m_SelectRoleData.JobId, m_SelectRoleData.WingId); GameEntry.Entity.ShowWeapon(Entity, m_SelectRoleData.JobId, m_SelectRoleData.WingId); GameEntry.Entity.ShowMagic(Entity, m_SelectRoleData.JobId, m_SelectRoleData.WingId); }
private void SetUI(List <RoleItem> roleList) { for (int i = 0; i < roleList.Count; i++) { JobDBModel jobDBModel = GameEntry.DataTable.GetDataTable <JobDBModel>(); JobEntity jobEntity = jobDBModel.Get(roleList[i].RoleJob); if (jobEntity == null) { Log.Warning("Can not load job '{0}' from data table.", roleList[i].RoleJob.ToString()); return; } m_RoleLists[i].GetComponent <ButtonHelper>().Id = roleList[i].RoleId; m_RoleLists[i].Find("ImgNotSelection").GetComponent <Image>().SetImage(ZJY.Framework.AssetUtility.GetCreateRoleImageAsset(jobEntity.HeadNotSelectAssetName)); m_RoleLists[i].Find("ImgSelection").GetComponent <Image>().SetImage(ZJY.Framework.AssetUtility.GetCreateRoleImageAsset(jobEntity.HeadSelectAssetName)); m_RoleLists[i].Find("txtLevel").GetComponent <Text>().text = roleList[i].RoleLevel.ToString(); m_RoleLists[i].Find("txtName").GetComponent <Text>().text = roleList[i].RoleNickName; } for (int i = 0; i < 4; i++) { bool showRoleList = i < roleList.Count; m_CreateRoleButtons[i].gameObject.SetActive(!showRoleList); m_RoleLists[i].gameObject.SetActive(showRoleList); } }
/// <summary> /// 设置选择的角色 /// </summary> /// <param name="roleId"></param> private void SetSelectRole(int roleId) { if (m_CurrSelectRoleId == roleId) { return; } m_CurrSelectRoleId = roleId; GameEntry.Entity.HideAllLoadedEntities(); GameEntry.Entity.HideAllLoadingEntities(); for (int i = 0; i < m_RoleLists.Length; i++) { if (m_RoleLists[i].GetComponent <ButtonHelper>().Id == roleId) { m_RoleLists[i].Find("ImgSelection").gameObject.SetActive(true); continue; } m_RoleLists[i].Find("ImgSelection").gameObject.SetActive(false); } RoleItem item = GetRoleItem(roleId); JobDBModel jobDBModel = GameEntry.DataTable.GetDataTable <JobDBModel>(); JobEntity jobEntity = jobDBModel.Get(item.RoleJob); if (jobEntity == null) { Log.Warning("Can not load job '{0}' from data table.", item.RoleJob.ToString()); return; } m_SelectRoleFormView.imgMiaoShu1.SetImage(ZJY.Framework.AssetUtility.GetCreateRoleImageAsset(jobEntity.DescAllAssetName)); m_SelectRoleFormView.imgMiaoShu2.SetImage(ZJY.Framework.AssetUtility.GetCreateRoleImageAsset(jobEntity.DescSpecificAssetName)); HotfixEntry.Entity.ShowSelectRoleEntity(new SelectRoleData().Fill(roleId, item.RoleJob, item.RoleJob, UnityEngine.Random.Range(1, 10), UnityEngine.Random.Range(1, 10), UnityEngine.Random.Range(1, 10), UnityEngine.Random.Range(1, 10))); }