Exemplo n.º 1
0
        private void InitRewardsGrid()
        {
            this.rewardsGrid = base.GetElement <UXGrid>("GridRewards");
            this.rewardsGrid.SetTemplateItem("RewardItem");
            RewardVO rewardVO = Service.StaticDataController.Get <RewardVO>(this.meta.Reward);
            List <RewardComponentTag> rewardComponents = RewardUtils.GetRewardComponents(rewardVO);

            for (int i = 0; i < rewardComponents.Count; i++)
            {
                RewardComponentTag rewardComponentTag = rewardComponents[i];
                string             itemUid            = rewardVO.Uid + i;
                UXElement          uXElement          = this.rewardsGrid.CloneTemplateItem(itemUid);
                uXElement.Tag = rewardComponentTag;
                UXLabel subElement = this.rewardsGrid.GetSubElement <UXLabel>(itemUid, "LabelRewardCount");
                subElement.Text = rewardComponentTag.Quantity;
                RewardType type = rewardComponentTag.Type;
                UXSprite   subElement2;
                if (type != RewardType.Building && type != RewardType.Currency)
                {
                    subElement2 = this.rewardsGrid.GetSubElement <UXSprite>(itemUid, "SpriteTroop");
                }
                else
                {
                    subElement2 = this.rewardsGrid.GetSubElement <UXSprite>(itemUid, "SpriteReward");
                }
                RewardUtils.SetRewardIcon(subElement2, rewardComponentTag.RewardGeometryConfig, AnimationPreference.NoAnimation);
                this.rewardsGrid.AddItem(uXElement, rewardComponentTag.Order);
                this.rewardsGrid.RepositionItems();
                this.rewardsGrid.Scroll(0.5f);
            }
            this.rewardsGrid.RepositionItems();
            this.rewardsGrid.Scroll(0.5f);
        }
Exemplo n.º 2
0
 private void InitMissionRewardsGrid(string rewardUid, int campaignPoints)
 {
     this.rewardsGrid = this.screen.GetElement <UXGrid>("MissionRewardsGrid");
     this.rewardsGrid.Clear();
     this.rewardsGrid.SetTemplateItem("MissionRewardsItem");
     if (string.IsNullOrEmpty(rewardUid) && campaignPoints <= 0)
     {
         return;
     }
     if (campaignPoints > 0)
     {
         string    itemUid    = "RewardItem0";
         UXElement item       = this.rewardsGrid.CloneTemplateItem(itemUid);
         UXLabel   subElement = this.rewardsGrid.GetSubElement <UXLabel>(itemUid, "LabelMissionReward");
         subElement.Text = base.LangController.Get("CAMPAIGN_POINTS", new object[]
         {
             campaignPoints
         });
         UXSprite subElement2 = this.rewardsGrid.GetSubElement <UXSprite>(itemUid, "SpriteMissionReward");
         subElement2.Visible    = true;
         subElement2.SpriteName = "icoCampaignPoints";
         this.rewardsGrid.AddItem(item, 0);
     }
     else
     {
         RewardVO rewardVO = base.Sdc.Get <RewardVO>(rewardUid);
         List <RewardComponentTag> rewardComponents = RewardUtils.GetRewardComponents(rewardVO);
         int i     = 0;
         int count = rewardComponents.Count;
         while (i < count)
         {
             string             itemUid2           = "RewardItem" + i;
             RewardComponentTag rewardComponentTag = rewardComponents[i];
             UXElement          item2       = this.rewardsGrid.CloneTemplateItem(itemUid2);
             UXLabel            subElement3 = this.rewardsGrid.GetSubElement <UXLabel>(itemUid2, "LabelMissionReward");
             subElement3.Text = base.LangController.Get("CURRENCY_VALUE_NAME", new object[]
             {
                 rewardComponentTag.Quantity,
                 rewardComponentTag.RewardName
             });
             UXSprite subElement4 = this.rewardsGrid.GetSubElement <UXSprite>(itemUid2, "SpriteMissionReward");
             RewardUtils.SetRewardIcon(subElement4, rewardComponentTag.RewardGeometryConfig, AnimationPreference.NoAnimation);
             this.rewardsGrid.AddItem(item2, i);
             i++;
         }
     }
     this.rewardsGrid.RepositionItems();
     this.rewardsGrid.Scroll(0.5f);
 }
        private void UpdateElements()
        {
            IDataController dataController = Service.Get <IDataController>();

            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.ConfirmationString, new object[0]);
                int i     = 0;
                int count = this.currentOffer.RewardUIDs.Count;
                while (i < count)
                {
                    RewardVO rewardVO = dataController.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.NoAnimation);
                            j++;
                        }
                    }
                    i++;
                }
                this.confirmButton.Tag = this.currentOffer;
            }
        }
Exemplo n.º 4
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");
            }
        }