public static List <string> BuildPlayerSimplePreloadAssets(PMatchProcessInfo info, List <string> assets = null) { if (assets == null) { assets = new List <string>(); } // Player model var model = ConfigManager.Get <CreatureInfo>(info.roleProto); if (model) { assets.AddRange(model.models); } var w = WeaponInfo.GetWeapon(0, info.fashion.weapon); // Player weapons BuildWeaponSimplePreloadAssets(info.roleProto, info.gender, w.weaponID, w.weaponItemId, assets); // Equipments assets.AddRange(CharacterEquip.GetEquipAssets(info.fashion)); return(assets); }
public CreatureInfo BuildPlayerInfo(PMatchProcessInfo matchInfo, bool playerBuff = true, bool playerSkill = true) { var info = ConfigManager.Get <CreatureInfo>(matchInfo.roleProto); if (!info) { Logger.LogError("Module_Player::BuildPlayerInfo: Build CreatureInfo from PMatchInfo failed, could not find proto template config: {0}", matchInfo.roleProto); return(null); } info = info.Clone <CreatureInfo>(); var w = WeaponInfo.GetWeapon(0, matchInfo.fashion.weapon); var ww = WeaponInfo.GetWeapon(0, matchInfo.fashion.gun); if (w.isEmpty) { Logger.LogError("Creature::BuildPlayerInfo: MatchInfo has invalid weapon item:<b>[{0}]</b>", matchInfo.fashion.weapon); } if (ww.isEmpty) { Logger.LogError("Creature::BuildPlayerInfo: MatchInfo has invalid off weapon item:<b>[{0}]</b>", matchInfo.fashion.gun); } info.weaponID = w.weaponID; info.offWeaponID = ww.weaponID; info.weaponItemID = matchInfo.fashion.weapon; info.offWeaponItemID = matchInfo.fashion.gun; info.buffs = null; return(info); }
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 static ShowCreatureInfo.SizeAndPos GetTransform(PMatchProcessInfo info, int index) { var showInfo = ConfigManager.Get <ShowCreatureInfo>(10000 + info.roleProto); var pos = new Vector3(1.65f * index, 0, 0); var rot = new Vector3(0, 90, 0); var data = showInfo?.GetDataByIndex(index); if (data?.data != null && data.data.Length > 0) { return(data.data[0]); } return(new ShowCreatureInfo.SizeAndPos() { size = 1, pos = pos, rotation = rot }); }
public Creature CreatePlayer(PMatchProcessInfo pi, Vector3 pos, CreatureDirection direction, bool buff = false, bool skill = false) { var node = Level.current.startPos; var info = modulePlayer.BuildPlayerInfo(pi, buff, skill); var creature = Creature.Create(info, pos, false, pi.roleId + ":" + pi.roleName); creature.roleId = pi.roleId; creature.roleProto = pi.roleProto; creature.direction = direction; Util.AddChild(node, creature.transform, true); CharacterEquip.ChangeCloth(creature, pi.fashion); return(creature); }
public void Bind(PMatchProcessInfo info) { Util.SetText(name, info.roleName); Util.SetText(level, Util.Format(ConfigText.GetDefalutString((int)TextForMatType.AwakeStage, 18), info.level)); AtlasHelper.SetShared(career, $"career_icon_{info.roleProto:00}"); }