Esempio n. 1
0
        private UXElement CreateInactiveCard(UXGrid grid, EquipmentVO equipment, CurrentPlayer currentPlayer)
        {
            UXElement uXElement = this.CreateCommonEquipmentCard(grid, equipment, "LabelEquipmentName", "LabelEquipmentLevel", "SpriteEquipmentItemImage", "EquipmentItemCardQ{0}", false, true);

            (uXElement.Tag as SortableEquipment).Player = currentPlayer;
            UXButton subElement = this.inactiveGrid.GetSubElement <UXButton>(equipment.Uid, "BtnEquipmentInfo");

            subElement.OnClicked = new UXButtonClickedDelegate(this.OnInfoButtonClicked);
            subElement.Tag       = equipment;
            UXButton subElement2 = this.inactiveGrid.GetSubElement <UXButton>(equipment.Uid, "BtnEquipmentItemCard");

            subElement2.OnClicked = new UXButtonClickedDelegate(this.OnCardButtonClicked);
            subElement2.Tag       = uXElement;
            EquipmentUpgradeCatalog equipmentUpgradeCatalog = Service.EquipmentUpgradeCatalog;
            UXSlider  subElement3 = this.inactiveGrid.GetSubElement <UXSlider>(equipment.Uid, "pBarEquipmentItemFrag");
            UXSprite  subElement4 = this.inactiveGrid.GetSubElement <UXSprite>(equipment.Uid, "SpriteEquipmentItempBarFrag");
            UXLabel   subElement5 = grid.GetSubElement <UXLabel>(equipment.Uid, "LabelFragProgress");
            UXElement subElement6 = this.inactiveGrid.GetSubElement <UXElement>(equipment.Uid, "IconUpgrade");
            UXSprite  subElement7 = grid.GetSubElement <UXSprite>(equipment.Uid, "SpriteEquipmentImageBkgStroke");
            UXSprite  subElement8 = grid.GetSubElement <UXSprite>(equipment.Uid, "SpriteEquipmentItemBarOutline");
            UXSprite  subElement9 = grid.GetSubElement <UXSprite>(equipment.Uid, "SpriteEquipmentImageBkgGlow");

            subElement7.Color = ArmoryScreen.qualityColor[equipment.Quality];
            subElement8.Color = ArmoryScreen.qualityColor[equipment.Quality];
            subElement9.Color = ArmoryScreen.qualityColor[equipment.Quality];
            subElement9.Alpha = 0.4f;
            float    sliderProgressValue = this.GetSliderProgressValue(equipment, currentPlayer.GetShards(equipment.EquipmentID));
            UXSprite subElement10        = this.inactiveGrid.GetSubElement <UXSprite>(equipment.Uid, "SpriteIconFragment");

            UXUtils.SetupFragmentIconSprite(subElement10, (int)equipment.Quality);
            UXUtils.SetShardProgressBarValue(subElement3, subElement4, sliderProgressValue);
            subElement6.Visible = false;
            if (ArmoryUtils.IsAtMaxLevel(equipmentUpgradeCatalog, equipment))
            {
                subElement5.Text = this.lang.Get("MAX_LEVEL", new object[0]);
            }
            else
            {
                int shards = currentPlayer.GetShards(equipment.EquipmentID);
                int shardsRequiredForNextUpgrade = ArmoryUtils.GetShardsRequiredForNextUpgrade(currentPlayer, equipmentUpgradeCatalog, equipment);
                if (shards >= shardsRequiredForNextUpgrade)
                {
                    subElement5.Text = this.lang.Get("ARMORY_UPGRADE_NOW", new object[0]);
                }
                else
                {
                    subElement5.Text = this.lang.Get("OBJECTIVE_PROGRESS", new object[]
                    {
                        shards,
                        shardsRequiredForNextUpgrade
                    });
                }
            }
            if (ArmoryUtils.IsEquipmentOwned(currentPlayer, equipment))
            {
                EquipmentVO nextLevel = equipmentUpgradeCatalog.GetNextLevel(equipment);
                if (nextLevel != null)
                {
                    if (Service.ISupportController.FindFirstContractWithProductUid(nextLevel.Uid) != null)
                    {
                        subElement5.Visible = false;
                        subElement3.Visible = false;
                    }
                    else if (currentPlayer.GetShards(equipment.EquipmentID) >= nextLevel.UpgradeShards)
                    {
                        subElement6.Visible = true;
                    }
                }
            }
            this.SetDimmerBasedOnRequirements(currentPlayer, equipment);
            return(uXElement);
        }