internal void Create(UserInfo user) { Init(); if (null != user) { m_User = user; ObjectInfo.UnitId = m_User.GetUnitId(); ObjectInfo.CampId = m_User.GetCampId(); ObjectInfo.LinkId = m_User.GetLinkId(); MovementStateInfo msi = m_User.GetMovementStateInfo(); Vector3 pos = msi.GetPosition3D(); float dir = msi.GetFaceDir(); CreateActor(m_User.GetId(), m_User.GetModel(), pos, dir, m_User.Scale); user.ActorId = Actor; UpdateXSoulEquip(); InitAnimationSets(); ObjectInfo.IsPlayer = true; if (user.GetId() == WorldSystem.Instance.PlayerSelfId) { GfxSystem.MarkPlayerSelf(Actor); } } }
private UserInfo CreateArenaTarget(ArenaTargetInfo target) { if (target == null) { return(null); } int image_res_id = target.HeroId; UserInfo image_player = m_UserMgr.AddUser(image_res_id); if (null != image_player) { image_player.SceneContext = m_SceneContext; int campid = NetworkSystem.Instance.CampId == (int)CampIdEnum.Blue ? (int)CampIdEnum.Red : (int)CampIdEnum.Blue; image_player.SetCampId(campid); Data_Unit unit = m_CurScene.StaticData.ExtractData(DataMap_Type.DT_Unit, GlobalVariables.GetUnitIdByCampId(campid)) as Data_Unit; if (null != unit) { image_player.GetAiStateInfo().AiLogic = unit.m_AiLogic; image_player.SetAIEnable(true); image_player.GetMovementStateInfo().SetPosition(unit.m_Pos); image_player.GetMovementStateInfo().SetFaceDir(unit.m_RotAngle); } image_player.SetLevel(target.Level); image_player.SetNickName(target.Nickname); image_player.SkillController = new SwordManSkillController(image_player, GfxModule.Skill.GfxSkillSystem.Instance); if (null != m_SpatialSystem) { m_SpatialSystem.AddObj(image_player.SpaceObject); } /// skills if (null != target.Skills) { image_player.GetSkillStateInfo().RemoveAllSkill(); int skill_ct = target.Skills.Count; for (int i = 0; i < skill_ct; i++) { SkillInfo info = target.Skills[i]; if (null != info) { SkillCategory cur_skill_pos = SkillCategory.kNone; if (info.Postions.Presets[0] == SlotPosition.SP_A) { cur_skill_pos = SkillCategory.kSkillA; } else if (info.Postions.Presets[0] == SlotPosition.SP_B) { cur_skill_pos = SkillCategory.kSkillB; } else if (info.Postions.Presets[0] == SlotPosition.SP_C) { cur_skill_pos = SkillCategory.kSkillC; } else if (info.Postions.Presets[0] == SlotPosition.SP_D) { cur_skill_pos = SkillCategory.kSkillD; } info.Category = cur_skill_pos; image_player.GetSkillStateInfo().AddSkill(info); WorldSystem.Instance.AddSubSkill(image_player, info.SkillId, cur_skill_pos, info.SkillLevel); } } } Data_PlayerConfig playerData = PlayerConfigProvider.Instance.GetPlayerConfigById(image_player.GetLinkId()); if (null != playerData && null != playerData.m_FixedSkillList && playerData.m_FixedSkillList.Count > 0) { foreach (int skill_id in playerData.m_FixedSkillList) { SkillInfo info = new SkillInfo(skill_id, 1); image_player.GetSkillStateInfo().AddSkill(info); } } image_player.ResetSkill(); /// equips if (null != target.Equips) { int equip_ct = target.Equips.Length; for (int i = 0; i < equip_ct; i++) { ItemDataInfo image_equip = target.Equips[i]; if (null != image_equip) { image_player.GetEquipmentStateInfo().ResetEquipmentData(i); image_equip.ItemConfig = ItemConfigProvider.Instance.GetDataById(image_equip.ItemId); if (null != image_equip.ItemConfig) { image_player.GetEquipmentStateInfo().SetEquipmentData(i, image_equip); } } } } /// if (null != target.Legacys) { int legacy_ct = target.Legacys.Length; for (int i = 0; i < legacy_ct; i++) { ItemDataInfo image_legacy = target.Legacys[i]; if (null != image_legacy && image_legacy.IsUnlock) { image_player.GetLegacyStateInfo().ResetLegacyData(i); image_legacy.ItemConfig = ItemConfigProvider.Instance.GetDataById(image_legacy.ItemId); if (null != image_legacy.ItemConfig) { image_player.GetLegacyStateInfo().SetLegacyData(i, image_legacy); } } } image_player.GetLegacyStateInfo().UpdateLegacyComplexAttr(); } foreach (ArenaXSoulInfo x in target.XSoulInfo) { ItemDataInfo item = new ItemDataInfo(); item.ItemId = x.ItemId; item.Level = x.Level; item.Experience = x.Experience; item.UpdateLevelByExperience(); ItemConfig config = ItemConfigProvider.Instance.GetDataById(item.ItemId); if (config == null) { continue; } item.ItemConfig = config; XSoulPartInfo part = new XSoulPartInfo((XSoulPart)config.m_WearParts, item); part.ShowModelLevel = x.ModelLevel; image_player.GetXSoulInfo().SetXSoulPartData((XSoulPart)config.m_WearParts, part); } image_player.SetPartnerInfo(target.ActivePartner); SetArenaCharacterCoefficient(image_player); UserAttrCalculator.Calc(image_player); image_player.SetHp(Operate_Type.OT_Absolute, image_player.GetActualProperty().HpMax); image_player.SetRage(Operate_Type.OT_Absolute, 0); image_player.SetEnergy(Operate_Type.OT_Absolute, image_player.GetActualProperty().EnergyMax); target.CreatedPartners.Clear(); int total_hp = image_player.GetActualProperty().HpMax; //LogSystem.Error("---challenge target hp=" + image_player.GetActualProperty().HpMax); foreach (PartnerInfo partner in target.FightPartners) { NpcInfo partner_npc = CreateParterner(image_player, partner); if (partner_npc != null) { target.CreatedPartners.Add(partner.Id, partner_npc); //LogSystem.Error("---parnter {0} hp={1}", partner.Id, partner_npc.GetBaseProperty().HpMax); total_hp += partner_npc.GetBaseProperty().HpMax; } } //LogSystem.Error("-----challenge target total hp=" + total_hp); EntityManager.Instance.CreateUserView(image_player.GetId()); UserView image_view = EntityManager.Instance.GetUserViewById(image_player.GetId()); image_view.UpdateEquipment(); image_view.UpdateXSoulEquip(); } SyncGfxUserInfo(image_player.GetId()); return(image_player); }