public override void CreateUI()
        {
            GameEvents.onGameSceneSwitchRequested.Add(onGameSceneSwitchRequested);
            base.CreateUI();

            gameObject.AddComponent <Touchable>();

            ScrollView  launchsiteList;
            UIScrollbar ls_scrollbar;

            this.Title(KKLocalization.LaunchsiteSelector)
            .Vertical()
            .ControlChildSize(true, true)
            .ChildForceExpand(false, false)
            .PreferredSizeFitter(true, true)
            .Anchor(AnchorPresets.TopLeft)
            .Pivot(PivotPresets.TopLeft)
            .SetSkin("KK.Default")

            .Add <HorizontalSep>("HorizontalSep").Space(1, 2).Finish()
            .Add <LaunchsiteFilter>(out launchsiteFilter)
            .OnFilterChanged(BuildLaunchsites)
            .Finish()
            .Add <FixedSpace>().Size(10).Finish()
            .Add <ScrollView>(out launchsiteList)
            .Horizontal(false)
            .Vertical(true)
            .Horizontal()
            .ControlChildSize(true, true)
            .ChildForceExpand(false, true)
            .FlexibleLayout(true, false)
            .PreferredSize(-1, 120)
            .Add <UIScrollbar>(out ls_scrollbar, "Scrollbar")
            .Direction(Scrollbar.Direction.BottomToTop)
            .PreferredWidth(15)
            .FlexibleLayout(false, true)
            .Finish()
            .Finish()
            .Add <FixedSpace>().Size(5).Finish()
            .Add <InfoLine> (out currentLaunchsite)
            .Label(KKLocalization.CurrentLaunchsite)
            .Finish()
            .Add <UIButton>(out setLaunchsite)
            .Text(KKLocalization.SetLaunchsite)
            .OnClick(SetLaunchsite)
            .FlexibleLayout(true, false)
            .Finish()
            .Add <HorizontalLayout>()
            .Add <UIButton>(out setDefault)
            .Text(KKLocalization.SetDefault)
            .OnClick(SetDefault)
            .FlexibleLayout(true, false)
            .Finish()
            .Add <UIButton>(out useDefault)
            .Text(KKLocalization.UseDefault)
            .OnClick(UseDefault)
            .FlexibleLayout(true, false)
            .Finish()
            .Finish()
            .Add <HorizontalSep>("HorizontalSep").SpaceBelow(2).Finish()
            .Finish();

            UIMain.SetTitlebar(titlebar, Close);

            ToggleGroup launchsiteGroup;

            launchsiteList.VerticalScrollbar = ls_scrollbar;
            launchsiteList.Viewport.FlexibleLayout(true, true);
            launchsiteList.Content
            .Vertical()
            .ControlChildSize(true, true)
            .ChildForceExpand(false, false)
            .Anchor(AnchorPresets.HorStretchTop)
            .PreferredSizeFitter(true, false)
            .WidthDelta(0)
            .ToggleGroup(out launchsiteGroup)
            .Finish();

            launchsiteItems            = new LaunchsiteItem.List(launchsiteGroup);
            launchsiteItems.Content    = launchsiteList.Content;
            launchsiteItems.onSelected = OnSelected;
        }
Exemplo n.º 2
0
        public override void CreateUI()
        {
            GameEvents.onGameSceneSwitchRequested.Add(onGameSceneSwitchRequested);
            base.CreateUI();

            ScrollView  launchsiteList;
            UIScrollbar ls_scrollbar;
            ScrollView  facilityList;
            UIScrollbar f_scrollbar;

            this.Title(KKLocalization.InflightBaseBoss)
            .Vertical()
            .ControlChildSize(true, true)
            .ChildForceExpand(false, false)
            .PreferredSizeFitter(true, true)
            .Anchor(AnchorPresets.TopLeft)
            .Pivot(PivotPresets.TopLeft)
            .SetSkin("KK.Default")

            .Add <FixedSpace>().Size(1).Finish()
            .Add <HorizontalSep>("HorizontalSep3").Space(2, 2).Finish()
            .Add <FixedSpace>().Size(5).Finish()
            .Add <UIText>()
            .Text(KKLocalization.FlightTools)
            .Finish()
            .Add <HorizontalLayout>()
            .Add <FixedSpace>().Size(2).Finish()
            .Add <UIText>()
            .Text(KKLocalization.LandingGuide)
            .Finish()
            .Add <IconToggle>(out landingGuide)
            .OnSprite(UIMain.tIconOpen)
            .OffSprite(UIMain.tIconClosed)
            .OnValueChanged(ToggleLandingGuideUI)
            .PreferredSize(56, 18)
            .Finish()
            .Add <FlexibleSpace>().Finish()
            .Add <UIText>()
            .Text(KKLocalization.NGS)
            .Finish()
            .Add <IconToggle>(out navGuidance)
            .OnSprite(UIMain.tIconOpen)
            .OffSprite(UIMain.tIconClosed)
            .OnValueChanged(ToggleNavGuidanceSystem)
            .PreferredSize(18, 18)
            .Finish()
            .Add <FixedSpace>().Size(2).Finish()
            .Finish()
            .Add <HorizontalSep>("HorizontalSep3").Space(2, 2).Finish()
            .Add <UIText>()
            .Text(KKLocalization.SelectedBase)
            .Finish()
            .Add <UIText>(out noBasesBeacon)
            .Text(KKLocalization.NoBasesBeacon)
            .Finish()
            .Add <UIText>(out noNearestBase)
            .Text(KKLocalization.NoNearestBase)
            .Finish()
            .Add <HorizontalLayout>(out nearestBaseGroup)
            .Add <InfoLine>(out nearestBase)
            .Label(KKLocalization.NearestBase)
            .Finish()
            .Add <FixedSpace>(out ngsFiller).Size(21).Finish()
            .Add <UIButton>(out setNGSTarget)
            .Text(KKLocalization.NGS)
            .OnClick(SetNGSTarget)
            .FlexibleLayout(true, false)
            .Finish()
            .Finish()
            .Add <HorizontalSep>("HorizontalSep3").Space(2, 2).Finish()
            .Add <UIText>()
            .Text(KKLocalization.BaseStatus)
            .Finish()
            .Add <VerticalLayout>(out careerGroup)
            .Add <ScrollView>(out launchsiteList)
            .Horizontal(false)
            .Vertical(true)
            .Horizontal()
            .ControlChildSize(true, true)
            .ChildForceExpand(false, true)
            .FlexibleLayout(true, false)
            .PreferredSize(-1, 120)
            .Add <UIScrollbar>(out ls_scrollbar, "Scrollbar")
            .Direction(Scrollbar.Direction.BottomToTop)
            .PreferredWidth(15)
            .FlexibleLayout(false, true)
            .Finish()
            .Finish()
            .Add <HorizontalSep>("HorizontalSep3").Space(2, 2).Finish()
            .Add <UIButton>(out openSite)
            .OnClick(OpenSite)
            .FlexibleLayout(true, false)
            .Finish()
            .Add <UIText>(out siteIsOpen)
            .Text(KKLocalization.BaseIsOpen)
            .Finish()
            .Add <UIText>(out siteCannoteBeOpened)
            .Text(KKLocalization.BaseCannotBeOpened)
            .Finish()
            .Add <UIText>(out basesCanBeOpened)
            .Text(KKLocalization.BasesCanBeOpened)
            .Finish()
            .Finish()
            .Add <VerticalLayout>(out facilitiesGroup)
            .Add <HorizontalSep>("HorizontalSep3").Space(2, 2).Finish()
            .Add <UIText>()
            .Text(KKLocalization.OperationalFacilities)
            .Finish()
            .Add <UIButton>(out facilityScan)
            .Text(KKLocalization.ScanForFacilities)
            .OnClick(CacheFacilities)
            .FlexibleLayout(true, false)
            .Finish()
            .Add <ScrollView>(out facilityList)
            .Horizontal(false)
            .Vertical(true)
            .Horizontal()
            .ControlChildSize(true, true)
            .ChildForceExpand(false, true)
            .FlexibleLayout(true, false)
            .PreferredSize(-1, 120)
            .Add <UIScrollbar>(out f_scrollbar, "Scrollbar")
            .Direction(Scrollbar.Direction.BottomToTop)
            .PreferredWidth(15)
            .FlexibleLayout(false, true)
            .Finish()
            .Finish()
            .Add <HorizontalSep>("HorizontalSep3").Space(2, 2).Finish()
            .Add <UIText>(out noFacilitiesWithin)
            .Text(KKLocalization.NoFacilitiesWithin)
            .Finish()
            .Add <UIText>(out nearbyFacilities)
            .Text(KKLocalization.NearbyFacilitiesCanBeShown)
            .Finish()
            .Finish()
            .Add <HorizontalSep>("HorizontalSep3").Space(2, 2).Finish()
            .Add <UIText>()
            .Text(KKLocalization.OtherFeatures)
            .Finish()
            .Add <UIButton>()
            .Text(KKLocalization.StartAirRacing)
            .OnClick(StartAirRacing)
            .FlexibleLayout(true, false)
            .Finish()
            .Add <UIButton>()
            .Text(KKLocalization.BasicOrbitalData)
            .OnClick(BasicOrbitalData)
            .FlexibleLayout(true, false)
            .Finish()
            .Add <HorizontalSep>("HorizontalSep3").Space(5, 2).Finish()
            .Finish();

            ToggleGroup launchsiteGroup;

            launchsiteList.VerticalScrollbar = ls_scrollbar;
            launchsiteList.Viewport.FlexibleLayout(true, true);
            launchsiteList.Content
            .Vertical()
            .ControlChildSize(true, true)
            .ChildForceExpand(false, false)
            .Anchor(AnchorPresets.HorStretchTop)
            .PreferredSizeFitter(true, false)
            .WidthDelta(0)
            .ToggleGroup(out launchsiteGroup)
            .Finish();

            UIMain.SetTitlebar(titlebar, Close);

            launchsiteItems            = new LaunchsiteItem.List(launchsiteGroup);
            launchsiteItems.Content    = launchsiteList.Content;
            launchsiteItems.onSelected = OnLaunchsiteSelected;

            ToggleGroup facilityGroup;

            facilityList.VerticalScrollbar = f_scrollbar;
            facilityList.Viewport.FlexibleLayout(true, true);
            facilityList.Content
            .Vertical()
            .ControlChildSize(true, true)
            .ChildForceExpand(false, false)
            .Anchor(AnchorPresets.HorStretchTop)
            .PreferredSizeFitter(true, false)
            .WidthDelta(0)
            .ToggleGroup(out facilityGroup)
            .Finish();

            facilityItems            = new FacilityItem.List(facilityGroup);
            facilityItems.Content    = facilityList.Content;
            facilityItems.onSelected = OnFacilitySelected;

            rectTransform.anchoredPosition3D = new Vector2(10, -25);

            GameEvents.onVesselSituationChange.Add(onVesselSituationChange);
        }