/// <summary> /// 是宠物或者召唤物 /// </summary> /// <param name="en"></param> /// <returns></returns> public static bool IsPetAndSummon(IEntity en) { IControllerSystem cs = EntitySystem.m_ClientGlobal.GetControllerSystem(); if (cs == null) { return(false); } //IControllerHelper ch = cs.GetControllerHelper(); //if ( ch == null ) //{ // return false; //} //if ( ch.NpcIsPet( en ) ) //{ // return true; //} INPC npc = en as INPC; if (npc != null) { if (npc.IsPet()) { return(true); } if (npc.IsSummon()) { return(true); } } return(false); }
public ColorType GetNpcNameColor(IEntity entity) { ColorType nameColor = ColorType.JSXT_NpcCheFu; INPC npc = entity as INPC; if (npc.IsCanAttackNPC()) { if (npc.IsMercenary()) { nameColor = ColorType.JSXT_Enemy_White; } else { if (npc.IsPet()) { nameColor = ColorType.JSXT_ZhanHun; } else if (npc.IsSummon()) { nameColor = ColorType.JSXT_ZhaoHuanWu; } else { int level = MainPlayerHelper.GetPlayerLevel(); int monsterLv = entity.GetProp((int)CreatureProp.Level); int levelGap = GameTableManager.Instance.GetGlobalConfig <int>("MonsterWarningLevelGap"); if (level + levelGap < monsterLv) { nameColor = ColorType.JSXT_Enemy_Red; } else { nameColor = ColorType.JSXT_Enemy_White; } } } } else { table.NpcDataBase npcdb = GameTableManager.Instance.GetTableItem <table.NpcDataBase>((uint)entity.GetProp((int)Client.EntityProp.BaseID)); if (npcdb != null) { if (npcdb.dwType == (int)GameCmd.enumNpcType.NPC_TYPE_COLLECT_PLANT) { nameColor = ColorType.JSXT_CaiJiWu; } else if (npcdb.dwType == (int)GameCmd.enumNpcType.NPC_TYPE_TRANSFER || npcdb.dwType == (int)GameCmd.enumNpcType.NPC_TYPE_FUNCTION) { nameColor = ColorType.JSXT_ChuanSongZhen; } else { nameColor = ColorType.White; } } } return(nameColor); }
/// <summary> /// 通过玩家id获取所属召唤物 /// </summary> /// <param name="playerID"></param> /// <returns></returns> public INPC GetOwnSummonByPlayerID(uint playerID) { List <INPC> npcList = new List <INPC>(); GetOwnNpcByPlayerID(playerID, ref npcList); for (int i = 0; i < npcList.Count; i++) { INPC npc = npcList[i]; if (npc.IsSummon()) { return(npc); } } npcList.Clear(); return(null); }
bool IsHideFx() { if (IsMainPlayer()) { return(false); } IEntity en = m_Master; if (en != null) { INPC npc = en as INPC; if (npc != null) { if (npc.IsPet() || npc.IsSummon()) { if (npc.IsMainPlayerSlave()) { return(false); } else { return(m_bHideOtherFx || m_bHideOtherPlayer); } } else { return(false); } } else { //player return(m_bHideOtherFx || m_bHideOtherPlayer); } } return(false); }
/// <summary> /// 获取实体血条 /// </summary> /// <param name="entity"></param> /// <returns></returns> public static EntityHpSprite GetEntityHpSpData(IEntity entity) { EntityHpSprite spriteParams = new EntityHpSprite(); spriteParams.spriteType = UISprite.Type.Filled; if (entity.GetEntityType() == EntityType.EntityType_Player) { GameCmd.eCamp mycamp = (GameCmd.eCamp)MainPlayerHelper.GetMainPlayer().GetProp((int)CreatureProp.Camp); GameCmd.eCamp camp = (GameCmd.eCamp)entity.GetProp((int)CreatureProp.Camp); spriteParams.bgSpriteName = GetHpSpriteName(HpSpriteType.PlayerBg); if (entity == MainPlayerHelper.GetMainPlayer()) { spriteParams.spriteName = GetHpSpriteName(HpSpriteType.Me); } else { if (EntityCanAttack(entity)) { spriteParams.spriteName = GetHpSpriteName(HpSpriteType.Enemy); } else { spriteParams.spriteName = GetHpSpriteName(HpSpriteType.Friend); } } spriteParams.bShow = true; } else if (entity.GetEntityType() == EntityType.EntityType_NPC) { INPC npc = entity as INPC; //任意NPC先给一个默认的血条 spriteParams.bgSpriteName = GetHpSpriteName(HpSpriteType.NoneBg); spriteParams.spriteName = GetHpSpriteName(HpSpriteType.None); spriteParams.bShow = IsNeedHpSlider(entity); if (npc.WhetherShowHeadTips()) { //是可以攻击的NPC if (npc.IsCanAttackNPC()) { //是不是佣兵 if (npc.IsMercenary()) { spriteParams.spriteName = GetHpSpriteName(HpSpriteType.Friend); spriteParams.bgSpriteName = GetHpSpriteName(HpSpriteType.PlayerBg); spriteParams.bShow = true; } else { if (npc.IsPet()) { spriteParams.bgSpriteName = GetHpSpriteName(HpSpriteType.PetBg); if (npc.IsMainPlayerSlave()) { spriteParams.spriteName = GetHpSpriteName(HpSpriteType.MyPet); } else { if (EntityCanAttack(entity)) { spriteParams.spriteName = GetHpSpriteName(HpSpriteType.EnemyPet); } } } else if (npc.IsSummon()) { spriteParams.bgSpriteName = GetHpSpriteName(HpSpriteType.SummonBg); if (npc.IsMainPlayerSlave()) { spriteParams.spriteName = GetHpSpriteName(HpSpriteType.MySummon); } else { if (EntityCanAttack(entity)) { spriteParams.spriteName = GetHpSpriteName(HpSpriteType.EnemySummon); } } } else if (npc.IsMonster()) { spriteParams.bgSpriteName = GetHpSpriteName(HpSpriteType.MonsterBg); spriteParams.spriteName = GetHpSpriteName(HpSpriteType.Monster); spriteParams.spriteType = UISprite.Type.Simple; } } } } else { spriteParams.bShow = false; } } else if (entity.GetEntityType() == EntityType.EntityTYpe_Robot) { GameCmd.eCamp mycamp = (GameCmd.eCamp)MainPlayerHelper.GetMainPlayer().GetProp((int)CreatureProp.Camp); GameCmd.eCamp camp = (GameCmd.eCamp)entity.GetProp((int)CreatureProp.Camp); spriteParams.bgSpriteName = GetHpSpriteName(HpSpriteType.PlayerBg); if (entity == MainPlayerHelper.GetMainPlayer()) { spriteParams.spriteName = GetHpSpriteName(HpSpriteType.Me); } else { if (EntityCanAttack(entity)) { spriteParams.spriteName = GetHpSpriteName(HpSpriteType.Enemy); } else { spriteParams.spriteName = GetHpSpriteName(HpSpriteType.Friend); } } spriteParams.bShow = true; } return(spriteParams); }
public static bool IsNeedHpSlider(Client.IEntity entity) { if (entity.GetEntityType() == EntityType.EntityType_NPC) { INPC npc = entity as INPC; //是可以攻击的NPC if (npc.IsCanAttackNPC()) { Client.ISkillPart skillPart = MainPlayerHelper.GetMainPlayer().GetPart(EntityPart.Skill) as Client.ISkillPart; bool canAttack = true; if (skillPart != null) { int skillerror = 0; canAttack = skillPart.CheckCanAttackTarget(entity, out skillerror); } if (npc.IsPet()) { if (npc.IsMainPlayerSlave()) { return(true); } else { if (canAttack) { return(true); } } return(false); } else if (npc.IsSummon()) { if (npc.IsMainPlayerSlave()) { return(true); } else { if (canAttack) { return(true); } } return(false); } else if (npc.IsMonster()) { int hp = entity.GetProp((int)CreatureProp.Hp); int maxhp = entity.GetProp((int)CreatureProp.MaxHp); return(hp < maxhp); } } else { table.NpcDataBase npcdb = GameTableManager.Instance.GetTableItem <table.NpcDataBase>((uint)entity.GetProp((int)Client.EntityProp.BaseID)); if (npcdb != null) { if (npcdb.dwType == (int)GameCmd.enumNpcType.NPC_TYPE_TRANSFER || npcdb.dwType == (int)GameCmd.enumNpcType.NPC_TYPE_COLLECT_PLANT || npcdb.dwType == (int)GameCmd.enumNpcType.NPC_TYPE_FUNCTION) { return(false); } } } } return(true); }
//StringBuilder targetName = new StringBuilder(20); private void OnTargetChange(object param) { stTargetChange tc = (stTargetChange)param; if (tc.target == null) { m_trans_target.gameObject.SetActive(false); } else { IEntity entity = tc.target; string name = entity.GetName(); string lvstr = entity.GetProp((int)CreatureProp.Level).ToString(); m_label_MonsterLevel_Label.text = lvstr; bool showPackeage = false; if (entity.GetEntityType() == EntityType.EntityType_NPC) { INPC npc = entity as INPC; showPackeage = npc.IsBoss(); NpcDataBase ndb = GameTableManager.Instance.GetTableItem <NpcDataBase>((uint)npc.GetProp((int)EntityProp.BaseID)); if (ndb != null) { if (ndb.dwMonsterType == 1) { InitTargetUIInMonster(); m_widget_player.gameObject.SetActive(false); m_widget_monster.gameObject.SetActive(true); m_lableTargetLevel.text = entity.GetProp((int)CreatureProp.Level).ToString(); } else { InitTargetUI(); string iconName = UIManager.GetIconName(ndb.npcIcon, npc.IsPet()); UIManager.GetTextureAsyn(iconName, ref m_curTargetIconAsynSeed, () => { if (null != m_spriteTargetIcon) { m_spriteTargetIcon.mainTexture = null; } }, m_spriteTargetIcon, false); m_widget_player.gameObject.SetActive(true); m_widget_monster.gameObject.SetActive(false); } } if (npc.IsMonster() == false) { bool bVisit = true; if (npc.IsSummon() || npc.IsPet()) { bVisit = false; } CopyTypeTable ct = DataManager.Manager <ComBatCopyDataManager>().GetCurCopyType(); if (ct != CopyTypeTable.Arena) { if (bVisit) { Client.ClientGlobal.Instance().GetControllerSystem().GetActiveCtrl().VisiteNPC(npc.GetUID()); } } } else { //请 if (m_nLastNpcId != entity.GetUID()) { BShowEnemyList = false; m_transHateList.gameObject.SetActive(false); } } m_nLastNpcId = entity.GetUID(); if (m_nLastNpcId != 0) { stRefreshNPCBelongParam npcbelongdata = NpcAscription.Instance.GetNpcBelongByNpcID(m_nLastNpcId); UpdateTargetStatus(npcbelongdata.npcid, npcbelongdata.teamid, npcbelongdata.ownerid, npcbelongdata.clanid, npcbelongdata.ownerName); } } else { InitTargetUI(); m_widget_player.gameObject.SetActive(true); m_widget_monster.gameObject.SetActive(false); IPlayer player = entity as IPlayer; if (player != null) { int job = player.GetProp((int)PlayerProp.Job); int sex = player.GetProp((int)PlayerProp.Sex); SelectRoleDataBase sdb = table.SelectRoleDataBase.Where((GameCmd.enumProfession)job, (GameCmd.enmCharSex)sex); if (sdb != null) { UIManager.GetTextureAsyn(sdb.strprofessionIcon, ref m_curTargetIconAsynSeed, () => { if (null != m_spriteTargetIcon) { m_spriteTargetIcon.mainTexture = null; } }, m_spriteTargetIcon, false); } m_transHateList.gameObject.SetActive(false); //目标选择 OnSetSelectTargetGrid(player.GetID()); } } m_toggle_packageState.gameObject.SetActive(showPackeage); m_lableTargetName.text = name; //m_lableTargetLevel.text = entity.GetProp((int)CreatureProp.Level).ToString(); UpdateTargetHp(entity); BuffManager.TargetBuffList.Clear(); if (entity != null) { List <Client.stAddBuff> lstBuff; IBuffPart part = entity.GetPart(EntityPart.Buff) as IBuffPart; if (part != null) { part.GetBuffList(out lstBuff); for (int i = 0; i < lstBuff.Count; ++i) { stAddBuff buff = lstBuff[i]; table.BuffDataBase db = GameTableManager.Instance.GetTableItem <table.BuffDataBase>(buff.buffid); if (db != null) { if (db.dwShield == 1) {//不显示的直接跳过 continue; } } BuffManager.TargetBuffList.Add(lstBuff[i]); } } else { Engine.Utility.Log.Error("获取{0}Buff部件失败!", entity.GetName()); } } m_trans_target.gameObject.SetActive(true); RefreshBuffIcon(m_trans_TargetBUffContainer, BuffManager.TargetBuffList); } }
EntityHpSprite GetSpiteName(IEntity entity) { EntityHpSprite spriteParams = new EntityHpSprite(); spriteParams.spriteType = UISprite.Type.Filled; bool needHp = RoleStateBarManagerOld.Instance().IsNeedHpSlider(entity); Client.ISkillPart skillPart = MainPlayerHelper.GetMainPlayer().GetPart(EntityPart.Skill) as Client.ISkillPart; bool canAttack = true; if (skillPart != null) { int skillerror = 0; canAttack = skillPart.CheckCanAttackTarget(entity, out skillerror); } if (entity.GetEntityType() == EntityType.EntityType_Player) { GameCmd.eCamp mycamp = (GameCmd.eCamp)MainPlayerHelper.GetMainPlayer().GetProp((int)CreatureProp.Camp); GameCmd.eCamp camp = (GameCmd.eCamp)entity.GetProp((int)CreatureProp.Camp); spriteParams.bgSpriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.PlayerBg); if (entity == MainPlayerHelper.GetMainPlayer()) { spriteParams.spriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.Me); } else { if (canAttack) { spriteParams.spriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.Enemy); } else { spriteParams.spriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.Friend); } } spriteParams.bShow = true; } else if (entity.GetEntityType() == EntityType.EntityType_NPC) { INPC npc = entity as INPC; //任意NPC先给一个默认的血条 spriteParams.bgSpriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.NoneBg); spriteParams.spriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.None); spriteParams.bShow = needHp; //是可以攻击的NPC if (npc.IsCanAttackNPC()) { //是不是佣兵 if (npc.IsMercenary()) { spriteParams.spriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.Friend); spriteParams.bgSpriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.PlayerBg); spriteParams.bShow = true; } else { if (npc.IsPet()) { spriteParams.bgSpriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.PetBg); if (npc.IsMainPlayerSlave()) { spriteParams.spriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.MyPet); } else { if (canAttack) { spriteParams.spriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.EnemyPet); } } } else if (npc.IsSummon()) { spriteParams.bgSpriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.SummonBg); if (npc.IsMainPlayerSlave()) { spriteParams.spriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.MySummon); } else { if (canAttack) { spriteParams.spriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.EnemySummon); } } } else if (npc.IsMonster()) { spriteParams.bgSpriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.MonsterBg); spriteParams.spriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.Monster); spriteParams.spriteType = UISprite.Type.Simple; } } } } else if (entity.GetEntityType() == EntityType.EntityTYpe_Robot) { GameCmd.eCamp mycamp = (GameCmd.eCamp)MainPlayerHelper.GetMainPlayer().GetProp((int)CreatureProp.Camp); GameCmd.eCamp camp = (GameCmd.eCamp)entity.GetProp((int)CreatureProp.Camp); spriteParams.bgSpriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.PlayerBg); if (entity == MainPlayerHelper.GetMainPlayer()) { spriteParams.spriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.Me); } else { if (canAttack) { spriteParams.spriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.Enemy); } else { spriteParams.spriteName = RoleStateBarManager.GetHpSpriteName(HpSpriteType.Friend); } } spriteParams.bShow = true; } return(spriteParams); }