protected override List <string> BuildPreloadAssets() { var assets = base.BuildPreloadAssets(); assets.Add(Module_Bordlands.BORDLAND_MONSTER_ANIMATOR_NAME); //add player data var c = ConfigManager.Get <CreatureInfo>(modulePlayer.proto); assets.AddRange(c.models); assets.Add(Creature.GetAnimatorName(moduleEquip.weaponID, modulePlayer.gender)); assets.AddRange(CharacterEquip.GetEquipAssets(moduleEquip.currentDressClothes)); assets.Add(headPanelName); assets.Add(GeneralConfigInfo.ssceneTextObject); // Player shadow assets.Add(CombatConfig.sdefaultSelfShadow); if (moduleBordlands.bordlandsSettlementReward != null) { assets.Add(Window_RandomReward.ASSET_NAME); } if (modulePet.FightingPet != null) { Module_Battle.BuildPetSimplePreloadAssets(modulePet.FightingPet, assets, 1); } var emjioList = ConfigManager.GetAll <FaceName>(); for (int i = 0; i < emjioList.Count; i++) { assets.Add(emjioList[i]?.head_icon); } return(assets); }
private void CreatEnemyCreature(PMatchInfo info) { //创建敌人 ShowCreatureInfo showInfo = ConfigManager.Get <ShowCreatureInfo>(10); Vector3_ pos = new Vector3_(1.3, 0, 0); Vector3 rot = new Vector3(0, -110, 0); if (showInfo != null) { for (int i = 0; i < showInfo.forData.Length; i++) { if (showInfo.forData[i].index == info.roleProto) { pos = showInfo.forData[i].data[0].pos; rot = showInfo.forData[i].data[0].rotation; break; } } } var weaponInfo = ConfigManager.Get <PropItemInfo>(info.fashion.weapon); if (weaponInfo == null) { return; } moduleGlobal.LockUI("", 0.5f); Level.PrepareAssets(Module_Battle.BuildPlayerSimplePreloadAssets(info), (r) => { if (!r) { return; } enemy = moduleHome.CreatePlayer(info, pos, CreatureDirection.BACK); enemy.transform.localEulerAngles = rot; moduleGlobal.UnLockUI(); }); if (info.pet != null && info.pet.itemTypeId != 0) { var rPet = PetInfo.Create(info.pet); var assets = new List <string>(); Level.PrepareAssets(Module_Battle.BuildPetSimplePreloadAssets(rPet, assets, 2), b => { var rGradeInfo = rPet.UpGradeInfo; var show = ConfigManager.Get <ShowCreatureInfo>(rPet.ID); if (show == null) { Logger.LogError("没有配置config_showCreatureInfo表。宠物ID = {0}, 没有出生位置信息。宠物模型创建失败", rPet.ID); return; } var showData = show.GetDataByIndex(0); var data = showData.data.GetValue <ShowCreatureInfo.SizeAndPos>(0); enemyPet = moduleHome.CreatePet(rGradeInfo, pos + data.pos, data.rotation, Level.current.startPos, true, Module_Home.FIGHTING_PET_OBJECT_NAME + "_Enemy"); enemyPet.transform.localScale *= data.size; enemyPet.transform.localEulerAngles = data.rotation; }); } }
/// <summary> /// 更新宠物模型 /// </summary> public void RefreshModule() { if (SelectPet == null || m_modeName == SelectPet.UpGradeInfo.mode) { return; } if (m_loadPetCoroutine != null) { Level.current.StopCoroutine(m_loadPetCoroutine); } if (m_loadEffectCoroutine != null) { Level.current.StopCoroutine(m_loadEffectCoroutine); } m_pet?.Destroy(); m_lockEffect?.Destroy(); var playUnlockEffect = modulePet.NewPetList.Contains(SelectPet.ID); m_modeName = SelectPet.UpGradeInfo.mode; m_loadPetCoroutine = Level.PrepareAssets(Module_Battle.BuildPetSimplePreloadAssets(SelectPet, null, 0), b => { var show = ConfigManager.Get <ShowCreatureInfo>(SelectPet.ID); if (show == null) { Logger.LogError("没有配置config_showCreatureInfo表。宠物ID = {0}, 没有出生位置信息。宠物模型创建失败", SelectPet.ID); return; } var showData = show.GetDataByIndex(1); var data = showData.data.GetValue <ShowCreatureInfo.SizeAndPos>(0); m_pet = moduleHome.CreatePet(SelectPet.UpGradeInfo, data.pos, data.rotation, Level.current.startPos, false, PET_OBJECT_NAME); m_pet.eulerAngles = data.rotation; m_pet.localPosition = data.pos; m_pet.transform.localScale *= data.size; if (!modulePet.Contains(SelectPet.ID)) { m_loadEffectCoroutine = Level.PrepareAsset <GameObject>(GeneralConfigInfo.defaultConfig.lockEffect.effect, (t) => { m_lockEffect = m_pet.behaviour.effects.PlayEffect(GeneralConfigInfo.defaultConfig.lockEffect); m_loadEffectCoroutine = null; }); } else if (playUnlockEffect) { m_loadEffectCoroutine = Level.PrepareAsset <GameObject>(GeneralConfigInfo.defaultConfig.unlockEffect.effect, (t) => { m_pet.behaviour.effects.PlayEffect(GeneralConfigInfo.defaultConfig.unlockEffect); m_loadEffectCoroutine = null; }); } m_loadPetCoroutine = null; }); }
public void CreatePet(PetInfo rPet) { if (rPet == null) { return; } pet?.Destroy(); pet = null; var rGradeInfo = rPet.UpGradeInfo; if (rGradeInfo == null) { return; } PrepareAssets(Module_Battle.BuildPetSimplePreloadAssets(rPet, null, 0), b => { var show = ConfigManager.Get <ShowCreatureInfo>(rPet.ID); if (show == null) { Logger.LogError("没有配置config_showCreatureInfo表。宠物ID = {0}, 没有出生位置信息。宠物模型创建失败", rPet.ID); return; } var showData = show.GetDataByIndex(1); var data = showData.data.GetValue <ShowCreatureInfo.SizeAndPos>(0); pet = moduleHome.CreatePet(rGradeInfo, data.pos, data.rotation, startPos, false, Module_Home.PET_OBJECT_NAME); pet.eulerAngles = data.rotation; pet.localPosition = data.pos; pet.transform.localScale *= data.size; }); }
private void CreatTeamCreature(PMatchProcessInfo info, int index) { //创建敌人 var t = GetTransform(info, index); var pos = t.pos; var rot = t.rotation; var weaponInfo = ConfigManager.Get <PropItemInfo>(info.fashion.weapon); if (weaponInfo == null) { return; } moduleGlobal.LockUI("", 0.5f); m_memberLoadCoroutine = Level.PrepareAssets(Module_Battle.BuildPlayerSimplePreloadAssets(info), r => { if (!r) { return; } teamPlayer = moduleHome.CreatePlayer(info, pos, CreatureDirection.FORWARD); teamPlayer.uiName = Module_Home.TEAM_OBJECT_NAME; teamPlayer.gameObject.name = Module_Home.TEAM_OBJECT_NAME; teamPlayer.transform.localEulerAngles = rot; teamPlayer.transform.localScale = Vector3.one * t.size; moduleGlobal.UnLockUI(); }); if (info.pet != null && info.pet.itemTypeId != 0) { var rPet = PetInfo.Create(info.pet); var assets = new List <string>(); Level.PrepareAssets(Module_Battle.BuildPetSimplePreloadAssets(rPet, assets, 2), b => { var rGradeInfo = rPet.UpGradeInfo; var show = ConfigManager.Get <ShowCreatureInfo>(rPet.ID); if (show == null) { Logger.LogError("没有配置config_showCreatureInfo表。宠物ID = {0}, 没有出生位置信息。宠物模型创建失败", rPet.ID); return; } var showData = show.GetDataByIndex(0); var data = showData.data.GetValue <ShowCreatureInfo.SizeAndPos>(0); teamPlayerPet = moduleHome.CreatePet(rGradeInfo, pos + data.pos, data.rotation, Level.current.startPos, true, Module_Home.TEAM_PET_OBJECT_NAME); teamPlayerPet.transform.localScale *= data.size; teamPlayerPet.transform.localEulerAngles = data.rotation; }); } }
private List <string> GetPlayerPreloadAssets(List <PMazePlayer> infos) { List <string> list = new List <string>(); string temp = string.Empty; foreach (var p in infos) { //add creature var c = ConfigManager.Get <CreatureInfo>(p.GetProto()); if (!c) { Logger.LogError("wrong player proto with pmazePlayer : id:{0},name:{1},gender:{2} proto:{3}", p.roleId, p.roleName, p.gender, p.GetProto()); continue; } list.AddRange(c.models); if (p.fashion != null) { //add animator asset var prop = ConfigManager.Get <PropItemInfo>(p.fashion.weapon); if (prop) { temp = Creature.GetAnimatorName(prop.subType, p.gender); if (!list.Contains(temp)) { list.Add(temp); } } //equip assets List <string> equips = CharacterEquip.GetEquipAssets(p.fashion); foreach (var e in equips) { if (!list.Contains(e)) { list.Add(e); } } } //pet assets if (p.pet != null && p.pet.itemTypeId != 0) { var pet = PetInfo.Create(p.pet); Module_Battle.BuildPetSimplePreloadAssets(pet, list, 1); } } list.Distinct(); return(list); }
public void CreateFightingPet(PetInfo rPet) { var rGradeInfo = rPet?.UpGradeInfo; if (rGradeInfo == null) { return; } if (fightingPet && fightingPet.weaponID == rGradeInfo.UIstateMachine) { return; } PrepareAssets(Module_Battle.BuildPetSimplePreloadAssets(rPet, null, 2), b => { var show = ConfigManager.Get <ShowCreatureInfo>(rPet.ID); if (show == null) { Logger.LogError("没有配置config_showCreatureInfo表。宠物ID = {0}, 没有出生位置信息。宠物模型创建失败", rPet.ID); return; } if (fightingPet) { fightingPet.Destroy(); fightingPet = null; } var showData = show.GetDataByIndex(0); var data = showData.data.GetValue <ShowCreatureInfo.SizeAndPos>(0); fightingPet = moduleHome.CreatePet(rGradeInfo, data.pos, data.rotation, startPos, true, Module_Home.FIGHTING_PET_OBJECT_NAME); fightingPet.eulerAngles = data.rotation; fightingPet.position_ = fightingPet.localPosition = data.pos; fightingPet.transform.localScale *= data.size; originPetPos = fightingPet.position_; if (recordMasterPos != Vector3_.zero) { var offset = fightingPet.position_ - originMasterPos; fightingPet.position_ = (recordMasterPos + offset); } //切换主界面的宠物待机动作 fightingPet.stateMachine.TranslateTo("StateIdle"); }); }
private List <string> GetPlayerPreloadAssets(PNmlPlayer[] infos) { List <string> list = new List <string>(); string temp = string.Empty; foreach (var p in infos) { //add creature var c = ConfigManager.Get <CreatureInfo>(p.GetProto()); list.AddRange(c.models); //add animator asset var prop = ConfigManager.Get <PropItemInfo>(p.fashion.weapon); if (prop) { temp = Creature.GetAnimatorName(prop.subType, p.gender); if (!list.Contains(temp)) { list.Add(temp); } } //equip assets List <string> equips = CharacterEquip.GetEquipAssets(p.fashion); foreach (var e in equips) { if (!list.Contains(e)) { list.Add(e); } } if (p.pet != null && p.pet.itemTypeId != 0) { var pet = PetInfo.Create(p.pet); Module_Battle.BuildPetSimplePreloadAssets(pet, list, 1); } } list.Distinct(); return(list); }
protected override List <string> BuildPreloadAssets() { var assets = base.BuildPreloadAssets(); //收到角色信息后才预加载。否则采用动态加载 if (moduleEquip.weaponID != 0) { assets.AddRange(Module_Battle.BuildPlayerSimplePreloadAssets()); } assets.AddRange(Module_Battle.BuildPetSimplePreloadAssets(modulePet.FightingPet, null, 2)); //切换场景回到主城的时候,需要预加载未完成的资源 if (moduleGuide.currentGuide != null) { assets.AddRange(moduleGuide.GetPreLoadAssets(moduleGuide.currentGuide)); } assets.AddRange(FaceName.cachedAssets); return(assets); }