Esempio n. 1
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);
        }
Esempio n. 2
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);
        }