Example #1
0
 public override void OnDestroyElement()
 {
     Service.EventManager.UnregisterObserver(this, EventId.ContractCompleted);
     Service.EventManager.UnregisterObserver(this, EventId.InventoryUnlockUpdated);
     this.DisableTimers();
     if (this.troopGrid != null)
     {
         this.troopGrid.Clear();
         this.troopGrid = null;
     }
     if (this.equipmentGrid != null)
     {
         this.equipmentGrid.Clear();
         this.equipmentGrid = null;
     }
     if (this.filterHelper != null)
     {
         this.filterHelper.Destroy();
         this.filterHelper = null;
     }
     this.eligibleDeployables.Clear();
     this.eligibleDeployables = null;
     this.eligibleTroopTypes.Clear();
     this.eligibleTroopTypes = null;
     this.activeContract     = null;
     base.OnDestroyElement();
 }
Example #2
0
        private void ShowInstructionalTextOnFirstEmptyCard(UXGrid grid)
        {
            if (!this.ListHasEmptyFirstCard(grid))
            {
                return;
            }
            List <UXElement> elementList = grid.GetElementList();
            int num   = 500000;
            int i     = 0;
            int count = elementList.Count;

            while (i < count)
            {
                SortableEquipment sortableEquipment = elementList[i].Tag as SortableEquipment;
                if (sortableEquipment.EmptyIndex < num)
                {
                    num = sortableEquipment.EmptyIndex;
                }
                i++;
            }
            StringBuilder stringBuilder = new StringBuilder("EMPTY");
            string        itemUid       = stringBuilder.Append(num).ToString();
            UXLabel       subElement    = grid.GetSubElement <UXLabel>(itemUid, "LabelEquipmentActiveInstructions");

            subElement.Visible = true;
        }
Example #3
0
        private UXElement CreateActiveCard(UXGrid grid, EquipmentVO equipment, CurrentPlayer player)
        {
            UXElement         uXElement         = this.CreateCommonEquipmentCard(this.activeGrid, equipment, "LabelEquipmentActiveName", "LabelEquipmentActiveLevel", "SpriteEquipmentActiveItemImage", "EquipmentActiveItemCardQ{0}", true, false);
            SortableEquipment sortableEquipment = uXElement.Tag as SortableEquipment;

            sortableEquipment.IncrementingIndex = this.activeCardID++;
            UXLabel subElement = this.activeGrid.GetSubElement <UXLabel>(equipment.Uid, "LabelEquipmentActiveInstructions");

            subElement.Visible = false;
            UXButton subElement2 = this.activeGrid.GetSubElement <UXButton>(equipment.Uid, "BtnEquipmentActiveCancel");

            subElement2.OnClicked = new UXButtonClickedDelegate(this.OnCancelButtonClicked);
            subElement2.Tag       = uXElement;
            UXButton subElement3 = this.activeGrid.GetSubElement <UXButton>(equipment.Uid, "BtnEquipmentActiveItemCard");

            subElement3.Tag       = equipment;
            subElement3.OnClicked = new UXButtonClickedDelegate(this.OnActiveCardButtonClicked);
            UXSprite subElement4 = grid.GetSubElement <UXSprite>(equipment.Uid, "SpriteEquipmentActiveImageBkgStroke");
            UXSprite subElement5 = grid.GetSubElement <UXSprite>(equipment.Uid, "SpriteEquipmentActiveImageBkgGlow");

            subElement4.Color = ArmoryScreen.qualityColor[equipment.Quality];
            subElement5.Color = ArmoryScreen.qualityColor[equipment.Quality];
            subElement5.Alpha = 0.4f;
            this.activeGrid.GetSubElement <UXSprite>(equipment.Uid, "SpriteEquipmentActiveImageEmptySlot").Visible = false;
            return(uXElement);
        }
Example #4
0
        private UXElement CreateEmptyCardInternal(UXGrid grid, string index)
        {
            UXElement uXElement = grid.CloneTemplateItem(index);

            uXElement.Tag = new SortableEquipment(null);
            UXButton subElement = grid.GetSubElement <UXButton>(index, "BtnEquipmentActiveItemCard");

            subElement.Enabled = false;
            UXLabel subElement2 = grid.GetSubElement <UXLabel>(index, "LabelEquipmentActiveName");

            subElement2.Visible = false;
            UXLabel subElement3 = this.activeGrid.GetSubElement <UXLabel>(index, "LabelEquipmentActiveInstructions");

            subElement3.Visible = false;
            UXLabel subElement4 = grid.GetSubElement <UXLabel>(index, "LabelEquipmentActiveLevel");

            subElement4.Visible = false;
            UXSprite subElement5 = grid.GetSubElement <UXSprite>(index, "SpriteEquipmentActiveItemImage");

            subElement5.Visible = false;
            UXButton subElement6 = grid.GetSubElement <UXButton>(index, "BtnEquipmentActiveCancel");

            subElement6.Visible = false;
            UXUtils.HideGridQualityCards(grid, index, "EquipmentActiveItemCardQ{0}");
            grid.GetSubElement <UXSprite>(index, "SpriteEquipmentActiveImageBkg").Visible       = false;
            grid.GetSubElement <UXSprite>(index, "SpriteEquipmentActiveGradientBottom").Visible = false;
            grid.GetSubElement <UXSprite>(index, "SpriteEquipmentActiveImageBkgGlow").Visible   = false;
            grid.GetSubElement <UXSprite>(index, "SpriteEquipmentActiveImageBkgStroke").Visible = false;
            return(uXElement);
        }
        private void InitUnlockItemGrid()
        {
            this.buildingLookupController = Service.Get <BuildingLookupController>();
            this.unlockGrid = base.GetElement <UXGrid>("BuildingUnlockGrid");
            this.unlockGrid.SetTemplateItem("BuildingUnlockTemplate");
            BuildingType type = this.nextBuildingInfo.Type;

            switch (type)
            {
            case BuildingType.Barracks:
            case BuildingType.Factory:
            case BuildingType.HeroMobilizer:
                break;

            case BuildingType.FleetCommand:
                this.InitStarshipUnlockGrid();
                goto IL_64;

            default:
                if (type != BuildingType.Cantina)
                {
                    goto IL_64;
                }
                break;
            }
            this.InitTroopUnlockGrid();
IL_64:
            if (this.unlockGrid.Count > 0)
            {
                this.unlockGrid.RepositionItems();
                this.unlockGrid.Scroll((this.unlockGrid.Count > 7) ? 0f : 0.5f);
                return;
            }
            base.GetElement <UXElement>("UnlockItems").Visible = false;
        }
Example #6
0
        public static void HideGridQualityCards(UXGrid grid, string itemUid, string cardName)
        {
            IEnumerator enumerator = Enum.GetValues(typeof(ShardQuality)).GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    int       num  = (int)enumerator.Current;
                    string    name = string.Format(cardName, num);
                    UXElement optionalSubElement = grid.GetOptionalSubElement <UXElement>(itemUid, name);
                    if (optionalSubElement != null)
                    {
                        optionalSubElement.Visible = false;
                    }
                }
            }
            finally
            {
                IDisposable disposable;
                if ((disposable = (enumerator as IDisposable)) != null)
                {
                    disposable.Dispose();
                }
            }
        }
Example #7
0
        protected UXElement FetchPerkGridItem(UXGrid perkGrid, string itemUid)
        {
            UXElement uXElement = null;

            if (perkGrid != null)
            {
                int i     = 0;
                int count = perkGrid.Count;
                while (i < count)
                {
                    UXElement item = perkGrid.GetItem(i);
                    if (item.Root.name.Contains(itemUid))
                    {
                        uXElement = item;
                        uXElement.SetRootName(itemUid);
                        break;
                    }
                    i++;
                }
            }
            if (uXElement == null)
            {
                uXElement = perkGrid.CloneTemplateItem(itemUid);
            }
            return(uXElement);
        }
Example #8
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);
        }
Example #9
0
 private void InitElements()
 {
     this.perksGrid = base.GetElement <UXGrid>("GridModalActivePerks");
     this.perksGrid.SetTemplateItem("TemplateModalActivePerks");
     this.perksGrid.Clear();
     this.InitializePerksGrid();
 }
Example #10
0
 public override void OnDestroyElement()
 {
     base.OnDestroyElement();
     Service.ViewTimeEngine.UnregisterClockTimeObserver(this);
     this.perksGrid.Clear();
     this.perksGrid = null;
 }
Example #11
0
 protected void InitGrid()
 {
     this.storageItemGrid = base.GetElement <UXGrid>("StorageItemsGrid");
     this.storageItemGrid.SetTemplateItem("StorageItemsTemplate");
     this.storageItemGrid.Clear();
     this.troopList = new List <TroopUpgradeTag>();
 }
 public override void OnDestroyElement()
 {
     this.UnregisterClockTimeObserver();
     this.UnregisterEvents();
     if (this.activePerkTimerLabels != null)
     {
         this.activePerkTimerLabels.Clear();
         this.activePerkTimerLabels = null;
     }
     if (this.cooldownTimerLabels != null)
     {
         this.cooldownTimerLabels.Clear();
         this.cooldownTimerLabels = null;
     }
     if (this.cooldownCostLabels != null)
     {
         this.cooldownCostLabels.Clear();
         this.cooldownCostLabels = null;
     }
     if (this.activePerksGrid != null)
     {
         this.activePerksGrid.Clear();
         this.activePerksGrid = null;
     }
     if (this.perksGrid != null)
     {
         this.perksGrid.Clear();
         this.perksGrid = null;
     }
     this.CleanUpActivationInfoView();
     base.OnDestroyElement();
 }
Example #13
0
        private void PopulateAvailablePlanetsPanel(StaticDataController sdc)
        {
            UXElement element = base.GetElement <UXElement>("PanelPlanetAvailability");

            element.Visible = true;
            base.GetElement <UXLabel>("LabelPlanetAvailability").Text = this.lang.Get("RESEARCH_LAB_ACTIVE_PLANETS", new object[0]);
            UXGrid element2 = base.GetElement <UXGrid>("GridPlanetAvailability");

            element2.SetTemplateItem("TemplatePlanet");
            element2.Clear();
            int i   = 0;
            int num = this.selectedEquipment.PlanetIDs.Length;

            while (i < num)
            {
                string    uid      = this.selectedEquipment.PlanetIDs[i];
                PlanetVO  planetVO = sdc.Get <PlanetVO>(uid);
                UXElement item     = element2.CloneTemplateItem(planetVO.Uid);
                element2.AddItem(item, planetVO.Order);
                element2.GetSubElement <UXLabel>(planetVO.Uid, "LabelAvailablePlanet").Text = LangUtils.GetPlanetDisplayName(uid);
                element2.GetSubElement <UXTexture>(planetVO.Uid, "TextureAvailablePlanet").LoadTexture(planetVO.LeaderboardButtonTexture);
                i++;
            }
            element2.RepositionItemsFrameDelayed();
        }
Example #14
0
 public static void SquadMemberElementsSetup(UXGrid grid, SquadMemberElements elements, string id)
 {
     elements.ButtonContainer         = grid.GetSubElement <UXElement>(id, "ButtonContainer");
     elements.ButtonOne               = grid.GetSubElement <UXButton>(id, "Btn1");
     elements.ButtonOneLabel          = grid.GetSubElement <UXLabel>(id, "LabelBtn1");
     elements.ButtonTwo               = grid.GetSubElement <UXButton>(id, "Btn2");
     elements.ButtonTwoLabel          = grid.GetSubElement <UXLabel>(id, "LabelBtn2");
     elements.ButtonThree             = grid.GetSubElement <UXButton>(id, "Btn3");
     elements.ButtonThreeLabel        = grid.GetSubElement <UXLabel>(id, "LabelBtn3");
     elements.MemberInfoGroup         = grid.GetSubElement <UXElement>(id, "MemberInfo");
     elements.MemberNameLabel         = grid.GetSubElement <UXLabel>(id, "LabelMemberName");
     elements.MemberRankLabel         = grid.GetSubElement <UXLabel>(id, "LabelMemberRank");
     elements.MemberRoleLabel         = grid.GetSubElement <UXLabel>(id, "LabelMemberRole");
     elements.MemberScoreLabel        = grid.GetSubElement <UXLabel>(id, "LabelMemberScore");
     elements.TroopsDonatedLabel      = grid.GetSubElement <UXLabel>(id, "LabelTroopsDonated");
     elements.TroopsReceivedLabel     = grid.GetSubElement <UXLabel>(id, "LabelTroopsReceived");
     elements.RepInvestedLabel        = grid.GetSubElement <UXLabel>(id, "LabelMemberRepAmt");
     elements.VictoriesLabel          = grid.GetSubElement <UXLabel>(id, "LabelVictories");
     elements.TroopsLabel             = grid.GetSubElement <UXLabel>(id, "LabelTroops");
     elements.AttacksWonLabel         = grid.GetSubElement <UXLabel>(id, "LabelAttacksWon");
     elements.DefensesWonLabel        = grid.GetSubElement <UXLabel>(id, "LabelDefensesWon");
     elements.LastLoginTimeLabel      = grid.GetSubElement <UXLabel>(id, "LabelMemberLastLogin");
     elements.ConflictMedalsGroup     = grid.GetSubElement <UXElement>(id, "MedalInfo");
     elements.TournamentScoreLabel1   = grid.GetSubElement <UXLabel>(id, "LabelMemberTournamentScore01");
     elements.TournamentScoreSprite1  = grid.GetSubElement <UXSprite>(id, "SpriteMemberTournamentMedalIcon01");
     elements.TournamentScoreLabel2   = grid.GetSubElement <UXLabel>(id, "LabelMemberTournamentScore02");
     elements.TournamentScoreSprite2  = grid.GetSubElement <UXSprite>(id, "SpriteMemberTournamentMedalIcon02");
     elements.TournamentScoreLabel3   = grid.GetSubElement <UXLabel>(id, "LabelMemberTournamentScore03");
     elements.TournamentScoreSprite3  = grid.GetSubElement <UXSprite>(id, "SpriteMemberTournamentMedalIcon03");
     elements.PlanetBackgroundTexture = grid.GetSubElement <UXTexture>(id, "TexturePlanetBg");
     elements.GroupMemberSelect       = grid.GetSubElement <UXElement>(id, "BtnSelectMember");
     elements.SpriteMemberSelect      = grid.GetSubElement <UXSprite>(id, "SpriteCheckBtnSelectMember");
     elements.SpriteMoreOptions       = grid.GetSubElement <UXSprite>(id, "SpriteMoreOptions");
     elements.SpriteWarIcon           = grid.GetSubElement <UXSprite>(id, "SpriteWarIcon");
 }
Example #15
0
 public override void OnDestroyElement()
 {
     if (this.projector != null)
     {
         this.projector.Destroy();
         this.projector = null;
     }
     if (this.observingClockViewTime)
     {
         this.observingClockViewTime = false;
         Service.ViewTimeEngine.UnregisterClockTimeObserver(this);
     }
     if (this.sliders != null)
     {
         for (int i = 0; i < 6; i++)
         {
             this.sliders[i] = null;
         }
     }
     if (this.storageItemGrid != null)
     {
         this.storageItemGrid.Clear();
         this.storageItemGrid = null;
     }
     this.troopTooltipHelper.Destroy();
     this.troopTooltipHelper = null;
     this.troopList          = null;
     base.OnDestroyElement();
 }
        private void InitFeaturedRewardsGrid()
        {
            this.rewardsGrid = base.GetElement <UXGrid>("RewardGrid");
            this.rewardsGrid.SetTemplateItem("RewardItemTemplate");
            InventoryCrateRewardController inventoryCrateRewardController = Service.Get <InventoryCrateRewardController>();
            List <PlanetLootEntryVO>       featuredLootEntriesForPlanet   = inventoryCrateRewardController.GetFeaturedLootEntriesForPlanet(this.currentPlanet);
            bool flag  = false;
            int  i     = 0;
            int  count = featuredLootEntriesForPlanet.Count;

            while (i < count)
            {
                this.AddFeaturedRewardItemToGrid(featuredLootEntriesForPlanet[i], i);
                if (this.DoesLootEntryHaveCountdown(featuredLootEntriesForPlanet[i]))
                {
                    flag = true;
                }
                i++;
            }
            this.rewardsGrid.RepositionItemsFrameDelayed(new UXDragDelegate(this.RewardsGridRepositionComplete));
            if (flag)
            {
                Service.Get <ViewTimeEngine>().RegisterClockTimeObserver(this, 1f);
            }
        }
Example #17
0
        public static void UpdateDeployableDecal(string itemUid, string name, UXGrid grid, IDeployableVO deployableVO)
        {
            string deployableDecalSpriteName = FactionDecal.GetDeployableDecalSpriteName(deployableVO);
            string name2 = UXUtils.FormatAppendedName("SpriteHeroDecal", name);

            FactionDecal.SetSpriteAndVisibility(grid.GetSubElement <UXSprite>(itemUid, name2), deployableDecalSpriteName);
        }
Example #18
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);
        }
        private void InitMissionGrid()
        {
            CampaignMissionVO        campaignMissionVO = null;
            List <CampaignMissionVO> list = new List <CampaignMissionVO>();

            foreach (CampaignMissionVO current in base.Sdc.GetAll <CampaignMissionVO>())
            {
                if (current.CampaignUid == this.selectedCampaign.Uid)
                {
                    list.Add(current);
                }
            }
            list.Sort(new Comparison <CampaignMissionVO>(PlanetDetailsMissionViewModule.CompareMissions));
            if (this.selectedCampaign.IsMiniCampaign())
            {
                this.missionGrid = this.screen.GetElement <UXGrid>("ObjectiveGridDifficulty");
                this.missionGrid.SetTemplateItem("ObjectiveTemplateDifficulty");
                this.screen.GetElement <UXGrid>("ObjectiveGrid").Visible = false;
            }
            else
            {
                this.missionGrid = this.screen.GetElement <UXGrid>("ObjectiveGrid");
                this.missionGrid.SetTemplateItem("ObjectiveTemplate");
                this.screen.GetElement <UXGrid>("ObjectiveGridDifficulty").Visible = false;
            }
            this.missionGrid.Clear();
            int i     = 0;
            int count = list.Count;

            while (i < count)
            {
                CampaignMissionVO campaignMissionVO2 = list[i];
                string            uid       = campaignMissionVO2.Uid;
                UXElement         uXElement = this.missionGrid.CloneTemplateItem(uid);
                this.missionGrid.AddItem(uXElement, i);
                this.UpdateMissionItem(uid, campaignMissionVO2, false);
                uXElement.Tag = campaignMissionVO2;
                if (!base.Player.CampaignProgress.IsMissionLocked(campaignMissionVO2) && (campaignMissionVO == null || campaignMissionVO2.UnlockOrder > campaignMissionVO.UnlockOrder))
                {
                    campaignMissionVO = campaignMissionVO2;
                }
                i++;
            }
            this.missionGrid.RepositionItems();
            int j      = 0;
            int count2 = this.missionGrid.Count;

            while (j < count2)
            {
                if (campaignMissionVO == (CampaignMissionVO)this.missionGrid.GetItem(j).Tag)
                {
                    this.missionSelectIndexOnFrameDelay = j;
                    Service.Get <ViewTimeEngine>().RegisterFrameTimeObserver(this);
                    break;
                }
                j++;
            }
            this.InitMissionDetailGroup();
        }
Example #20
0
 public void Destroy()
 {
     if (this.campaignGrid != null)
     {
         this.campaignGrid.Clear();
         this.campaignGrid = null;
     }
 }
Example #21
0
 private void InitUI()
 {
     this.tabTitle = this.screen.GetElement <UXLabel>("LabelTitleUpgradePerks");
     this.perkGrid = this.screen.GetElement <UXGrid>("GridUpPerks");
     base.InitFilterGrid("GridUpFilterPerks", "TemplateUpFilterPerks", "BtnUpFilterPerks", "LabelUpFilterPerks", this.perkGrid);
     this.InitViewLabels();
     this.InitPerkGrid();
 }
Example #22
0
        protected void EnableGridLoadHelper(GridLoadHelper gridLoadHelper, bool isEnabled)
        {
            UXGrid grid = gridLoadHelper.GetGrid();

            grid.Enabled       = isEnabled;
            grid.Visible       = isEnabled;
            grid.LocalPosition = ((!isEnabled) ? AbstractLeaderboardScreen.OFFSCREEN_GRID_POSITION : Vector3.zero);
        }
Example #23
0
 protected void InitFilterGrid(string filterGridName, string filterGridTemplateName, string filterGridButtonName, string filterGridLabelName, UXGrid gridToFilter)
 {
     this.gridToFilter         = gridToFilter;
     this.filterGridButtonName = filterGridButtonName;
     this.filterGridLabelName  = filterGridLabelName;
     this.filterGrid           = this.screen.GetElement <UXGrid>(filterGridName);
     this.filterGrid.SetTemplateItem(filterGridTemplateName);
 }
Example #24
0
        private void InitRewardsGrid()
        {
            this.rewardsGrid = base.GetElement <UXGrid>("GridRewardsList");
            this.rewardsGrid.SetTemplateItem("TemplateRewards");
            if (this.filteredFlyoutItems.Count == 0)
            {
                base.GetElement <UXElement>("PanelGroupRewardPreview").Visible = false;
                this.rewardsGrid.Visible       = false;
                this.labelRewardChance.Visible = false;
                return;
            }
            int i     = 0;
            int count = this.filteredFlyoutItems.Count;

            while (i < count)
            {
                CrateFlyoutItemVO crateFlyoutItemVO = this.filteredFlyoutItems[i];
                string            uid        = crateFlyoutItemVO.Uid;
                UXElement         uXElement  = this.rewardsGrid.CloneTemplateItem(uid);
                UXLabel           subElement = this.rewardsGrid.GetSubElement <UXLabel>(uid, "LabelChance");
                subElement.Text = this.lang.Get(crateFlyoutItemVO.ListChanceString, new object[0]);
                UXLabel subElement2 = this.rewardsGrid.GetSubElement <UXLabel>(uid, "LabelRewardName");
                subElement2.Text = this.lang.Get(crateFlyoutItemVO.ListDescString, new object[0]);
                UXElement subElement3 = this.rewardsGrid.GetSubElement <UXElement>(uid, "Group2Option");
                UXSprite  subElement4 = this.rewardsGrid.GetSubElement <UXSprite>(uid, "Sprite2OptionA");
                UXLabel   subElement5 = this.rewardsGrid.GetSubElement <UXLabel>(uid, "LabelConjunction");
                UXSprite  subElement6 = this.rewardsGrid.GetSubElement <UXSprite>(uid, "Sprite2OptionB");
                UXSprite  subElement7 = this.rewardsGrid.GetSubElement <UXSprite>(uid, "SpriteGridReward");
                string[]  listIcons   = crateFlyoutItemVO.ListIcons;
                if (listIcons != null)
                {
                    if (listIcons.Length == 1)
                    {
                        subElement7.SpriteName = listIcons[0];
                        subElement3.Visible    = false;
                    }
                    else if (listIcons.Length == 2)
                    {
                        subElement4.SpriteName = listIcons[0];
                        subElement6.SpriteName = listIcons[1];
                        subElement5.Text       = this.lang.Get("OR", new object[0]);
                        subElement7.Visible    = false;
                    }
                }
                else
                {
                    subElement3.Visible = false;
                    subElement7.Visible = false;
                }
                this.UpdateRowHighlight(uid, false);
                UXButton uXButton = (UXButton)uXElement;
                uXButton.Tag       = i;
                uXButton.OnClicked = new UXButtonClickedDelegate(this.OnGridItemButtonClicked);
                this.rewardsGrid.AddItem(uXElement, i);
                i++;
            }
            this.rewardsGrid.RepositionItems();
        }
Example #25
0
        protected override void OnScreenLoaded()
        {
            if (this.selectedBuilding == null)
            {
                base.DestroyScreen();
                return;
            }
            this.researchMode = TroopUpgradeScreenMode.Troops;
            base.GetElement <UXLabel>("LabelSelectTroop").Text = this.lang.Get("UPGRADE_UPGRADE_TROOPS", new object[0]);
            this.troopGrid = base.GetElement <UXGrid>("TroopCapacityGrid");
            this.troopGrid.SetTemplateItem("TroopItemTemplate");
            this.equipmentGrid = base.GetElement <UXGrid>("EquipmentGrid");
            this.equipmentGrid.SetTemplateItem("EquipmentItemTemplate");
            this.equipmentGrid.DupeOrdersAllowed = true;
            this.InitButtons();
            this.troopTabButton                  = base.GetElement <UXCheckbox>("Btn1");
            this.troopTabButton.OnSelected       = new UXCheckboxSelectedDelegate(this.OnTroopsTabClicked);
            this.troopTabLabel                   = base.GetElement <UXLabel>("LabelBtn1");
            this.troopTabLabel.Text              = this.lang.Get("RESEARCH_LAB_TROOPS_TAB", new object[0]);
            this.equipmentTabButton              = base.GetElement <UXCheckbox>("Btn2");
            this.equipmentTabButton.OnSelected   = new UXCheckboxSelectedDelegate(this.OnEquipmentTabClicked);
            this.equipmentTabLabel               = base.GetElement <UXLabel>("LabelBtn2");
            this.equipmentTabLabel.Text          = this.lang.Get("RESEARCH_LAB_EQUIPMENT_TAB", new object[0]);
            this.equipmentTabButtonDim           = base.GetElement <UXButton>("Btn2Dim");
            this.equipmentTabButtonDim.OnClicked = new UXButtonClickedDelegate(this.OnEquipmentTabDimClicked);
            this.equipmentTabLabelDim            = base.GetElement <UXLabel>("LabelBtn2Dim");
            this.equipmentTabLabelDim.Text       = this.lang.Get("RESEARCH_LAB_EQUIPMENT_TAB", new object[0]);
            if (ArmoryUtils.PlayerHasArmory())
            {
                this.equipmentTabButton.Enabled    = true;
                this.equipmentTabButton.Visible    = true;
                this.equipmentTabButtonDim.Enabled = false;
                this.equipmentTabButtonDim.Visible = false;
            }
            else
            {
                this.equipmentTabButton.Enabled    = false;
                this.equipmentTabButton.Visible    = false;
                this.equipmentTabButtonDim.Enabled = true;
                this.equipmentTabButtonDim.Visible = true;
            }
            base.GetElement <UXElement>("ContainerJewel1").Visible = false;
            base.GetElement <UXLabel>("LabelMessage1").Text        = this.lang.Get("RESEARCH_EQUIPMENT_TAB_NEW", new object[0]);
            ArmoryController armoryController = Service.ArmoryController;
            bool             visible          = armoryController.AllowShowEquipmentTabBadge && armoryController.DoesUserHaveAnyUpgradableEquipment();

            base.GetElement <UXElement>("ContainerJewel").Visible = visible;
            base.GetElement <UXLabel>("LabelMessage").Text        = this.lang.Get("RESEARCH_EQUIPMENT_TAB_NEW", new object[0]);
            EventManager eventManager = Service.EventManager;

            eventManager.RegisterObserver(this, EventId.ContractCompleted);
            eventManager.RegisterObserver(this, EventId.InventoryUnlockUpdated);
            this.RefreshFilterTabs();
            this.RefreshGrids();
            armoryController.AllowShowEquipmentTabBadge = false;
            Service.DeployableShardUnlockController.AllowResearchBuildingBadging = false;
            eventManager.SendEvent(EventId.TroopUpgradeScreenOpened, null);
        }
Example #26
0
        protected GridLoadHelper CreateGridLoadHelperByCloningGrid(UXGrid originalGrid, string itemId)
        {
            UXGrid         grid   = base.CloneElement <UXGrid>(originalGrid, itemId, originalGrid.Root.transform.parent.gameObject);
            GridLoadHelper result = new GridLoadHelper(new GridLoadHelper.CreateUXElementFromGridItem(this.CreateUXElementFromGridItem), grid);

            this.EnableGridLoadHelper(result, false);
            Service.EventManager.SendEvent(EventId.AllUXElementsCreated, this);
            return(result);
        }
        public override void Execute()
        {
            base.Execute();
            string elementName = this.prepareArgs[0];
            UXGrid uXGrid      = Service.Get <ScreenController>().FindElement <UXGrid>(elementName);

            uXGrid.IsScrollable = true;
            this.parent.ChildComplete(this);
        }
Example #28
0
 public override void OnDestroyElement()
 {
     if (this.rewardsGrid != null)
     {
         this.rewardsGrid.Clear();
         this.rewardsGrid = null;
     }
     base.OnDestroyElement();
 }
 public DynamicScrollingList(UXGrid grid, int maxItemsToLoad)
 {
     this.listItems       = new Dictionary <int, ListItem>();
     this.myGrid          = grid;
     this.firstLoadedItem = -1;
     this.lastLoadedItem  = -1;
     this.maxItemsToLoad  = maxItemsToLoad;
     this.recycleEnabled  = true;
 }
Example #30
0
 public override void OnDestroyElement()
 {
     if (this.squadMemberGrid != null)
     {
         this.squadMemberGrid.Clear();
         this.squadMemberGrid.RepositionCallback = null;
         this.squadMemberGrid = null;
     }
 }