Example #1
0
    public void OnPetLevelUP(stLevelUpPetUserCmd_S cmd)
    {
        IPet pet = GetPetByThisID(cmd.id);

        if (pet != null)
        {
            pet.SetProp((int)CreatureProp.Level, cmd.lv);
            pet.SetProp((int)PetProp.LevelExp, cmd.exp);
            pet.SetProp((int)PetProp.MaxPoint, cmd.max_point);
            UpdatePetProp();
            string txt = DataManager.Manager <TextManager>().GetLocalFormatText(LocalTextType.Talk_System_zhanhunshengji, GetPetName(pet), cmd.lv);
            ChatDataManager.SendToChatSystem(txt);
            INPC npc = GetNpcByPetID(cmd.id);
            if (npc != null)
            {
                npc.SetProp((int)CreatureProp.Level, cmd.lv);
                stPropUpdate prop = new stPropUpdate();
                prop.uid        = npc.GetUID();
                prop.nPropIndex = (int)CreatureProp.Level;
                prop.newValue   = (int)cmd.lv;

                Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_PROPUPDATE, prop);
            }
        }
    }
Example #2
0
    void SkillEvent(int eventID, object param)
    {
        if (ClientGlobal.Instance().MainPlayer == null)
        {
            return;
        }
        long userUID = ClientGlobal.Instance().MainPlayer.GetUID();

        if (eventID == (int)GameEventID.ENTITYSYSTEM_ENTITYDEAD)
        {
            stEntityDead ed = (stEntityDead)param;
            if (ed.uid == userUID)
            {
                DeleteFightPet(0);
            }
            if (CurPet != null)
            {
                INPC npc = GetNpcByPetID(CurPet.GetID());
                if (npc != null)
                {
                    if (ed.uid == npc.GetUID())
                    {
                        DeleteFightPet(0);
                    }
                }
            }
        }
    }
Example #3
0
    void SetHP(long uid = 0)
    {
        if (m_petID == 0)
        {
            m_hpSpr.fillAmount = 1;
            return;
        }
        INPC npc = m_petData.GetNpcByPetID(m_petID);

        if (npc != null)
        {
            if (uid == 0 || uid == npc.GetUID())
            {
                int curHP = npc.GetProp((int)CreatureProp.Hp);
                int maxHP = npc.GetProp((int)CreatureProp.MaxHp);
                if (maxHP != 0)
                {
                    float v = curHP * 1.0f / maxHP;
                    m_hpSpr.fillAmount = v;
                }
            }
        }
    }
Example #4
0
 void SetPetHP(long uid = 0)
 {
     if (m_petData.CurFightingPet != 0)
     {
         INPC npc = m_petData.GetNpcByPetID(m_petData.CurFightingPet);
         if (npc != null)
         {
             if (uid == 0 || uid == npc.GetUID())
             {
                 int curHP = npc.GetProp((int)CreatureProp.Hp);
                 int maxHP = npc.GetProp((int)CreatureProp.MaxHp);
                 if (maxHP != 0)
                 {
                     float v = curHP * 1.0f / maxHP;
                     m_hpSlider.fillAmount = v;
                 }
             }
         }
         else
         {
             m_hpSlider.fillAmount = 1;
         }
     }
 }
Example #5
0
    [Execute]//Npc归属人列表返回信息
    public void Execute(GameCmd.stNpcBelongListMapScreenUserCmd_S cmd)
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
            return;
        }

        INPC npc = es.FindNPC(cmd.npcid);

        if (npc != null)
        {
            npc.OwnerID = cmd.userid;
            npc.TeamID  = cmd.teamid;
            bool belongOther = false;
            if (cmd.userid != 0)
            {
                if (cmd.userid != ClientGlobal.Instance().MainPlayer.GetID())
                {
                    belongOther = true;
                }
                else
                {
                    npc.BelongMe = true;
                }
            }
            if (!belongOther && (cmd.teamid != 0 || cmd.clanid != 0))
            {
                if (DataManager.Manager <TeamDataManager>().IsJoinTeam == true)
                {
                    if (DataManager.Manager <TeamDataManager>().TeamId != cmd.teamid)
                    {
                        belongOther = true;
                    }
                }
                else if (DataManager.Manager <ClanManger>().IsJoinClan == true)
                {
                    if (DataManager.Manager <ClanManger>().ClanId != cmd.clanid)
                    {
                        belongOther = true;
                    }
                }
                else
                {
                    belongOther = true;
                }
            }

            npc.BelongOther = belongOther;
            stEntityChangename e = new stEntityChangename();
            e.uid = npc.GetUID();
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ENTITYSYSTEM_CHANGENAME, e);

            stRefreshNPCBelongParam param = new stRefreshNPCBelongParam()
            {
                npcid     = npc.GetUID(),
                teamid    = cmd.teamid,
                ownerid   = cmd.userid,
                clanid    = cmd.clanid,
                ownerName = cmd.ownername,
            };
            NpcAscription.Instance.OnBelongChanged(param);
            DataManager.Manager <UIPanelManager>().SendMsg(PanelID.MainPanel, UIMsgID.eRefreshNpcBelong, param);
        }
    }
Example #6
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);
        }
    }