Пример #1
0
        protected void InitPlanetSlots()
        {
            this.selectPlanetGrid = base.GetElement <UXGrid>("SelectPlanetGrid");
            UXElement element = base.GetElement <UXElement>("SelectPlanetTemplate");

            element.Visible = true;
            this.selectPlanetGrid.SetTemplateItem("SelectPlanetCard");
            element.Visible = false;
            this.unlockablePlanetList.Clear();
            CurrentPlayer currentPlayer = Service.CurrentPlayer;

            foreach (PlanetVO current in Service.StaticDataController.GetAll <PlanetVO>())
            {
                if (current.PlayerFacing && !currentPlayer.UnlockedPlanets.Contains(current.Uid) && currentPlayer.Map.Planet.Uid != current.Uid)
                {
                    UXCheckbox uXCheckbox = (UXCheckbox)this.selectPlanetGrid.CloneTemplateItem(current.Uid);
                    UXLabel    subElement = this.selectPlanetGrid.GetSubElement <UXLabel>(current.Uid, "LabelSelectPlanetName");
                    if (!this.reqMet && !this.tutorialMode)
                    {
                        uXCheckbox.RadioGroup = 0;
                        uXCheckbox.SetSelectable(false);
                        uXCheckbox.Selected = false;
                    }
                    uXCheckbox.OnSelected = new UXCheckboxSelectedDelegate(this.PlanetSelected);
                    UXTexture subElement2 = this.selectPlanetGrid.GetSubElement <UXTexture>(current.Uid, "SpriteSelectPlanetImagePlanet");
                    subElement2.LoadTexture("PlanetEnvIcon-" + current.Abbreviation);
                    subElement.Text       = LangUtils.GetPlanetDisplayName(current);
                    uXCheckbox.Tag        = current;
                    uXCheckbox.RadioGroup = 0;
                    uXCheckbox.DelayedSelect(false);
                    this.selectPlanetGrid.AddItem(uXCheckbox, current.Order);
                    this.unlockablePlanetList.Add(uXCheckbox);
                }
            }
            if (this.unlockablePlanetList.Count == 0)
            {
                base.GetElement <UXElement>("ButtonPrimary").Visible = false;
                base.GetElement <UXElement>("BtnInstantBuy").Visible = false;
                this.buttonTutorialConfirm.Visible = false;
            }
            this.selectPlanetGrid.RepositionItems();
            this.selectPlanetGrid.IsScrollable = true;
            this.selectPlanetGrid.ScrollToItem(0);
        }