Ejemplo n.º 1
0
        public uint Execute(PacketDistributed ipacket)
        {
            CG_GONGJISHOP_BUY packet = (CG_GONGJISHOP_BUY )ipacket;

            if (null == packet)
            {
                return((uint)PACKET_EXE.PACKET_EXE_ERROR);
            }
            //enter your logic
            return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
        }
Ejemplo n.º 2
0
    void BoxBuyItemOK(int nCurNum)
    {
        //nCurNum数量判断
        if (nCurNum < m_nShopItemChangeMin || nCurNum > m_nShopItemChangeMax)
        {
            return;
        }

        //背包判断
        if (GameManager.gameManager.PlayerDataPool.BackPack.GetCanContainerSize() <= 0)
        {
            GUIData.AddNotifyData2Client(false, "#{1903}");
            return;
        }

        //判断是否够
        int nRealCost = Price * nCurNum;

        if (nRealCost > 0)
        {
            int GongJiItemNum = GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(ConsumItemID);
            if (nRealCost > GongJiItemNum)
            {
                //不够,返回
                GUIData.AddNotifyData2Client(false, "#{5295}");
                return;
            }
        }
        else
        {
            //可能溢出,直接返回
            return;
        }

        //发送购买消息包
        CG_GONGJISHOP_BUY msg = (CG_GONGJISHOP_BUY)PacketDistributed.CreatePacket(MessageID.PACKET_CG_GONGJISHOP_BUY);

        msg.GoodID = ShopTabID;
        msg.BuyNum = nCurNum;
        msg.SendPacket();
    }