public void OnSettingsUI(UIHelperBase helper) { UIHelper actualHelp = helper as UIHelper; UIComponent container = actualHelp.self as UIComponent; UITabstrip tabStrip = container.AddUIComponent <UITabstrip>(); tabStrip.relativePosition = new Vector3(0, 0); tabStrip.size = new Vector2(container.width - 20, 40); UITabContainer tabContainer = container.AddUIComponent <UITabContainer>(); tabContainer.relativePosition = new Vector3(0, 40); tabContainer.size = new Vector2(container.width - 20, container.height - tabStrip.height - 20);; tabStrip.tabPages = tabContainer; int tabIndex = 0; #region Features AddTab(tabStrip, "Features"); tabStrip.selectedIndex = tabIndex; UIPanel currentPanel = tabStrip.tabContainer.components[tabIndex] as UIPanel; currentPanel.autoLayout = true; currentPanel.autoLayoutDirection = LayoutDirection.Vertical; currentPanel.autoLayoutPadding.top = 5; currentPanel.autoLayoutPadding.left = 10; currentPanel.autoLayoutPadding.right = 10; UIHelper panelHelper = new UIHelper(currentPanel); var FeatureGroup = panelHelper.AddGroup("Features"); FeatureGroup.AddCheckbox("Unlocker Enabled", Unlocker.UnlockerActive, delegate(bool x) { Unlocker.UnlockerActive = x; }); FeatureGroup.AddCheckbox("Unlock Districts", Unlocker.UnlockDistricts, delegate(bool x) { Unlocker.UnlockDistricts = x; }); FeatureGroup.AddCheckbox("Unlock Policies", Unlocker.UnlockPolicies, delegate(bool x) { Unlocker.UnlockPolicies = x; }); FeatureGroup.AddCheckbox("Unlock Budget", Unlocker.UnlockBudget, delegate(bool x) { Unlocker.UnlockBudget = x; }); FeatureGroup.AddCheckbox("Unlock Taxes", Unlocker.UnlockTaxes, delegate(bool x) { Unlocker.UnlockTaxes = x; }); FeatureGroup.AddCheckbox("Unlock First Loan", Unlocker.UnlockFirstLoan, delegate(bool x) { Unlocker.UnlockFirstLoan = x; }); FeatureGroup.AddCheckbox("Unlock Second Loan", Unlocker.UnlockSecondLoan, delegate(bool x) { Unlocker.UnlockSecondLoan = x; }); FeatureGroup.AddCheckbox("Unlock Third Loan", Unlocker.UnlockThirdLoan, delegate(bool x) { Unlocker.UnlockThirdLoan = x; }); FeatureGroup.AddCheckbox("Unlock Industrial Specializations", Unlocker.UnlockIndustrySpecialization, delegate(bool x) { Unlocker.UnlockIndustrySpecialization = x; }); FeatureGroup.AddCheckbox("Unlock Commercial Specializations", Unlocker.UnlockCommercialSpecialization, delegate(bool x) { Unlocker.UnlockCommercialSpecialization = x; }); FeatureGroup.AddCheckbox("Unlock Residential Specializations", Unlocker.UnlockResidentialSpecialization, delegate(bool x) { Unlocker.UnlockResidentialSpecialization = x; }); FeatureGroup.AddCheckbox("Unlock Office Specializations", Unlocker.UnlockOfficeSpecialization, delegate(bool x) { Unlocker.UnlockOfficeSpecialization = x; }); FeatureGroup.AddCheckbox("Unlock Landscaping", Unlocker.UnlockLandscaping, delegate(bool x) { Unlocker.UnlockLandscaping = x; }); FeatureGroup.AddCheckbox("Unlock Park Areas", Unlocker.UnlockParkAreas, delegate(bool x) { Unlocker.UnlockParkAreas = x; }); #endregion #region Education ++tabIndex; AddTab(tabStrip, "Education"); tabStrip.selectedIndex = tabIndex; currentPanel = tabStrip.tabContainer.components[tabIndex] as UIPanel; currentPanel.autoLayout = true; currentPanel.autoLayoutDirection = LayoutDirection.Vertical; currentPanel.autoLayoutPadding.top = 5; currentPanel.autoLayoutPadding.left = 10; currentPanel.autoLayoutPadding.right = 10; panelHelper = new UIHelper(currentPanel); var EducationGroup = panelHelper.AddGroup("Education"); EducationGroup.AddCheckbox("Unlock Education", Unlocker.UnlockEducation, delegate(bool x) { Unlocker.UnlockEducation = x; }); EducationGroup.AddCheckbox("Unlock Second Tier Education", Unlocker.UnlockSecondTierEducation, delegate(bool x) { Unlocker.UnlockSecondTierEducation = x; }); EducationGroup.AddCheckbox("Unlock Third Tier Education", Unlocker.UnlockThirdTierEducation, delegate(bool x) { Unlocker.UnlockThirdTierEducation = x; }); #endregion #region Monuments ++tabIndex; AddTab(tabStrip, "Monuments"); tabStrip.selectedIndex = tabIndex; currentPanel = tabStrip.tabContainer.components[tabIndex] as UIPanel; currentPanel.autoLayout = true; currentPanel.autoLayoutDirection = LayoutDirection.Vertical; currentPanel.autoLayoutPadding.top = 5; currentPanel.autoLayoutPadding.left = 10; currentPanel.autoLayoutPadding.right = 10; panelHelper = new UIHelper(currentPanel); var MonumentsGroup = panelHelper.AddGroup("Monuments"); MonumentsGroup.AddCheckbox("Unlock Monuments", Unlocker.UnlockMonuments, delegate(bool x) { Unlocker.UnlockMonuments = x; }); MonumentsGroup.AddCheckbox("Unlock Second Tier Monuments", Unlocker.UnlockSecondTierMonuments, delegate(bool x) { Unlocker.UnlockSecondTierMonuments = x; }); MonumentsGroup.AddCheckbox("Unlock Third Tier Monuments", Unlocker.UnlockThirdTierMonuments, delegate(bool x) { Unlocker.UnlockThirdTierMonuments = x; }); MonumentsGroup.AddCheckbox("Unlock Fourth Tier Monuments", Unlocker.UnlockFourthTierMonuments, delegate(bool x) { Unlocker.UnlockFourthTierMonuments = x; }); MonumentsGroup.AddCheckbox("Unlock Fifth Tier Monuments", Unlocker.UnlockFifthTierMonuments, delegate(bool x) { Unlocker.UnlockFifthTierMonuments = x; }); MonumentsGroup.AddCheckbox("Unlock Sixth Tier Monuments", Unlocker.UnlockSixthTierMonuments, delegate(bool x) { Unlocker.UnlockSixthTierMonuments = x; }); #endregion #region Buildings ++tabIndex; AddTab(tabStrip, "Buildings"); tabStrip.selectedIndex = tabIndex; currentPanel = tabStrip.tabContainer.components[tabIndex] as UIPanel; currentPanel.autoLayout = true; currentPanel.autoLayoutDirection = LayoutDirection.Vertical; currentPanel.autoLayoutPadding.top = 5; currentPanel.autoLayoutPadding.left = 10; currentPanel.autoLayoutPadding.right = 10; panelHelper = new UIHelper(currentPanel); var BuildingsGroup = panelHelper.AddGroup("Buildings"); BuildingsGroup.AddCheckbox("Unlock Death Care Buildings", Unlocker.UnlockDeathCare, delegate(bool x) { Unlocker.UnlockDeathCare = x; }); BuildingsGroup.AddCheckbox("Unlock Football Stadiums", Unlocker.UnlockFootballStadiums, delegate(bool x) { Unlocker.UnlockFootballStadiums = x; }); BuildingsGroup.AddCheckbox("Unlock Concerts", Unlocker.UnlockConcerts, delegate(bool x) { Unlocker.UnlockConcerts = x; }); BuildingsGroup.AddCheckbox("Unlock Disaster Response Buildings", Unlocker.UnlockDisasterResponse, delegate(bool x) { Unlocker.UnlockDisasterResponse = x; }); BuildingsGroup.AddCheckbox("Unlock Wonder Buildings", Unlocker.UnlockWonders, delegate(bool x) { Unlocker.UnlockWonders = x; }); #endregion #region Transport ++tabIndex; AddTab(tabStrip, "Transport"); tabStrip.selectedIndex = tabIndex; currentPanel = tabStrip.tabContainer.components[tabIndex] as UIPanel; currentPanel.autoLayout = true; currentPanel.autoLayoutDirection = LayoutDirection.Vertical; currentPanel.autoLayoutPadding.top = 5; currentPanel.autoLayoutPadding.left = 10; currentPanel.autoLayoutPadding.right = 10; panelHelper = new UIHelper(currentPanel); var TransportGroup = panelHelper.AddGroup("Transport"); TransportGroup.AddCheckbox("Unlock Transport Service (Must be Enabled for setting below)", Unlocker.UnlockTransportService, delegate(bool x) { Unlocker.UnlockTransportService = x; }); TransportGroup.AddCheckbox("Unlock Buses and Stations", Unlocker.UnlockBus, delegate(bool x) { Unlocker.UnlockBus = x; }); TransportGroup.AddCheckbox("Unlock Metro and Stations", Unlocker.UnlockMetro, delegate(bool x) { Unlocker.UnlockMetro = x; }); TransportGroup.AddCheckbox("Unlock Airports and Planes", Unlocker.UnlockPlane, delegate(bool x) { Unlocker.UnlockPlane = x; }); TransportGroup.AddCheckbox("Unlock Ships", Unlocker.UnlockShips, delegate(bool x) { Unlocker.UnlockShips = x; }); TransportGroup.AddCheckbox("Unlock Trains and Stations", Unlocker.UnlockTrains, delegate(bool x) { Unlocker.UnlockTrains = x; }); TransportGroup.AddCheckbox("Unlock Taxis", Unlocker.UnlockTaxis, delegate(bool x) { Unlocker.UnlockTaxis = x; }); TransportGroup.AddCheckbox("Unlock Trams and Stations", Unlocker.UnlockTrams, delegate(bool x) { Unlocker.UnlockTrams = x; }); TransportGroup.AddCheckbox("Unlock Monorail and Stations", Unlocker.UnlockMonorail, delegate(bool x) { Unlocker.UnlockMonorail = x; }); TransportGroup.AddCheckbox("Unlock Cable Cars", Unlocker.UnlockCableCar, delegate(bool x) { Unlocker.UnlockCableCar = x; }); TransportGroup.AddCheckbox("Unlock Ferries", Unlocker.UnlockFerry, delegate(bool x) { Unlocker.UnlockFerry = x; }); TransportGroup.AddCheckbox("Unlock Blimps", Unlocker.UnlockBlimp, delegate(bool x) { Unlocker.UnlockBlimp = x; }); TransportGroup.AddCheckbox("Unlock Sightseeing Bus", Unlocker.UnlockSightseeingBus, delegate(bool x) { Unlocker.UnlockSightseeingBus = x; }); TransportGroup.AddCheckbox("Unlock Walking Tour", Unlocker.UnlockWalkingTour, delegate(bool x) { Unlocker.UnlockWalkingTour = x; }); #endregion }
public override void Start() { AtomicNET.GetSubsystem <Player> ().LoadScene("Scenes/Scene.scene"); var ui = GetSubsystem <UI> (); ui.AddFont("Textures/BrokenGlass.ttf", "BrokenGlass"); // add a gooder font ui.LoadSkin("Textures/desktop.tb.txt"); // load in the app skin ResourceCache cache = GetSubsystem <ResourceCache> (); Graphics graphics = GetSubsystem <Graphics> (); graphics.SetWindowTitle("PeriodicApp"); Image icon = cache.GetResource <Image> ("Textures/AtomicLogo32.png"); graphics.SetWindowIcon(icon); myuivew = new UIView(); mylayout = new UILayout(); // make the host widget for all visible ui mylayout.SetId("UIPeriodicTable"); // tag it, like a big game scientist mylayout.SetRect(myuivew.GetRect()); //size it to fill the screen area mylayout.SetLayoutConfig("YAGAC"); //all-in-one setting mylayout.SetSkinBg("background_solid"); // make it look gooder mylayout.Load("Scenes/main_layout.ui.txt"); // load the main layout myuivew.AddChild(mylayout); // And make it show up. UITabContainer maintb = (UITabContainer)mylayout.GetWidget("maintabs"); UITabContainer acttb = (UITabContainer)mylayout.GetWidget("primarytabs"); UITabContainer semitb = (UITabContainer)mylayout.GetWidget("moretabs"); UITabContainer viewtb = (UITabContainer)mylayout.GetWidget("supporttabs"); UITabContainer supporttb = (UITabContainer)mylayout.GetWidget("atomictabs"); supporttb.SetCurrentPage(0); viewtb.SetCurrentPage(0); semitb.SetCurrentPage(0); acttb.SetCurrentPage(0); maintb.SetCurrentPage(0); // do this or else the tab contents look like crap! mylog = (UITextField)mylayout.GetWidget("LogText"); UIWidget ea = mylayout.GetWidget("exitapp"); var cota = new code_table(); cota.Setup(mylayout); var cobg = new code_uibargraph(); cobg.Setup(mylayout.GetWidget("pageuibargraph")); var cobu = new code_uibutton(); cobu.Setup(mylayout.GetWidget("pageuibutton")); var cocb = new code_uicheckbox(); cocb.Setup(mylayout.GetWidget("pageuicheckbox")); var cocl = new code_uiclicklabel(); cocl.Setup(mylayout.GetWidget("pageuiclicklabel")); var coch = new code_uicolorwheel(); coch.Setup(mylayout.GetWidget("pageuicolorwheel")); var cocw = new code_uicolorwidget(); cocw.Setup(mylayout.GetWidget("pageuicolorwidget")); var coco = new code_uicontainer(); coco.Setup(mylayout.GetWidget("pageuicontainer")); var coef = new code_uieditfield(); coef.Setup(mylayout.GetWidget("pageuieditfield")); var cofw = new code_uifinderwindow(); cofw.Setup(mylayout.GetWidget("pageuifinderwindow")); var cofd = new code_uifontdescription(); cofd.Setup(mylayout.GetWidget("pageuifontdescription")); var coiw = new code_uiimagewidget(); coiw.Setup(mylayout.GetWidget("pageuiimagewidget")); var cois = new code_uiinlineselect(); cois.Setup(mylayout.GetWidget("pageuiinlineselect")); var colo = new code_uilayout(); colo.Setup(mylayout.GetWidget("pageuilayout")); var colp = new code_uilayoutparams(); colp.Setup(mylayout.GetWidget("pageuilayoutparams")); var comi = new code_uimenuitem(); comi.Setup(mylayout.GetWidget("pageuimenuitem")); var comw = new code_uimenuwindow(); comw.Setup(mylayout.GetWidget("pageuimenuwindow")); var come = new code_uimessagewindow(); come.Setup(mylayout.GetWidget("pageuimessagewindow")); var copw = new code_uipromptwindow(); copw.Setup(mylayout.GetWidget("pageuipromptwindow")); var copd = new code_uipulldownmenu(); copd.Setup(mylayout.GetWidget("pageuipulldownmenu")); var corb = new code_uiradiobutton(); corb.Setup(mylayout.GetWidget("pageuiradiobutton")); var cosv = new code_uisceneview(); cosv.Setup(mylayout.GetWidget("pageuisceneview")); var cosb = new code_uiscrollbar(); cosb.Setup(mylayout.GetWidget("pageuiscrollbar")); var cosc = new code_uiscrollcontainer(); cosc.Setup(mylayout.GetWidget("pageuiscrollcontainer")); var cose = new code_uisection(); cose.Setup(mylayout.GetWidget("pageuisection")); var cosd = new code_uiselectdropdown(); cosd.Setup(mylayout.GetWidget("pageuiselectdropdown")); var cosi = new code_uiselectitem(); cosi.Setup(mylayout.GetWidget("pageuiselectitem")); var cosl = new code_uiselectlist(); cosl.Setup(mylayout.GetWidget("pageuiselectlist")); var cosp = new code_uiseparator(); cosp.Setup(mylayout.GetWidget("pageuiseparator")); var cosk = new code_uiskinimage(); cosk.Setup(mylayout.GetWidget("pageuiskinimage")); var cosa = new code_uislider(); cosa.Setup(mylayout.GetWidget("pageuislider")); var cotc = new code_uitabcontainer(); cotc.Setup(mylayout.GetWidget("pageuitabcontainer")); var cotf = new code_uitextfield(); cotf.Setup(mylayout.GetWidget("pageuitextfield")); var cotw = new code_uitexturewidget(); cotw.Setup(mylayout.GetWidget("pageuitexturewidget")); var cowd = new code_uiwidget(); cowd.Setup(mylayout.GetWidget("pageuiwidget")); var cowi = new code_uiwindow(); cowi.Setup(mylayout.GetWidget("pageuiwindow")); SubscribeToEvent <WidgetEvent> (ea, ev => { if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) { GetSubsystem <Engine> ().Exit(); } }); SubscribeToEvent <KeyDownEvent> (e => { if (e.Key == Constants.KEY_ESCAPE) { GetSubsystem <Engine> ().Exit(); } }); }
public void Start() { try { if (mainButton == null) { tsContainer = GameObject.Find("TSContainer").GetComponent <UITabContainer>(); thumbnailBar = UIView.Find <UISlicedSprite>("ThumbnailBar"); mainTS = UIView.Find <UITabstrip>("MainToolstrip"); tsBar = UIView.Find <UISlicedSprite>("TSBar"); infoPanel = UIView.Find <UIPanel>("InfoPanel"); pauseOutline = GameObject.Find("PauseOutline")?.GetComponent <UIComponent>(); if (pauseOutline != null) { pauseOutlineOriginalSize = pauseOutline.size; } isFindItEnabled = IsAssemblyEnabled("findit"); if (isFindItEnabled) { Debugging.Message($"Found enabled mod: findit. Yet Another Toolbar layout patch will be applied"); } isRICOEnabled = IsAssemblyEnabled("ploppablerico"); if (isRICOEnabled) { Debugging.Message($"Found enabled mod: ploppablerico. Yet Another Toolbar layout patch will be applied"); bool result = DrawPloppablePanelPatch.ApplyPatch(Patcher.harmonyInstance); if (result) { Debugging.Message($"Found enabled mod: ploppablerico. Yet Another Toolbar scale patch applied"); } } originalTSPosX = mainTS.relativePosition.x; originalScreenSize = UIView.GetAView().GetScreenResolution(); //UIMultiStateButton advisorButton = view.FindUIComponent<UIMultiStateButton>("AdvisorButton"); // Set Advisor Button and filter panel visiblity SetAdvisorButtonVisibility(); // SetFilterPanelsVisibility(); // Create main button mainButton = CreatMainButton(); // check UUI isUUIEnabled = IsAssemblyEnabled("unifieduimod"); if (isUUIEnabled && Settings.integrateMainButtonUUI) { UUIIntegration.AttachMainButton(); Debugging.Message($"Found enabled mod: unifieduimod. Yet Another Toolbar main button UUI integration applied"); } } } catch (Exception ex) { Debugging.Message("Start() - " + ex.Message); } }
// handle table clicks private static void HandleTableEvent(WidgetEvent ev) { UIWidget widget = (UIWidget)ev.Target; if (widget.Equals(null)) { return; } if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) { UITabContainer maintb = (UITabContainer)widget.FindWidget("maintabs"); UITabContainer acttb = (UITabContainer)widget.FindWidget("primarytabs"); UITabContainer semitb = (UITabContainer)widget.FindWidget("moretabs"); UITabContainer viewtb = (UITabContainer)widget.FindWidget("supporttabs"); UITabContainer supporttb = (UITabContainer)widget.FindWidget("atomictabs"); if (widget.GetId() == "A1") { maintb.SetCurrentPage(1); acttb.SetCurrentPage(0); } if (widget.GetId() == "A2") { maintb.SetCurrentPage(1); acttb.SetCurrentPage(1); } if (widget.GetId() == "A3") { maintb.SetCurrentPage(1); acttb.SetCurrentPage(2); } if (widget.GetId() == "A4") { maintb.SetCurrentPage(1); acttb.SetCurrentPage(3); } if (widget.GetId() == "A5") { maintb.SetCurrentPage(1); acttb.SetCurrentPage(4); } if (widget.GetId() == "A6") { maintb.SetCurrentPage(1); acttb.SetCurrentPage(5); } if (widget.GetId() == "A7") { maintb.SetCurrentPage(1); acttb.SetCurrentPage(6); } if (widget.GetId() == "A8") { maintb.SetCurrentPage(1); acttb.SetCurrentPage(7); } if (widget.GetId() == "A9") { maintb.SetCurrentPage(1); acttb.SetCurrentPage(8); } if (widget.GetId() == "B1") { maintb.SetCurrentPage(2); semitb.SetCurrentPage(0); } if (widget.GetId() == "B2") { maintb.SetCurrentPage(2); semitb.SetCurrentPage(1); } if (widget.GetId() == "B3") { maintb.SetCurrentPage(2); semitb.SetCurrentPage(2); } if (widget.GetId() == "B4") { maintb.SetCurrentPage(2); semitb.SetCurrentPage(3); } if (widget.GetId() == "B5") { maintb.SetCurrentPage(2); semitb.SetCurrentPage(4); } if (widget.GetId() == "B6") { maintb.SetCurrentPage(2); semitb.SetCurrentPage(5); } if (widget.GetId() == "B7") { maintb.SetCurrentPage(2); semitb.SetCurrentPage(6); } if (widget.GetId() == "B8") { maintb.SetCurrentPage(2); semitb.SetCurrentPage(7); } if (widget.GetId() == "B9") { maintb.SetCurrentPage(2); semitb.SetCurrentPage(8); } if (widget.GetId() == "C1") { maintb.SetCurrentPage(3); viewtb.SetCurrentPage(0); } if (widget.GetId() == "C2") { maintb.SetCurrentPage(3); viewtb.SetCurrentPage(1); } if (widget.GetId() == "C3") { maintb.SetCurrentPage(3); viewtb.SetCurrentPage(2); } if (widget.GetId() == "C4") { maintb.SetCurrentPage(3); viewtb.SetCurrentPage(3); } if (widget.GetId() == "C5") { maintb.SetCurrentPage(3); viewtb.SetCurrentPage(4); } if (widget.GetId() == "C6") { maintb.SetCurrentPage(3); viewtb.SetCurrentPage(5); } if (widget.GetId() == "C7") { maintb.SetCurrentPage(3); viewtb.SetCurrentPage(6); } if (widget.GetId() == "C8") { maintb.SetCurrentPage(3); viewtb.SetCurrentPage(7); } if (widget.GetId() == "C9") { maintb.SetCurrentPage(3); viewtb.SetCurrentPage(8); } if (widget.GetId() == "D2") { maintb.SetCurrentPage(4); supporttb.SetCurrentPage(0); } if (widget.GetId() == "D3") { maintb.SetCurrentPage(4); supporttb.SetCurrentPage(1); } if (widget.GetId() == "D4") { maintb.SetCurrentPage(4); supporttb.SetCurrentPage(2); } if (widget.GetId() == "D5") { maintb.SetCurrentPage(4); supporttb.SetCurrentPage(3); } if (widget.GetId() == "D6") { maintb.SetCurrentPage(4); supporttb.SetCurrentPage(4); } if (widget.GetId() == "D7") { maintb.SetCurrentPage(4); supporttb.SetCurrentPage(5); } if (widget.GetId() == "D8") { maintb.SetCurrentPage(4); supporttb.SetCurrentPage(6); } if (widget.GetId() == "D9") { maintb.SetCurrentPage(4); supporttb.SetCurrentPage(7); } } }
public TabContainer(UITabContainer tabContainer, bool subschribeEvents = false) : base(tabContainer, subschribeEvents) { }
public static void CreateTabsComponent(out UITabstrip tabstrip, out UITabContainer tabContainer, Transform parent, string namePrefix, Vector4 areaTabstrip, Vector4 areaContainer) => CreateTabsComponent(out tabstrip, out tabContainer, parent, parent, namePrefix, areaTabstrip, areaContainer);
public static void makeSettings(UIHelperBase helper) { // tabbing code is borrowed from RushHour mod // https://github.com/PropaneDragon/RushHour/blob/release/RushHour/Options/OptionHandler.cs LoadSetting(); UIHelper actualHelper = helper as UIHelper; UIComponent container = actualHelper.self as UIComponent; UITabstrip tabStrip = container.AddUIComponent <UITabstrip>(); tabStrip.relativePosition = new Vector3(0, 0); tabStrip.size = new Vector2(container.width - 20, 40); UITabContainer tabContainer = container.AddUIComponent <UITabContainer>(); tabContainer.relativePosition = new Vector3(0, 40); tabContainer.size = new Vector2(container.width - 20, container.height - tabStrip.height - 20); tabStrip.tabPages = tabContainer; int tabIndex = 0; // Lane_ShortCut AddOptionTab(tabStrip, "Lane ShortCut"); tabStrip.selectedIndex = tabIndex; UIPanel currentPanel = tabStrip.tabContainer.components[tabIndex] as UIPanel; currentPanel.autoLayout = true; currentPanel.autoLayoutDirection = LayoutDirection.Vertical; currentPanel.autoLayoutPadding.top = 5; currentPanel.autoLayoutPadding.left = 10; currentPanel.autoLayoutPadding.right = 10; UIHelper panelHelper = new UIHelper(currentPanel); var generalGroup = panelHelper.AddGroup("Lane Button ShortCut") as UIHelper; var panel = generalGroup.self as UIPanel; panel.gameObject.AddComponent <OptionsKeymappingLane>(); var generalGroup1 = panelHelper.AddGroup("ShortCuts Control") as UIHelper; generalGroup1.AddCheckbox("ShortCuts will be used for ToPanel Button", isShortCutsToPanel, (index) => isShortCutsToPanelEnable(index)); generalGroup1.AddCheckbox("N/NP/N+1 is mutually excluded(select this if you never use ShortCuts)", isMutuallyExclude, (index) => isMutuallyExcludeEnable(index)); SaveSetting(); // Function_ShortCut ++tabIndex; AddOptionTab(tabStrip, "Function ShortCut"); tabStrip.selectedIndex = tabIndex; currentPanel = tabStrip.tabContainer.components[tabIndex] as UIPanel; currentPanel.autoLayout = true; currentPanel.autoLayoutDirection = LayoutDirection.Vertical; currentPanel.autoLayoutPadding.top = 5; currentPanel.autoLayoutPadding.left = 10; currentPanel.autoLayoutPadding.right = 10; panelHelper = new UIHelper(currentPanel); generalGroup = panelHelper.AddGroup("Function Button ShortCut") as UIHelper; panel = generalGroup.self as UIPanel; panel.gameObject.AddComponent <OptionsKeymappingFunction>(); }
private static void HandleUitabcontainerEvent(WidgetEvent ev) { UIWidget widget = (UIWidget)ev.Target; string refid = (string)ev.RefID; if (widget.Equals(null)) { return; } if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) { if (widget.GetId() == "uitabcontainercode") { AtomicMain.AppLog("UITabContainer support : " + widget.GetId() + " was pressed "); AtomicMain.ViewCode("Components/code_uitabcontainer.cs", widget.GetParent()); } if (widget.GetId() == "uitabcontainerlayout") { AtomicMain.AppLog("UITabContainer support : " + widget.GetId() + " was pressed "); AtomicMain.ViewCode("Scenes/layout_uitabcontainer.ui.txt", widget.GetParent()); } if (widget.GetId() == "uitabcontainerremove") { AtomicMain.AppLog("UITabContainer action : " + widget.GetId() + " was pressed "); UITabContainer tcx = (UITabContainer)widget.FindWidget("UITabContainerDemo"); int current = tcx.GetCurrentPage(); tcx.DeletePage(current); } if (widget.GetId() == "uitabcontaineradd") { AtomicMain.AppLog("UITabContainer action : " + widget.GetId() + " was pressed "); UITabContainer tcx = (UITabContainer)widget.FindWidget("UITabContainerDemo"); tcx.AddTabPageFile("New File", "Scenes/sheet.ui.txt"); } if (widget.GetId() == "uitabcontainermake") { AtomicMain.AppLog("UITabContainer action : " + widget.GetId() + " was pressed "); var cache = GetSubsystem <ResourceCache>(); UITabContainer tcx = (UITabContainer)widget.FindWidget("UITabContainerDemo"); UILayout lo = new UILayout(); lo.SetLayoutConfig("YAGAC"); // YACAC! UIEditField myeditfield = new UIEditField(); myeditfield.SetGravity(UI_GRAVITY.UI_GRAVITY_ALL); myeditfield.SetMultiline(true); File filex = cache.GetFile("Components/code_uitabcontainer.cs"); String textx = filex.ReadText(); filex.Close(); myeditfield.SetText(textx); UIFontDescription myfont = new UIFontDescription(); // put in a coder font myfont.SetSize(16); myfont.SetId("Vera"); myeditfield.SetFontDescription(myfont); lo.AddChild(myeditfield); tcx.AddTabPageWidget("New Code", lo); } if (widget.GetId() == "uitabcontainerundock") { AtomicMain.AppLog("UITabContainer action : " + widget.GetId() + " was pressed "); UITabContainer tcx = (UITabContainer)widget.FindWidget("UITabContainerDemo"); int current = tcx.GetCurrentPage(); tcx.UndockPage(current); } if (widget.GetId() == "uitabcontainerredock") { AtomicMain.AppLog("UITabContainer action : " + widget.GetId() + " was pressed "); UITabContainer tcx = (UITabContainer)widget.FindWidget("UITabContainerDemo"); if (!tcx.DockWindow("tab1")) { if (!tcx.DockWindow("tab2")) { if (!tcx.DockWindow("tab3")) { if (!tcx.DockWindow("New File")) { if (!tcx.DockWindow("New Code")) { AtomicMain.AppLog("UITabContainer action : no more windows to dock."); } } } } } } } }
private void CreateUI() { try { name = "NoteItMainPanel"; backgroundSprite = "MenuPanel2"; clipChildren = true; isVisible = ModConfig.Instance.ShowAfterLoad ? true : false; eventMouseEnter += (component, eventParam) => { opacity = ModConfig.Instance.OpacityWhenHover; }; eventMouseLeave += (component, eventParam) => { opacity = ModConfig.Instance.Opacity; }; _title = UIUtils.CreateMenuPanelTitle(this, "Note It! - Main"); _location = UIUtils.CreateMenuPanelLocationButton(this); _location.eventClick += (component, eventParam) => { if (!eventParam.used) { TogglePanel(_locationPanel); eventParam.Use(); } }; _close = UIUtils.CreateMenuPanelCloseButton(this); _dragHandle = UIUtils.CreateMenuPanelDragHandle(this); _dragHandle.eventMouseUp += (component, eventParam) => { ModConfig.Instance.PositionX = absolutePosition.x; ModConfig.Instance.PositionY = absolutePosition.y; ModConfig.Instance.Save(); }; _tabAddButton = UIUtils.CreateSmallButton(this, "TabAddButton", "+"); _tabAddButton.height = 26f; _tabAddButton.width = 26f; _tabAddButton.eventClick += (component, eventParam) => { if (!eventParam.used) { ModConfig.Instance.Notes.Add("Type your note #" + (ModConfig.Instance.Notes.Count + 1) + " here."); RefreshNotes(); eventParam.Use(); } }; _tabDeleteButton = UIUtils.CreateSmallButton(this, "TabDeleteButton", "-"); _tabDeleteButton.height = 26f; _tabDeleteButton.width = 26f; _tabDeleteButton.eventClick += (component, eventParam) => { if (!eventParam.used) { ModConfig.Instance.Notes.RemoveAt(ModConfig.Instance.Notes.Count - 1); RefreshNotes(); eventParam.Use(); } }; _tabstrip = UIUtils.CreateTabStrip(this); _tabContainer = UIUtils.CreateTabContainer(this); _templateButton = UIUtils.CreateTabButton(this); _tabstrip.tabPages = _tabContainer; UIPanel panel = null; UITextField textField = null; for (int i = 0; i < ModConfig.Instance.MaxNotes; i++) { _tabstrip.AddTab("#" + (i + 1), _templateButton, true); _tabstrip.selectedIndex = i; panel = _tabstrip.tabContainer.components[i] as UIPanel; if (panel != null) { textField = UIUtils.CreateMultilineTextField(panel, "TextField", ""); } } } catch (Exception e) { Debug.Log("[Note It!] MainPanel:CreateUI -> Exception: " + e.Message); } }
private void InitUI() { if(toolbarTabContainer == null){ MainToolbar toolbar = ToolsModifierControl.mainToolbar; UITabstrip tabstrip = (UITabstrip)toolbar.component; toolbarTabContainer = tabstrip.tabContainer; } Options.eventScrollDirectionChanged += (bool value) =>{ if(expanded) Expand(value); }; if(m_expandButton == null){ UIView view = UIView.GetAView(); UIMultiStateButton advisorButton = view.FindUIComponent<UIMultiStateButton>("AdvisorButton"); m_expandButton = (UIButton)view.AddUIComponent(typeof(UIButton)); m_expandButton.absolutePosition = advisorButton.absolutePosition + new Vector3(advisorButton.width,0); var atlas = TextureLoader.CreateTextureAtlas("ExapandCollapseIcons","ExpandCollapseIcons",TextureLoader.FileDirectory.Images, new string[]{ "Expand","Collapse","OptionBase","OptionBaseDisabled","OptionBaseHovered","OptionBaseFocused" },2,3); //m_expandButton.text = "+"; m_expandButton.atlas = atlas; m_expandButton.name = "ExpandToolbarButton"; m_expandButton.isInteractive = true; m_expandButton.scaleFactor = 0.76f; m_expandButton.size = new Vector2(36,36); m_expandButton.normalBgSprite = "OptionBase"; m_expandButton.normalFgSprite = "Expand"; m_expandButton.disabledBgSprite = "OptionBaseDisabled"; m_expandButton.hoveredBgSprite = "OptionBaseHovered"; m_expandButton.eventClicked += (component, eventParam) => { ToggleExpand(); }; } }
public static void Postfix(ContentManagerPanel __instance, UIListBox ___m_Categories, UITabContainer ___m_CategoriesContainer, UIComponent ___m_ModsContainer) { Debug.Log("Create Categories!"); var handler = (PropertyChangedEventHandler <int>)Delegate.CreateDelegate(typeof(PropertyChangedEventHandler <int>), __instance, "OnCategoryChanged"); ___m_Categories.eventSelectedIndexChanged -= handler; ___m_Categories.selectedIndex = -1; // Manually Insert Category // TODO: Cleanup! UIComponent container; List <string> list = (___m_Categories.items == null) ? new List <string>() : new List <string>(___m_Categories.items); list.Insert(list.Count - 2, "GROUPS"); container = ___m_CategoriesContainer.AddUIComponent <UIPanel>(); container.zOrder = list.Count - 3; ___m_Categories.items = list.ToArray(); ___m_Categories.filteredItems = new int[1] { 10 }; ___m_Categories.eventSelectedIndexChanged += handler; ___m_Categories.selectedIndex = 0; }
public AssetSelectorConfig(UITabContainer tsContainer) { tsContainer_ = tsContainer; }
public static void MakeSettings(UIHelperBase helper) { LoadSetting(); UIHelper actualHelper = helper as UIHelper; UIComponent container = actualHelper.self as UIComponent; UITabstrip tabStrip = container.AddUIComponent <UITabstrip>(); tabStrip.relativePosition = new Vector3(0, 0); tabStrip.size = new Vector2(container.width - 20, 40); UITabContainer tabContainer = container.AddUIComponent <UITabContainer>(); tabContainer.relativePosition = new Vector3(0, 40); tabContainer.size = new Vector2(container.width - 20, container.height - tabStrip.height - 20); tabStrip.tabPages = tabContainer; int tabIndex = 0; // Lane_ShortCut AddOptionTab(tabStrip, Localization.Get("BASIC_SETTING")); tabStrip.selectedIndex = tabIndex; UIPanel currentPanel = tabStrip.tabContainer.components[tabIndex] as UIPanel; currentPanel.autoLayout = true; currentPanel.autoLayoutDirection = LayoutDirection.Vertical; currentPanel.autoLayoutPadding.top = 5; currentPanel.autoLayoutPadding.left = 10; currentPanel.autoLayoutPadding.right = 10; UIHelper panelHelper = new UIHelper(currentPanel); UIHelperBase group = panelHelper.AddGroup(Localization.Get("BASIC_SETTING")); group.AddCheckbox(Localization.Get("SHOW_LACK_OF_RESOURCE"), RealCity.debugMode, (index) => debugModeEnable(index)); group.AddCheckbox(Localization.Get("REDUCE_CARGO_ENABLE"), RealCity.reduceVehicle, (index) => reduceVehicleEnable(index)); group.AddCheckbox(Localization.Get("NO_PASSENGERCAR"), RealCity.noPassengerCar, (index) => noPassengerCarEnable(index)); group.AddButton(Localization.Get("RESET_VALUE"), Loader.InitData); if (Loader.isTransportLinesManagerRunning) { UIHelperBase group1 = panelHelper.AddGroup(Localization.Get("TLMRUNNING")); } else { UIHelperBase group1 = panelHelper.AddGroup(Localization.Get("TLMNOTRUNNING")); } ++tabIndex; AddOptionTab(tabStrip, Localization.Get("SPTB")); tabStrip.selectedIndex = tabIndex; currentPanel = tabStrip.tabContainer.components[tabIndex] as UIPanel; currentPanel.autoLayout = true; currentPanel.autoLayoutDirection = LayoutDirection.Vertical; currentPanel.autoLayoutPadding.top = 5; currentPanel.autoLayoutPadding.left = 10; currentPanel.autoLayoutPadding.right = 10; panelHelper = new UIHelper(currentPanel); var generalGroup2 = panelHelper.AddGroup(Localization.Get("SMART_PUBLIC_TRANSPORT_BUDGET_WEEKDAY")) as UIHelper; morningBudgetWeekDaySlider = generalGroup2.AddSlider(Localization.Get("WEEKDAY_MORNING_BUDGET") + "(" + morningBudgetWeekDay.ToString() + "%)", 10, 300, 5, morningBudgetWeekDay, onMorningBudgetWeekDayChanged) as UISlider; morningBudgetWeekDaySlider.parent.Find <UILabel>("Label").width = 500f; eveningBudgetWeekDaySlider = generalGroup2.AddSlider(Localization.Get("WEEKDAY_EVENING_BUDGET") + "(" + eveningBudgetWeekDay.ToString() + "%)", 10, 300, 5, eveningBudgetWeekDay, onEveningBudgetWeekDayChanged) as UISlider; eveningBudgetWeekDaySlider.parent.Find <UILabel>("Label").width = 500f; deepNightBudgetWeekDaySlider = generalGroup2.AddSlider(Localization.Get("WEEKDAY_DEEPNIGHT_BUDGET") + "(" + deepNightBudgetWeekDay.ToString() + "%)", 10, 300, 5, deepNightBudgetWeekDay, onDeepNightBudgetWeekDayChanged) as UISlider; deepNightBudgetWeekDaySlider.parent.Find <UILabel>("Label").width = 500f; otherBudgetWeekDaySlider = generalGroup2.AddSlider(Localization.Get("WEEKDAY_OTHER_BUDGET") + "(" + otherBudgetWeekDay.ToString() + "%)", 10, 300, 5, otherBudgetWeekDay, onOtherBudgetWeekDayChanged) as UISlider; otherBudgetWeekDaySlider.parent.Find <UILabel>("Label").width = 500f; var generalGroup3 = panelHelper.AddGroup(Localization.Get("SMART_PUBLIC_TRANSPORT_BUDGET_WEEKEND")) as UIHelper; morningBudgetWeekEndSlider = generalGroup3.AddSlider(Localization.Get("WEEKEND_MORNING_BUDGET") + "(" + morningBudgetWeekEnd.ToString() + "%)", 10, 300, 5, morningBudgetWeekEnd, onMorningBudgetWeekEndChanged) as UISlider; morningBudgetWeekEndSlider.parent.Find <UILabel>("Label").width = 500f; eveningBudgetWeekEndSlider = generalGroup3.AddSlider(Localization.Get("WEEKEND_EVENING_BUDGET") + "(" + eveningBudgetWeekEnd.ToString() + "%)", 10, 300, 5, eveningBudgetWeekEnd, onEveningBudgetWeekEndChanged) as UISlider; eveningBudgetWeekEndSlider.parent.Find <UILabel>("Label").width = 500f; deepNightBudgetWeekEndSlider = generalGroup3.AddSlider(Localization.Get("WEEKEND_DEEPNIGHT_BUDGET") + "(" + deepNightBudgetWeekEnd.ToString() + "%)", 10, 300, 5, deepNightBudgetWeekEnd, onDeepNightBudgetWeekEndChanged) as UISlider; deepNightBudgetWeekEndSlider.parent.Find <UILabel>("Label").width = 500f; otherBudgetWeekEndSlider = generalGroup3.AddSlider(Localization.Get("WEEKEND_OTHER_BUDGET") + "(" + otherBudgetWeekEnd.ToString() + "%)", 10, 300, 5, otherBudgetWeekEnd, onOtherBudgetWeekEndChanged) as UISlider; otherBudgetWeekEndSlider.parent.Find <UILabel>("Label").width = 500f; ++tabIndex; AddOptionTab(tabStrip, Localization.Get("SPTB2")); tabStrip.selectedIndex = tabIndex; currentPanel = tabStrip.tabContainer.components[tabIndex] as UIPanel; currentPanel.autoLayout = true; currentPanel.autoLayoutDirection = LayoutDirection.Vertical; currentPanel.autoLayoutPadding.top = 5; currentPanel.autoLayoutPadding.left = 10; currentPanel.autoLayoutPadding.right = 10; panelHelper = new UIHelper(currentPanel); var generalGroup4 = panelHelper.AddGroup(Localization.Get("SMART_PUBLIC_TRANSPORT_BUDGET_MAX")) as UIHelper; morningBudgetMaxSlider = generalGroup4.AddSlider(Localization.Get("MAX_MORNING_BUDGET") + "(" + morningBudgetMax.ToString() + "%)", 10, 300, 5, morningBudgetMax, onMorningBudgetMaxChanged) as UISlider; morningBudgetMaxSlider.parent.Find <UILabel>("Label").width = 500f; eveningBudgetMaxSlider = generalGroup4.AddSlider(Localization.Get("MAX_EVENING_BUDGET") + "(" + eveningBudgetMax.ToString() + "%)", 10, 300, 5, eveningBudgetMax, onEveningBudgetMaxChanged) as UISlider; eveningBudgetMaxSlider.parent.Find <UILabel>("Label").width = 500f; deepNightBudgetMaxSlider = generalGroup4.AddSlider(Localization.Get("MAX_DEEPNIGHT_BUDGET") + "(" + deepNightBudgetMax.ToString() + "%)", 10, 300, 5, deepNightBudgetMax, onDeepNightBudgetMaxChanged) as UISlider; deepNightBudgetMaxSlider.parent.Find <UILabel>("Label").width = 500f; otherBudgetMaxSlider = generalGroup4.AddSlider(Localization.Get("MAX_OTHER_BUDGET") + "(" + otherBudgetMax.ToString() + "%)", 10, 300, 5, otherBudgetMax, onOtherBudgetMaxChanged) as UISlider; otherBudgetMaxSlider.parent.Find <UILabel>("Label").width = 500f; var generalGroup5 = panelHelper.AddGroup(Localization.Get("SMART_PUBLIC_TRANSPORT_BUDGET_MIN")) as UIHelper; morningBudgetMinSlider = generalGroup5.AddSlider(Localization.Get("MIN_MORNING_BUDGET") + "(" + morningBudgetMin.ToString() + "%)", 10, 300, 5, morningBudgetMin, onMorningBudgetMinChanged) as UISlider; morningBudgetMinSlider.parent.Find <UILabel>("Label").width = 500f; eveningBudgetMinSlider = generalGroup5.AddSlider(Localization.Get("MIN_EVENING_BUDGET") + "(" + eveningBudgetMin.ToString() + "%)", 10, 300, 5, eveningBudgetMin, onEveningBudgetMinChanged) as UISlider; eveningBudgetMinSlider.parent.Find <UILabel>("Label").width = 500f; deepNightBudgetMinSlider = generalGroup5.AddSlider(Localization.Get("MIN_DEEPNIGHT_BUDGET") + "(" + deepNightBudgetMin.ToString() + "%)", 10, 300, 5, deepNightBudgetMin, onDeepNightBudgetMinChanged) as UISlider; deepNightBudgetMinSlider.parent.Find <UILabel>("Label").width = 500f; otherBudgetMinSlider = generalGroup5.AddSlider(Localization.Get("MIN_OTHER_BUDGET") + "(" + otherBudgetMin.ToString() + "%)", 10, 300, 5, otherBudgetMin, onOtherBudgetMinChanged) as UISlider; otherBudgetMinSlider.parent.Find <UILabel>("Label").width = 500f; SaveSetting(); }
public void OnSettingsUI(UIHelperBase helper) { LoadSettings(); UIDropDown uIDropDown = (UIDropDown)helper.AddDropdown("Select Preset", EmergencyLightPresets, SelectedPreset, delegate(int sel) { if (sel == 1) { CustomSettingsVisibility = true; } else { CustomSettingsVisibility = false; } SelectedPreset = sel; if (loaded) { Apply(); } }); UIScrollablePanel uIScrollablePanel = ((UIHelper)helper).self as UIScrollablePanel; uIScrollablePanel.autoLayout = false; int num = 100; int num2 = 10; int num3 = 40; strip = uIScrollablePanel.AddUIComponent <UITabstrip>(); strip.relativePosition = new Vector3(num2, num); strip.size = new Vector2(744 - num2, num3); container = uIScrollablePanel.AddUIComponent <UITabContainer>(); container.relativePosition = new Vector3(num2, num3 + num); container.size = new Vector3(744 - num2, 713 - num); strip.tabPages = container; UIButton uIButton = (UIButton)UITemplateManager.Peek("OptionsButtonTemplate"); UIButton uIButton2 = strip.AddTab("Police Car", uIButton, fillText: true); uIButton2.textColor = uIButton.textColor; uIButton2.pressedTextColor = uIButton.pressedTextColor; uIButton2.hoveredTextColor = uIButton.hoveredTextColor; uIButton2.focusedTextColor = uIButton.hoveredTextColor; uIButton2.disabledTextColor = uIButton.hoveredTextColor; UIPanel uIPanel = strip.tabContainer.components[0] as UIPanel; uIPanel.autoLayout = true; uIPanel.wrapLayout = true; uIPanel.autoLayoutDirection = LayoutDirection.Horizontal; UIHelper uIHelper = new UIHelper(uIPanel); uIHelper.AddSpace(15); uIHelper.AddDropdown("Left", ColorNames, Array.IndexOf(ColorNames, settings[Setting.PoliceLeft]), delegate(int sel) { settings[Setting.PoliceLeft] = ColorNames[sel]; ExportSettings(); if (loaded) { Apply(); } }); uIHelper.AddDropdown("Right", ColorNames, Array.IndexOf(ColorNames, settings[Setting.PoliceRight]), delegate(int sel) { settings[Setting.PoliceRight] = ColorNames[sel]; ExportSettings(); if (loaded) { Apply(); } }); uIButton2 = strip.AddTab("Fire Truck"); uIButton2.textColor = uIButton.textColor; uIButton2.pressedTextColor = uIButton.pressedTextColor; uIButton2.hoveredTextColor = uIButton.hoveredTextColor; uIButton2.focusedTextColor = uIButton.hoveredTextColor; uIButton2.disabledTextColor = uIButton.hoveredTextColor; uIPanel = (strip.tabContainer.components[1] as UIPanel); uIPanel.autoLayout = true; uIPanel.wrapLayout = true; uIPanel.autoLayoutDirection = LayoutDirection.Horizontal; uIHelper = new UIHelper(uIPanel); uIHelper.AddSpace(15); uIHelper.AddDropdown("Left", ColorNames, Array.IndexOf(ColorNames, settings[Setting.FireLeft]), delegate(int sel) { settings[Setting.FireLeft] = ColorNames[sel]; ExportSettings(); if (loaded) { Apply(); } }); uIHelper.AddDropdown("Right", ColorNames, Array.IndexOf(ColorNames, settings[Setting.FireRight]), delegate(int sel) { settings[Setting.FireRight] = ColorNames[sel]; ExportSettings(); if (loaded) { Apply(); } }); uIHelper.AddSpace(15); chkManualRearFire = (uIHelper.AddCheckbox("Configure Rear Lights Separately", Convert.ToBoolean(settings[Setting.ManualRearFire]), delegate(bool chkd) { settings[Setting.ManualRearFire] = chkd.ToString(); ExportSettings(); RearFireVisibility(chkd); if (loaded) { Apply(); } }) as UICheckBox); chkManualRearFire.width = 744f; uIHelper.AddSpace(15); ddFireLeftRear = (UIDropDown)uIHelper.AddDropdown("Left", ColorNames, Array.IndexOf(ColorNames, settings[Setting.FireLeftRear]), delegate(int sel) { settings[Setting.FireLeftRear] = ColorNames[sel]; ExportSettings(); if (loaded) { Apply(); } }); ddFireRightRear = (UIDropDown)uIHelper.AddDropdown("Right", ColorNames, Array.IndexOf(ColorNames, settings[Setting.FireRightRear]), delegate(int sel) { settings[Setting.FireRightRear] = ColorNames[sel]; ExportSettings(); if (loaded) { Apply(); } }); RearFireVisibility(Convert.ToBoolean(settings[Setting.ManualRearFire])); uIButton2 = strip.AddTab("Ambulance"); uIButton2.textColor = uIButton.textColor; uIButton2.pressedTextColor = uIButton.pressedTextColor; uIButton2.hoveredTextColor = uIButton.hoveredTextColor; uIButton2.focusedTextColor = uIButton.hoveredTextColor; uIButton2.disabledTextColor = uIButton.hoveredTextColor; uIPanel = (strip.tabContainer.components[2] as UIPanel); uIPanel.autoLayout = true; uIPanel.wrapLayout = true; uIPanel.autoLayoutDirection = LayoutDirection.Horizontal; uIHelper = new UIHelper(uIPanel); uIHelper.AddSpace(15); uIHelper.AddDropdown("Left", ColorNames, Array.IndexOf(ColorNames, settings[Setting.AmbulanceLeft]), delegate(int sel) { settings[Setting.AmbulanceLeft] = ColorNames[sel]; ExportSettings(); if (loaded) { Apply(); } }); uIHelper.AddDropdown("Right", ColorNames, Array.IndexOf(ColorNames, settings[Setting.AmbulanceRight]), delegate(int sel) { settings[Setting.AmbulanceRight] = ColorNames[sel]; ExportSettings(); if (loaded) { Apply(); } }); uIHelper.AddSpace(15); chkManualRearAmbulance = (uIHelper.AddCheckbox("Configure Rear Lights Separately", Convert.ToBoolean(settings[Setting.ManualRearAmbulance]), delegate(bool chkd) { settings[Setting.ManualRearAmbulance] = chkd.ToString(); ExportSettings(); RearAmbulanceVisibility(chkd); if (loaded) { Apply(); } }) as UICheckBox); chkManualRearAmbulance.width = 744f; uIHelper.AddSpace(15); ddAmbulanceLeftRear = (UIDropDown)uIHelper.AddDropdown("Left", ColorNames, Array.IndexOf(ColorNames, settings[Setting.AmbulanceLeftRear]), delegate(int sel) { settings[Setting.AmbulanceLeftRear] = ColorNames[sel]; ExportSettings(); if (loaded) { Apply(); } }); ddAmbulanceRightRear = (UIDropDown)uIHelper.AddDropdown("Right", ColorNames, Array.IndexOf(ColorNames, settings[Setting.AmbulanceRightRear]), delegate(int sel) { settings[Setting.AmbulanceRightRear] = ColorNames[sel]; ExportSettings(); if (loaded) { Apply(); } }); RearAmbulanceVisibility(Convert.ToBoolean(settings[Setting.ManualRearAmbulance])); uIButton2 = strip.AddTab("Rotary (e.g. Snow Plow)", uIButton, fillText: true); uIButton2.textColor = uIButton.textColor; uIButton2.pressedTextColor = uIButton.pressedTextColor; uIButton2.hoveredTextColor = uIButton.hoveredTextColor; uIButton2.focusedTextColor = uIButton.hoveredTextColor; uIButton2.disabledTextColor = uIButton.hoveredTextColor; uIPanel = strip.tabContainer.components[3] as UIPanel; uIPanel.autoLayout = true; uIPanel.wrapLayout = true; uIPanel.autoLayoutDirection = LayoutDirection.Horizontal; uIHelper = new UIHelper(uIPanel); uIHelper.AddSpace(15); uIHelper.AddDropdown("Left", ColorNames, Array.IndexOf(ColorNames, settings[Setting.SnowPlowLeft]), delegate(int sel) { settings[Setting.SnowPlowLeft] = ColorNames[sel]; ExportSettings(); if (loaded) { Apply(); } }); uIHelper.AddDropdown("Right", ColorNames, Array.IndexOf(ColorNames, settings[Setting.SnowPlowRight]), delegate(int sel) { settings[Setting.SnowPlowRight] = ColorNames[sel]; ExportSettings(); if (loaded) { Apply(); } }); strip.selectedIndex = -1; strip.selectedIndex = 0; int selectedIndex = uIDropDown.selectedIndex; uIDropDown.selectedIndex = -1; uIDropDown.selectedIndex = selectedIndex; }
public static void makeSettings(UIHelperBase helper) { // tabbing code is borrowed from RushHour mod // https://github.com/PropaneDragon/RushHour/blob/release/RushHour/Options/OptionHandler.cs UIHelper actualHelper = helper as UIHelper; UIComponent container = actualHelper.self as UIComponent; UITabstrip tabStrip = container.AddUIComponent <UITabstrip>(); tabStrip.relativePosition = new Vector3(0, 0); tabStrip.size = new Vector2(container.width - 20, 40); UITabContainer tabContainer = container.AddUIComponent <UITabContainer>(); tabContainer.relativePosition = new Vector3(0, 40); tabContainer.size = new Vector2(container.width - 20, container.height - tabStrip.height - 20); tabStrip.tabPages = tabContainer; int tabIndex = 0; // GENERAL AddOptionTab(tabStrip, Translation.GetString("General")); // tabStrip.AddTab(Translation.GetString("General"), tabTemplate, true); tabStrip.selectedIndex = tabIndex; UIPanel currentPanel = tabStrip.tabContainer.components[tabIndex] as UIPanel; currentPanel.autoLayout = true; currentPanel.autoLayoutDirection = LayoutDirection.Vertical; currentPanel.autoLayoutPadding.top = 5; currentPanel.autoLayoutPadding.left = 10; currentPanel.autoLayoutPadding.right = 10; UIHelper panelHelper = new UIHelper(currentPanel); simAccuracyDropdown = panelHelper.AddDropdown(Translation.GetString("Simulation_accuracy") + ":", new string[] { Translation.GetString("Very_high"), Translation.GetString("High"), Translation.GetString("Medium"), Translation.GetString("Low"), Translation.GetString("Very_Low") }, simAccuracy, onSimAccuracyChanged) as UIDropDown; var featureGroup = panelHelper.AddGroup(Translation.GetString("Activated_features")); enablePrioritySignsToggle = featureGroup.AddCheckbox(Translation.GetString("Priority_signs"), prioritySignsEnabled, onPrioritySignsEnabledChanged) as UICheckBox; enableTimedLightsToggle = featureGroup.AddCheckbox(Translation.GetString("Timed_traffic_lights"), timedLightsEnabled, onTimedLightsEnabledChanged) as UICheckBox; enableCustomSpeedLimitsToggle = featureGroup.AddCheckbox(Translation.GetString("Speed_limits"), customSpeedLimitsEnabled, onCustomSpeedLimitsEnabledChanged) as UICheckBox; enableVehicleRestrictionsToggle = featureGroup.AddCheckbox(Translation.GetString("Vehicle_restrictions"), vehicleRestrictionsEnabled, onVehicleRestrictionsEnabledChanged) as UICheckBox; enableJunctionRestrictionsToggle = featureGroup.AddCheckbox(Translation.GetString("Junction_restrictions"), junctionRestrictionsEnabled, onJunctionRestrictionsEnabledChanged) as UICheckBox; enableLaneConnectorToggle = featureGroup.AddCheckbox(Translation.GetString("Lane_connector"), laneConnectorEnabled, onLaneConnectorEnabledChanged) as UICheckBox; // GAMEPLAY ++tabIndex; AddOptionTab(tabStrip, Translation.GetString("Gameplay")); tabStrip.selectedIndex = tabIndex; currentPanel = tabStrip.tabContainer.components[tabIndex] as UIPanel; currentPanel.autoLayout = true; currentPanel.autoLayoutDirection = LayoutDirection.Vertical; currentPanel.autoLayoutPadding.top = 5; currentPanel.autoLayoutPadding.left = 10; currentPanel.autoLayoutPadding.right = 10; panelHelper = new UIHelper(currentPanel); var vehBehaviorGroup = panelHelper.AddGroup(Translation.GetString("Vehicle_behavior")); recklessDriversDropdown = vehBehaviorGroup.AddDropdown(Translation.GetString("Reckless_driving") + ":", new string[] { Translation.GetString("Path_Of_Evil_(10_%)"), Translation.GetString("Rush_Hour_(5_%)"), Translation.GetString("Minor_Complaints_(2_%)"), Translation.GetString("Holy_City_(0_%)") }, recklessDrivers, onRecklessDriversChanged) as UIDropDown; realisticSpeedsToggle = vehBehaviorGroup.AddCheckbox(Translation.GetString("Realistic_speeds"), realisticSpeeds, onRealisticSpeedsChanged) as UICheckBox; strongerRoadConditionEffectsToggle = vehBehaviorGroup.AddCheckbox(Translation.GetString("Road_condition_has_a_bigger_impact_on_vehicle_speed"), strongerRoadConditionEffects, onStrongerRoadConditionEffectsChanged) as UICheckBox; enableDespawningToggle = vehBehaviorGroup.AddCheckbox(Translation.GetString("Enable_despawning"), enableDespawning, onEnableDespawningChanged) as UICheckBox; var vehAiGroup = panelHelper.AddGroup(Translation.GetString("Advanced_Vehicle_AI")); advancedAIToggle = vehAiGroup.AddCheckbox(Translation.GetString("Enable_Advanced_Vehicle_AI"), advancedAI, onAdvancedAIChanged) as UICheckBox; #if DEBUG //if (SystemInfo.processorCount >= DYNAMIC_RECALC_MIN_PROCESSOR_COUNT) //dynamicPathRecalculationToggle = vehAiGroup.AddCheckbox(Translation.GetString("Enable_dynamic_path_calculation"), dynamicPathRecalculation, onDynamicPathRecalculationChanged) as UICheckBox; #endif highwayRulesToggle = vehAiGroup.AddCheckbox(Translation.GetString("Enable_highway_specific_lane_merging/splitting_rules"), highwayRules, onHighwayRulesChanged) as UICheckBox; preferOuterLaneToggle = vehAiGroup.AddCheckbox(Translation.GetString("Heavy_trucks_prefer_outer_lanes_on_highways"), preferOuterLane, onPreferOuterLaneChanged) as UICheckBox; var parkAiGroup = panelHelper.AddGroup(Translation.GetString("Parking_AI")); prohibitPocketCarsToggle = parkAiGroup.AddCheckbox(Translation.GetString("Enable_more_realistic_parking") + " (BETA feature)", prohibitPocketCars, onProhibitPocketCarsChanged) as UICheckBox; // VEHICLE RESTRICTIONS ++tabIndex; AddOptionTab(tabStrip, Translation.GetString("Policies_&_Restrictions")); tabStrip.selectedIndex = tabIndex; currentPanel = tabStrip.tabContainer.components[tabIndex] as UIPanel; currentPanel.autoLayout = true; currentPanel.autoLayoutDirection = LayoutDirection.Vertical; currentPanel.autoLayoutPadding.top = 5; currentPanel.autoLayoutPadding.left = 10; currentPanel.autoLayoutPadding.right = 10; panelHelper = new UIHelper(currentPanel); var atJunctionsGroup = panelHelper.AddGroup(Translation.GetString("At_junctions")); #if DEBUG allRelaxedToggle = atJunctionsGroup.AddCheckbox(Translation.GetString("All_vehicles_may_ignore_lane_arrows"), allRelaxed, onAllRelaxedChanged) as UICheckBox; #endif relaxedBussesToggle = atJunctionsGroup.AddCheckbox(Translation.GetString("Busses_may_ignore_lane_arrows"), relaxedBusses, onRelaxedBussesChanged) as UICheckBox; allowEnterBlockedJunctionsToggle = atJunctionsGroup.AddCheckbox(Translation.GetString("Vehicles_may_enter_blocked_junctions"), allowEnterBlockedJunctions, onAllowEnterBlockedJunctionsChanged) as UICheckBox; allowUTurnsToggle = atJunctionsGroup.AddCheckbox(Translation.GetString("Vehicles_may_do_u-turns_at_junctions"), allowUTurns, onAllowUTurnsChanged) as UICheckBox; allowLaneChangesWhileGoingStraightToggle = atJunctionsGroup.AddCheckbox(Translation.GetString("Vehicles_going_straight_may_change_lanes_at_junctions"), allowLaneChangesWhileGoingStraight, onAllowLaneChangesWhileGoingStraightChanged) as UICheckBox; if (SteamHelper.IsDLCOwned(SteamHelper.DLC.NaturalDisastersDLC)) { var inCaseOfEmergencyGroup = panelHelper.AddGroup(Translation.GetString("In_case_of_emergency")); evacBussesMayIgnoreRulesToggle = inCaseOfEmergencyGroup.AddCheckbox(Translation.GetString("Evacuation_busses_may_ignore_traffic_rules"), evacBussesMayIgnoreRules, onEvacBussesMayIgnoreRulesChanged) as UICheckBox; } // OVERLAYS ++tabIndex; AddOptionTab(tabStrip, Translation.GetString("Overlays")); tabStrip.selectedIndex = tabIndex; currentPanel = tabStrip.tabContainer.components[tabIndex] as UIPanel; currentPanel.autoLayout = true; currentPanel.autoLayoutDirection = LayoutDirection.Vertical; currentPanel.autoLayoutPadding.top = 5; currentPanel.autoLayoutPadding.left = 10; currentPanel.autoLayoutPadding.right = 10; panelHelper = new UIHelper(currentPanel); prioritySignsOverlayToggle = panelHelper.AddCheckbox(Translation.GetString("Priority_signs"), prioritySignsOverlay, onPrioritySignsOverlayChanged) as UICheckBox; timedLightsOverlayToggle = panelHelper.AddCheckbox(Translation.GetString("Timed_traffic_lights"), timedLightsOverlay, onTimedLightsOverlayChanged) as UICheckBox; speedLimitsOverlayToggle = panelHelper.AddCheckbox(Translation.GetString("Speed_limits"), speedLimitsOverlay, onSpeedLimitsOverlayChanged) as UICheckBox; vehicleRestrictionsOverlayToggle = panelHelper.AddCheckbox(Translation.GetString("Vehicle_restrictions"), vehicleRestrictionsOverlay, onVehicleRestrictionsOverlayChanged) as UICheckBox; junctionRestrictionsOverlayToggle = panelHelper.AddCheckbox(Translation.GetString("Junction_restrictions"), junctionRestrictionsOverlay, onJunctionRestrictionsOverlayChanged) as UICheckBox; connectedLanesOverlayToggle = panelHelper.AddCheckbox(Translation.GetString("Connected_lanes"), connectedLanesOverlay, onConnectedLanesOverlayChanged) as UICheckBox; nodesOverlayToggle = panelHelper.AddCheckbox(Translation.GetString("Nodes_and_segments"), nodesOverlay, onNodesOverlayChanged) as UICheckBox; showLanesToggle = panelHelper.AddCheckbox(Translation.GetString("Lanes"), showLanes, onShowLanesChanged) as UICheckBox; #if DEBUG vehicleOverlayToggle = panelHelper.AddCheckbox(Translation.GetString("Vehicles"), vehicleOverlay, onVehicleOverlayChanged) as UICheckBox; citizenOverlayToggle = panelHelper.AddCheckbox(Translation.GetString("Citizens"), citizenOverlay, onCitizenOverlayChanged) as UICheckBox; buildingOverlayToggle = panelHelper.AddCheckbox(Translation.GetString("Buildings"), buildingOverlay, onBuildingOverlayChanged) as UICheckBox; #endif // MAINTENANCE ++tabIndex; AddOptionTab(tabStrip, Translation.GetString("Maintenance")); tabStrip.selectedIndex = tabIndex; currentPanel = tabStrip.tabContainer.components[tabIndex] as UIPanel; currentPanel.autoLayout = true; currentPanel.autoLayoutDirection = LayoutDirection.Vertical; currentPanel.autoLayoutPadding.top = 5; currentPanel.autoLayoutPadding.left = 10; currentPanel.autoLayoutPadding.right = 10; panelHelper = new UIHelper(currentPanel); forgetTrafficLightsBtn = panelHelper.AddButton(Translation.GetString("Forget_toggled_traffic_lights"), onClickForgetToggledLights) as UIButton; resetStuckEntitiesBtn = panelHelper.AddButton(Translation.GetString("Reset_stuck_cims_and_vehicles"), onClickResetStuckEntities) as UIButton; #if DEBUG resetSpeedLimitsBtn = panelHelper.AddButton(Translation.GetString("Reset_custom_speed_limits"), onClickResetSpeedLimits) as UIButton; #endif reloadGlobalConfBtn = panelHelper.AddButton(Translation.GetString("Reload_global_configuration"), onClickReloadGlobalConf) as UIButton; resetGlobalConfBtn = panelHelper.AddButton(Translation.GetString("Reset_global_configuration"), onClickResetGlobalConf) as UIButton; #if DEBUG // DEBUG /*++tabIndex; * * settingsButton = tabStrip.AddTab("Debug", tabTemplate, true); * settingsButton.textPadding = new RectOffset(10, 10, 10, 10); * settingsButton.autoSize = true; * settingsButton.tooltip = "Debug"; * * currentPanel = tabStrip.tabContainer.components[tabIndex] as UIPanel; * currentPanel.autoLayout = true; * currentPanel.autoLayoutDirection = LayoutDirection.Vertical; * currentPanel.autoLayoutPadding.top = 5; * currentPanel.autoLayoutPadding.left = 10; * currentPanel.autoLayoutPadding.right = 10; * * panelHelper = new UIHelper(currentPanel); * * debugSwitchFields.Clear(); * for (int i = 0; i < debugSwitches.Length; ++i) { * int index = i; * string varName = $"Debug switch #{i}"; * debugSwitchFields.Add(panelHelper.AddCheckbox(varName, debugSwitches[i], delegate (bool newVal) { onBoolValueChanged(varName, newVal, ref debugSwitches[index]); }) as UICheckBox); * } * * debugValueFields.Clear(); * for (int i = 0; i < debugValues.Length; ++i) { * int index = i; * string varName = $"Debug value #{i}"; * debugValueFields.Add(panelHelper.AddTextfield(varName, String.Format("{0:0.##}", debugValues[i]), delegate(string newValStr) { onFloatValueChanged(varName, newValStr, ref debugValues[index]); }, null) as UITextField); * }*/ #endif tabStrip.selectedIndex = 0; }