public void Execute(GameCmd.stAddMapNpcAndPosMapScreenUserCmd_S cmd) { //AddNPC(cmd.data); Profiler.BeginSample("stAddMapNpcAndPosMapScreenUserCmd_S"); EntityCreator.Instance().AddNPC(cmd.data, cmd.master_id); IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return; } uint userUID = ClientGlobal.Instance().MainPlayer.GetID(); if (userUID == cmd.master_id && cmd.pet_id != 0) { DataManager.Manager <PetDataManager>().AddPetToNpc(cmd.pet_id, cmd.data.mapnpcdata.npcdata.dwTempID); } GameCmd.stNpcBelongListMapScreenUserCmd_S belongcmd = new GameCmd.stNpcBelongListMapScreenUserCmd_S(); belongcmd.teamid = cmd.data.mapnpcdata.npcdata.owernteamid; belongcmd.userid = cmd.master_id; belongcmd.npcid = cmd.data.mapnpcdata.npcdata.dwTempID; Execute(belongcmd); RoleStateBarManager.RefreshAllRoleBarHeadStatus(HeadStatusType.Hp); Profiler.EndSample(); }
public void Execute(stSetPKModePropertyUserCmd_CS cmd) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return; } IEntity en = es.FindPlayer(cmd.userid); if (en != null) { en.SetProp((int)PlayerProp.PkMode, (int)cmd.pkmode); stPropUpdate prop = new stPropUpdate(); prop.uid = en.GetUID(); prop.nPropIndex = (int)PlayerProp.PkMode; prop.oldValue = en.GetProp((int)PlayerProp.PkMode); prop.newValue = (int)cmd.pkmode; Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_PROPUPDATE, prop); //切换模式后刷新一下场景内的的血条 RoleStateBarManager.RefreshAllRoleBarHeadStatus(HeadStatusType.Hp); } else { Engine.Utility.Log.Error("找不到player :{0}", cmd.userid); } }
/// <summary> /// 实体创建 /// </summary> /// <param name="ce"></param> private void OnCretateEntity(Client.stCreateEntity ce) { IEntity entity = RoleStateBarManager.GetEntity(ce.uid); if (entity == null) { Engine.Utility.Log.Error("找不到对象------------{0}", ce.uid); return; } if (entity.GetEntityType() == EntityType.EntityType_Pet) { return; } if (entity.GetEntityType() == EntityType.EntityType_NPC) { table.NpcDataBase npctable = GameTableManager.Instance.GetTableItem <table.NpcDataBase>((uint)entity.GetProp((int)Client.EntityProp.BaseID)); if (npctable != null) { if (npctable.dwType == (uint)GameCmd.enumNpcType.NPC_TYPE_TRAP) { return; } } } AddRoleBar(entity); }
/// <summary> /// 刷新头顶所有状态 /// </summary> /// <param name="status"></param> private void RefreshAllHeadStatus(HeadStatusType status) { IEntity entity = null; long uid = 0; var enumerator = m_dicActiveRoleStateBar.GetEnumerator(); while (enumerator.MoveNext()) { if (null == enumerator.Current.Value) { continue; } entity = RoleStateBarManager.GetEntity(enumerator.Current.Key); if (null == entity) { continue; } switch (status) { case HeadStatusType.Hp: break; case HeadStatusType.Name: break; case HeadStatusType.Clan: { if (entity.GetEntityType() != EntityType.EntityType_Player && entity.GetEntityType() != EntityType.EntityType_NPC) { continue; } } break; case HeadStatusType.Title: { if (entity.GetEntityType() != EntityType.EntityType_Player) { continue; } } break; case HeadStatusType.Collect: break; case HeadStatusType.HeadMaskIcon: case HeadStatusType.TaskStatus: { if (entity.GetEntityType() != EntityType.EntityType_NPC) { continue; } } break; } enumerator.Current.Value.UpdateHeadStatus(status); } }
/// <summary> /// 添加或者刷新血条 /// </summary> /// <param name="entity"></param> /// <param name="refresh">是否刷新已有的血条</param> void AddBar(IEntity entity) { if (entity == null) { return; } List <HeadTipData> lstdata = new List <HeadTipData>(); lstdata.Add(new HeadTipData(entity, HeadTipType.Name, GetNameVisible(entity))); EntityType entityType = entity.GetEntityType(); if (entityType != EntityType.EntityType_Box) { bool addHpSlider = IsNeedHpSlider(entity); if (addHpSlider) { bool visible = true; IPlayer player = ClientGlobal.Instance().MainPlayer; if (player == null) { return; } if (entity.GetUID() == player.GetUID()) { visible = true; } else { visible = m_bHpSliderVisible; } lstdata.Add(new HeadTipData(entity, HeadTipType.Hp, visible)); } else { lstdata.Add(new HeadTipData(entity, HeadTipType.Hp, addHpSlider)); } //称号 int titleId = entity.GetProp((int)PlayerProp.TitleId); if (titleId != 0) { lstdata.Add(new HeadTipData(entity, HeadTipType.Title, m_bPlayerTitleVisible)); } } //添加头顶NPC icon if (RoleStateBarManager.IsEntityHaveHeadIconMask(entity) && !NpcHeadTipsManager.Instance.IsHaveTips((Client.INPC)entity)) { lstdata.Add(new HeadTipData(entity, HeadTipType.HeadMaskIcon, m_bHpSliderVisible)); } RoleStateBar bar = this.CreateHeadText(entity, lstdata); if (bar != null) { //clan Name RefreshClanName(entity, bar); } }
/// 添加实体头顶标识 /// </summary> /// <param name="uid"></param> private UIRoleStateBar AddRoleBar(long uid) { IEntity entity = RoleStateBarManager.GetEntity(uid); if (null == entity) { Engine.Utility.Log.Error("RoleStateBarPanel GetEntity Failed UID = " + uid); return(null); } return(AddRoleBar(entity)); }
/// <summary> /// 刷新npc任务状态表示 /// </summary> /// <param name="taskId"></param> private void OnUpdateNpcTaskStatus(uint taskId, Client.GameEventID eventID) { long uid = 0; string icon = ""; bool enable = false; switch (eventID) { case GameEventID.TASK_ACCEPT: case GameEventID.TASK_CANACCEPT: case GameEventID.TASK_DONING: case GameEventID.TASK_CANSUBMIT: { enable = RoleStateBarManager.TryGetQuestStatusIcon(taskId, out uid, out icon); if (eventID == GameEventID.TASK_ACCEPT) { table.QuestDataBase questDB = GameTableManager.Instance.GetTableItem <table.QuestDataBase>(taskId); if (questDB != null && questDB.dwBeginNpc != questDB.dwEndNpc) { //交接任务不在同一个npc移除任务标示 Client.INPC npc = RoleStateBarManager.GetNPCByBaseID(questDB.dwBeginNpc); if (null != npc) { UpdateNpcTaskStatus(npc.GetUID(), false); } } } } break; case GameEventID.TASK_DELETE: case GameEventID.TASK_DONE: { table.QuestDataBase questDB = GameTableManager.Instance.GetTableItem <table.QuestDataBase>(taskId); if (questDB == null) { return; } Client.INPC npc = RoleStateBarManager.GetNPCByBaseID(questDB.dwEndNpc); if (null != npc) { uid = npc.GetUID(); } } break; } if (uid != 0) { UpdateNpcTaskStatus(uid, enable, icon); } }
public void SetTalkingBossID(uint bossID) { IEntity en = RoleStateBarManager.GetEntityByUserID <INPC>(bossID); if (en != null) { m_uTalkingBossID = (uint)en.GetProp((int)EntityProp.BaseID); } else { m_uTalkingBossID = 0; } if (m_uTalkingBossID != 0) { table.BossTalkDataBase db = GameTableManager.Instance.GetTableItem <table.BossTalkDataBase>((uint)m_uTalkingBossID); if (db != null) { table.LangTextDataBase ldb = GameTableManager.Instance.GetTableItem <table.LangTextDataBase>(db.textID); if (ldb != null) { if (!string.IsNullOrEmpty(ldb.talkVoice)) { List <uint> idList = StringUtil.GetSplitStringList <uint>(ldb.talkVoice); if (idList != null && idList.Count > 0) { uint audioID = idList[0]; if (audioID != 0) { DataManager.Manager <PetDataManager>().PlayCreateAudio(audioID); } } } } if (TimerAxis.Instance().IsExist(m_uBossTalkTimerID, this)) { TimerAxis.Instance().KillTimer(m_uBossTalkTimerID, this); } TimerAxis.Instance().SetTimer(m_uBossTalkTimerID, db.aliveTime * 1000, this, 1); TimerAxis.Instance().SetTimer(m_uRefreshStatusTimerID, 1000, this, 1); } } RefreshAllRoleBarHeadStatus(HeadStatusType.BossSay); }
/// <summary> /// 更新位置 /// </summary> public void UpdatePositon() { if (!Visible) { return; } if (UID == 0) { return; } Client.IEntity entity = RoleStateBarManager.GetEntity(UID); if (entity == null) { return; } RoleStateBarManager mgr = DataManager.Manager <RoleStateBarManager>(); Vector3 pos = Vector3.zero; if (entity.GetEntityType() == EntityType.EntityType_Player) { bool bRide = (bool)entity.SendMessage(Client.EntityMessage.EntityCommond_IsRide, null); if (bRide) { pos = mgr.GetNodeWorldPos(UID, "MountName", offsetY); } else { pos = mgr.GetNodeWorldPos(UID, "Name", offsetY); } } else { pos = mgr.GetNodeWorldPos(UID, "Name", offsetY); } Camera mainCamera = Util.MainCameraObj.GetComponent <Camera>(); Camera uiCamera = Util.UICameraObj.GetComponent <Camera>(); if (null == uiCamera || null == mainCamera) { return; } pos = mainCamera.WorldToViewportPoint(pos); //bool isVisible = (mainCamera.orthographic || pos.z > 0f) && (/*!disableIfInvisible || */(pos.x > 0f && pos.x < 1f && pos.y > 0f && pos.y < 1f)); //if (Visible != isVisible) //{ // SetVisible(isVisible); // if (Visible) // { // AdjustStatusPos(); // } //} pos = uiCamera.ViewportToWorldPoint(pos); m_tsTran.position = pos; pos = m_tsTran.localPosition; pos.x = Mathf.FloorToInt(pos.x); pos.y = Mathf.FloorToInt(pos.y); pos.z = 0f; m_tsTran.localPosition = pos; }
/// <summary> /// 事件处理 /// </summary> /// <param name="nEventID"></param> /// <param name="param"></param> public void GlobalEventHandler(int eventID, object param) { switch (eventID) { case (int)Client.GameEventID.ENTITYSYSTEM_CHANGE: { if (null != param && param is Client.stPlayerChange) { Client.stPlayerChange change = (Client.stPlayerChange)param; IEntity entity = RoleStateBarManager.GetEntityByUserID <IPlayer>(change.uid); if (null == entity) { entity = RoleStateBarManager.GetEntityByUserID <INPC>(change.uid); } if (null != entity) { LateUpdateChangePos(entity.GetUID()); } } } break; case (int)Client.GameEventID.ENTITYSYSTEM_UNRIDE: { if (null != param && param is stEntityUnRide) { stEntityUnRide unride = (stEntityUnRide)param; LateUpdateChangePos(unride.uid); } } break; case (int)Client.GameEventID.ENTITYSYSTEM_RIDE: { if (null != param && param is stEntityRide) { stEntityRide ride = (stEntityRide)param; LateUpdateChangePos(ride.uid); } } break; case (int)Client.GameEventID.ENTITYSYSTEM_ENTITYBEGINMOVE: { if (null != param && param is stEntityBeginMove) { stEntityBeginMove move = (stEntityBeginMove)param; OnEntityMoving(move.uid); } } break; case (int)Client.GameEventID.ENTITYSYSTEM_ENTITYMOVE: { if (null != param && param is stEntityMove) { stEntityMove move = (stEntityMove)param; OnEntityMoving(move.uid); } } break; case (int)Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE: { if (null != param && param is stEntityStopMove) { stEntityStopMove move = (stEntityStopMove)param; OnEntityMoving(move.uid); } } break; case (int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY: { //实体创建 Client.stCreateEntity ce = (Client.stCreateEntity)param; OnCretateEntity(ce); } break; case (int)Client.GameEventID.ENTITYSYSTEM_REMOVEENTITY: { //实体删除 Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param; RemoveRoleBar(removeEntiy.uid); } break; case (int)Client.GameEventID.ENTITYSYSTEM_PROPUPDATE: { //实体属性变更 stPropUpdate prop = (stPropUpdate)param; OnPropUpdate(ref prop); } break; case (int)Client.GameEventID.ENTITYSYSTEM_HPUPDATE: { //实体属性变更 stPropUpdate prop = (stPropUpdate)param; OnPropUpdate(ref prop); } break; case (int)Client.GameEventID.ENTITYSYSTEM_CHANGENAME: { //实体名称改变 stEntityChangename e = (stEntityChangename)param; UpdateHeadStaus(e.uid, HeadStatusType.Name); } break; case (int)Client.GameEventID.ENTITYSYSTEM_SETHIDE: { //实体名称改变 stEntityHide st = (stEntityHide)param; //UpdateHeadStaus(e.uid, HeadStatusType.Name); OnSetEntityHide(ref st); } break; case (int)Client.GameEventID.TITLE_WEAR: { Client.stTitleWear data = (Client.stTitleWear)param; IPlayer player = RoleStateBarManager.GetEntityByUserID <IPlayer>(data.uid); if (null != player) { //佩戴称号 UpdateHeadStaus(player.GetUID(), HeadStatusType.Title); } } break; case (int)Client.GameEventID.SKILLGUIDE_PROGRESSSTART: { //引导技能开始 } break; case (int)Client.GameEventID.SKILLGUIDE_PROGRESSBREAK: { //引导技能中断 } break; case (int)Client.GameEventID.SKILLGUIDE_PROGRESSEND: { //引导技能结束 } break; case (int)Client.GameEventID.CLANQUIT: case (int)Client.GameEventID.CLANJOIN: case (int)Client.GameEventID.CLANREFRESHID: case (int)Client.GameEventID.CITYWARWINERCLANID: case (int)Client.GameEventID.CLANDeclareInfoAdd: case (int)Client.GameEventID.CLANDeclareInfoRemove: { //氏族状态改变 OnRefreshAllClan(); } break; case (int)Client.GameEventID.CITYWARTOTEMCLANNAMECHANGE: { long uid = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_NPC, (uint)param); UpdateHeadStaus(uid, HeadStatusType.Clan); } break; case (int)Client.GameEventID.SYSTEM_GAME_READY: { OnRefresAllHp(); } break; case (int)Client.GameEventID.CAMERA_MOVE_END: { UpdateAllPos(); } break; case (int)Client.GameEventID.RFRESHENTITYHEADSTATUS: { HeadStatusType status = (HeadStatusType)param; RefreshAllHeadStatus(status); } break; //npc头顶任务状态 case (int)Client.GameEventID.TASK_ACCEPT: { uint taskId = (uint)param; OnUpdateNpcTaskStatus(taskId, Client.GameEventID.TASK_ACCEPT); } break; case (int)Client.GameEventID.TASK_DELETE: { uint taskId = (uint)param; OnUpdateNpcTaskStatus(taskId, Client.GameEventID.TASK_DELETE); } break; case (int)Client.GameEventID.TASK_DONE: { Client.stTaskDone td = (Client.stTaskDone)param; OnUpdateNpcTaskStatus(td.taskid, Client.GameEventID.TASK_DONE); } break; case (int)Client.GameEventID.TASK_CANSUBMIT: { Client.stTaskCanSubmit tcs = (Client.stTaskCanSubmit)param; OnUpdateNpcTaskStatus(tcs.taskid, Client.GameEventID.TASK_CANSUBMIT); } break; case (int)Client.GameEventID.TASK_CANACCEPT: { uint taskId = (uint)param; OnUpdateNpcTaskStatus(taskId, Client.GameEventID.TASK_CANACCEPT); } break; } }
public void InitInfo(Client.NPCInfo info) { if (null == m_spMaskIcon) { m_spMaskIcon = transform.Find("MaskIcon").GetComponent <UISprite>(); } m_type = (MapScrollItemType)info.type; npcInfo = info; if (info != null) { Transform labelTrans = transform.Find("Label"); bool visible = RoleStateBarManager.IsEntityHaveHeadIconMask((uint)info.npcID); if (null != m_spMaskIcon) { if (m_spMaskIcon.gameObject.activeSelf != visible) { m_spMaskIcon.gameObject.SetActive(visible); } if (visible) { table.NpcHeadMaskDataBase maskDb = RoleStateBarManager.GetNPCHeadMaskDB((uint)info.npcID); if (null != maskDb) { UIManager.GetAtlasAsyn(maskDb.miniMapMaskIcon, ref m_curIconAsynSeed, () => { if (null != m_spMaskIcon) { m_spMaskIcon.atlas = null; } }, m_spMaskIcon, false); } } } if (labelTrans != null) { UILabel label = labelTrans.GetComponent <UILabel>(); if (label != null) { string showText = npcInfo.name; if (npcInfo.pos.x != 0 || npcInfo.pos.y != 0) { string levelStr = string.Empty; table.NpcDataBase ndb = GameTableManager.Instance.GetTableItem <table.NpcDataBase>((uint)npcInfo.npcID); if (ndb != null) { if (ndb.dwType == (int)GameCmd.enumNpcType.NPC_TYPE_NONE) { if (ndb.dwMonsterType != 0) { levelStr = ndb.dwLevel + "级 "; } } } showText = levelStr + npcInfo.name + "(" + npcInfo.pos.x.ToString() + "," + npcInfo.pos.y.ToString() + ")"; } label.text = showText; } } } }
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); }
/// <summary> /// 是否实体顶部栏可用 /// </summary> /// <param name="entity"></param> /// <param name="statusType"></param> /// <returns></returns> public static bool IsEntityHeadStatusTypeEnable(IEntity entity, HeadStatusType statusType) { bool enable = false; if (null != entity) { switch (statusType) { case HeadStatusType.Hp: { EntityHpSprite hpSp = RoleStateBarManager.GetEntityHpSpData(entity); if (hpSp != null) { enable = hpSp.bShow; } } break; case HeadStatusType.Name: { enable = PlayerNameEnable; if (entity.GetEntityType() == EntityType.EntityType_NPC) { INPC npc = entity as INPC; enable = npc.WhetherShowHeadTips(); } } break; case HeadStatusType.Clan: { uint clanIdLow = (uint)entity.GetProp((int)CreatureProp.ClanIdLow); uint clanIdHigh = (uint)entity.GetProp((int)CreatureProp.ClanIdHigh); uint clanid = (clanIdHigh << 16) | clanIdLow; enable = ClanNameEnable && (clanid != 0); //enable = ClanNameEnable && ((uint)entity.GetProp((int)CreatureProp.ClanId) != 0); } break; case HeadStatusType.Title: { enable = PlayerTitleEnable && (entity.GetEntityType() == EntityType.EntityType_Player && (uint)entity.GetProp((int)PlayerProp.TitleId) != 0); } break; case HeadStatusType.Collect: { } break; case HeadStatusType.HeadMaskIcon: { enable = IsEntityHaveHeadIconMask(entity); } break; case HeadStatusType.TaskStatus: { if (entity.GetEntityType() == EntityType.EntityType_NPC) { QuestTraceInfo info = null; if (TryGetNPCTraceInfo(entity, out info)) { enable = true; } } } break; case HeadStatusType.CampMask: { int camp = entity.GetProp((int)Client.CreatureProp.Camp); if (camp == (int)GameCmd.eCamp.CF_Green || camp == (int)GameCmd.eCamp.CF_Red) { enable = true; } } break; case HeadStatusType.BossSay: { int baseID = entity.GetProp((int)EntityProp.BaseID); if (baseID == DataManager.Manager <RoleStateBarManager>().GetTalkingBossID()) { enable = DataManager.Manager <RoleStateBarManager>().GetBossTalkVisible(); } else { enable = false; } } break; } } return(enable); }
public void SetHpDisplay() { bool value = ClientGlobal.Instance().gameOption.GetInt("ShowDetail", "HpDisplay", 1) == 1; RoleStateBarManager.SetHpSliderVisible(value); }
//正常播放完成 public void PlaybackFinished(WellFired.USSequencer sequencer) { m_IsPlay = false; if (m_SequencerCamera != null) { GameObject obj = GameObject.Find("MainCamera"); Camera camera = obj.GetComponent <Camera>(); if (camera != m_SequencerCamera) { camera.enabled = true; } } m_SequencerCamera = null; m_SequencerData = null; // 取消回调 if (sequencer != null) { sequencer.PlaybackFinished -= this.PlaybackFinished; sequencer.BeforeUpdate -= this.BeforeUpdate; } try { //显示npc Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es != null) { es.ShowEntity(true); } //删除剧情gameobject if (m_SequencerGameObject != null) { GameObject.Destroy(m_SequencerGameObject); m_SequencerGameObject = null; } Debug.Log("清理剧情对象"); //清理剧情对象 ClearSequencerTempObject(); //打开声音 Client.ClientGlobal.Instance().MuteGameSound(false); } catch { goto Exit0; } Exit0: //隐藏提示 TipsManager.Instance.EnableTips(true); //DataManager.Manager<UIPanelManager>().ShowStoryCachePanel(); Debug.Log("剧情结束显示UI"); RoleStateBarManager.ShowHeadStatus(); //剧情结束隐藏黑边 DataManager.Manager <UIPanelManager>().HideStory(); Debug.Log("剧情结束隐藏黑边"); Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.STORY_PLAY_OVER, null); //却换到原场景 Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem(); if (m_MapID != 0) { // 剧情播放完毕加载原场景 table.MapDataBase data = GameTableManager.Instance.GetTableItem <table.MapDataBase>(m_MapID); if (data == null) { return; } table.ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(data.dwResPath); if (resDB == null) { return; } if (rs != null) { string str = resDB.strPath; Engine.IScene scene = rs.EnterScene(ref str, SequencerManager.Instance()); if (scene != null) { ///加载场景 SequencerManager.Instance().Pause(); scene.StartLoad(Vector3.one); } } m_MapID = 0; } }
public HeadTipData(IEntity entity, HeadTipType htype, bool vivible) { if (entity == null) { throw new ArgumentNullException("entity"); } this.type = htype; this.m_bVisible = vivible; switch (type) { case HeadTipType.Hp: { this.value = entity.GetProp((int)CreatureProp.Hp) / (float)entity.GetProp((int)CreatureProp.MaxHp); this.color = ColorType.Green; this.spriteParams = GetSpiteName(entity); } break; case HeadTipType.Name: { this.value = entity.GetName(); this.color = GetNameColor(entity); } break; case HeadTipType.HeadMaskIcon: { table.NpcHeadMaskDataBase npcmaskDB = RoleStateBarManager.GetNPCHeadMaskDB(entity); this.value = (null != npcmaskDB) ? npcmaskDB.headMaskIcon : ""; } break; case HeadTipType.Clan: { this.color = GetClanNameColor(entity); // this.m_nFontSize = 18; //this.value = //异步请求 } break; case HeadTipType.Title: { this.value = GetTitleText(entity); this.color = ColorType.Green; } break; case HeadTipType.Collect: { this.color = ColorType.JSXT_CaiJiWu; this.m_bVisible = true; } break; case HeadTipType.Max: break; default: break; } }
/// <summary> /// 更新顶部栏状态 /// </summary> public void UpdateHeadStatus(HeadStatusType type, bool adjustPos = true) { RoleStateBarManager mgr = DataManager.Manager <RoleStateBarManager>(); IEntity entity = RoleStateBarManager.GetEntity(UID); if (null == entity) { return; } Transform widget = GetWidget(type); if (null != widget) { QuestTraceInfo traceInfo = null; bool visible = false; if (type != HeadStatusType.TaskStatus) { visible = RoleStateBarManager.IsEntityHeadStatusTypeEnable(entity, type); } else { if (RoleStateBarManager.TryGetNPCTraceInfo(entity, out traceInfo)) { visible = true; } } if (widget.gameObject.activeSelf != visible) { widget.gameObject.SetActive(visible); } if (type == HeadStatusType.Title && null != m_particleWidget) { m_particleWidget.ReleaseParticle(); } if (visible) { switch (type) { case HeadStatusType.Hp: if (null != m_hpSlider && null != m_spHpbg && null != m_spHpForg) { float hpPer = entity.GetProp((int)CreatureProp.Hp) / (float)entity.GetProp((int)CreatureProp.MaxHp); EntityHpSprite hpSp = RoleStateBarManager.GetEntityHpSpData(entity); if (hpSp != null) { m_spHpbg.spriteName = hpSp.bgSpriteName; m_spHpbg.MakePixelPerfect(); m_spHpForg.spriteName = hpSp.spriteName; m_spHpForg.MakePixelPerfect(); m_hpSlider.gameObject.SetActive(hpSp.bShow); m_hpSlider.value = hpPer; } } break; case HeadStatusType.Name: if (null != m_labName) { m_labName.text = ColorManager.GetColorString(mgr.GetNameColor(entity), entity.GetName()); } break; case HeadStatusType.Clan: if (null != m_labClanName) { Action <string, int> clanNameDlg = (clanName, getNameSeed) => { if (getNameSeed >= m_iGetNameSeed) { //保证先后 //string name = DataManager.Manager<TextManager>().GetLocalFormatText(LocalTextType.Clan_Commond_shizumingzi, clanName); //labelClan.fontSize = data.m_nFontSize; m_labClanName.text = ColorManager.GetColorString(RoleStateBarManager.GetClanNameColor(entity), clanName); } }; RoleStateBarManager.GetRoleBarClanName(entity, clanNameDlg, ++m_iGetNameSeed); } break; case HeadStatusType.Title: if (null != m_labTitle) { table.TitleDataBase titleDb = RoleStateBarManager.GetTitleText(entity); if (null != titleDb) { bool visibleTxt = (titleDb.UIState == 0); if (null != m_labTitle) { if (m_labTitle.gameObject.activeSelf != visibleTxt) { m_labTitle.gameObject.SetActive(visibleTxt); } m_labTitle.text = titleDb.SceneTextUI; } if (null != m_particleWidget) { if (m_particleWidget.gameObject.activeSelf == visibleTxt) { m_particleWidget.gameObject.SetActive(!visibleTxt); } m_particleWidget.AddParticle(titleDb.FxUI, m_particleRelativeWidget); } } } break; case HeadStatusType.Collect: if (null != m_labCollectTips) { m_labCollectTips.color = ColorManager.GetColor32OfType(ColorType.JSXT_CaiJiWu); } break; case HeadStatusType.HeadMaskIcon: if (null != m_spHeadMask) { table.NpcHeadMaskDataBase npcmaskDB = RoleStateBarManager.GetNPCHeadMaskDB(entity); string iconName = (null != npcmaskDB) ? npcmaskDB.headMaskIcon : ""; UIManager.GetAtlasAsyn(iconName, ref m_headCASD, () => { if (null != m_spHeadMask) { m_spHeadMask.atlas = null; } }, m_spHeadMask); } break; case HeadStatusType.TaskStatus: if (null != m_spTaskStatus && null != traceInfo) { long uid = 0; string icon = ""; if (RoleStateBarManager.TryGetQuestStatusIcon(traceInfo, out uid, out icon) && uid == UID) { UIManager.GetAtlasAsyn(icon, ref m_taskCASD, () => { if (null != m_spTaskStatus) { m_spTaskStatus.atlas = null; } }, m_spTaskStatus); } else { widget.gameObject.SetActive(false); } } break; case HeadStatusType.CampMask: { bool isGod = true; int camp = entity.GetProp((int)Client.CreatureProp.Camp); if (camp == (int)GameCmd.eCamp.CF_Red) { isGod = false; } if (null != m_tsDemonMask && m_tsDemonMask.gameObject.activeSelf == isGod) { m_tsDemonMask.gameObject.SetActive(!isGod); } if (null != m_tsGodMask && m_tsGodMask.gameObject.activeSelf != isGod) { m_tsGodMask.gameObject.SetActive(isGod); } } break; case HeadStatusType.BossSay: { uint npcID = DataManager.Manager <RoleStateBarManager>().GetTalkingBossID(); table.BossTalkDataBase db = GameTableManager.Instance.GetTableItem <table.BossTalkDataBase>(npcID); if (db != null) { uint textID = db.textID; table.LangTextDataBase ldb = GameTableManager.Instance.GetTableItem <table.LangTextDataBase>(textID); if (ldb != null) { m_bossText.text = ldb.strText; } m_bossTalk.gameObject.SetActive(visible); } else { m_bossTalk.gameObject.SetActive(false); } } break; } } if (adjustPos) { AdjustStatusPos(); } } }
public void SetMonsterName() { bool value = ClientGlobal.Instance().gameOption.GetInt("ShowDetail", "MonsterName", 1) == 1; RoleStateBarManager.SetNpcNameVisible(value); }
public void PlaySequencer(string strSequencer) { if (m_IsPlay) { return; } if (strSequencer == "") { return; } //隐藏npc //Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); //if (es != null) // es.ShowEntity(false); try { m_SequencerGameObject = WellFired.USSequencerLoad.LoadSequencerFromXml(strSequencer); } catch { PlaybackFinished(null); goto Exit0; } if (m_SequencerGameObject != null) { WellFired.USSequencer sequencer = m_SequencerGameObject.GetComponent <WellFired.USSequencer>(); if (sequencer != null) { sequencer.PlaybackFinished += this.PlaybackFinished; sequencer.BeforeUpdate += this.BeforeUpdate; m_IsPlay = true; if (m_IsPlay == true) { RoleStateBarManager.HideHeadStatus();//隐藏npc血条 //隐藏提示 TipsManager.Instance.EnableTips(false); //关闭声音 //IClientGlobal的MuteGameSound方法 Client.ClientGlobal.Instance().MuteGameSound(true); ///显示黑边 StoryPanel.StoryData data = new StoryPanel.StoryData(); data.Des = ""; data.ShowSkip = SequencerManager.Instance().IsShowSkipSequencerBtn(); data.SkipDlg = SequencerManager.Instance().OnSkipSequencer; data.ColliderClickDlg = SequencerManager.Instance().OnClickSequencer; ////隐藏npc Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es != null) { es.ShowEntity(false); } } sequencer.Play(); } } Exit0: return; }