Пример #1
0
    protected void S2C_BuffUpdate(Pt _info)
    {
        pt_scene_chg_buff_c008 pt = _info as pt_scene_chg_buff_c008;

        if (pt != null)
        {
            BuffInfo bf = new BuffInfo(pt);
            switch ((ObjectType)pt.obj_sort)
            {
            case ObjectType.Player:
                if (pt.oid == GameCenter.mainPlayerMng.MainPlayerInfo.ServerInstanceID)
                {
                    GameCenter.mainPlayerMng.MainPlayerInfo.Update(bf, bf.BuffTypeID, (int)pt.oid);
                }
                else
                {
                    OtherPlayerInfo info = GameCenter.sceneMng.GetOPCInfo((int)pt.oid);
                    if (info != null)
                    {
                        info.Update(bf, bf.BuffTypeID, (int)pt.oid);
                    }
                }
                break;

            case ObjectType.MOB:
                MonsterInfo mob = GameCenter.sceneMng.GetMobInfo((int)pt.oid);
                if (mob != null)
                {
                    mob.Update(bf, bf.BuffTypeID, (int)pt.oid);
                }
                break;

            case ObjectType.Entourage:
                MercenaryInfo ent = null;
                if (GameCenter.mercenaryMng.curMercernaryInfo != null && (int)pt.oid == GameCenter.mercenaryMng.curMercernaryInfo.ServerInstanceID)
                {
                    ent = GameCenter.mercenaryMng.curMercernaryInfo;
                }
                else
                {
                    ent = GameCenter.sceneMng.GetEntourageInfo((int)pt.oid);
                }
                if (ent != null)
                {
                    ent.Update(bf, bf.BuffTypeID, (int)pt.oid);
                }
                break;

            default:
                break;
            }
        }
    }
Пример #2
0
    protected void S2C_BuffDelete(Pt _info)
    {
        pt_scene_remove_buff_c009 pt = _info as pt_scene_remove_buff_c009;

        if (pt != null)
        {
            switch ((ObjectType)pt.obj_sort)
            {
            case ObjectType.Player:
                if (pt.oid == GameCenter.mainPlayerMng.MainPlayerInfo.ServerInstanceID)
                {
                    GameCenter.mainPlayerMng.MainPlayerInfo.Update(null, (int)pt.buff_type, (int)pt.oid);
                }
                else
                {
                    OtherPlayerInfo info = GameCenter.sceneMng.GetOPCInfo((int)pt.oid) as OtherPlayerInfo;
                    if (info != null)
                    {
                        info.Update(null, (int)pt.buff_type, (int)pt.oid);
                    }
                }
                break;

            case ObjectType.MOB:
                MonsterInfo mob = GameCenter.sceneMng.GetMobInfo((int)pt.oid) as MonsterInfo;
                if (mob != null)
                {
                    mob.Update(null, (int)pt.buff_type, (int)pt.oid);
                }
                break;

            case ObjectType.Entourage:
                MercenaryInfo ent = null;
                if (GameCenter.mercenaryMng.curMercernaryInfo != null && (int)pt.oid == GameCenter.mercenaryMng.curMercernaryInfo.ServerInstanceID)
                {
                    ent = GameCenter.mercenaryMng.curMercernaryInfo;
                }
                else
                {
                    ent = GameCenter.sceneMng.GetEntourageInfo((int)pt.oid);
                }
                if (ent != null)
                {
                    ent.Update(null, (int)pt.buff_type, (int)pt.oid);
                }
                break;

            default:
                break;
            }
        }
    }
Пример #3
0
    /// <summary>
    /// 得到宠物链表信息
    /// </summary>
    protected void S2C_GetAllMercenayDataList(Pt _msg)
    {
        pt_pet_list_d402 msg = _msg as pt_pet_list_d402;

        if (msg != null)
        {
            for (int i = 0; i < msg.pet_list.Count; i++)
            {
                PetData data = new PetData(msg.pet_list[i]);
                //Debug.Log("发来的宠物serverInstanceID: " + data.configId + ", 宠物type: " + data.type + " , 宠物状态: " + data.status + " , 战力:" + data.fight_score + " , 天魂: " + data.tian_soul + " , 地魂 : " + data.di_soul + " , 命魂 : " + data.life_soul);
                //Debug.Log("  allPetCount :   " + msg.pet_list.Count + "   , name : " + data.pet_name + "    , id : " + data.configId);
                //for (int j = 0; j < data.pet_skill.Count; j++)
                //{
                //    Debug.Log(" skillid :  " + data.pet_skill[j] + data.configId);
                //}

                if (mercenaryInfoList.ContainsKey((int)data.configId))
                {
                    MercenaryInfo info = mercenaryInfoList[(int)data.configId] as MercenaryInfo;
                    if (info != null)
                    {
                        info.Update(data, info.ServerInstanceID);
                        if (curMercernaryInfo != null && curMercernaryInfo.ConfigId == (int)data.configId)
                        {
                            if (info.IsActive != (int)PetChange.FINGHTING)
                            {
                                curMercernaryInfo = null;
                            }
                        }
                        else
                        {
                            if (info.IsActive == (int)PetChange.FINGHTING)
                            {
                                curMercernaryInfo = info;
                            }
                        }
                    }
                }
                else
                {
                    MercenaryInfo info = new MercenaryInfo(data, GameCenter.mainPlayerMng.MainPlayerInfo);
                    mercenaryInfoList[info.ConfigId] = info;
                    if (OnGetNewPetUpdate != null)
                    {
                        OnGetNewPetUpdate(info);
                    }
                    if (curMercernaryInfo != null && curMercernaryInfo.ConfigId == (int)data.configId)
                    {
                        if (info.IsActive != (int)PetChange.FINGHTING)
                        {
                            curMercernaryInfo = null;
                        }
                    }
                    else
                    {
                        if (info.IsActive == (int)PetChange.FINGHTING)
                        {
                            curMercernaryInfo = info;
                        }
                    }
                }

                if (data.status == (int)PetChange.FINGHTING)
                {
                    curPetId = data.configId;
                }
            }
            if (msg.pet_list.Count > 0)
            {
                SetRedRemind();
                if (curPetId == noPet)
                {
                    curPetId = (int)msg.pet_list[0].id;//默认当前展示的id为第一个
                }
            }
        }
        //抛出数据变化的事件
        if (OnMercenaryListUpdate != null)
        {
            OnMercenaryListUpdate();
        }
    }