void OnChangeName(long uid) { Client.IEntity entity = ClientGlobal.Instance().GetEntitySystem().FindEntity(uid); if (entity != null) { RoleStateBar bar = GetRoleBarByUID(uid); if (bar != null) { HeadTipData data = new HeadTipData(entity, HeadTipType.Name, GetNameVisible(entity)); bar.UpdateWidget(data); } } }
private void UpdateNpcHeadMask(Client.INPC npc) { if (null != npc) { return; } RoleStateBar bar = GetRoleBarByUID(npc.GetUID()); bool enable = IsEntityHaveHeadIconMask(npc) && !NpcHeadTipsManager.Instance.IsHaveTips(npc); bar.SetWidgetState(HeadTipType.HeadMaskIcon, enable); if (enable) { bar.UpdateWidget(new HeadTipData(npc, HeadTipType.HeadMaskIcon, m_bHpSliderVisible)); } }
private void OnTitleWear(uint uid) { Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } Client.IPlayer entity = es.FindPlayer(uid); if (entity != null) { RoleStateBar bar = GetRoleBarByUID(entity.GetUID()); if (bar != null) { bar.UpdateWidget(new HeadTipData(entity, HeadTipType.Title, m_bPlayerTitleVisible)); } } }
void RefreshHpSlider(Client.IEntity entity, RoleStateBar bar) { if (entity == null) { Engine.Utility.Log.Error("RefreshHpSlider entity is null"); return; } if (bar == null) { Engine.Utility.Log.Error("RefreshHpSlider bar is null"); return; } bool addHpSlider = IsNeedHpSlider(entity); HeadTipData data = null; 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; } data = new HeadTipData(entity, HeadTipType.Hp, visible); } else { data = new HeadTipData(entity, HeadTipType.Hp, addHpSlider); } if (data != null) { bar.UpdateWidget(data); } }
private void OnPropUpdate(ref stPropUpdate prop) { Client.IEntity entity = ClientGlobal.Instance().GetEntitySystem().FindEntity(prop.uid); if (prop.nPropIndex == (int)CreatureProp.Hp || prop.nPropIndex == (int)CreatureProp.MaxHp) { if (entity != null) { RoleStateBar bar = GetRoleBarByUID(prop.uid); if (bar != null) { HeadTipData data = new HeadTipData(entity, HeadTipType.Hp, m_bHpSliderVisible); bar.UpdateWidget(data); } } } else if (prop.nPropIndex == (int)PlayerProp.GoodNess || prop.nPropIndex == (int)CreatureProp.Camp) { OnChangeName(prop.uid); } }
//----------------------------------------------------------------------------------------------- private void OnStartCollectSlider(ref Client.stUninterruptMagic uninterrupt) { if (ShowCollectTip(uninterrupt.type)) { Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } Client.IEntity entity = es.FindEntity(uninterrupt.uid); if (entity != null && Client.ClientGlobal.Instance().IsMainPlayer(entity.GetUID()) == false) { RoleStateBar bar = GetRoleBarByUID(uninterrupt.uid); if (bar != null) { HeadTipData data = new HeadTipData(entity, HeadTipType.Collect, true); data.SetCollectType(uninterrupt.type); bar.UpdateWidget(data); } } } }
void RefreshClanName(Client.IEntity entity, RoleStateBar bar) { if (entity == null) { Engine.Utility.Log.Error("AddClanName entity is null"); return; } if (bar == null) { Engine.Utility.Log.Error("AddClanName bar is null"); return; } EntityType entityType = entity.GetEntityType(); if (entityType == EntityType.EntityType_Player) { uint clanIdLow = (uint)entity.GetProp((int)CreatureProp.ClanIdLow); uint clanIdHigh = (uint)entity.GetProp((int)CreatureProp.ClanIdHigh); uint clanId = (clanIdHigh << 16) | clanIdLow; //int clanId = entity.GetProp((int)Client.CreatureProp.ClanId); if (clanId != 0) { DataManager.Manager <ClanManger>().GetClanName((uint)clanId, (namedata) => { string winerCityName = string.Empty; string name = string.Empty; if (DataManager.Manager <CityWarManager>().GetWinerOfCityWarCityName((uint)clanId, out winerCityName)) { //name = namedata.ClanName + winerCityName; name = string.Format("{0}【{1}】", winerCityName, namedata.ClanName); } else { //name = namedata.ClanName; name = string.Format("【{0}】", namedata.ClanName); } bool visible = m_bPlayerClanNameVisible; if (entity.GetUID() == Client.ClientGlobal.Instance().MainPlayer.GetUID()) { visible = true; } HeadTipData data = new HeadTipData(entity, HeadTipType.Clan, visible); data.value = name; bar.UpdateWidget(data); }); } else { bar.SetWidgetState(HeadTipType.Clan, false); } } else if (entity.GetEntityType() == EntityType.EntityType_NPC) { CityWarTotem cityWarTotemInfo = null; if (DataManager.Manager <CityWarManager>().GetCityWarTotemClanName((uint)entity.GetProp((int)Client.EntityProp.BaseID), out cityWarTotemInfo)) { HeadTipData data = new HeadTipData(entity, HeadTipType.Clan, m_bPlayerClanNameVisible); data.value = cityWarTotemInfo.clanName; bar.UpdateWidget(data); } else { bar.SetWidgetState(HeadTipType.Clan, false); } } }