Beispiel #1
0
        private void InitExpirationLabel()
        {
            TargetedBundleController targetedBundleController = Service.Get <TargetedBundleController>();

            this.expirationLabel = base.GetElement <UXLabel>("LabelCrateExpireTimer");
            if (this.ModalReason == CrateInfoReason.Reason_Store_Buy && this.targetLEIVO != null)
            {
                UXUtils.SetLeiExpirationTimerLabel(this.targetLEIVO, this.expirationLabel, this.lang);
                Service.Get <ViewTimeEngine>().RegisterClockTimeObserver(this, 1f);
                return;
            }
            if (this.ModalReason == CrateInfoReason.Reason_Inventory_Open && this.crateData != null)
            {
                UXUtils.SetCrateExpirationTimerLabel(this.crateData, this.expirationLabel, this.lang);
                if (this.crateData.DoesExpire)
                {
                    Service.Get <ViewTimeEngine>().RegisterClockTimeObserver(this, 1f);
                    return;
                }
            }
            else
            {
                if (this.ModalReason == CrateInfoReason.Reason_Targeted_Offer)
                {
                    UXUtils.SetCrateTargetedOfferTimerLabel(targetedBundleController.OfferExpiresAt, this.expirationLabel, this.lang);
                    Service.Get <ViewTimeEngine>().RegisterClockTimeObserver(this, 1f);
                    return;
                }
                this.expirationLabel.Visible = false;
            }
        }
        public void OnViewClockTime(float dt)
        {
            int i     = 0;
            int count = this.itemGrid.Count;

            while (i < count)
            {
                PrizeInventoryItemTag prizeInventoryItemTag = (PrizeInventoryItemTag)this.itemGrid.GetItem(i).Tag;
                if (prizeInventoryItemTag.PrizeType == PrizeType.Crate)
                {
                    CrateData crateData = this.cp.Prizes.Crates.Available[prizeInventoryItemTag.PrizeID];
                    if (crateData.DoesExpire)
                    {
                        if (crateData.ExpiresTimeStamp <= ServerTime.Time)
                        {
                            this.SetupCurTabElements();
                            return;
                        }
                        UXLabel subElement = this.itemGrid.GetSubElement <UXLabel>(prizeInventoryItemTag.PrizeID, "LabelItemExpiration");
                        UXUtils.SetCrateExpirationTimerLabel(crateData, subElement, this.lang);
                    }
                }
                i++;
            }
        }
Beispiel #3
0
        private UXElement CreateInventoryGridItem(string id, PrizeType prizeType, string title, string description, int count, IGeometryVO vo, int quality)
        {
            PrizeInventoryItemTag prizeInventoryItemTag = new PrizeInventoryItemTag();
            UXElement             uXElement             = this.itemGrid.CloneTemplateItem(id);

            prizeInventoryItemTag.TileElement = uXElement;
            prizeInventoryItemTag.PrizeID     = id;
            prizeInventoryItemTag.PrizeType   = prizeType;
            uXElement.Tag = prizeInventoryItemTag;
            this.SetupGridItemQuality(id, quality);
            prizeInventoryItemTag.MainElement = this.itemGrid.GetSubElement <UXElement>(id, "ItemInfo");
            UXLabel subElement = this.itemGrid.GetSubElement <UXLabel>(id, "LabelName");

            subElement.Text = title;
            UXButton subElement2 = this.itemGrid.GetSubElement <UXButton>(id, "BtnItemInfo");

            prizeInventoryItemTag.InfoLabel = this.itemGrid.GetSubElement <UXLabel>(id, "LabelItemInfo");
            if (!string.IsNullOrEmpty(description) && prizeType != PrizeType.None)
            {
                prizeInventoryItemTag.InfoLabel.Text = description;
                subElement2.Visible   = true;
                subElement2.OnClicked = new UXButtonClickedDelegate(this.OnInfoButtonClicked);
                subElement2.Tag       = prizeInventoryItemTag;
            }
            else
            {
                subElement2.Visible = false;
            }
            prizeInventoryItemTag.CountLabel = this.itemGrid.GetSubElement <UXLabel>(id, "LabelItemCount");
            UXSprite subElement3 = this.itemGrid.GetSubElement <UXSprite>(id, "SpriteItemImage");

            if (prizeType == PrizeType.None)
            {
                RewardUtils.SetCrateIcon(subElement3, (CrateVO)vo, AnimState.Idle);
            }
            else if (prizeType == PrizeType.Crate)
            {
                RewardUtils.SetCrateIcon(subElement3, (CrateVO)vo, AnimState.Closed);
            }
            else
            {
                RewardUtils.SetRewardIcon(subElement3, vo, AnimationPreference.NoAnimation);
            }
            prizeInventoryItemTag.IconAssetName = vo.IconAssetName;
            UXButton subElement4 = this.itemGrid.GetSubElement <UXButton>(id, "InventoryCard");

            subElement4.OnClicked = new UXButtonClickedDelegate(this.OnTileClicked);
            subElement4.Tag       = prizeInventoryItemTag;
            this.itemGrid.GetSubElement <UXElement>(id, "CountAndBuildTime").Visible = true;
            this.itemGrid.GetSubElement <UXElement>(id, "ContainerJewelNew").Visible = false;
            UXLabel subElement5 = this.itemGrid.GetSubElement <UXLabel>(id, "LabelItemExpiration");
            UXLabel subElement6 = this.itemGrid.GetSubElement <UXLabel>(id, "LabelCurrencyAmount");

            subElement6.Visible = false;
            if (prizeType == PrizeType.None)
            {
                prizeInventoryItemTag.CountLabel.Visible = false;
                subElement5.Visible = false;
                subElement6.Text    = description;
                subElement6.Visible = true;
            }
            else if (prizeType == PrizeType.Crate)
            {
                prizeInventoryItemTag.CountLabel.Visible = false;
                CrateData crateData = this.cp.Prizes.Crates.Available[id];
                subElement5.Visible = true;
                UXUtils.SetCrateExpirationTimerLabel(crateData, subElement5, this.lang);
                if (!string.IsNullOrEmpty(crateData.PlanetId))
                {
                    PlanetVO  planetVO    = Service.StaticDataController.Get <PlanetVO>(crateData.PlanetId);
                    UXTexture subElement7 = this.itemGrid.GetSubElement <UXTexture>(id, "TexturePlanet");
                    subElement7.LoadTexture(planetVO.LeaderboardTileTexture);
                }
                if (this.crateTabLastViewedTime < crateData.ReceivedTimeStamp)
                {
                    this.itemGrid.GetSubElement <UXElement>(id, "ContainerJewelNew").Visible = true;
                    this.itemGrid.GetSubElement <UXLabel>(id, "LabelMessageCountNew").Text   = this.lang.Get("CRATE_INVENTORY_CRATE_NEW_BADGE", new object[0]);
                }
                subElement4.Tag = prizeInventoryItemTag;
            }
            else
            {
                prizeInventoryItemTag.CountLabel.Text    = string.Format("x{0}", count);
                prizeInventoryItemTag.CountLabel.Visible = true;
                subElement5.Visible = false;
            }
            this.itemGrid.GetSubElement <UXLabel>(id, "LabelItemInfo").Visible        = false;
            this.itemGrid.GetSubElement <UXLabel>(id, "LabelItemRequirement").Visible = false;
            this.itemGrid.GetSubElement <UXSprite>(id, "SpriteItemTimeIcon").Visible  = false;
            this.itemGrid.GetSubElement <UXLabel>(id, "LabelBuildTime").Visible       = false;
            uXElement.Tag = prizeInventoryItemTag;
            return(uXElement);
        }