public static SuitInfo GetResPathBySuitID(uint uSuitID, Client.EquipPos pos, uint profession, uint sex, uint skillStatu) { SuitInfo info = new SuitInfo(); info.pos = (SuitPos)pos; var table_data = GameTableManager.Instance.GetTableItem <table.SuitDataBase>(uSuitID); if (table_data == null) { GameCmd.enmCharSex nSex = (GameCmd.enmCharSex)GameUtil.FaceToSex(sex); // 根据职业、性别和部位去查找 var database = table.SelectRoleDataBase.Where((GameCmd.enumProfession)profession, (GameCmd.enmCharSex)nSex); if (database != null) { switch (pos) { case Client.EquipPos.EquipPos_Body: { table_data = GameTableManager.Instance.GetTableItem <table.SuitDataBase>((uint)database.bodyPathID); break; } case Client.EquipPos.EquipPos_Weapon: { table_data = GameTableManager.Instance.GetTableItem <table.SuitDataBase>((uint)database.weaponPath); break; } } } } if (table_data == null) { return(info); } uint viewID = skillStatu == 0?table_data.viewresid:table_data.viewresid2; table.ResourceDataBase db = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(viewID); // 使用观察路径 if (db != null) { info.modelPath = db.strPath; info.locatorName = table_data.locator_name; } return(info); }
public override bool CreateEntityView(EntityCreateData data) { //Profiler.BeginSample("CreateEntityView"); m_Data = data; base.CreateEntityView(data); if (GetEntityType() != EntityType.EntityType_Player) { m_bChangeRestore = false; Engine.Utility.Log.Error("CreateEntityView failed:{0}", GetName()); return(false); } string strResName = ""; //if (data.PropList != null) //{ // for (int i = 0; i < data.PropList.Length; ++i ) // { // if (data.PropList[i].nPropIndex == (int)PlayerProp.TransModelResId) // { int ntransModelID = GetProp((int)PlayerProp.TransModelResId);//.PropList[i].value; if (ntransModelID != 0) { table.ResourceDataBase resData = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>((uint)ntransModelID); if (resData != null) { strResName = resData.strPath; } } // break; // } // } //} table.SuitDataBase table_data = null; if (string.IsNullOrEmpty(strResName) && data.ViewList != null) { //Profiler.BeginSample("CreateEntityView:Table:Query"); for (int i = 0; i < data.ViewList.Length; ++i) { if (data.ViewList[i] == null) { continue; } if (data.ViewList[i].nPos == (int)EquipPos.EquipPos_Body) { table_data = GameTableManager.Instance.GetTableItem <table.SuitDataBase>((uint)data.ViewList[i].value); if (table_data == null) { GameCmd.enumProfession profession = (GameCmd.enumProfession)GetProp((int)PlayerProp.Job); GameCmd.enmCharSex sex = (GameCmd.enmCharSex)GetProp((int)PlayerProp.Sex); var role_data = table.SelectRoleDataBase.Where(profession, sex); if (role_data == null) { Engine.Utility.Log.Error("CreateEntityView:job{0}或者sex{1}数据非法!", profession, sex); return(false); } table_data = GameTableManager.Instance.GetTableItem <table.SuitDataBase>((uint)role_data.bodyPathID); } if (table_data != null) { table.ResourceDataBase db = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(table_data.resid); if (db == null) { Debug.LogError("ResourceDataBase is null bodypahtid is " + table_data.resid + " 请检查resource 表格"); return(false); } strResName = db.strPath; } //else //{ // strResName = ""; //} //if(m_EntityView!=null) //{ // m_EntityView.AddSuitData(EquipPos.EquipPos_Body, data.ViewList[i].value, (int)table_data.resid); //} } } //Profiler.EndSample(); } // 修改技能形态值 m_Data.eSkillState = (SkillSettingState)GetProp((int)PlayerProp.SkillStatus); // 设置名称 SetName(data.strName); string strPath, strFileName, strExt, strFileNameNoExt; Engine.Utility.StringUtility.ParseFileName(ref strResName, out strPath, out strFileName, out strFileNameNoExt, out strExt); m_strObjName = strFileNameNoExt; if (m_Data.bImmediate) { // 立即创建 if (!m_EntityView.Create(ref strResName, OnCreateRenderObj, m_Data.bImmediate)) { Engine.Utility.Log.Error("CreateEntityView failed:{0}", strResName); return(false); } } else { EntityViewCreator.Instance.AddView(GetUID(), m_EntityView, ref strResName, OnCreateRenderObj); } //Profiler.EndSample(); //Profiler.EndSample(); return(true); }