示例#1
0
        public void CreatePacks(NodeAddedEvent e, SingleNode <PremiumShopTabComponent> shopNode, [JoinAll] ICollection <PremiumGoodsNode> goods, [JoinAll] BaseUserNode userNode)
        {
            List <PremiumGoodsNode> list = this.BuildList(goods, userNode);

            list.Sort(new PremiumGoodsNodeComparer());
            for (int i = 0; i < list.Count; i++)
            {
                PremiumPackComponent pack = Object.Instantiate <GameObject>(shopNode.component.PackPrefab, shopNode.component.PackContainer).GetComponent <PremiumPackComponent>();
                this.FillPack(pack, list[i], i);
            }
        }
示例#2
0
        private void FillPack(PremiumPackComponent pack, PremiumGoodsNode packNode, int count)
        {
            GetDiscountForOfferEvent eventInstance = new GetDiscountForOfferEvent();

            base.ScheduleEvent(eventInstance, packNode);
            pack.DaysText        = packNode.countableItemsPack.Pack.First <KeyValuePair <long, int> >().Value.ToString();
            pack.DaysDescription = packNode.specialOfferContentLocalization.Description;
            pack.Price           = $"{(1f - eventInstance.Discount) * packNode.goodsPrice.Price:0.00} {packNode.goodsPrice.Currency}";
            pack.Discount        = eventInstance.Discount;
            pack.HasXCrystals    = this.IsGoodsWithCrystals(packNode);
            pack.LearnMoreIndex  = count;
            pack.GoodsEntity     = packNode.Entity;
        }