Пример #1
0
        public override bool TakeAction()
        {
            PlayerVipShopLogic pds = new PlayerVipShopLogic();

            pds.SetUser(m_UserId);
            if (!pds.PurchaseItem(m_RequestPacket.ShopItemIndex, m_RequestPacket.TypeId, m_RequestPacket.Count))
            {
                ErrorCode = (int)ErrorType.RequireNotMet;
                ErrorInfo = "Item info is not correct";
                return(false);
            }
            Dictionary <int, int> itemDict = new Dictionary <int, int>();

            itemDict.Add(m_RequestPacket.TypeId, m_RequestPacket.Count);
            PlayerPackageLogic pp = new PlayerPackageLogic();

            pp.SetUser(m_UserId);
            PBReceivedItems receivedItems;

            pp.GetItems(itemDict, ReceiveItemMethodType.None, out receivedItems);
            m_ResponsePacket.ReceivedItems = receivedItems;
            m_ResponsePacket.OpenedGoodInfo.Add(new PBItemInfo()
            {
                Type = m_RequestPacket.TypeId, Count = m_RequestPacket.Count
            });
            PlayerLogic p = new PlayerLogic();

            p.SetUser(m_UserId);
            m_ResponsePacket.PlayerInfo = new PBPlayerInfo()
            {
                Id     = m_UserId,
                Money  = p.MyPlayer.Money,
                Coin   = p.MyPlayer.Coin,
                Spirit = p.MyPlayer.Spirit
            };
            m_ResponsePacket.ShopItemIndex = m_RequestPacket.ShopItemIndex;
            return(true);
        }
Пример #2
0
        public override bool TakeAction()
        {
            PlayerVipShopLogic pds = new PlayerVipShopLogic();

            pds.SetUser(m_UserId);
            var playerShopInfo = pds.GetShopInfo();

            m_ResponsePacket.NextAutoRefreshTime = playerShopInfo.NextRefreshTime;
            foreach (var shopItem in playerShopInfo.ShopItems)
            {
                m_ResponsePacket.ShopItems.Add(new PBShopItem()
                {
                    TypeId            = shopItem.ItemType,
                    Count             = shopItem.ItemCount,
                    Currency          = shopItem.CurrencyType,
                    PurchasedTimes    = shopItem.PurchasedTimes,
                    MaxPurchasedTimes = 1,
                    OriginalPrice     = shopItem.OriginalPrice,
                    DiscountedPrice   = shopItem.DiscountedPrice,
                });
            }
            return(true);
        }
Пример #3
0
        public override bool TakeAction()
        {
            PlayerVipShopLogic pds = new PlayerVipShopLogic();

            pds.SetUser(m_UserId);
            PlayerLogic p = new PlayerLogic();

            p.SetUser(m_UserId);
            if (!p.DeductMoney(GameConfigs.GetInt("Vip_Shop_Refresh_Cost", 200)))
            {
                ErrorCode = (int)ErrorType.RequireNotMet;
                ErrorInfo = "You have not enough money.";
                return(false);
            }
            pds.ResetShopItems();
            var playerShopInfo = pds.GetShopInfo();

            foreach (var shopItem in playerShopInfo.ShopItems)
            {
                m_ResponsePacket.ShopItems.Add(new PBShopItem()
                {
                    TypeId            = shopItem.ItemType,
                    Count             = shopItem.ItemCount,
                    Currency          = shopItem.CurrencyType,
                    PurchasedTimes    = shopItem.PurchasedTimes,
                    MaxPurchasedTimes = 1,
                    OriginalPrice     = shopItem.OriginalPrice,
                    DiscountedPrice   = shopItem.DiscountedPrice,
                });
            }
            m_ResponsePacket.Me = new PBPlayerInfo()
            {
                Id    = p.MyPlayer.Id,
                Money = p.MyPlayer.Money
            };
            return(true);
        }