Exemplo n.º 1
0
        public void Render(ShardShopViewTO vto, bool shouldShowProgressLerp)
        {
            bool flag  = this.vto == null || this.vto.SupplyVO != vto.SupplyVO;
            bool flag2 = this.vto != null && !this.vto.ValueEquals(vto);

            if (flag2)
            {
                this.previousShardsEarned = this.vto.UpgradeShardsEarned;
            }
            this.vto = vto;
            if (flag)
            {
                IGeometryVO     iconVOFromCrateSupply = GameUtils.GetIconVOFromCrateSupply(vto.SupplyVO, vto.PlayerHQLevel);
                ProjectorConfig config = ProjectorUtils.GenerateGeometryConfig(iconVOFromCrateSupply, this.iconSprite);
                this.projector = ProjectorUtils.GenerateProjector(config);
            }
            int upgradeShardsEarned   = vto.UpgradeShardsEarned;
            int upgradeShardsRequired = vto.UpgradeShardsRequired;

            this.quantityCounter.Text = vto.RemainingShardsForSale.ToString();
            this.bodyText.Text        = this.lang.Get("shard_shop_shards_remaining", new object[]
            {
                vto.ItemName
            });
            this.purchaseSingleDescLabel.Text    = this.lang.Get("shard_shop_buy_single", new object[0]);
            this.purchaseAllDescLabel.Text       = this.lang.Get("shard_shop_buy_all", new object[0]);
            this.nextProgressBarValue            = this.GetProgessBarValue(upgradeShardsEarned, upgradeShardsRequired);
            this.previousProgressBarValue        = this.GetProgessBarValue(this.previousShardsEarned, upgradeShardsRequired);
            this.iconDeltaShardProgressBar.Value = this.nextProgressBarValue;
            if (!shouldShowProgressLerp)
            {
                this.isProgressBarLerping           = false;
                this.iconProgressLabel.Text         = upgradeShardsEarned + "/" + upgradeShardsRequired;
                this.iconBaseShardProgressBar.Value = this.nextProgressBarValue;
            }
            else if (flag2)
            {
                this.progressLerpTimer              = 0f;
                this.isProgressBarLerping           = true;
                this.iconProgressLabel.Text         = this.previousShardsEarned + "/" + upgradeShardsRequired;
                this.iconBaseShardProgressBar.Value = this.previousProgressBarValue;
                Service.ViewTimeEngine.RegisterFrameTimeObserver(this);
            }
            SupplyType type = vto.SupplyVO.Type;

            if (type != SupplyType.Shard)
            {
                if (type == SupplyType.ShardTroop || type == SupplyType.ShardSpecialAttack)
                {
                    this.titleText.Text = this.lang.Get("shard_shop_buy_unit_shards", new object[0]);
                }
            }
            else
            {
                this.titleText.Text = this.lang.Get("shard_shop_buy_equipment_shards", new object[0]);
            }
            if (vto.RemainingShardsForSale > 0)
            {
                UXUtils.SetupSingleResourceUI(vto.CostOfNextShard, this.purchaseSingleLabel, this.purchaseSingleSprite);
                UXUtils.SetupSingleResourceUI(vto.CostOfAllShards, this.purchaseAllLabel, this.purchaseAllSprite);
            }
            this.returnBtn.Visible         = (vto.RemainingShardsForSale == 0);
            this.purchaseSingleBtn.Visible = (vto.RemainingShardsForSale > 0);
            this.purchaseAllBtn.Visible    = (vto.RemainingShardsForSale > 0);
            this.parent.RevertToOriginalNameRecursively(this.icon.Root, "ModalIcon");
            Service.Engine.StartCoroutine(this.SetAnimatorState());
        }