Ejemplo n.º 1
0
        public bool Special;                  //特殊礼包标记

        public RmbMallVo(RmbMallRulePB gamemallRulePb)
        {
            MallId        = gamemallRulePb.MallId;
            MallSortPb    = gamemallRulePb.MallSort;
            MallName      = gamemallRulePb.MallName;
            MallDesc      = gamemallRulePb.MallDesc;
            GiftImage     = gamemallRulePb.GiftImage;
            Slot          = gamemallRulePb.Slot;
            MallLabelPb   = gamemallRulePb.MallLabel;
            LabelImage    = gamemallRulePb.LabelImage;
            RealPrice     = gamemallRulePb.RealPrice;
            OriginalPrice = gamemallRulePb.OriginalPrice;
            Special       = gamemallRulePb.Special;
            BuyMax        = gamemallRulePb.BuyMax;
            BuyRefreshDay = gamemallRulePb.BuyRefreshDay;
            Award         = gamemallRulePb.Award;
            Starttime     = gamemallRulePb.StartTime;
            EndTime       = gamemallRulePb.EndTime;
        }
Ejemplo n.º 2
0
        private void FilterNewGift(RepeatedField <UserTriggerGiftPB> oldTriggerGiftPb,
                                   RepeatedField <UserTriggerGiftPB> newTriggerGiftPb, bool showNewGiftWindow)
        {
            GiftCount = 0;
            _newGifts = new List <UserTriggerGiftPB>();
            foreach (var giftPb in newTriggerGiftPb)
            {
                bool hasGift = false;
                if (_oldGift != null)
                {
                    foreach (var oldPb in _oldGift)
                    {
                        if (giftPb.Id == oldPb.Id)
                        {
                            hasGift = true;
                            break;
                        }
                    }
                }

                if (hasGift == false)
                {
                    _newGifts.Add(giftPb);
                }
            }

            _oldGift = newTriggerGiftPb;

            GiftList = new List <TriggerGiftVo>();

            foreach (var giftPb in newTriggerGiftPb)
            {
                GiftCount++;

                RmbMallRulePB pb = GetMallPb(giftPb.MallId);

                bool hasFree = false;
                foreach (var rule in _triggerGiftsRule)
                {
                    if (rule.MallId == giftPb.MallId && giftPb.FreeType == 0 && rule.FreeAward != null && rule.FreeAward.Count > 0)
                    {
                        TriggerGiftVo vo1 = new TriggerGiftVo();
                        vo1.Id           = giftPb.Id;
                        vo1.IsFree       = true;
                        vo1.MallId       = giftPb.MallId;
                        vo1.FreeType     = giftPb.FreeType;
                        vo1.MaturityTime = giftPb.MaturityTime;
                        vo1.Awards       = rule.FreeAward;
                        vo1.Rule         = pb;
                        GiftList.Add(vo1);
                        hasFree = true;
                        break;
                    }
                }

                if (giftPb.FreeType == 1 || hasFree == false)
                {
                    //免费礼包领取之后才会显示收费礼包
                    TriggerGiftVo vo = new TriggerGiftVo();
                    vo.Id           = giftPb.Id;
                    vo.MallId       = giftPb.MallId;
                    vo.FreeType     = giftPb.FreeType;
                    vo.MaturityTime = giftPb.MaturityTime;
                    vo.IsFree       = false;

                    vo.Awards = pb.Award;
                    vo.Rule   = pb;

                    GiftList.Add(vo);
                }
            }


            GiftList.Sort();

            if (showNewGiftWindow)
            {
                RandomEventManager.ShowNewTriggerGift();
            }

            EventDispatcher.TriggerEvent(EventConst.OnTriggerGiftChange);
        }