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; }); } }
public static List <string> BuildPlayerSimplePreloadAssets(PMatchInfo 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 void BindData(PMatchInfo rMatchInfo, PBattleInfo rBattleInfo) { Util.SetText(name, rMatchInfo.roleName); Util.SetText(level, $"lv:{rMatchInfo.level}"); Util.SetText(kill, Module_FactionBattle.GetKillString(rBattleInfo.maxCombokill)); Util.SetText(score, rBattleInfo.score.ToString()); killIcon.SafeSetActive(!string.IsNullOrEmpty(kill.text)); var info = ConfigManager.Get <FactionKillRewardInfo>(rBattleInfo.maxCombokill); if (!string.IsNullOrEmpty(info?.applique)) { AtlasHelper.SetIcons(killIcon, info.applique); } }
/// <summary> /// Create a creature at position pos and set direction to direction from PvP match info. /// </summary> /// <returns></returns> public Creature CreatePlayer(PMatchInfo 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 static List <string> BuildPlayerPreloadAssets(PMatchInfo info, List <string> assets = null) { if (assets == null) { assets = new List <string>(); } // Player shadow if (info.roleId == modulePlayer.id_) { assets.Add(CombatConfig.sdefaultSelfShadow); } // Player model var model = ConfigManager.Get <CreatureInfo>(info.roleProto); if (model) { assets.AddRange(model.models); } var w = WeaponInfo.GetWeapon(0, info.fashion.weapon); var ww = WeaponInfo.GetWeapon(0, info.fashion.gun); // Player weapons BuildWeaponPreloadAssets(info.roleProto, info.gender, w.weaponID, w.weaponItemId, ww.weaponID, ww.weaponItemId, assets); // Buff effects BuildBuffPreloadAssets(info.buffs, assets); // Equipments assets.AddRange(CharacterEquip.GetEquipAssets(info.fashion)); // Pet BuildPetPreloadAssets(assets, info.pet == null || info.pet.itemTypeId == 0 ? null : PetInfo.Create(info.pet)); return(assets); }
private void CreatEnemyCreature(PMatchInfo info, int index) { //创建敌人 var t = GetTransform(index); var pos = t.pos; var rot = t.rotation; var weaponInfo = ConfigManager.Get <PropItemInfo>(info.fashion.weapon); if (weaponInfo == null) { return; } if (m_LoadCoroutine != null) { Level.current.StopCoroutine(m_LoadCoroutine); m_LoadCoroutine = null; } if (m_petLoadCoroutine != null) { Level.current.StopCoroutine(m_petLoadCoroutine); m_petLoadCoroutine = null; } m_LoadCoroutine = Level.PrepareAssets(Module_Battle.BuildPlayerSimplePreloadAssets(info), r => { m_petLoadCoroutine = null; if (!r) { return; } m_enemy = moduleHome.CreatePlayer(info, pos, index == 0 ? CreatureDirection.FORWARD: CreatureDirection.BACK); m_enemy.uiName = Module_Home.TEAM_OBJECT_NAME; m_enemy.gameObject.name = Module_Home.TEAM_OBJECT_NAME; m_enemy.transform.localEulerAngles = rot; m_enemy.transform.localScale = Vector3.one * t.size; }); if (info.pet != null && info.pet.itemTypeId != 0) { var rPet = PetInfo.Create(info.pet); var assets = new List <string>(); m_petLoadCoroutine = Level.PrepareAssets(Module_Battle.BuildPetSimplePreloadAssets(rPet, assets, 2), b => { m_petLoadCoroutine = null; if (!b) { return; } 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); m_enemyPet = moduleHome.CreatePet(rGradeInfo, pos + data.pos, data.rotation, Level.current.startPos, true, Module_Home.TEAM_PET_OBJECT_NAME); m_enemyPet.transform.localScale *= data.size; m_enemyPet.transform.localEulerAngles = data.rotation; }); } }
public CreatureInfo BuildPlayerInfo(PMatchInfo 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 = matchInfo.attrInfo.ToCreatureInfo(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); } if (matchInfo.currentHp > 0) { info.health = matchInfo.currentHp; } info.elementType = matchInfo.elementType; info.weaponID = w.weaponID; info.offWeaponID = ww.weaponID; info.weaponItemID = matchInfo.fashion.weapon; info.offWeaponItemID = matchInfo.fashion.gun; info.bulletCount = matchInfo.bulletCount; info.energy = matchInfo.energy; info.maxEnergy = matchInfo.maxEnergy; info.awakeDuration = matchInfo.awakeDuration; matchInfo.awakeChangeAttr.CopyTo(ref info.awakeChangeAttr); if (playerBuff) { info.buffs = matchInfo.buffs.SimpleClone(); } else { info.buffs = null; } if (playerSkill && matchInfo.skills != null && matchInfo.skills.Length > 0) { PSkill[] skills = null; matchInfo.skills.CopyTo(ref skills); info.skills = skills; } else { info.skills = null; } return(info); }