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); }
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); }