Ejemplo n.º 1
0
    void OnEvent(int eventID, object param)
    {
        switch ((Client.GameEventID)eventID)
        {
        case GameEventID.BUFF_ADDTOTARGETBUFF:
            OnEeventAddBuff(eventID, (Client.stAddBuff)param);
            break;

        case GameEventID.BUFF_DELETETARGETBUFF:
            OnEventRemoveBuff(eventID, (Client.stRemoveBuff)param);
            break;

        case GameEventID.BUFF_UPDATEARGETBUFF:
            break;

        case GameEventID.ENTITYSYSTEM_TARGETCHANGE:
        {
            stTargetChange tc = (stTargetChange)param;
            IEntity        en = tc.target;
            if (en != null)
            {
                IBuffPart bp = en.GetPart(EntityPart.Buff) as IBuffPart;
                if (bp != null)
                {
                    List <stAddBuff> list = null;
                    bp.GetBuffList(out list);
                    if (list != null)
                    {
                        targetBuffList.Clear();
                        for (int i = 0; i < list.Count; i++)
                        {
                            targetBuffList.Insert(0, list[i]);
                        }
                    }
                }
            }
        }
        break;

        case GameEventID.RECONNECT_SUCESS:
        {
            stReconnectSucess reconnectSucess = (stReconnectSucess)param;
            if (reconnectSucess.isLogin)
            {
                ClearAllBuff();
            }
        }
        break;
        }
    }
Ejemplo n.º 2
0
 void OnEvent(int evenId, object param)
 {
     if (evenId == (int)GameEventID.ENTITYSYSTEM_ENTITYDEAD)
     {
         if (m_currEntity == null)
         {
             return;
         }
         stEntityDead ed = (stEntityDead)param;
         IEntity      e  = ControllerSystem.m_ClientGlobal.GetEntitySystem().FindEntity(ed.uid);
         if (e != null && e.GetUID() == m_currEntity.GetUID())
         {
             Engine.RareEngine.Instance().Root.GetComponent <MonoBehaviour>().StartCoroutine(WaitFoeOneSec(m_currEntity));
         }
     }
     else if (evenId == (int)GameEventID.ENTITYSYSTEM_REMOVEENTITY)
     {
         if (m_currEntity == null)
         {
             return;
         }
         Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param;
         if (removeEntiy.uid == m_currEntity.GetUID())
         {
             ReleseTarget();
         }
     }
     else if (evenId == (int)GameEventID.ENTITYSYSTEM_TARGETCHANGE)
     {
         stTargetChange tc = (stTargetChange)param;
         if (tc.target != null)
         {
             m_currEntity = tc.target;
             SetTimer();
         }
     }
 }
Ejemplo n.º 3
0
    //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);
        }
    }