/// <summary> /// 添加模型固有特效 /// </summary> public static void AddCharModelEffects(Obj_Character obj, EEffectBindTargetType type = EEffectBindTargetType.TYPE_CHARACTER) { if (obj == null) { LogModule.ErrorLog("AddCharModelEffects called but parameter obj is null!"); return; } if (type == EEffectBindTargetType.TYPE_CHARACTER) { Tab_CharModel table = TableManager.GetCharModelByID(obj.ModelID, 0); if (table != null) { int totalEffectCountOnModel = table.getEffectIdCount(); int tmpValue; for (int i = 0; i < totalEffectCountOnModel; i++) { tmpValue = table.GetEffectIdbyIndex(i); if (tmpValue >= 0) { obj.PlayEffect(tmpValue); } } } } }
public static void ChangeMainPLayerObjToNormal() { Obj_MainPlayer main = Singleton <ObjManager> .Instance.MainPlayer; if (main == null) { LogModule.ErrorLog("ReloadMainPLayerObj called burt Singleton<ObjManager>.Instance.MainPlayer is null!"); return; } Tab_ItemVisual tabItemVisual = TableManager.GetItemVisualByID(main.ModelVisualID, 0); if (tabItemVisual == null) { tabItemVisual = TableManager.GetItemVisualByID(GlobeVar.DEFAULT_VISUAL_ID, 0); if (tabItemVisual == null) { return; } } int nCharmodelID = main.GetCharModelID(tabItemVisual, main.Profession); Tab_CharModel charModel = TableManager.GetCharModelByID(nCharmodelID, 0); if (charModel == null) { return; } main.AnimationFilePath = charModel.AnimPath; main.ModelID = nCharmodelID; LoadModelToRoot(nCharmodelID, EResourceType.CharacterModel, LoadModelComplete, main.gameObject, charModel, false); }
public static void CreateModelNpcObj(int nCharModelID, Obj_Init_Data initData, DelAsycModelOver delAsycStroyModel) { if (initData == null) { LogModule.ErrorLog("CreateModelNpcObj called but initData == null is null!"); } //NPC创建的时候统一用RoleBase中的ID,而不用Obj_Init_Data结构中的CharModelID Tab_CharModel charModel = TableManager.GetCharModelByID(nCharModelID, 0); if (null == charModel) { return; } GameObject npc = ResourceManager.InstantiateResource("Prefab/Model/NPCRoot", initData.m_ServerID.ToString()) as GameObject; //GameObject npc = CreateGameObjectByResource(initData); if (null != npc) { //加载逻辑体,同时异步加载渲染体 Obj_NPC objNPC = (Obj_NPC)npc.GetComponent <Obj_NPC>(); if (!objNPC) { objNPC = (Obj_NPC)npc.AddComponent <Obj_NPC>(); } if (objNPC && objNPC.Init(initData)) { objNPC.CanLogic = true; Singleton <ObjManager> .Instance.AddPoolObj(objNPC.ServerID.ToString(), objNPC); } LoadModelToRoot(nCharModelID, EResourceType.CharacterModel, LoadModelComplete, npc, charModel, null); Singleton <ObjManager> .Instance.CachedNpc(npc.name, npc, objNPC.IsNeedBecameVisible()); } }
public string GetPath(int id, EResourceType type) { string url = ""; switch (type) { case EResourceType.Effect: { Tab_Effect data = TableManager.GetEffectByID(id, 0); if (data == null) { LogModule.ErrorLog("GetPath called type {0} id {1} is invalid!", type, id); return(url); } url = data.Path.Substring(data.Path.LastIndexOf('/') + 1); url = BundleManager.GetBundleLoadUrl(BundleManager.PathEffectPrefab, url + ".data"); return(url); } case EResourceType.CharacterModel: { Tab_CharModel model = TableManager.GetCharModelByID(id, 0); if (model == null) { LogModule.ErrorLog("GetPath called type {0} id {1} is invalid!", type, id); return(url); } url = BundleManager.GetBundleLoadUrl(BundleManager.PathModelPrefab, model.ResPath + ".data"); return(url); } } LogModule.ErrorLog("GetPath failed invalid type {0} id {1} !", type, id); return("ffff"); }
public static void CreateModelStoryObj(int nCharModelID, string strName, DelAsycModelOver delAsycStroyModel) { Tab_CharModel charModel = TableManager.GetCharModelByID(nCharModelID, 0); if (null == charModel) { LogModule.WarningLog("can not find char model id in table :" + nCharModelID); return; } GameObject charObj = ResourceManager.InstantiateResource("Prefab/Model/PlayerRoot", strName) as GameObject; if (null == charObj) { LogModule.WarningLog("can not load PlayerRoot :" + nCharModelID); return; } Obj_Client curCharacter = charObj.GetComponent <Obj_Client>(); if (null == curCharacter) { charObj.AddComponent <Obj_Client>(); } LoadModelToRoot(nCharModelID, EResourceType.CharacterModel, LoadModelComplete, charObj, charModel, delAsycStroyModel); }
void InitFashionFakeObj(GameObject Obj, int nModelVisualID, Tab_FakeObject FakeObjTable) { if (Singleton <ObjManager> .Instance.MainPlayer == null) { return; } // 重载模型 Tab_ItemVisual tabItemVisual = TableManager.GetItemVisualByID(nModelVisualID, 0); if (tabItemVisual == null) { return; } int nCharModelID = GetCharModelID(tabItemVisual, GameManager.gameManager.OtherPlayerData.Profession); Tab_CharModel tabCharModel = TableManager.GetCharModelByID(nCharModelID, 0); if (tabCharModel == null) { return; } Singleton <ObjManager> .GetInstance().ReloadModel(Obj, tabCharModel.ResPath, Singleton <ObjManager> .GetInstance().OtherView_AsycLoadFakeObjOver, FakeObjTable, this); }
public static void ChangeOtherPLayerObjToNormal(Obj_OtherPlayer otherPlayer) { Tab_ItemVisual tabItemVisual = TableManager.GetItemVisualByID(otherPlayer.ModelVisualID, 0); if (tabItemVisual == null) { tabItemVisual = TableManager.GetItemVisualByID(GlobeVar.DEFAULT_VISUAL_ID, 0); if (tabItemVisual == null) { return; } } int nCharmodelID = otherPlayer.GetCharModelID(tabItemVisual, otherPlayer.Profession); Tab_CharModel charModel = TableManager.GetCharModelByID(nCharmodelID, 0); if (charModel == null) { return; } otherPlayer.AnimationFilePath = charModel.AnimPath; otherPlayer.ModelID = nCharmodelID; LoadModelToRoot(nCharmodelID, EResourceType.CharacterModel, LoadModelComplete, otherPlayer.gameObject, charModel, false); }
void InitFashionFakeObj(GameObject Obj, int nModelVisualID, Tab_FakeObject FakeObjTable, int nProfession = -1) { // 重载模型 Tab_ItemVisual tabItemVisual = TableManager.GetItemVisualByID(nModelVisualID, 0); if (tabItemVisual == null) { return; } int nCharModelID = -1; if (Singleton <ObjManager> .Instance != null && Singleton <ObjManager> .Instance.MainPlayer != null) { nCharModelID = Singleton <ObjManager> .Instance.MainPlayer.GetCharModelID(tabItemVisual); } else { nCharModelID = GetCharModelID(tabItemVisual, nProfession); } Tab_CharModel tabCharModel = TableManager.GetCharModelByID(nCharModelID, 0); if (tabCharModel == null) { return; } Singleton <ObjManager> .GetInstance().ReloadModel(Obj, tabCharModel.ResPath, Singleton <ObjManager> .GetInstance().AsycLoadFakeObjOver, FakeObjTable, this); }
void HandleFitOnFashion(int nGoodsId, int nFashionID) { m_FitOnVisual.FellowGoodsID = GlobeVar.INVALID_ID; m_FitOnVisual.MountGoodsID = GlobeVar.INVALID_ID; m_FitOnVisual.FellowID = GlobeVar.INVALID_ID; m_FitOnVisual.MountID = GlobeVar.INVALID_ID; Tab_FashionData tabFashionData = TableManager.GetFashionDataByID(nFashionID, 0); if (tabFashionData == null) { return; } Tab_ItemVisual tabItemVisual = TableManager.GetItemVisualByID(tabFashionData.ItemVisualID, 0); if (tabItemVisual == null) { return; } int nCharModelID = Singleton <ObjManager> .Instance.MainPlayer.GetCharModelID(tabItemVisual); Tab_CharModel tabCharModel = TableManager.GetCharModelByID(nCharModelID, 0); if (tabCharModel == null) { return; } Tab_FakeObject tabFakeObject = TableManager.GetFakeObjectByID(m_FakeObjID, 0); if (tabFakeObject == null) { return; } m_FitOnVisual.FashionGoodsID = nFashionID; m_FitOnVisual.FashionID = nFashionID; m_FitOnVisual.FashionDeadline = m_eDeadline; // 装备 时装 不同时预览 m_FitOnVisual.ArmorGoodsID = GlobeVar.INVALID_ID; m_FitOnVisual.ArmorID = GlobeVar.INVALID_ID; List <object> param = new List <object>(); param.Add(tabFakeObject); param.Add(m_FitOnFakeObj); param.Add(m_FitOnVisual); Singleton <ObjManager> .GetInstance().ReloadModel(m_FitOnGameObject, tabCharModel.ResPath, Singleton <ObjManager> .GetInstance().AsycLoadFitOnObjOver, param); }
public void UpdateFashionView() { if (null == Singleton <ObjManager> .Instance.MainPlayer) { return; } int nModelVisualID = Singleton <ObjManager> .Instance.MainPlayer.ModelVisualID; bool isDefaultVisual = false; Tab_ItemVisual tabItemVisual = null; tabItemVisual = TableManager.GetItemVisualByID(nModelVisualID, 0); if (tabItemVisual == null) { isDefaultVisual = true; } else { isDefaultVisual = false; } if (isDefaultVisual) { tabItemVisual = TableManager.GetItemVisualByID(GlobeVar.DEFAULT_VISUAL_ID, 0); if (tabItemVisual == null) { return; } } int nCharModelID = Singleton <ObjManager> .Instance.MainPlayer.GetCharModelID(tabItemVisual); Tab_CharModel tabCharModel = TableManager.GetCharModelByID(nCharModelID, 0); if (tabCharModel == null) { return; } Tab_FakeObject tabFakeObject = TableManager.GetFakeObjectByID(m_PlayerFakeObjID, 0); if (tabFakeObject == null) { return; } Singleton <ObjManager> .GetInstance().ReloadModel(m_FakeObjGameObject, tabCharModel.ResPath, Singleton <ObjManager> .GetInstance().AsycLoadFakeObjOver, tabFakeObject, m_PlayerFakeObj); }
void ShowOpponentView() { UIStage = 1; SearchSecond = 0; progress.text = WuLinData.WuLinRounderTip(); if (WuLinData.OppoViewInfo.guid == Games.GlobeDefine.GlobeVar.INVALID_GUID) { string text = ""; if (WuLinData.Rounder == 1) { text = StrDictionary.GetClientDictionaryString("#{4813}"); } else { string roundTips = WuLinData.WuLinRoundTipPrefix(); text = StrDictionary.GetClientDictionaryString("#{4814}", roundTips); } searchTip.text = text; Countdown.text = text; } else { searchTip.text = Utils.GetDicByID(1845); Countdown.text = Utils.GetDicByID(1845); int id = (int)WuLinData.OppoViewInfo.profession; Tab_RoleBaseAttr roleBaseAttr = TableManager.GetRoleBaseAttrByID(id, 0); if (roleBaseAttr != null) { Tab_CharModel charModel = TableManager.GetCharModelByID(roleBaseAttr.CharModelID, 0); if (charModel != null) { HeadIcon.spriteName = charModel.HeadPic; } } // if( id >= 0 && id < CharacterDefine.PROFESSION_DICNUM.Length) { Profession.text = Utils.GetProfessionNameByType(id); //Utils.GetDicByID(CharacterDefine.PROFESSION_DICNUM[id]); } } Name.text = WuLinData.OppoViewInfo.name; CombatNum.text = WuLinData.OppoViewInfo.combat.ToString(); HP.text = WuLinData.OppoViewInfo.hp.ToString(); MP.text = WuLinData.OppoViewInfo.mp.ToString(); Attack.text = WuLinData.OppoViewInfo.atk.ToString(); Defense.text = WuLinData.OppoViewInfo.def.ToString(); Critical.text = WuLinData.OppoViewInfo.cri.ToString(); Speed.text = WuLinData.OppoViewInfo.spd.ToString(); dodge.text = WuLinData.OppoViewInfo.dge.ToString(); }
//将模型变成变身状态下 public static void ChangeOtherPLayerObjToChangeModel(int nCharmodelID, Obj_Character otherPlayer) { Tab_CharModel charModel = TableManager.GetCharModelByID(nCharmodelID, 0); if (charModel == null) { LogModule.ErrorLog("Tab_CharModel is null == " + nCharmodelID); return; } otherPlayer.AnimationFilePath = charModel.AnimPath; otherPlayer.ModelID = nCharmodelID; LoadModelToRoot(nCharmodelID, EResourceType.CharacterModel, LoadModelComplete, otherPlayer.gameObject, charModel, true); }
public static void CreateOtherPlayerHided(Obj_OtherPlayer obj, Obj_HidePlayerData data) { if (data == null || obj == null || obj.gameObject == null) { LogModule.ErrorLog("CreateOtherPlayerHided called but data == null || obj == null ||obj.gameObject == null"); return; } Tab_CharModel charModel = TableManager.GetCharModelByID(data.CharModelId, 0); if (charModel == null) { return; } LoadModelToRoot(data.CharModelId, EResourceType.CharacterModel, LoadModelComplete, obj.gameObject, charModel, obj.CurChangeState == (int)GameDefine_Globe.ChangeModeState.CHANGE_2 || obj.CurChangeState == (int)GameDefine_Globe.ChangeModeState.CHANGE_1); //ReloadModel(curChar.gameObject, curObjData.ResPath, AsycCreateOtherPlayerOver, curObjData.InitData); }
protected override void InitBindPointData(GameObject go) { base.InitBindPointData(go); if (go != null) { m_EffectHolder = go.GetComponent <Obj>(); if (m_EffectHolder != null && m_EffectHolder.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER) { Tab_CharModel modelTable = TableManager.GetCharModelByID(m_EffectHolder.ModelID, 0); if (modelTable != null && GameManager.gameManager.ActiveScene != null) { GameManager.gameManager.ActiveScene.SetMainPlayerCircleSize(modelTable.SelectCircleSize); } } } }
/// <summary> /// 后期可以 看情况 跟OtherPlayer的创建 合并 /// </summary> /// <param name="initData"></param> public static void CreateZombieUser(Obj_Init_Data initData) { if (null == initData) { return; } //mwh 根据RoleBase的ID获得路径 Tab_RoleBaseAttr roleBaseAttr = TableManager.GetRoleBaseAttrByID(initData.m_RoleBaseID, 0); if (null == roleBaseAttr) { return; } initData.m_CharModelID = roleBaseAttr.CharModelID; GameObject otherPlayer = ResourceManager.InstantiateResource("Prefab/Model/OtherPlayerRoot", initData.m_ServerID.ToString()) as GameObject; if (null != otherPlayer) { Obj_ZombieUser objZombiePlayer = otherPlayer.AddComponent <Obj_ZombieUser>(); if (null != objZombiePlayer && objZombiePlayer.Init(initData)) { objZombiePlayer.CanLogic = true; } Tab_ItemVisual tabItemVisual = TableManager.GetItemVisualByID(objZombiePlayer.ModelVisualID, 0); if (tabItemVisual == null) { tabItemVisual = TableManager.GetItemVisualByID(GlobeVar.DEFAULT_VISUAL_ID, 0); if (tabItemVisual == null) { return; } } int nCharmodelID = objZombiePlayer.GetCharModelID(tabItemVisual, objZombiePlayer.Profession); Tab_CharModel charModel = TableManager.GetCharModelByID(nCharmodelID, 0); if (charModel == null) { return; } Singleton <ObjManager> .Instance.AddPoolObj(objZombiePlayer.ServerID.ToString(), objZombiePlayer); LoadModelToRoot(nCharmodelID, EResourceType.CharacterModel, LoadModelComplete, otherPlayer, charModel, null); } }
public void FitOnFashion(int nFashionID) { Tab_FashionData tabFashionData = TableManager.GetFashionDataByID(nFashionID, 0); if (tabFashionData == null) { return; } Tab_ItemVisual tabItemVisual = TableManager.GetItemVisualByID(tabFashionData.ItemVisualID, 0); if (tabItemVisual == null) { return; } int nCharModelID = Singleton <ObjManager> .Instance.MainPlayer.GetCharModelID(tabItemVisual); Tab_CharModel tabCharModel = TableManager.GetCharModelByID(nCharModelID, 0); if (tabCharModel == null) { return; } Tab_FakeObject tabFakeObject = TableManager.GetFakeObjectByID(m_PlayerFakeObjID, 0); if (tabFakeObject == null) { return; } List <object> param = new List <object>(); param.Add(tabFakeObject); param.Add(m_PlayerFakeObj); Singleton <ObjManager> .GetInstance().ReloadModel(m_FakeObjGameObject, tabCharModel.ResPath, Singleton <ObjManager> .GetInstance().AsycLoadRoleViewFitOnObjOver, param); GameManager.gameManager.ActiveScene.ShowFakeObj(); }
void ShowMissionUI(string missionContent, bool defaultDialog) { m_bIsDefaultDialog = defaultDialog; if (m_bIsDefaultDialog) { UIManager.HideAllUIExceptStory(); } //LogModule.ErrorLog("________________________________ " + missionContent); m_StoryDialogBottomLabel.text = missionContent; Obj_NPC TargetNpc = Singleton <DialogCore> .GetInstance().CareNPC; if (TargetNpc == null) { return; } if (TargetNpc.ModelID < 0) { return; } Tab_RoleBaseAttr roleBase = TableManager.GetRoleBaseAttrByID(TargetNpc.BaseAttr.RoleBaseID, 0); if (roleBase == null) { return; } Tab_CharModel charModel = TableManager.GetCharModelByID(TargetNpc.ModelID, 0); if (null == charModel) { return; } if (m_SpeakerName && m_StoryDialogBottomRole) { m_SpeakerName.text = roleBase.Name; m_StoryDialogBottomRole.mainTexture = ResourceManager.LoadResource("Texture/MissionRole/" + charModel.NPCSpriteName, typeof(Texture)) as Texture; } #if BOBJOYSTICK // RefreshJoyGUI(MissionUIType.TYPE_NONE); #endif }
void UpdateNPCInfo() { Obj_NPC TargetNpc = Singleton <DialogCore> .GetInstance().CareNPC; if (TargetNpc != null) { if (TargetNpc.ModelID >= 0) { Tab_RoleBaseAttr roleBase = TableManager.GetRoleBaseAttrByID(TargetNpc.BaseAttr.RoleBaseID, 0); if (roleBase != null) { Tab_CharModel charModel = TableManager.GetCharModelByID(TargetNpc.ModelID, 0); if (charModel != null && m_NPCHead && m_NPCName) { m_NPCName.text = roleBase.Name; Texture curTexture = ResourceManager.LoadResource("Texture/MissionRole/" + charModel.NPCSpriteName, typeof(Texture)) as Texture; if (null != curTexture) { m_NPCHead.gameObject.SetActive(true); m_NPCHead.mainTexture = curTexture; } else { m_NPCHead.gameObject.SetActive(false); } } } } if (m_curOptionDialogId != -1) { Tab_NpcOptionDialog _npcOptionInfo = TableManager.GetNpcOptionDialogByID(m_curOptionDialogId, 0); if (_npcOptionInfo != null) { m_NPCTalk.text = StrDictionary.GetClientString_WithNameSex(_npcOptionInfo.CenterText); } //RESET AWARD TEXT FOR TW if (m_curOptionDialogId == AWARD_DIALOGID && PlatformHelper.IsChannelTW()) { m_NPCTalk.text = StrDictionary.GetClientDictionaryString("#{5248}"); } } } }
void HandleFitOnArmor(int nGoodsId, int nDataID, Tab_EquipAttr tabArmorEquipAttr) { Tab_ItemVisual tabItemVisual = TableManager.GetItemVisualByID(tabArmorEquipAttr.ModelId, 0); if (tabItemVisual == null) { return; } int nCharModelID = Singleton <ObjManager> .Instance.MainPlayer.GetCharModelID(tabItemVisual); Tab_CharModel tabCharModel = TableManager.GetCharModelByID(nCharModelID, 0); if (tabCharModel == null) { return; } Tab_FakeObject tabFakeObject = TableManager.GetFakeObjectByID(m_FakeObjID, 0); if (tabFakeObject == null) { return; } m_FitOnVisual.ArmorGoodsID = nGoodsId; m_FitOnVisual.ArmorID = nDataID; // 装备 时装 不同时预览 m_FitOnVisual.FashionGoodsID = GlobeVar.INVALID_ID; m_FitOnVisual.FashionID = GlobeVar.INVALID_ID; m_FitOnVisual.FashionDeadline = YuanBaoShopItemLogic.DEADLINE_PRICE.PRICE_FOREVER; List <object> param = new List <object>(); param.Add(tabFakeObject); param.Add(m_FitOnFakeObj); param.Add(m_FitOnVisual); Singleton <ObjManager> .GetInstance().ReloadModel(m_FitOnGameObject, tabCharModel.ResPath, Singleton <ObjManager> .GetInstance().AsycLoadFitOnObjOver, param); }
/// <summary> /// 创建陷阱 /// </summary> /// <param name="nCharModelID"></param> /// <param name="initData"></param> public static void CreateModelSnareObj(ObjSnare_Init_Data initData) { if (null == initData) { return; } //根据RoleBase的ID获得路径 Tab_SnareObjInfo SnareObjInfo = TableManager.GetSnareObjInfoByID(initData.m_SnareID, 0); if (null == SnareObjInfo) { return; } int nCharModelID = SnareObjInfo.CharModelId; Tab_CharModel charModel = TableManager.GetCharModelByID(nCharModelID, 0); if (charModel == null) { LogModule.WarningLog("can not find char model id in table :{0}", nCharModelID); return; } GameObject SnareObj = ResourceManager.InstantiateResource("Prefab/Model/SnareRoot", initData.m_ServerID.ToString()) as GameObject; if (null != SnareObj) { //加载逻辑体,同时异步加载渲染体 Obj_Snare objSnare = SnareObj.AddComponent <Obj_Snare>();; if (objSnare.Init(initData)) { objSnare.CanLogic = true; Singleton <ObjManager> .Instance.AddPoolObj(objSnare.ServerID.ToString(), objSnare); } //ReloadModel(SnareObj, charModel.ResPath, AsycSnareObjOver, initData); LoadModelToRoot(nCharModelID, EResourceType.CharacterModel, LoadModelComplete, SnareObj, charModel, null); } }
void UpdateNPCInfo() { Obj_NPC TargetNpc = Singleton <DialogCore> .GetInstance().CareNPC; if (TargetNpc != null) { if (TargetNpc.ModelID >= 0) { Tab_RoleBaseAttr roleBase = TableManager.GetRoleBaseAttrByID(TargetNpc.BaseAttr.RoleBaseID, 0); if (roleBase != null) { Tab_CharModel charModel = TableManager.GetCharModelByID(TargetNpc.ModelID, 0); if (charModel != null && m_NPCHead && m_NPCName) { m_NPCName.text = roleBase.Name; Texture curTexture = ResourceManager.LoadResource("Texture/MissionRole/" + charModel.NPCSpriteName, typeof(Texture)) as Texture; if (null != curTexture) { m_NPCHead.gameObject.SetActive(true); m_NPCHead.mainTexture = curTexture; } else { m_NPCHead.gameObject.SetActive(false); } } } } Tab_NpcDialog DialogLine = TableManager.GetNpcDialogByID(TargetNpc.DefaultDialogID, 0); if (DialogLine != null) { if (m_NPCTalk) { m_NPCTalk.text = StrDictionary.GetClientString_WithNameSex(DialogLine.Dialog); } } } }
//行走状态处理 void ProcessDeathAnimState() { if (AnimLogic != null && m_Objanimation != null) { //是否在播放动作 if (m_Objanimation.isPlaying && AnimLogic.CurAnimData != null) { //击飞是不播死亡动画 if (AnimLogic.CurAnimData.AnimID != (int)CharacterDefine.CharacterAnimId.Knockback_01 && AnimLogic.CurAnimData.AnimID != (int)CharacterDefine.CharacterAnimId.Knockback_02) { m_AnimLogic.Stop(); m_AnimLogic.Play((int)(CharacterDefine.CharacterAnimId.Die)); } } else { m_AnimLogic.Stop(); m_AnimLogic.Play((int)(CharacterDefine.CharacterAnimId.Die)); } } Tab_RoleBaseAttr roleBaseAttr = TableManager.GetRoleBaseAttrByID(BaseAttr.RoleBaseID, 0); if (roleBaseAttr != null) { Tab_CharModel charModel = TableManager.GetCharModelByID(roleBaseAttr.CharModelID, 0); if (charModel != null) { int nDeadSoundCount = charModel.getDeadSoundCount(); int nRandNum = Random.Range(0, nDeadSoundCount - 1); if (charModel.GetDeadSoundbyIndex(nRandNum) >= 0) { PlaySoundAtPos(ObjType, charModel.GetDeadSoundbyIndex(nRandNum), Position); } } } }
//创建伙伴 public static void CreateFellowModel(Obj_Init_Data initData) { if (null == initData) { return; } Tab_CabalFellowAttr fellowAttr = TableManager.GetCabalFellowAttrByID(initData.m_RoleBaseID, 0); if (null == fellowAttr) { return; } //根据ModelId找到CharModel资源 Tab_CharModel charModel = TableManager.GetCharModelByID(fellowAttr.ModelId, 0); if (null == charModel) { return; } GameObject fellow = ResourceManager.InstantiateResource("Prefab/Model/FellowRoot", initData.m_ServerID.ToString()) as GameObject; if (null != fellow) { //加载逻辑体,同时异步加载渲染体 Obj_Fellow objFellow = fellow.AddComponent <Obj_Fellow>(); if (objFellow && objFellow.Init(initData)) { objFellow.CanLogic = true; Singleton <ObjManager> .Instance.AddPoolObj(objFellow.ServerID.ToString(), objFellow); } LoadModelToRoot(fellowAttr.ModelId, EResourceType.CharacterModel, LoadModelComplete, fellow, charModel, null); //ReloadModel(fellow, charModel.ResPath, AsycCreateFellowOver, initData); } }
public static void CreateModelYanhuaObj(ObjYanHua_Init_Data initData) { if (null == initData) { return; } //根据RoleBase的ID获得路径 Tab_YanHua YanHuaInfo = TableManager.GetYanHuaByID(initData.m_nYanHuaID, 0); if (null == YanHuaInfo) { return; } Tab_CharModel charModel = TableManager.GetCharModelByID(YanHuaInfo.CharModelId, 0); if (null == charModel) { return; } GameObject yanhuaGo = ResourceManager.InstantiateResource("Prefab/Model/SnareRoot", initData.m_ServerID.ToString()) as GameObject; if (null != yanhuaGo) { Obj_YanHua objYanhua = yanhuaGo.AddComponent <Obj_YanHua>(); if (objYanhua.Init(initData)) { objYanhua.CanLogic = true; Singleton <ObjManager> .Instance.AddPoolObj(objYanhua.ServerID.ToString(), objYanhua); } LoadModelToRoot(YanHuaInfo.CharModelId, EResourceType.CharacterModel, LoadModelComplete, yanhuaGo, charModel, null); } }
public static void ChangeMainPLayerObj(int nCharmodelID) { Obj_MainPlayer main = Singleton <ObjManager> .Instance.MainPlayer; if (main == null) { LogModule.ErrorLog("ReloadMainPLayerObj called but Singleton<ObjManager>.Instance.MainPlayer is null!"); return; } Tab_CharModel charModel = TableManager.GetCharModelByID(nCharmodelID, 0); if (charModel == null) { LogModule.ErrorLog("Tab_CharModel is null == " + nCharmodelID); return; } main.AnimationFilePath = charModel.AnimPath; //324 main.ModelID = nCharmodelID; LoadModelToRoot(nCharmodelID, EResourceType.CharacterModel, LoadModelComplete, main.gameObject, charModel, true); }
public override bool Init(Obj_Init_Data initData) { if (null == m_ObjTransform) { m_ObjTransform = gameObject.transform; } m_ObjTransform.position = ActiveScene.GetTerrainPosition(new Vector3(initData.m_fX, 0, initData.m_fZ)); //暂时 写死了 后面再用服务器 m_ObjTransform.Rotate(Vector3.up * 135); //服务器发过来的信息 this.ServerID = initData.m_ServerID; BaseAttr.RoleBaseID = initData.m_RoleBaseID; BaseAttr.RoleName = initData.m_StrName; m_OwnerObjId = initData.m_OwnerObjId; StealthLev = initData.m_StealthLev; m_Quality = initData.m_FellowQuality; OptStealthLevChange(); //防止伙伴追上人物导致动作不流畅 把客户端主角伙伴速度修改为和人物一样 if (IsOwnedByMainPlayer() == true) { Singleton <ObjManager> .GetInstance().MainPlayer.CurFellowObjId = ServerID; Singleton <ObjManager> .GetInstance().MainPlayer.CurFellowObjGuid = initData.m_Guid; BaseAttr.MoveSpeed = Singleton <ObjManager> .GetInstance().MainPlayer.BaseAttr.MoveSpeed; } else { Obj_OtherPlayer otherPlayer = Singleton <ObjManager> .Instance.FindObjInScene(m_OwnerObjId) as Obj_OtherPlayer; if (null != otherPlayer) { otherPlayer.FellowID = ServerID; m_bVisible = otherPlayer.IsVisibleChar(); } BaseAttr.MoveSpeed = initData.m_MoveSpeed; } Tab_CabalFellowAttr fellowAttrTab = TableManager.GetCabalFellowAttrByID(BaseAttr.RoleBaseID, 0); if (fellowAttrTab != null) { //初始化CharModelID,并读取部分客户端信息 ModelID = fellowAttrTab.ModelId; Tab_CharModel charModel = TableManager.GetCharModelByID(ModelID, 0); if (null != charModel) { BaseAttr.HeadPic = charModel.HeadPic; //设置动作路径 AnimationFilePath = charModel.AnimPath; //设置名字版高度 DeltaHeight = charModel.HeadInfoHeight; m_ObjTransform.localScale = new Vector3(charModel.Scale, charModel.Scale, charModel.Scale); m_ObjTransform.localRotation = Utils.DirServerToClient(initData.m_fDir); } } //初始化寻路代理 InitNavAgent(); //初始化AutoMove功能模块 //if (gameObject.GetComponent<AutoMove>() == null) //{ gameObject.AddComponent <AutoMove>(); //} //初始化动画,需要在AnimationFilePath被赋值后进行 if (AnimLogic == null) { AnimLogic = gameObject.AddComponent <AnimationLogic>(); } //初始化特效 if (ObjEffectController == null) { ObjEffectController = gameObject.AddComponent <CharacterEffectBehaviourController>(); } //召出播放特效 if (Singleton <ObjManager> .GetInstance().MainPlayer != null) { if (m_OwnerObjId == Singleton <ObjManager> .GetInstance().MainPlayer.ServerID) { if (GameManager.gameManager.PlayerDataPool.FellowPlayerEffect == true) { //PlayEffect(52); GameManager.gameManager.PlayerDataPool.FellowPlayerEffect = false; } } } if (IsDie()) { OnCorpse(); } else { if (Objanimation != null) { Objanimation.Stop(); } CurObjAnimState = Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_NORMOR; } InitNameBoard(); return(base.Init(initData)); }
public override void OnBindOpt(Obj_Character obj) { base.OnBindOpt(obj); //婚车特殊摆设 if (BaseAttr.RoleBaseID == GlobeVar.PARADE_BUSID && obj != null) { Transform playermodel = obj.transform.FindChild("Model"); Transform ridepoint = gameObject.transform.FindChild("Model/All/Bip01/Bip01 Pelvis/Bip01 Spine/Ride_Point01"); Transform seatpoint = gameObject.transform.FindChild("Model/All/Bone02/Ride_Point02"); if (playermodel == null || ridepoint == null || seatpoint == null) { return; } if (GetBindChildIndex(obj.ServerID) == 0 && ridepoint.childCount < 1) { obj.gameObject.transform.localPosition = new Vector3(0.0f, 0.78f, -0.47f); GameObject fakeobj = (GameObject)Instantiate(playermodel.gameObject); if (fakeobj != null) { fakeobj.SetActive(true); fakeobj.transform.parent = ridepoint; fakeobj.transform.localPosition = Vector3.zero; fakeobj.transform.localRotation = Quaternion.Euler(90.0f, 0.0f, 0.0f); fakeobj.transform.localScale = Vector3.one; AnimationLogic al = ridepoint.gameObject.AddComponent <AnimationLogic>(); if (al != null) { al.InitState(fakeobj); Tab_RoleBaseAttr role = TableManager.GetRoleBaseAttrByID(obj.BaseAttr.RoleBaseID, 0); if (role != null) { Tab_CharModel mo = TableManager.GetCharModelByID(role.CharModelID, 0); if (mo != null) { al.AnimResFilePath = mo.AnimPath; } } // int animId = -1; //sl/ts/dl/xy //if (obj.BaseAttr.RoleBaseID == 0) // animId = 153; //else if (obj.BaseAttr.RoleBaseID == 1) // animId = 155; //else if (obj.BaseAttr.RoleBaseID == 2) // animId = 159; //else if (obj.BaseAttr.RoleBaseID == 3) // animId = 157; // if (animId > 0) { al.Play(227); } } } return; } if (GetBindChildIndex(obj.ServerID) == 1 && seatpoint.childCount < 1) { obj.gameObject.transform.localPosition = new Vector3(0.0f, 0.47f, -1.83f); GameObject fakeobj = (GameObject)Instantiate(playermodel.gameObject); if (fakeobj != null) { fakeobj.SetActive(true); fakeobj.transform.parent = seatpoint; fakeobj.transform.localPosition = Vector3.zero; fakeobj.transform.localRotation = Quaternion.Euler(90.0f, 0.0f, 0.0f); fakeobj.transform.localScale = Vector3.one; AnimationLogic al = seatpoint.gameObject.AddComponent <AnimationLogic>(); if (al != null) { al.InitState(fakeobj); Tab_RoleBaseAttr role = TableManager.GetRoleBaseAttrByID(obj.BaseAttr.RoleBaseID, 0); if (role != null) { Tab_CharModel mo = TableManager.GetCharModelByID(role.CharModelID, 0); if (mo != null) { al.AnimResFilePath = mo.AnimPath; } } //int animId = -1; ////sl/ts/dl/xy //if (obj.BaseAttr.RoleBaseID == 0) // animId = 146; //else if (obj.BaseAttr.RoleBaseID == 1) // animId = 148; //else if (obj.BaseAttr.RoleBaseID == 2) // animId = 152; //else if (obj.BaseAttr.RoleBaseID == 3) // animId = 150; //if (animId > 0) { al.Play(225); } } } return; } } }
public override bool Init(Obj_Init_Data initData) { if (null == m_ObjTransform) { m_ObjTransform = transform; } m_ObjTransform.position = ActiveScene.GetTerrainPosition(new Vector3(initData.m_fX, 0, initData.m_fZ)); BaseAttr.RoleBaseID = initData.m_RoleBaseID; BaseAttr.MoveSpeed = initData.m_MoveSpeed; Tab_RoleBaseAttr roleBaseTab = TableManager.GetRoleBaseAttrByID(BaseAttr.RoleBaseID, 0); if (roleBaseTab != null) { m_NpcType = (Games.GlobeDefine.GameDefine_Globe.NPC_TYPE)roleBaseTab.NpcType; //初始化CharModelID,并读取部分客户端信息 ModelID = roleBaseTab.CharModelID; Tab_CharModel charModel = TableManager.GetCharModelByID(ModelID, 0); if (null != charModel) { BaseAttr.HeadPic = charModel.HeadPic; //设置动作路径 AnimationFilePath = charModel.AnimPath; //设置名字版高度 DeltaHeight = charModel.HeadInfoHeight; transform.localScale = Vector3.one; } } //服务器发过来的信息 this.ServerID = initData.m_ServerID; this.BornPosX = initData.m_fX; this.BornPosY = gameObject.transform.position.y; this.BornPosZ = initData.m_fZ; BaseAttr.RoleName = initData.m_StrName; BaseAttr.Force = initData.m_Force; BaseAttr.Die = initData.m_IsDie; m_ObjTransform.rotation = Utils.DirServerToClient(initData.m_fDir); StealthLev = initData.m_StealthLev; m_bIsBornCreate = initData.m_bNpcBornCreate; OptStealthLevChange(); // NPC挂任务 AddDialogMission(); //组件在初始化数据后进行 //初始化寻路代理 InitNavAgent(); //初始化动画,需要在AnimationFilePath被赋值后进行 AnimLogic = gameObject.GetComponent <AnimationLogic>(); if (AnimLogic == null) { AnimLogic = gameObject.AddComponent <AnimationLogic>(); } //初始化特效 ObjEffectController = gameObject.GetComponent <CharacterEffectBehaviourController>(); if (ObjEffectController == null) { ObjEffectController = gameObject.AddComponent <CharacterEffectBehaviourController>(); } //初始化AutoMove功能模块 if (gameObject.GetComponent <AutoMove>() == null) { gameObject.AddComponent <AutoMove>(); } if (IsDie()) { OnCorpse(); } else { if (Objanimation != null) { Objanimation.Stop(); } CurObjAnimState = Games.GlobeDefine.GameDefine_Globe.OBJ_ANIMSTATE.STATE_NORMOR; } //创新跟玩家一样的模型 m_ModelVisualID = initData.m_ModelVisualID; m_nProfession = initData.m_nProfession; m_WeaponDataID = initData.m_WeaponDataID; m_WeaponEffectGem = initData.m_WeaponDataID; if (initData.m_ModelVisualID != GlobeVar.INVALID_ID && initData.m_nProfession != -1) { ReloadPlayerModelVisual(initData.m_ModelVisualID, initData.m_nProfession); } //初始化名字版 //InitNameBoard(); if (!m_IsNameBoard) { InitNameBoard(); } else { if (m_MissionBoard != null) { //m_MissionBoard.SetActive(true); ShowNameBoard(); } } m_mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer; // 帮会活动NPC判断 m_bIsGuildActivityBoss = IsGuildBoss(); m_SceneNpcId = initData.m_SceneNpcId; return(base.Init(initData)); }
public void SetState(string name, State state, Type type, List <LoginData.PlayerRoleData> serverRoleList) { labelServerName.text = name; switch (state) { case ServerListItem.State.HOT: sprState.spriteName = "YanChi03"; break; case ServerListItem.State.NEW: sprState.spriteName = "YanChi01"; break; case ServerListItem.State.NORAML: sprState.spriteName = "YanChi02"; break; case ServerListItem.State.STOP: sprState.spriteName = "YanChi04"; break; default: sprState.spriteName = "YanChi04"; break; } sprRecommand.gameObject.SetActive((int)type > 0); /* * switch(type) * { * case Type.NEW: * sprStateLabel.spriteName = "xinqu"; * break; * case Type.NORMAL: * sprStateLabel.spriteName = "shunchang"; * break; * case Type.HOT: * sprStateLabel.spriteName = "tuijian"; * break; * default: * sprStateLabel.spriteName = "xinqu"; * break; * } */ if (null != serverRoleList) { for (int i = 0, max = serverRoleList.Count; i < max; i++) { if (i < serverRolesHead.Length) { Tab_CharModel curCharModel = TableManager.GetCharModelByID(serverRoleList[i].type, 0); if (null != curCharModel) { serverRolesHead[i].spriteName = curCharModel.HeadPic; serverRolesHead[i].gameObject.SetActive(true); } serverRolesLevel[i].text = serverRoleList[i].level.ToString(); serverRolesLevel[i].gameObject.SetActive(true); } } } }
void HandleFitOnWeapon(int nGoodsId, int nDataID, Tab_EquipAttr tabWeaponEquipAttr) { Tab_ItemVisual tabItemVisual = TableManager.GetItemVisualByID(tabWeaponEquipAttr.ModelId, 0); if (tabItemVisual == null) { return; } int nWeaponModelID = Singleton <ObjManager> .Instance.MainPlayer.GetWeaponModelID(tabItemVisual); Tab_WeaponModel tabWeaponModel = TableManager.GetWeaponModelByID(nWeaponModelID, 0); if (tabWeaponModel == null) { return; } /// 因为可能显示过伙伴 坐骑的模型 所以要重载玩家模型预览 设置玩家外观 Tab_ItemVisual tabModelVisual = null; if (m_FitOnVisual.FashionID != GlobeVar.INVALID_ID) { Tab_FashionData tabFashionData = TableManager.GetFashionDataByID(m_FitOnVisual.FashionID, 0); if (tabFashionData == null) { return; } tabModelVisual = TableManager.GetItemVisualByID(tabFashionData.ItemVisualID, 0); } else if (m_FitOnVisual.ArmorID != GlobeVar.INVALID_ID) { Tab_EquipAttr tabArmorEquipAttr = TableManager.GetEquipAttrByID(m_FitOnVisual.ArmorID, 0); if (tabArmorEquipAttr == null) { return; } tabModelVisual = TableManager.GetItemVisualByID(tabArmorEquipAttr.ModelId, 0); } else { if (Singleton <ObjManager> .Instance.MainPlayer.ModelVisualID == GlobeVar.INVALID_ID) { tabModelVisual = TableManager.GetItemVisualByID(GlobeVar.DEFAULT_VISUAL_ID, 0); } else { tabModelVisual = TableManager.GetItemVisualByID(Singleton <ObjManager> .Instance.MainPlayer.ModelVisualID, 0); } } if (tabModelVisual == null) { return; } // 设置结束 下面与武器一起重载 int nCharModelID = Singleton <ObjManager> .Instance.MainPlayer.GetCharModelID(tabModelVisual); Tab_CharModel tabCharModel = TableManager.GetCharModelByID(nCharModelID, 0); if (tabCharModel == null) { return; } Tab_FakeObject tabFakeObject = TableManager.GetFakeObjectByID(m_FakeObjID, 0); if (tabFakeObject == null) { return; } m_FitOnVisual.WeaponGoodsID = nGoodsId; m_FitOnVisual.WeaponID = nDataID; List <object> param = new List <object>(); param.Add(tabFakeObject); param.Add(m_FitOnFakeObj); param.Add(m_FitOnVisual); Singleton <ObjManager> .GetInstance().ReloadModel(m_FitOnGameObject, tabCharModel.ResPath, Singleton <ObjManager> .GetInstance().AsycLoadFitOnObjOver, param); }