Exemple #1
0
        private void SetupTargetedOfferElements()
        {
            IDataController dataController = Service.Get <IDataController>();

            this.characterSprite1 = base.GetElement <UXSprite>("SpriteCharacter1");
            this.characterSprite2 = base.GetElement <UXSprite>("SpriteCharacter2");
            TextureVO optional = dataController.GetOptional <TextureVO>("gui_textures_promotional");

            if (optional != null)
            {
                UXTexture element = base.GetElement <UXTexture>("TexturePromoArt");
                element.LoadTexture(optional.AssetName);
            }
            optional = dataController.GetOptional <TextureVO>("targeted_bundle_entry");
            if (optional != null)
            {
                UXTexture element2 = base.GetElement <UXTexture>("TextureEnvironmentEntry");
                element2.LoadTexture(optional.AssetName);
            }
            optional = dataController.GetOptional <TextureVO>("targeted_bundle_treads");
            if (optional != null)
            {
                UXTexture element3 = base.GetElement <UXTexture>("TextureEnvironmentRight");
                element3.LoadTexture(optional.AssetName);
            }
            optional = dataController.GetOptional <TextureVO>("targeted_bundle_treads");
            if (optional != null)
            {
                UXTexture element4 = base.GetElement <UXTexture>("TextureEnvironmentLeft");
                element4.LoadTexture(optional.AssetName);
            }
            optional = dataController.GetOptional <TextureVO>("targeted_bundle_dust");
            if (optional != null)
            {
                UXTexture element5 = base.GetElement <UXTexture>("TextureEnvironmentDustRight");
                element5.LoadTexture(optional.AssetName);
                element5 = base.GetElement <UXTexture>("TextureEnvironmentDustLeft");
                element5.LoadTexture(optional.AssetName);
            }
            UXUtils.SetupAnimatedCharacter(this.characterSprite1, this.CurrentOffer.Character1Image, ref this.charGeometry1);
            UXUtils.SetupAnimatedCharacter(this.characterSprite2, this.CurrentOffer.Character2Image, ref this.charGeometry2);
        }
Exemple #2
0
        private void UpdateElements()
        {
            StaticDataController     staticDataController     = Service.StaticDataController;
            TargetedBundleController targetedBundleController = Service.TargetedBundleController;

            this.currentOffer = targetedBundleController.CurrentTargetedOffer;
            if (this.currentOffer != null)
            {
                UXLabel element = base.GetElement <UXLabel>("LabelTitle");
                element.Text = this.lang.Get(this.currentOffer.Title, new object[0]);
                UXLabel element2 = base.GetElement <UXLabel>("LabelDescription");
                element2.Text = this.lang.Get(this.currentOffer.Description, new object[0]);
                TextureVO optional = staticDataController.GetOptional <TextureVO>("gui_textures_promotional");
                if (optional != null)
                {
                    UXTexture element3 = base.GetElement <UXTexture>("TexturePromoArt");
                    element3.LoadTexture(optional.AssetName);
                }
                optional = staticDataController.GetOptional <TextureVO>("targeted_bundle_entry");
                if (optional != null)
                {
                    UXTexture element4 = base.GetElement <UXTexture>("TextureEnvironmentEntry");
                    element4.LoadTexture(optional.AssetName);
                }
                optional = staticDataController.GetOptional <TextureVO>("targeted_bundle_treads");
                if (optional != null)
                {
                    UXTexture element5 = base.GetElement <UXTexture>("TextureEnvironmentRight");
                    element5.LoadTexture(optional.AssetName);
                }
                optional = staticDataController.GetOptional <TextureVO>("targeted_bundle_treads");
                if (optional != null)
                {
                    UXTexture element6 = base.GetElement <UXTexture>("TextureEnvironmentLeft");
                    element6.LoadTexture(optional.AssetName);
                }
                optional = staticDataController.GetOptional <TextureVO>("targeted_bundle_dust");
                if (optional != null)
                {
                    UXTexture element7 = base.GetElement <UXTexture>("TextureEnvironmentDustRight");
                    element7.LoadTexture(optional.AssetName);
                    element7 = base.GetElement <UXTexture>("TextureEnvironmentDustLeft");
                    element7.LoadTexture(optional.AssetName);
                }
                int i     = 0;
                int count = this.currentOffer.RewardUIDs.Count;
                while (i < count)
                {
                    RewardVO rewardVO = staticDataController.Get <RewardVO>(this.currentOffer.RewardUIDs[i]);
                    if (!RewardUtils.SetupTargetedOfferCrateRewardDisplay(rewardVO, this.itemLabels[i], this.itemSprites[i]))
                    {
                        List <RewardComponentTag> rewardComponents = RewardUtils.GetRewardComponents(rewardVO);
                        int j      = 0;
                        int count2 = rewardComponents.Count;
                        while (j < count2)
                        {
                            RewardComponentTag rewardComponentTag = rewardComponents[j];
                            this.itemLabels[i].Text = this.lang.Get("AMOUNT_AND_NAME", new object[]
                            {
                                rewardComponentTag.RewardName,
                                rewardComponentTag.Quantity
                            });
                            RewardUtils.SetRewardIcon(this.itemSprites[i], rewardComponentTag.RewardGeometryConfig, AnimationPreference.AnimationAlways);
                            j++;
                        }
                    }
                    i++;
                }
                if (targetedBundleController.IsCurrencyCostOffer(this.currentOffer))
                {
                    this.SetupCurrencyCostOffer(this.currentOffer);
                }
                else
                {
                    this.SetupIAPLinkedOffer(this.currentOffer);
                }
                UXUtils.SetupAnimatedCharacter(this.characterSprite1, this.currentOffer.Character1Image, ref this.charGeometry1);
                UXUtils.SetupAnimatedCharacter(this.characterSprite2, this.currentOffer.Character2Image, ref this.charGeometry2);
                uint serverTime = Service.ServerAPI.ServerTime;
                this.timeRemaining   = (int)(targetedBundleController.OfferExpiresAt - serverTime);
                this.timerLabel.Text = this.lang.Get("expires_in", new object[]
                {
                    GameUtils.GetTimeLabelFromSeconds(this.timeRemaining)
                });
                this.valueLabel.Text = this.lang.Get("PERCENTAGE", new object[]
                {
                    this.currentOffer.Discount.ToString()
                });
                this.value2Label.Text = this.lang.Get("TARGETED_BUNDLE_DISCOUNT", new object[]
                {
                    this.currentOffer.Discount.ToString()
                });
            }
            else
            {
                Service.Logger.Error("No current offer available for targeted bundle screen");
            }
        }