Пример #1
0
    /// <summary>
    ///D405
    /// </summary>
    public void C2S_ReqPromote(PetChange _data, int _id, int _isQuikBuy)
    {
        pt_req_pet_three_int_d405 msg = new pt_req_pet_three_int_d405();

        msg.req_state   = (uint)_data;
        msg.parameter_1 = (uint)_id;
        msg.parameter_2 = (uint)_isQuikBuy;
        NetMsgMng.SendMsg(msg);
    }
Пример #2
0
    /// <summary>
    /// 403
    /// </summary>
    public void C2S_ReqMercenaryInfo(PetChange _data, int _id)
    {
        //Debug.Log("  d403 :  " + _data + "   ,id : " + _id);
        pt_req_pet_info_d403 msg = new pt_req_pet_info_d403();

        msg.req_state = (uint)_data;
        msg.pet_type  = (uint)_id;
        NetMsgMng.SendMsg(msg);
    }
Пример #3
0
    /// <summary>
    /// 状态
    /// </summary>
    public void UpdateAfterChange(pt_pet_updata_state_d404 _msg)
    {
        //Debug.Log("d404 : " + ", state : " + _msg.state + " , id : " + _msg.pet_type);
        PetChange state = (PetChange)_msg.state;

        switch (state)
        {
        case PetChange.FINGHTING:
        {
            serverData.status = 1;
            //GameCenter.mercenaryMng.FloatingReminger(181);
            break;
        }

        case PetChange.GUARD:
            serverData.status = 2; break;

        case PetChange.FREE:
        {
            FDictionary pets = GameCenter.mercenaryMng.mercenaryInfoList;
            GameCenter.mercenaryMng.mercenaryInfoList.Remove(_msg.pet_type);
            if (GameCenter.mercenaryMng.mercenaryInfoList.Count > 0)
            {
                foreach (MercenaryInfo info in pets.Values)
                {
                    GameCenter.mercenaryMng.curPetId = info.ConfigId; break;
                }
            }
            else
            {
                GameCenter.mercenaryMng.curPetId = MercenaryMng.noPet;
            }
        }
        break;

        case PetChange.REST:
        case PetChange.CANCELGUARD:
            serverData.status = 0; break;

        default:
            break;
        }
    }
Пример #4
0
 /// <summary>
 /// 判断物品是否充足
 /// </summary>
 void CheckCondition(PetChange _id)
 {
     //int id = 0;
     //if (_id == PetChange.PRACTICETIANSOUL) id = curInfo.Tian_soul;
     //else if (_id == PetChange.PRACTICEDISOUL) id = curInfo.Di_soul;
     //else id = curInfo.Life_soul;
     if (curInfo != null)
     {
         if (curInfo.LxItem.Count > 0)
         {
             int coinNum = 0;
             int itemNum = 0;
             for (int i = 0; i < curInfo.LxItem.Count; i++)
             {
                 if (curInfo.LxItem[i].eid == 5)
                 {
                     coinNum = curInfo.LxItem[i].count;
                 }
                 else
                 {
                     itemNum = curInfo.LxItem[i].count;
                 }
             }
             if (MainPlayerInfo != null && MainPlayerInfo.TotalCoinCount >= (ulong)coinNum)
             {
                 if (GameCenter.inventoryMng.GetNumberByType(itemId) < itemNum && itemRef != null)//灵修丹 2200005
                 {
                     if (isAutomaticBuy != null && isAutomaticBuy.value)
                     {
                         if (MainPlayerInfo.TotalDiamondCount >= itemRef.diamonPrice)
                         {
                             GameCenter.mercenaryMng.C2S_ReqPromote(_id, GameCenter.mercenaryMng.curPetId, (isAutomaticBuy.value == true) ? 1 : 0);
                         }
                         else
                         {
                             MessageST mst = new MessageST();
                             mst.messID = 137;
                             mst.delYes = delegate
                             {
                                 GameCenter.uIMng.SwitchToUI(GUIType.RECHARGE);
                             };
                             GameCenter.messageMng.AddClientMsg(mst);
                         }
                     }
                     else
                     {
                         MessageST mst = new MessageST();
                         mst.messID = 158;
                         mst.words  = new string[2] {
                             itemRef.diamonPrice.ToString(), itemRef.name
                         };
                         mst.delYes = delegate
                         {
                             if (MainPlayerInfo.TotalDiamondCount >= itemRef.diamonPrice)
                             {
                                 GameCenter.mercenaryMng.C2S_ReqPromote(_id, GameCenter.mercenaryMng.curPetId, 1);
                             }
                             else
                             {
                                 MessageST mst1 = new MessageST();
                                 mst1.messID = 137;
                                 mst1.delYes = delegate
                                 {
                                     GameCenter.uIMng.SwitchToUI(GUIType.RECHARGE);
                                 };
                                 GameCenter.messageMng.AddClientMsg(mst1);
                             }
                         };
                         GameCenter.messageMng.AddClientMsg(mst);
                     }
                 }
                 else
                 {
                     GameCenter.mercenaryMng.C2S_ReqPromote(_id, GameCenter.mercenaryMng.curPetId, 0);
                 }
             }
             else
             {
                 GameCenter.messageMng.AddClientMsg(155);
             }
         }
     }
 }
Пример #5
0
    /// <summary>
    /// 提升
    /// </summary>
    public void UpdateAfterChange(pt_pet_updata_property_d409 _msg)
    {
        //Debug.Log("收到类型值 : " + _msg.state + " , 收到num  : " + _msg.num + " , 收到等级: " + _msg.lev);
        PetChange state = (PetChange)_msg.state;

        switch (state)
        {
        case PetChange.NONESTATE:    //使用宠物蛋增加资质经验
            if (Aptitude < _msg.lev)
            {
                Aptitude = _msg.lev;
                GameCenter.messageMng.AddClientMsg(150);
            }
            serverData.aptitude_exp = _msg.num;
            if (GameCenter.mercenaryMng.OnZhuPetUpdate != null && _msg.pet_type == GameCenter.mercenaryMng.zhuPetId)
            {
                GameCenter.mercenaryMng.OnZhuPetUpdate();
            }
            if (GameCenter.mercenaryMng.OnFuPetUpdate != null && _msg.pet_type == GameCenter.mercenaryMng.fuPetId)
            {
                GameCenter.mercenaryMng.OnFuPetUpdate();
            }
            if (GameCenter.mercenaryMng.OnPetGrowUpUpdate != null)
            {
                GameCenter.mercenaryMng.OnPetGrowUpUpdate();
            }
            break;

        case PetChange.GROWUP:
            serverData.grow_up_exp = _msg.num;
            if (_msg.lev > serverData.grow_up)
            {
                serverData.grow_up = _msg.lev;
                GameCenter.messageMng.AddClientMsg(146);
            }
            SetTitle();
            if (GameCenter.mercenaryMng.OnPetGrowUpUpdate != null)
            {
                GameCenter.mercenaryMng.OnPetGrowUpUpdate();
            }
            break;

        case PetChange.PRACTICETIANSOUL:
            int att = 0;
            if (_msg.lev > Tian_soul)
            {
                serverData.tian_soul = _msg.lev;
                GameCenter.messageMng.AddClientMsg(323);
                if (GameCenter.mercenaryMng.OnLingXiuLevUpdate != null)
                {
                    GameCenter.mercenaryMng.OnLingXiuLevUpdate(LingXiuType.TIAN);
                }
            }
            else
            {
                if (GameCenter.mercenaryMng.OnLingXiuExpUpdate != null)
                {
                    GameCenter.mercenaryMng.OnLingXiuExpUpdate(LingXiuType.TIAN);
                }
            }
            for (int i = 0; i < serverData.jinghun_property.Count; i++)
            {
                if (serverData.jinghun_property[i].type == 1)
                {
                    att = serverData.jinghun_property[i].num;
                    serverData.jinghun_property[i].num = _msg.num; break;
                }
            }
            GameCenter.practiceMng.ReminderWnd(320, (_msg.num - att).ToString());
            break;

        case PetChange.SEALSKILL:
            //++GameCenter.mercenaryMng.emptyNest;
            //serverData.pet_skill.Remove((uint)_msg.num);
            break;

        case PetChange.FORGETSKILL:
            //++GameCenter.mercenaryMng.emptyNest;
            //serverData.pet_skill.Remove((uint)_msg.num);
            break;

        case PetChange.STUDYSKILL:
            serverData.pet_skill.Add((uint)_msg.num);
            //Debug.Log("   学习技能 : " + serverData.pet_skill.Count);
            break;

        case PetChange.PRACTICEDISOUL:
            int hit = 0;
            if (_msg.lev > Di_soul)
            {
                serverData.di_soul = _msg.lev;
                GameCenter.messageMng.AddClientMsg(324);
                if (GameCenter.mercenaryMng.OnLingXiuLevUpdate != null)
                {
                    GameCenter.mercenaryMng.OnLingXiuLevUpdate(LingXiuType.DI);
                }
            }
            else
            {
                if (GameCenter.mercenaryMng.OnLingXiuExpUpdate != null)
                {
                    GameCenter.mercenaryMng.OnLingXiuExpUpdate(LingXiuType.DI);
                }
            }
            for (int i = 0; i < serverData.jinghun_property.Count; i++)
            {
                if (serverData.jinghun_property[i].type == 7)
                {
                    hit = serverData.jinghun_property[i].num;
                    serverData.jinghun_property[i].num = _msg.num; break;
                }
            }
            GameCenter.practiceMng.ReminderWnd(322, (_msg.num - hit).ToString());
            break;

        case PetChange.PRACTICELIFESOUL:
            int cri = 0;
            if (_msg.lev > Life_soul)
            {
                serverData.life_soul = _msg.lev;
                GameCenter.messageMng.AddClientMsg(325);
                if (GameCenter.mercenaryMng.OnLingXiuLevUpdate != null)
                {
                    GameCenter.mercenaryMng.OnLingXiuLevUpdate(LingXiuType.LIFE);
                }
            }
            else
            {
                if (GameCenter.mercenaryMng.OnLingXiuExpUpdate != null)
                {
                    GameCenter.mercenaryMng.OnLingXiuExpUpdate(LingXiuType.LIFE);
                }
            }
            for (int i = 0; i < serverData.jinghun_property.Count; i++)
            {
                if (serverData.jinghun_property[i].type == 9)
                {
                    cri = serverData.jinghun_property[i].num;
                    serverData.jinghun_property[i].num = _msg.num; break;
                }
            }
            GameCenter.practiceMng.ReminderWnd(321, (_msg.num - cri).ToString());
            break;

        case PetChange.USEPRIMERYPILL:
        case PetChange.USEMIDDLEPILL:
        case PetChange.USESENIORPILL:     //资质经验提升
        {
            if (Aptitude < _msg.lev)
            {
                Aptitude = _msg.lev;
                GameCenter.messageMng.AddClientMsg(150);
            }
            serverData.aptitude_exp = _msg.num;
            GameCenter.practiceMng.ReminderWnd(149, ((_msg.state == 19) ? 10 : ((_msg.state == 20) ? 50 : 200)).ToString());
            if (GameCenter.mercenaryMng.OnZhuPetUpdate != null && _msg.pet_type == GameCenter.mercenaryMng.zhuPetId)
            {
                GameCenter.mercenaryMng.OnZhuPetUpdate();
            }
            if (GameCenter.mercenaryMng.OnFuPetUpdate != null && _msg.pet_type == GameCenter.mercenaryMng.fuPetId)
            {
                GameCenter.mercenaryMng.OnFuPetUpdate();
            }
        }
            if (GameCenter.mercenaryMng.OnPetGrowUpUpdate != null)
            {
                GameCenter.mercenaryMng.OnPetGrowUpUpdate();
            }
            break;

        default:
            break;
        }
    }
Пример #6
0
    /// <summary>
    /// 判断资质丹是否够用
    /// </summary>
    void CheckCondition(int _id, PetChange _req)
    {
        //Debug.Log("判断资质丹是否够用");
        int itemNum = 0;

        if (zZItem.Count > 0)
        {
            for (int i = 0; i < zZItem.Count; i++)
            {
                if (zZItem[i].eid == _id)
                {
                    itemNum = zZItem[i].count;
                }
            }
        }
        if (itemNum > GameCenter.inventoryMng.GetNumberByType(_id)) //物品不够
        {
            if (isAutomaticBuy != null && isAutomaticBuy.value)     //自动购买
            {
                if (MainPlayerInfo != null && MainPlayerInfo.TotalDiamondCount >= ConfigMng.Instance.GetEquipmentRef(_id).diamonPrice)
                {
                    GameCenter.mercenaryMng.C2S_ReqPromote(_req, upZiZhiId, 1);
                }
                else
                {
                    MessageST mst = new MessageST();
                    mst.messID = 137;
                    mst.delYes = delegate
                    {
                        GameCenter.uIMng.SwitchToUI(GUIType.RECHARGE);
                    };
                    GameCenter.messageMng.AddClientMsg(mst);
                }
            }
            else
            {
                MessageST mst = new MessageST();
                mst.messID = 158;
                mst.words  = new string[2] {
                    ConfigMng.Instance.GetEquipmentRef(_id).diamonPrice.ToString(), ConfigMng.Instance.GetEquipmentRef(_id).name
                };
                mst.delYes = delegate
                {
                    if (MainPlayerInfo != null && MainPlayerInfo.TotalDiamondCount >= ConfigMng.Instance.GetEquipmentRef(_id).diamonPrice)
                    {
                        GameCenter.mercenaryMng.C2S_ReqPromote(_req, upZiZhiId, 1);
                    }
                    else
                    {
                        MessageST mst1 = new MessageST();
                        mst1.messID = 137;
                        mst1.delYes = delegate
                        {
                            GameCenter.uIMng.SwitchToUI(GUIType.RECHARGE);
                        };
                        GameCenter.messageMng.AddClientMsg(mst1);
                    }
                };
                GameCenter.messageMng.AddClientMsg(mst);
            }
        }
        else
        {
            GameCenter.mercenaryMng.C2S_ReqPromote(_req, upZiZhiId, 0);
        }
    }