コード例 #1
0
 private void SetupCurrencyCostOffer(TargetedBundleVO currentOffer)
 {
     this.purchaseIAPButtonLabel.Visible          = false;
     this.purchaseWithCurrencySprite.Visible      = true;
     this.purchaseWithCurrencyButtonLabel.Visible = true;
     UXUtils.SetupTargetedOfferCostUI(currentOffer, this.purchaseWithCurrencyButtonLabel, this.purchaseWithCurrencySprite);
 }
コード例 #2
0
        private void InitCTAUI()
        {
            this.crateInfoCTAButton         = base.GetElement <UXButton>("BtnCrateInfoCTA");
            this.crateInfoPayButton         = base.GetElement <UXButton>("BtnCrateInfoPay");
            this.crateInfoPayButton.Visible = false;
            this.crateInfoCTAButton.Visible = false;
            this.btnCurrencyLabel.Visible   = false;
            this.btnCurrencySprite.Visible  = false;
            bool     flag     = this.targetCrateVO.Purchasable && CrateUtils.IsVisibleInStore(this.targetCrateVO) && CrateUtils.IsPurchasableInStore(this.targetCrateVO);
            UXLabel  element  = base.GetElement <UXLabel>("LabelPurchase");
            UXSprite element2 = base.GetElement <UXSprite>("PurchaseCostCrystal");
            UXLabel  element3 = base.GetElement <UXLabel>("PurchaseCostLabel");
            UXLabel  element4 = base.GetElement <UXLabel>("LabelBtnPayCentered");

            if (this.ModalReason == CrateInfoReason.Reason_Targeted_Offer)
            {
                element.Visible  = false;
                element2.Visible = true;
                element3.Visible = true;
                element4.Visible = false;
                this.crateInfoPayButton.Visible = true;
                this.btnCurrencyLabel.Visible   = false;
                this.btnCurrencySprite.Visible  = false;
                if (this.CurrentOffer != null)
                {
                    this.crateInfoPayButton.OnClicked = new UXButtonClickedDelegate(this.OnTargetedOfferPurchaseClicked);
                    string[] cost = this.CurrentOffer.Cost;
                    if (cost != null && cost.Length != 0)
                    {
                        element.Visible = true;
                        element.Text    = this.lang.Get("CRATE_FLYOUT_STORE_OPEN_CTA", new object[0]);
                        UXUtils.SetupTargetedOfferCostUI(this.CurrentOffer, element3, element2);
                        return;
                    }
                    if (this.CurrentOffer.LinkedIAPs.Count <= 0)
                    {
                        Service.Get <StaRTSLogger>().Error("CrateModalInfoScreen::InitCTAUI No Cost on Offer: " + this.CurrentOffer.Uid);
                        return;
                    }
                    this.btnCurrencySprite.Visible = false;
                    this.currentIapId    = null;
                    this.currentRealCost = null;
                    if (!Service.Get <TargetedBundleController>().FindAvailableIAP(this.CurrentOffer, out this.currentIapId, out this.currentRealCost))
                    {
                        this.discountGroup.Visible      = false;
                        this.crateInfoPayButton.Visible = false;
                        this.btnCurrencyLabel.Visible   = false;
                        Service.Get <StaRTSLogger>().Error("CrateModalInfoScreen::InitCTAUI LinkedIAP invalid on Offer: " + this.CurrentOffer.Uid);
                        return;
                    }
                    element4.Text = this.lang.Get("TARGETED_BUNDLE_PURCHASE", new object[]
                    {
                        this.currentRealCost
                    });
                    element4.Visible = true;
                    element2.Visible = false;
                    element3.Visible = false;
                    return;
                }
            }
            else if (this.ModalReason == CrateInfoReason.Reason_Store_Buy && (flag || this.targetLEIVO != null))
            {
                this.crateInfoPayButton.Visible   = true;
                this.crateInfoPayButton.OnClicked = new UXButtonClickedDelegate(this.OnCrateInfoPayButtonClicked);
                element.Text     = this.lang.Get("CRATE_FLYOUT_STORE_OPEN_CTA", new object[0]);
                element4.Visible = false;
                int           num           = (this.targetLEIVO == null) ? this.targetCrateVO.Crystals : this.targetLEIVO.Crystals;
                CurrentPlayer currentPlayer = Service.Get <CurrentPlayer>();
                if (currentPlayer.ArmoryInfo.FirstCratePurchased || this.targetLEIVO != null)
                {
                    element3.Text = this.lang.ThousandsSeparated(num);
                    UXUtils.UpdateCostColor(element3, null, 0, 0, 0, num, 0, false);
                    element2.Visible = true;
                    return;
                }
                element4.Text    = this.lang.Get("CRATE_FLYOUT_STORE_OPEN_CTA", new object[0]);
                element4.Visible = true;
                element.Visible  = false;
                element3.Visible = false;
                element2.Visible = false;
                return;
            }
            else if (this.ModalReason == CrateInfoReason.Reason_Inventory_Open && this.crateData != null)
            {
                this.crateInfoCTAButton.Visible   = true;
                this.crateInfoCTAButton.OnClicked = new UXButtonClickedDelegate(this.OnCrateInfoCTAButtonClicked);
                UXLabel element5 = base.GetElement <UXLabel>("LabelBtnCrateInfoCTA");
                element5.Text = this.lang.Get("CRATE_FLYOUT_OPEN_CTA", new object[0]);
            }
        }