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> /// 获取实体血条 /// </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); }
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); }