Exemplo n.º 1
0
        private void SetupItemGrid()
        {
            this.itemGrid = base.GetElement <UXGrid>("UnlockItemsGrid");
            this.itemGrid.SetTemplateItem("UnlockItemsTemplate");
            BuildingLookupController         buildingLookupController = Service.BuildingLookupController;
            Dictionary <BuildingTypeVO, int> buildingsUnlockedBy      = buildingLookupController.GetBuildingsUnlockedBy(this.headQuarter);
            int num = 0;

            foreach (KeyValuePair <BuildingTypeVO, int> current in buildingsUnlockedBy)
            {
                BuildingTypeVO key   = current.Key;
                int            value = current.Value;
                if (key.Type == BuildingType.Turret && key.BuildingRequirement != this.headQuarter.Uid)
                {
                    if (num == 0)
                    {
                        num = value;
                    }
                }
                else
                {
                    string          uid             = key.Uid;
                    UXElement       item            = this.itemGrid.CloneTemplateItem(uid);
                    UXSprite        subElement      = this.itemGrid.GetSubElement <UXSprite>(uid, "SpriteItemImage");
                    ProjectorConfig projectorConfig = ProjectorUtils.GenerateBuildingConfig(key, subElement);
                    projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred;
                    ProjectorUtils.GenerateProjector(projectorConfig);
                    UXLabel subElement2 = this.itemGrid.GetSubElement <UXLabel>(uid, "LabelUnlockCount");
                    if (key.Type == BuildingType.Turret)
                    {
                        subElement2.Visible = false;
                    }
                    else
                    {
                        subElement2.Text = this.lang.Get("TROOP_MULTIPLIER", new object[]
                        {
                            value
                        });
                    }
                    this.itemGrid.AddItem(item, key.Order);
                }
            }
            UXElement item2       = this.itemGrid.CloneTemplateItem("TURRETS");
            UXSprite  subElement3 = this.itemGrid.GetSubElement <UXSprite>("TURRETS", "SpriteItemImage");

            subElement3.Visible = false;
            UXLabel subElement4 = this.itemGrid.GetSubElement <UXLabel>("TURRETS", "LabelUnlockCount");

            subElement4.Visible = false;
            UXLabel subElement5 = this.itemGrid.GetSubElement <UXLabel>("TURRETS", "LabelTurrets");

            subElement5.Visible = true;
            subElement5.Text    = this.lang.Get("HQ_UPGRADE_TURRETS_UNLOCKED", new object[]
            {
                num
            });
            this.itemGrid.AddItem(item2, 99999999);
            this.itemGrid.RepositionItems();
            this.itemGrid.Scroll((this.itemGrid.Count <= 7) ? 0.5f : 0f);
        }
Exemplo n.º 2
0
        protected override void InitImages()
        {
            IGeometryVO     imageGeometryConfig = this.GetImageGeometryConfig();
            ProjectorConfig config = ProjectorUtils.GenerateBuildingConfig(imageGeometryConfig as BuildingTypeVO, base.GetElement <UXSprite>("BldgImageBottomFrame"));

            this.projector = ProjectorUtils.GenerateProjector(config);
            base.GetElement <UXSprite>("SpriteSquadSymbol").Visible = false;
        }
Exemplo n.º 3
0
        private void SetupProjectorWithUpdatedConfig(IGeometryVO geometryVO)
        {
            UXSprite frameSprite = this.projector.Config.FrameSprite;

            this.projector.Destroy();
            ProjectorConfig config = ProjectorUtils.GenerateBuildingConfig(geometryVO as BuildingTypeVO, frameSprite);

            this.projector = ProjectorUtils.GenerateProjector(config);
        }
Exemplo n.º 4
0
        protected virtual void InitImages()
        {
            IGeometryVO     imageGeometryConfig = this.GetImageGeometryConfig();
            UXSprite        element             = base.GetElement <UXSprite>((!this.useStorageGroup) ? "BldgImageFrame" : "BldgImageFrameStorage");
            ProjectorConfig projectorConfig     = ProjectorUtils.GenerateBuildingConfig(imageGeometryConfig as BuildingTypeVO, element);

            projectorConfig.AnimPreference = AnimationPreference.AnimationAlways;
            this.projector = ProjectorUtils.GenerateProjector(projectorConfig);
            base.GetElement <UXSprite>("SpriteSquadSymbol").Visible = false;
        }
Exemplo n.º 5
0
        private void CreateBuildingTrayItem(BuildingTypeVO vo, int count)
        {
            UXElement  uXElement  = this.stashedBuildingsGrid.CloneTemplateItem(vo.Uid);
            UXCheckbox subElement = this.stashedBuildingsGrid.GetSubElement <UXCheckbox>(vo.Uid, "CheckboxStash");

            subElement.Tag        = vo.Uid;
            subElement.OnSelected = new UXCheckboxSelectedDelegate(this.OnStashedBuildingClicked);
            subElement.Selected   = false;
            uXElement.Tag         = vo;
            UXLabel subElement2 = this.stashedBuildingsGrid.GetSubElement <UXLabel>(vo.Uid, "LabelQuantityStash");

            subElement2.Tag  = vo.Uid;
            subElement2.Text = count.ToString();
            UXLabel subElement3 = this.stashedBuildingsGrid.GetSubElement <UXLabel>(vo.Uid, "LabelBldgLevelStash");

            subElement3.Text = LangUtils.GetLevelText(vo.Lvl);
            UXSprite        subElement4     = this.stashedBuildingsGrid.GetSubElement <UXSprite>(vo.Uid, "SpriteBldgStash");
            ProjectorConfig projectorConfig = ProjectorUtils.GenerateBuildingConfig(vo, subElement4);

            projectorConfig.AnimPreference = AnimationPreference.NoAnimation;
            ProjectorUtils.GenerateProjector(projectorConfig);
            this.stashedBuildingsGrid.AddItem(uXElement, vo.Lvl + vo.StashOrder);
        }
Exemplo n.º 6
0
        private void SetupGrid()
        {
            if (this.itemGrid != null)
            {
                return;
            }
            this.itemGrid = base.GetElement <UXGrid>("SwapTypeGrid");
            this.itemGrid.SetTemplateItem("SwapTypeTemplate");
            CurrentPlayer          currentPlayer          = Service.CurrentPlayer;
            FactionType            faction                = currentPlayer.Faction;
            StaticDataController   staticDataController   = Service.StaticDataController;
            BuildingUpgradeCatalog buildingUpgradeCatalog = Service.BuildingUpgradeCatalog;
            UnlockController       unlockController       = Service.UnlockController;

            foreach (BuildingTypeVO current in staticDataController.GetAll <BuildingTypeVO>())
            {
                if (current.Type == BuildingType.Turret && current.Faction == faction && current.StoreTab != StoreTab.NotInStore)
                {
                    BuildingTypeVO byLevel        = buildingUpgradeCatalog.GetByLevel(current.UpgradeGroup, this.buildingInfo.Lvl);
                    BuildingTypeVO buildingTypeVO = null;
                    bool           flag           = unlockController.IsUnlocked(current, 1, out buildingTypeVO);
                    if (flag || !byLevel.HideIfLocked)
                    {
                        StoreItemTag storeItemTag = new StoreItemTag();
                        storeItemTag.BuildingInfo = byLevel;
                        string    uid       = byLevel.Uid;
                        UXElement uXElement = this.itemGrid.CloneTemplateItem(uid);
                        uXElement.Tag            = storeItemTag;
                        storeItemTag.MainElement = this.itemGrid.GetSubElement <UXElement>(uid, "ItemInfoTurret");
                        UXLabel subElement = this.itemGrid.GetSubElement <UXLabel>(uid, "LabelItemInfoTurret");
                        subElement.Text                  = LangUtils.GetBuildingDescription(byLevel);
                        storeItemTag.InfoGroup           = this.itemGrid.GetSubElement <UXButton>(uid, "InfoTextTurret");
                        storeItemTag.InfoGroup.Visible   = false;
                        storeItemTag.InfoGroup.OnClicked = new UXButtonClickedDelegate(this.OnSwapInfoLabelButtonClicked);
                        storeItemTag.InfoGroup.Tag       = storeItemTag;
                        UXButton subElement2 = this.itemGrid.GetSubElement <UXButton>(uid, "BtnItemInfoTurret");
                        subElement2.OnClicked = new UXButtonClickedDelegate(this.OnSwapInfoButtonClicked);
                        subElement2.Tag       = storeItemTag;
                        UXSprite        subElement3     = this.itemGrid.GetSubElement <UXSprite>(uid, "SpriteItemImageTurret");
                        ProjectorConfig projectorConfig = ProjectorUtils.GenerateBuildingConfig(byLevel, subElement3);
                        projectorConfig.AnimPreference = AnimationPreference.NoAnimation;
                        ProjectorUtils.GenerateProjector(projectorConfig);
                        UXLabel subElement4 = this.itemGrid.GetSubElement <UXLabel>(uid, "LabelItemRequirement");
                        subElement4.Visible = !flag;
                        UXElement subElement5 = this.itemGrid.GetSubElement <UXElement>(uid, "CountAndBuildTime");
                        subElement5.Visible = flag;
                        if (flag)
                        {
                            int swapCredits    = byLevel.SwapCredits;
                            int swapMaterials  = byLevel.SwapMaterials;
                            int swapContraband = byLevel.SwapContraband;
                            UXUtils.SetupCostElements(this, "CostTurretSwap", uid, swapCredits, swapMaterials, swapContraband, 0, !flag, null, 150);
                            UXLabel subElement6 = this.itemGrid.GetSubElement <UXLabel>(uid, "LabelBuildTime");
                            subElement6.Text = GameUtils.GetTimeLabelFromSeconds(byLevel.SwapTime);
                            UXLabel subElement7 = this.itemGrid.GetSubElement <UXLabel>(uid, "LabelSwapItemCount");
                            subElement7.Text = string.Empty;
                        }
                        else if (buildingTypeVO != null)
                        {
                            subElement4.Text = this.lang.Get("BUILDING_REQUIREMENT", new object[]
                            {
                                buildingTypeVO.Lvl,
                                LangUtils.GetBuildingDisplayName(buildingTypeVO)
                            });
                            UXUtils.SetupCostElements(this, "CostTurretSwap", uid, 0, 0, 0, 0, !flag, this.lang.Get("s_Locked", new object[0]), 150);
                        }
                        UXCheckbox subElement8 = this.itemGrid.GetSubElement <UXCheckbox>(uid, "TurretItemCard");
                        subElement8.Enabled    = flag;
                        subElement8.OnSelected = new UXCheckboxSelectedDelegate(this.OnSwapItemCheckboxSelected);
                        subElement8.Selected   = (byLevel.Uid == this.buildingInfo.Uid);
                        subElement8.Tag        = storeItemTag;
                        if (subElement8.Selected)
                        {
                            this.OnSwapItemCheckboxSelected(subElement8, true);
                        }
                        this.itemGrid.AddItem(uXElement, byLevel.Order);
                    }
                }
            }
            this.itemGrid.RepositionItems();
        }