Exemplo n.º 1
0
    public void SetPlayerTitleVisible(bool visible)
    {
        m_bPlayerTitleVisible = visible;

        for (int i = 0, imax = m_lstAllStateBar.Count; i < imax; i++)
        {
            RoleStateBar bar = m_lstAllStateBar[i];
            if (bar == null)
            {
                continue;
            }
            if (bar.entity == null)
            {
                continue;
            }
            if (bar.entity.GetEntityType() != EntityType.EntityType_Player)
            {
                continue;
            }

            if (bar.entity.GetUID() == ClientGlobal.Instance().MainPlayer.GetUID())
            {
                continue;
            }

            bar.SetWidgetState(HeadTipType.Clan, m_bPlayerTitleVisible);
        }
    }
Exemplo n.º 2
0
    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));
        }
    }
Exemplo n.º 3
0
    private void OnClanNameRefresh(uint clanID, uint uid)
    {
        RoleStateBar bar = GetRoleBarByUID(uid);

        if (bar != null)
        {
            if (clanID != 0)
            {
                Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();

                if (es == null)
                {
                    return;
                }
            }
            else
            {
                bar.SetWidgetState(HeadTipType.Clan, false);
            }
        }
    }
Exemplo n.º 4
0
    public void SetHpSliderVisible(bool visible)
    {
        m_bHpSliderVisible = visible;
        for (int i = 0, imax = m_lstAllStateBar.Count; i < imax; i++)
        {
            RoleStateBar bar = m_lstAllStateBar[i];
            if (bar == null)
            {
                continue;
            }
            if (bar.entity == null)
            {
                continue;
            }
            //             if (bar.entity.GetUID() == ClientGlobal.Instance().MainPlayer.GetUID())
            //             {
            //                 continue;
            //             }

            bar.SetWidgetState(HeadTipType.Hp, m_bHpSliderVisible);
        }
    }
Exemplo n.º 5
0
    public void SetNpcNameVisible(bool visible)
    {
        m_bNpcNameVisible = visible;
        for (int i = 0, imax = m_lstAllStateBar.Count; i < imax; i++)
        {
            RoleStateBar bar = m_lstAllStateBar[i];
            if (bar == null)
            {
                continue;
            }
            if (bar.entity == null)
            {
                continue;
            }
            if (bar.entity.GetEntityType() != EntityType.EntityType_NPC)
            {
                continue;
            }

            bar.SetWidgetState(HeadTipType.Name, m_bNpcNameVisible);
        }
    }
Exemplo n.º 6
0
    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);
            }
        }
    }
Exemplo n.º 7
0
 /// <summary>
 /// 事件处理
 /// </summary>
 /// <param name="nEventID"></param>
 /// <param name="param"></param>
 public void GlobalEventHandler(int eventID, object param)
 {
     if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_NPCHEADSTATUSCHANGED)
     {
         if (null != param && param is Client.INPC)
         {
             UpdateNpcHeadMask((Client.INPC)param);
         }
     }
     else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY)
     {
         Client.stCreateEntity ce = (Client.stCreateEntity)param;
         OnCretateEntity(ref ce);
     }
     else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_REMOVEENTITY)
     {
         Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param;
         RemoveBar(removeEntiy);
     }
     else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_PROPUPDATE)
     {
         stPropUpdate prop = (stPropUpdate)param;
         OnPropUpdate(ref prop);
     }
     else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_HPUPDATE)
     {
         stPropUpdate prop = (stPropUpdate)param;
         OnPropUpdate(ref prop);
     }
     else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_CHANGENAME)
     {
         stEntityChangename e = (stEntityChangename)param;
         OnChangeName(e.uid);
     }
     else if (eventID == (int)(int)Client.GameEventID.ENTITYSYSTEM_SETHIDE)
     {
         stEntityHide st = (stEntityHide)param;
         OnSetEntityHide(ref st);
         return;
     }
     else if (eventID == (int)(int)Client.GameEventID.TITLE_WEAR)//佩戴称号
     {
         Client.stTitleWear data = (Client.stTitleWear)param;
         OnTitleWear(data.uid);
     }
     else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSSTART)
     {
         Client.stUninterruptMagic uninterrupt = (Client.stUninterruptMagic)param;
         OnStartCollectSlider(ref uninterrupt);
     }
     else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSBREAK)
     {
         if (param != null)
         {
             stGuildBreak guildbreak = (stGuildBreak)param;
             if (ShowCollectTip(guildbreak.action))
             {
                 long         uid = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_Player, guildbreak.uid);
                 RoleStateBar bar = GetRoleBarByUID(uid);
                 if (bar != null)
                 {
                     bar.SetWidgetState(HeadTipType.Collect, false);
                 }
             }
         }
     }
     else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSEND)
     {
         if (param != null)
         {
             stGuildEnd guildEnd = (stGuildEnd)param;
             if (ShowCollectTip(guildEnd.action))
             {
                 long         uid = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_Player, guildEnd.uid);
                 RoleStateBar bar = GetRoleBarByUID(uid);
                 if (bar != null)
                 {
                     bar.SetWidgetState(HeadTipType.Collect, false);
                 }
             }
         }
     }
     else if (eventID == (int)Client.GameEventID.CLANQUIT || eventID == (int)Client.GameEventID.CLANJOIN ||
              eventID == (int)Client.GameEventID.CLANREFRESHID || eventID == (int)Client.GameEventID.CITYWARWINERCLANID ||
              eventID == (int)Client.GameEventID.CLANDeclareInfoAdd || eventID == (int)Client.GameEventID.CLANDeclareInfoRemove)
     {
         OnRefreshAllClanTitile();
     }
     else if (eventID == (int)Client.GameEventID.CITYWARTOTEMCLANNAMECHANGE)
     {
         long         uid = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_NPC, (uint)param);
         RoleStateBar bar = GetRoleBarByUID(uid);
         if (bar != null)
         {
             Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
             if (es == null)
             {
                 return;
             }
             RefreshClanName(es.FindEntity(uid), bar);
         }
     }
     else if (eventID == (int)Client.GameEventID.SYSTEM_GAME_READY)
     {
         OnRefreshAllHpSlider();
     }
 }