public void Awake() { Instance = this; m_controlContainer = GetComponent <UIPanel>(); m_controlContainer.area = new Vector4(0, 0, 0, 0); m_controlContainer.isVisible = false; m_controlContainer.name = "TLMPanel"; KlyteMonoUtils.CreateUIElement(out UIPanel _mainPanel, GetComponent <UIPanel>().transform, "TLMListPanel", new Vector4(0, 0, 875, m_controlContainer.parent.height)); MainPanel = _mainPanel; MainPanel.backgroundSprite = "MenuPanel2"; CreateTitleBar(); KlyteMonoUtils.CreateUIElement(out m_stripMain, MainPanel.transform, "TLMTabstrip", new Vector4(5, 45, MainPanel.width - 10, 40)); KlyteMonoUtils.CreateUIElement(out UITabContainer tabContainer, MainPanel.transform, "TLMTabContainer", new Vector4(0, 85, MainPanel.width, MainPanel.height - 85)); m_stripMain.tabPages = tabContainer; CreateTsdTabstrip(); m_stripMain.selectedIndex = 0; m_stripMain.selectedIndex = -1; m_stripMain.eventSelectedIndexChanged += SetViewMode; m_stripMain.eventVisibilityChanged += OnOpenClosePanel; }
private void CreateMainPanel() { m_mainPanel = gameObject.AddComponent <UIPanel>(); m_mainPanel.Hide(); m_mainPanel.width = 250; m_mainPanel.height = 350; m_mainPanel.zOrder = 50; m_mainPanel.color = new Color32(255, 255, 255, 255); m_mainPanel.backgroundSprite = "MenuPanel2"; m_mainPanel.name = "AssetSelectorWindow_" + typeof(T).Name; m_mainPanel.autoLayoutPadding = new RectOffset(5, 5, 10, 10); m_mainPanel.autoLayout = false; m_mainPanel.useCenter = true; m_mainPanel.wrapLayout = false; m_mainPanel.canFocus = true; GetComponentInParent <UIComponent>().eventVisibilityChanged += (component, value) => { m_mainPanel.isVisible = value; }; KlyteMonoUtils.CreateUIElement(out m_title, m_mainPanel.transform); m_title.textAlignment = UIHorizontalAlignment.Center; m_title.autoSize = false; m_title.autoHeight = true; m_title.width = m_mainPanel.width - 30f; m_title.relativePosition = new Vector3(5, 5); m_title.textScale = 0.9f; }
public void Awake() { m_bg = component as UIScrollablePanel; PublicTransportWorldInfoPanel ptwip = UVMPublicTransportWorldInfoPanel.m_obj.origInstance; AddNewStopTemplate(); ptwip.component.width = 800; BindComponents(ptwip); AdjustLineStopsPanel(ptwip); KlyteMonoUtils.CreateUIElement(out m_panelModeSelector, m_bg.parent.transform); m_panelModeSelector.autoFitChildrenHorizontally = true; m_panelModeSelector.autoFitChildrenVertically = true; m_panelModeSelector.autoLayout = true; m_panelModeSelector.autoLayoutDirection = LayoutDirection.Horizontal; m_mapModeDropDown = UIHelperExtension.CloneBasicDropDownNoLabel(Enum.GetNames(typeof(MapMode)).Select(x => Locale.Get("K45_TLM_LINEAR_MAP_VIEW_MODE", x)).ToArray(), (int idx) => { m_currentMode = (MapMode)idx; RefreshVehicleButtons(GetLineID()); }, m_panelModeSelector); m_mapModeDropDown.textScale = 0.75f; m_mapModeDropDown.size = new Vector2(200, 25); m_mapModeDropDown.itemHeight = 16; UICheckBox unscaledCheck = UIHelperExtension.AddCheckboxLocale(m_panelModeSelector, "K45_TLM_LINEAR_MAP_SHOW_UNSCALED", m_unscaledMode, (val) => m_unscaledMode = val); KlyteMonoUtils.LimitWidthAndBox(unscaledCheck.label, 165); InstanceManagerOverrides.EventOnBuildingRenamed += (x) => m_dirtyNames = true; }
private void CreateMainPanel() { KlyteMonoUtils.CreateUIElement(out m_mainPanel, m_parent.transform); m_mainPanel.Hide(); m_mainPanel.relativePosition = new Vector3(m_parent.width - 375f, 0.0f); m_mainPanel.width = 350; m_mainPanel.height = m_parent.height; m_mainPanel.zOrder = 50; m_mainPanel.color = new Color32(255, 255, 255, 255); m_mainPanel.name = "AssetSelectorWindow"; m_mainPanel.autoLayoutPadding = new RectOffset(5, 5, 10, 10); m_mainPanel.autoLayout = false; m_mainPanel.useCenter = true; m_mainPanel.wrapLayout = false; m_mainPanel.canFocus = true; m_parent.eventVisibilityChanged += (component, value) => { m_mainPanel.isVisible = value; }; KlyteMonoUtils.CreateUIElement(out m_title, m_mainPanel.transform); m_title.textAlignment = UIHorizontalAlignment.Center; m_title.autoSize = false; m_title.autoHeight = true; m_title.width = m_mainPanel.width - 30f; m_title.relativePosition = new Vector3(5, 5); m_title.textScale = 0.9f; m_title.localeID = "K45_VMC_DISTRICT_ASSET_SELECT_WINDOW_TITLE_PREFIX"; }
public void Awake() { LogUtils.DoLog("AWAKE AdrMapBordersChart !"); UIPanel panel = transform.gameObject.AddComponent <UIPanel>(); panel.width = 370; panel.height = 70; panel.autoLayout = false; panel.useCenter = true; panel.wrapLayout = false; panel.tooltipLocaleID = "K45_ADR_CITY_NEIGHBORHOOD"; KlyteMonoUtils.CreateUIElement(out m_container, transform, "NeighborhoodContainer"); m_container.relativePosition = new Vector3((panel.width / 2f) - 35, 0); m_container.width = 70; m_container.height = 70; m_container.autoLayout = false; m_container.useCenter = true; m_container.wrapLayout = false; m_container.tooltipLocaleID = "K45_ADR_CITY_NEIGHBORHOOD"; KlyteMonoUtils.CreateUIElement(out m_bordersInformation, m_container.transform, "Neighbors"); m_bordersInformation.spriteName = "EmptySprite"; m_bordersInformation.relativePosition = new Vector3(0, 0); m_bordersInformation.width = 70; m_bordersInformation.height = 70; KlyteMonoUtils.CreateUIElement(out m_cityMap, m_bordersInformation.transform, "City"); m_cityMap.spriteName = "EmptySprite"; m_cityMap.relativePosition = new Vector3(5, 5); m_cityMap.color = Color.gray; m_cityMap.width = 60; m_cityMap.height = 60; m_cityMap.tooltipLocaleID = "K45_ADR_CITY_AREA"; }
private void CreateTitleRowBuilding(ref UIPanel titleLine, UIComponent parent) { KlyteMonoUtils.CreateUIElement(out titleLine, parent.transform, "VMCtitleline", new Vector4(5, 80, parent.width - 10, 40)); KlyteMonoUtils.CreateUIElement(out UILabel districtNameLabel, titleLine.transform, "districtNameLabel"); districtNameLabel.autoSize = false; districtNameLabel.area = new Vector4(0, 10, 175, 18); districtNameLabel.textAlignment = UIHorizontalAlignment.Center; districtNameLabel.text = Locale.Get("TUTORIAL_ADVISER_TITLE", "District"); KlyteMonoUtils.CreateUIElement(out UILabel buildingNameLabel, titleLine.transform, "buildingNameLabel"); buildingNameLabel.autoSize = false; buildingNameLabel.area = new Vector4(200, 10, 198, 18); buildingNameLabel.textAlignment = UIHorizontalAlignment.Center; buildingNameLabel.text = Locale.Get("K45_VMC_BUILDING_NAME_LABEL"); KlyteMonoUtils.CreateUIElement(out UILabel vehicleCapacityLabel, titleLine.transform, "vehicleCapacityLabel"); vehicleCapacityLabel.autoSize = false; vehicleCapacityLabel.area = new Vector4(475, 10, 200, 18); vehicleCapacityLabel.textAlignment = UIHorizontalAlignment.Center; vehicleCapacityLabel.text = Locale.Get("K45_VMC_VEHICLE_CAPACITY_LABEL"); KlyteMonoUtils.CreateUIElement(out m_directionLabel, titleLine.transform, "directionLabel"); m_directionLabel.autoSize = false; m_directionLabel.area = new Vector4(600, 10, 200, 18); m_directionLabel.textAlignment = UIHorizontalAlignment.Center; m_directionLabel.text = Locale.Get("K45_VMC_DIRECTION_LABEL"); }
private void CreateScrollPanel() { KlyteMonoUtils.CreateUIElement(out m_scrollablePanel, m_mainPanel.transform); m_scrollablePanel.width = m_mainPanel.width - 20f; m_scrollablePanel.height = m_mainPanel.height - 50f; m_scrollablePanel.autoLayoutDirection = LayoutDirection.Vertical; m_scrollablePanel.autoLayoutStart = LayoutStart.TopLeft; m_scrollablePanel.autoLayoutPadding = new RectOffset(0, 0, 0, 0); m_scrollablePanel.scrollPadding = new RectOffset(10, 10, 10, 10); m_scrollablePanel.autoLayout = true; m_scrollablePanel.clipChildren = true; m_scrollablePanel.relativePosition = new Vector3(5, 45); m_scrollablePanel.backgroundSprite = "ScrollbarTrack"; KlyteMonoUtils.CreateUIElement(out UIPanel trackballPanel, m_mainPanel.transform); trackballPanel.width = 10f; trackballPanel.height = m_scrollablePanel.height; trackballPanel.autoLayoutDirection = LayoutDirection.Horizontal; trackballPanel.autoLayoutStart = LayoutStart.TopLeft; trackballPanel.autoLayoutPadding = new RectOffset(0, 0, 0, 0); trackballPanel.autoLayout = true; trackballPanel.relativePosition = new Vector3(m_mainPanel.width - 15, 45); KlyteMonoUtils.CreateUIElement(out m_scrollbar, trackballPanel.transform); m_scrollbar.width = 10f; m_scrollbar.height = m_scrollbar.parent.height; m_scrollbar.orientation = UIOrientation.Vertical; m_scrollbar.pivot = UIPivotPoint.BottomLeft; m_scrollbar.AlignTo(trackballPanel, UIAlignAnchor.TopRight); m_scrollbar.minValue = 0f; m_scrollbar.value = 0f; m_scrollbar.incrementAmount = 25f; KlyteMonoUtils.CreateUIElement(out UISlicedSprite scrollBg, m_scrollbar.transform); scrollBg.relativePosition = Vector2.zero; scrollBg.autoSize = true; scrollBg.size = scrollBg.parent.size; scrollBg.fillDirection = UIFillDirection.Vertical; scrollBg.spriteName = "ScrollbarTrack"; m_scrollbar.trackObject = scrollBg; KlyteMonoUtils.CreateUIElement(out UISlicedSprite scrollFg, scrollBg.transform); scrollFg.relativePosition = Vector2.zero; scrollFg.fillDirection = UIFillDirection.Vertical; scrollFg.autoSize = true; scrollFg.width = scrollFg.parent.width - 4f; scrollFg.spriteName = "ScrollbarThumb"; m_scrollbar.thumbObject = scrollFg; m_scrollablePanel.verticalScrollbar = m_scrollbar; m_scrollablePanel.eventMouseWheel += delegate(UIComponent component, UIMouseEventParameter param) { m_scrollablePanel.scrollPosition += new Vector2(0f, Mathf.Sign(param.wheelDelta) * -1f * m_scrollbar.incrementAmount); }; m_uiHelper = new UIHelperExtension(m_scrollablePanel); }
public void Awake() { MainContainer = GetComponent <UIPanel>(); MainContainer.autoLayout = true; MainContainer.autoLayoutDirection = LayoutDirection.Vertical; MainContainer.autoLayoutPadding = new RectOffset(5, 5, 5, 5); var m_uiHelperHS = new UIHelperExtension(MainContainer); m_buttonTool = (UIButton)m_uiHelperHS.AddButton(Locale.Get("K45_ADR_PICK_A_SEGMENT"), EnablePickTool); KlyteMonoUtils.LimitWidth(m_buttonTool, (m_uiHelperHS.Self.width - 20), true); AddLabel("", m_uiHelperHS, out m_labelSelectionDescription, out m_topContainerBar, false); m_labelSelectionDescription.prefix = Locale.Get("K45_ADR_CURRENTSELECTION") + ": "; m_labelSelectionDescription.padding.top = 8; AddButtonInEditorRow(m_labelSelectionDescription, Commons.UI.SpriteNames.CommonsSpriteNames.K45_PaintBucket, EnterPaintBucketMode, "K45_ADR_PAINTSEED", true, 30); AddButtonInEditorRow(m_labelSelectionDescription, Commons.UI.SpriteNames.CommonsSpriteNames.K45_Reload, OnSegmentNewSeed, "K45_ADR_CHANGESEED_INTERCROSS", true, 30); KlyteMonoUtils.LimitWidthAndBox(m_labelSelectionDescription, (m_labelSelectionDescription.width), true); KlyteMonoUtils.CreateUIElement(out m_editingContainer, MainContainer.transform, "SecContainer", new Vector4(0, 0, MainContainer.width, MainContainer.height - 10 - m_topContainerBar.height)); m_editingContainer.autoLayout = true; m_editingContainer.autoLayoutDirection = LayoutDirection.Vertical; m_editingContainer.autoLayoutPadding = new RectOffset(0, 0, 5, 5); var m_editingHelper = new UIHelperExtension(m_editingContainer); AddFilterableInput(Locale.Get("K45_ADR_HIGHWAYITEM_TYPE"), m_editingHelper, out m_hwType, out _, OnFilterHwTypes, OnSetHwType); AddTextField(Locale.Get("K45_ADR_HIGHWAYITEM_ID"), out m_hwId, m_editingHelper, OnSetHwId); AddTextField(Locale.Get("K45_ADR_HIGHWAYITEM_FORCEDNAME"), out m_hwName, m_editingHelper, OnSetHwForcedName); AddIntField(Locale.Get("K45_ADR_HIGHWAYITEM_MILEAGEOFFSET"), out m_hwMileageOffset, m_editingHelper, OnSetMileageOffset, false); AddCheckboxLocale("K45_ADR_HIGHWAYITEM_INVERTMILEAGE", out m_hwInvertMileage, m_editingHelper, OnSetMileageInvert); AddColorField(m_editingHelper, Locale.Get("K45_ADR_HIGHWAYITEM_COLOR"), out m_hwColor, OnSetHwColor); m_hwMileageOffset.width = 120; MainContainer.eventVisibilityChanged += (x, y) => { if (y) { eraseSeedBuffer = -1; DoEraseSeed(); } else { if (ToolsModifierControl.toolController.CurrentTool is RoadSegmentTool) { ToolsModifierControl.SetTool <DefaultTool>(); } OnSegmentSet(0); } }; OnSegmentSet(0); }
private void Awake() { parent = GetComponentInParent <UIComponent>(); var group6 = new UIHelperExtension(parent.GetComponentInChildren <UIScrollablePanel>()); ((UIScrollablePanel)group6.Self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIScrollablePanel)group6.Self).wrapLayout = true; ((UIScrollablePanel)group6.Self).width = 730; group6.AddLabel(Locale.Get("K45_TLM_CUSTOM_PALETTE_CONFIG")); group6.AddSpace(15); FileInfo fiPalette = FileUtils.EnsureFolderCreation(TLMController.PalettesFolder); group6.AddLabel(Locale.Get("K45_TLM_PALETTE_FOLDER_LABEL") + ":"); var namesFilesButton = ((UIButton)group6.AddButton("/", () => ColossalFramework.Utils.OpenInFileBrowser(fiPalette.FullName))); namesFilesButton.textColor = Color.yellow; KlyteMonoUtils.LimitWidthAndBox(namesFilesButton, 710); namesFilesButton.text = fiPalette.FullName + Path.DirectorySeparatorChar; ((UIButton)group6.AddButton(Locale.Get("K45_TLM_RELOAD_PALETTES"), delegate() { TLMAutoColorPaletteContainer.Reload(); ReloadData(); OnPaletteReloaded?.Invoke(); })).width = 710; UIPanel m_listColorContainer = null; m_paletteSelect = group6.AddDropdown(Locale.Get("K45_TLM_PALETTE_VIEW"), TLMAutoColorPaletteContainer.PaletteListForEditing, 0, delegate(int sel) { if (sel <= 0 || sel >= TLMAutoColorPaletteContainer.PaletteListForEditing.Length) { m_listColorContainer?.Disable(); m_colorFieldTemplateListColors?.SetItemCount(0); } else { m_listColorContainer?.Enable(); UpdateColorList(TLMAutoColorPaletteContainer.GetColors(TLMAutoColorPaletteContainer.PaletteListForEditing[sel])); } }) as UIDropDown; m_paletteSelect.GetComponentInParent <UIPanel>().width = 720; m_paletteSelect.GetComponentInParent <UIPanel>().autoLayoutDirection = LayoutDirection.Horizontal; m_paletteSelect.GetComponentInParent <UIPanel>().wrapLayout = true; m_paletteSelect.width = 710; KlyteMonoUtils.CreateUIElement(out m_listColorContainer, group6.Self.transform, "listColors", new UnityEngine.Vector4(0, 0, group6.Self.width, group6.Self.height - 250)); KlyteMonoUtils.CreateScrollPanel(m_listColorContainer, out m_colorListScroll, out _, m_listColorContainer.width - 20, m_listColorContainer.height); m_colorListScroll.backgroundSprite = "OptionsScrollbarTrack"; m_colorListScroll.autoLayout = true; m_colorListScroll.autoLayoutDirection = LayoutDirection.Horizontal; m_colorListScroll.wrapLayout = true; }
protected override void AwakeActions() { KlyteMonoUtils.CreateUIElement(out m_stripMain, base.MainPanel.transform, "AdrTabstrip", new Vector4(5, 40, base.MainPanel.width - 10, 40)); KlyteMonoUtils.CreateUIElement(out UITabContainer tabContainer, base.MainPanel.transform, "AdrTabContainer", new Vector4(5, 80, base.MainPanel.width - 10, base.MainPanel.height - 80)); m_stripMain.tabPages = tabContainer; m_stripMain.CreateTabLocalized <AdrDistrictConfigTab>("ToolbarIconDistrict", "K45_ADR_CONFIG_PER_DISTRICT_TAB", "AdrPerDistrict", false); m_stripMain.CreateTabLocalized <AdrHighwayParentEditorTab>("SubBarRoadsHighway", "K45_ADR_HIGHWAY_TYPES_TAB", "AdrHwTypes", false); m_stripMain.CreateTabLocalized <AdrHighwaySeedNameDataTab>("IconAdjustRoad", "K45_ADR_HIGHWAYNAMESEED_TAB", "AdrHwNameSeed", false); m_stripMain.CreateTabLocalized <AdrNeighborConfigTab>("IconRightArrow", "K45_ADR_CONFIG_NEIGHBOR_TAB", "AdrNeighbor", false); m_stripMain.CreateTabLocalized <AdrCitizenConfigTab>("IconCitizen", "K45_ADR_CONFIG_CITIZEN_TAB", "AdrCitizen", false); m_stripMain.CreateTabLocalized <AdrGlobalConfigTab>("ToolbarIconZoomOutGlobe", "K45_ADR_CONFIG_GLOBAL_TAB", "AdrGlobal", false); }
protected override void AwakeActions() { KlyteMonoUtils.CreateUIElement(out m_stripMain, MainPanel.transform, "TLMTabstrip", new Vector4(5, 45, MainPanel.width - 10, 40)); KlyteMonoUtils.CreateUIElement(out UITabContainer tabContainer, MainPanel.transform, "TLMTabContainer", new Vector4(0, 85, MainPanel.width, MainPanel.height - 85)); m_stripMain.tabPages = tabContainer; CreateTsdTabstrip(); m_stripMain.selectedIndex = 0; m_stripMain.selectedIndex = -1; m_stripMain.eventVisibilityChanged += OnOpenClosePanel; }
private void CreateLineCharts(Vector3 relativePos) { KlyteMonoUtils.CreateUIElement(out m_agesChartPanel, m_parent); m_agesChartPanel.relativePosition = relativePos; m_agesChartPanel.width = 140; m_agesChartPanel.height = 70; m_agesChartPanel.name = "WorkersPanel"; m_agesChartPanel.autoLayout = false; m_agesChartPanel.useCenter = true; m_agesChartPanel.wrapLayout = false; m_agesChartPanel.tooltipLocaleID = "ZONEDBUILDING_WORKERCHART"; KlyteMonoUtils.CreateUIElement(out UIPanel pieLegendPanel, m_agesChartPanel.transform); pieLegendPanel.relativePosition = new Vector3(70f, 0f); pieLegendPanel.width = 70; pieLegendPanel.height = 70; pieLegendPanel.name = "WorkersLegendPanel"; pieLegendPanel.wrapLayout = false; pieLegendPanel.autoLayout = false; pieLegendPanel.useCenter = true; KlyteMonoUtils.CreateUIElement(out m_workplaceChart, m_agesChartPanel.transform); m_workplaceChart.spriteName = "PieChartWhiteBg"; m_workplaceChart.relativePosition = new Vector3(0, 0); m_workplaceChart.width = 70; m_workplaceChart.height = 70; m_workplaceChart.name = "WorkersChart"; Color32 unskill = new Color32(210, 40, 40, 255); Color32 oneSchool = new Color32(180, 180, 40, 255); Color32 twoSchool = new Color32(40, 180, 40, 255); Color32 threeSchool = new Color32(40, 40, 210, 255); int y = 0; m_legendL0 = CriaFatiaELegenda(unskill, m_workplaceChart, pieLegendPanel, "ZONEDBUILDING_UNEDUCATED", 14 * y++); m_legendL1 = CriaFatiaELegenda(oneSchool, m_workplaceChart, pieLegendPanel, "ZONEDBUILDING_EDUCATED", 14 * y++); m_legendL2 = CriaFatiaELegenda(twoSchool, m_workplaceChart, pieLegendPanel, "ZONEDBUILDING_WELLEDUCATED", 14 * y++); m_legendL3 = CriaFatiaELegenda(threeSchool, m_workplaceChart, pieLegendPanel, "ZONEDBUILDING_HIGHLYEDUCATED", 14 * y++); KlyteMonoUtils.CreateUIElement(out m_workersChart, m_workplaceChart.transform); m_workersChart.spriteName = "PieChartWhiteFg"; m_workersChart.relativePosition = new Vector3(0, 0); m_workersChart.width = 70; m_workersChart.height = 70; m_workersChart.name = "WorkersChart"; CriaFatiaELegenda(MultiplyColor(unskill, 0.5f), m_workersChart); CriaFatiaELegenda(MultiplyColor(oneSchool, 0.5f), m_workersChart); CriaFatiaELegenda(MultiplyColor(twoSchool, 0.5f), m_workersChart); CriaFatiaELegenda(MultiplyColor(threeSchool, 0.5f), m_workersChart); m_legendFr = CriaFatiaELegenda(Color.gray, m_workersChart, pieLegendPanel, "ZONEDBUILDING_JOBSAVAIL", 14 * y++); }
protected override void AwakeActions() { KlyteMonoUtils.CreateUIElement(out m_stripMain, base.MainPanel.transform, "AdrTabstrip", new Vector4(5, 45, base.MainPanel.width - 5, 40)); KlyteMonoUtils.CreateUIElement(out UITabContainer tabContainer, base.MainPanel.transform, "AdrTabContainer", new Vector4(5, 80, base.MainPanel.width - 5, base.MainPanel.height - 80)); m_stripMain.tabPages = tabContainer; CreateTab<AdrDistrictConfigTab>("ToolbarIconDistrict", "K45_ADR_CONFIG_PER_DISTRICT_TAB", "AdrPerDistrict"); CreateTab<AdrNeighborConfigTab>("IconRightArrow", "K45_ADR_CONFIG_NEIGHBOR_TAB", "AdrNeighbor"); CreateTab<AdrCitizenConfigTab>("IconCitizen", "K45_ADR_CONFIG_CITIZEN_TAB", "AdrCitizen"); CreateTab<AdrGlobalConfigTab>("ToolbarIconZoomOutGlobe", "K45_ADR_CONFIG_GLOBAL_TAB", "AdrGlobal"); }
protected override void AwakeActions() { KlyteMonoUtils.CreateUIElement(out m_stripMain, MainPanel.transform, "ACETabstrip", new Vector4(5, 40, MainPanel.width - 10, 40)); m_stripMain.startSelectedIndex = -1; m_stripMain.selectedIndex = -1; KlyteMonoUtils.CreateUIElement(out UITabContainer tabContainer, MainPanel.transform, "ACETabContainer", new Vector4(0, 80, MainPanel.width, MainPanel.height - 90)); m_stripMain.tabPages = tabContainer; BuildingTab = m_stripMain.CreateTabLocalized <ACEBuildingController>("IconAssetBuilding", "K45_ACE_BUILDINGSRULEEDITOR_TAB", "ACEBuildingEditorTab", false); VehicleTab = m_stripMain.CreateTabLocalized <ACEVehicleController>("IconAssetVehicle", "K45_ACE_VEHICLESRULEEDITOR_TAB", "ACEVehicleEditorTab", false); CitizenTab = m_stripMain.CreateTabLocalized <ACECitizenController>("IconAssetCitizen", "K45_ACE_CITIZENRULEEDITOR_TAB", "ACECitizenEditorTab", false); PropTab = m_stripMain.CreateTabLocalized <ACEPropController>("IconAssetProp", "K45_ACE_PROPRULEEDITOR_TAB", "ACEPropEditorTab", false); }
protected float InitField(out UILabel label, string name, string tooltipLocale, float xAdvance, float columnWidth) { KlyteMonoUtils.CreateUIElement(out label, m_container.transform, name); label.autoSize = false; label.minimumSize = new Vector2(columnWidth, 24); label.textScale = 1f; label.relativePosition = new Vector3(xAdvance, 3); label.textAlignment = UIHorizontalAlignment.Right; label.verticalAlignment = UIVerticalAlignment.Middle; label.padding = new RectOffset(3, 3, 5, 3); label.isTooltipLocalized = true; label.tooltipLocaleID = tooltipLocale; KlyteMonoUtils.LimitWidthAndBox(label); return(label.minimumSize.x); }
private void Awake() { parent = GetComponentInChildren <UIScrollablePanel>(); int parentWidth = 730; KlyteMonoUtils.CreateUIElement(out UITabstrip strip, parent.transform, "TLMTabstrip", new Vector4(5, 0, parentWidth - 10, 40)); KlyteMonoUtils.CreateUIElement(out tabContainer, parent.transform, "TLMTabContainer", new Vector4(0, 40, parentWidth - 10, 660)); strip.tabPages = tabContainer; UIButton tabTemplate = CreateTabSubStripTemplate(); UIComponent bodyContent = CreateContentTemplate(parentWidth, 660, false); foreach (var kv in ReflectionUtils.GetSubtypesRecursive(typeof(TLMShowConfigTab), GetType())) { var tsd = (kv.GetConstructor(new Type[0]).Invoke(null) as TLMShowConfigTab).TSD; GameObject tab = Instantiate(tabTemplate.gameObject); GameObject body = Instantiate(bodyContent.gameObject); string name = tsd.GetTransportName(); string bgIcon = KlyteResourceLoader.GetDefaultSpriteNameFor(tsd.DefaultIcon, true); string fgIcon = tsd.GetTransportTypeIcon(); UIButton tabButton = tab.GetComponent <UIButton>(); tabButton.tooltip = name; tabButton.hoveredBgSprite = bgIcon; tabButton.focusedBgSprite = bgIcon; tabButton.normalBgSprite = bgIcon; tabButton.disabledBgSprite = bgIcon; tabButton.focusedColor = Color.green; tabButton.hoveredColor = new Color(0, 0.5f, 0f); tabButton.color = Color.white; tabButton.disabledColor = Color.gray; if (!string.IsNullOrEmpty(fgIcon)) { KlyteMonoUtils.CreateUIElement(out UIButton secSprite, tabButton.transform, "OverSprite", new Vector4(5, 5, 30, 30)); secSprite.normalFgSprite = fgIcon; secSprite.foregroundSpriteMode = UIForegroundSpriteMode.Scale; secSprite.isInteractive = false; secSprite.disabledColor = Color.black; } strip.AddTab(name, tab, body, new Type[] { kv }); } strip.selectedIndex = -1; strip.selectedIndex = 0; }
public static void GenerateExportButtons(UIHelperExtension helperSettings, string assetKind, out UIPanel m_exportButtonContainer, out UIButton m_exportButton, OnButtonClicked OnExport, out UIPanel m_exportButtonContainerLocal, out UIButton m_exportButtonLocal, OnButtonClicked OnExportLocal) { KlyteMonoUtils.CreateUIElement(out m_exportButtonContainer, helperSettings.Self.transform, $"ExportContainer{assetKind}", new Vector4(0, 0, helperSettings.Self.width, 45)); m_exportButtonContainer.autoLayout = true; m_exportButtonContainer.autoLayoutPadding = new RectOffset(0, 6, 0, 0); m_exportButton = UIHelperExtension.AddButton(m_exportButtonContainer, Locale.Get($"K45_ACE_EXPORTDATA_TOASSET{assetKind.ToUpper()}"), OnExport); KlyteMonoUtils.LimitWidthAndBox(m_exportButton, m_exportButtonContainer.width * 0.7f); KlyteMonoUtils.CreateUIElement(out m_exportButtonContainerLocal, helperSettings.Self.transform, $"ExportContainerLocal{assetKind}", new Vector4(0, 0, helperSettings.Self.width, 45)); m_exportButtonContainerLocal.autoLayout = true; m_exportButtonContainerLocal.autoLayoutPadding = new RectOffset(0, 6, 0, 0); m_exportButtonLocal = UIHelperExtension.AddButton(m_exportButtonContainerLocal, Locale.Get($"K45_ACE_EXPORTDATA_TOLOCAL{assetKind.ToUpper()}"), OnExportLocal); KlyteMonoUtils.LimitWidthAndBox(m_exportButtonLocal, m_exportButtonContainerLocal.width * 0.7f); }
private void SetPreviewWindow() { KlyteMonoUtils.CreateUIElement(out m_previewPanel, m_mainPanel.transform); m_previewPanel.backgroundSprite = "GenericPanel"; m_previewPanel.width = m_parent.width - 400f; m_previewPanel.height = 170; m_previewPanel.relativePosition = new Vector3(-m_previewPanel.width, m_mainPanel.height - 175); KlyteMonoUtils.CreateUIElement(out m_preview, m_previewPanel.transform); m_preview.size = m_previewPanel.size; m_preview.relativePosition = Vector3.zero; KlyteMonoUtils.CreateElement(out m_previewRenderer, m_mainPanel.transform); m_previewRenderer.Size = m_preview.size * 2f; m_preview.texture = m_previewRenderer.Texture; m_previewRenderer.Zoom = 3; m_previewRenderer.CameraRotation = 40; }
public void GenerateOptionsMenu(UIHelperExtension helper) { LogUtils.DoLog("Loading Options"); KlyteMonoUtils.CreateUIElement(out UITabstrip strip, helper.Self.transform, "TabListTLMopt", new Vector4(5, 0, 730, 40)); float effectiveOffsetY = strip.height; KlyteMonoUtils.CreateUIElement(out tabContainer, helper.Self.transform, "TabContainerTLMopt", new Vector4(0, 40, 725, 710)); tabContainer.autoSize = true; strip.tabPages = tabContainer; helper.Self.eventVisibilityChanged += delegate(UIComponent component, bool b) { if (b) { TransportLinesManagerMod.Instance.ShowVersionInfoPopup(); ReloadData(); } try { strip.selectedIndex = strip.tabCount - 1; } catch { } }; foreach (ConfigTabs tab in Enum.GetValues(typeof(ConfigTabs))) { UIButton superTab = CreateTabTemplate(); superTab.normalFgSprite = tab.GetTabFgSprite(); superTab.tooltip = tab.GetTabName(); KlyteMonoUtils.CreateUIElement(out UIPanel contentParent, null); KlyteMonoUtils.CreateScrollPanel(contentParent, out UIScrollablePanel content, out _, tabContainer.width, tabContainer.height, Vector3.zero); content.name = "Container"; content.area = new Vector4(0, 0, tabContainer.width, tabContainer.height); content.autoLayout = true; content.autoLayoutPadding = new RectOffset(2, 2, 2, 2); content.autoLayoutDirection = LayoutDirection.Vertical; strip.AddTab(tab.ToString(), superTab.gameObject, contentParent.gameObject, tab.GetTabGenericContentImpl()); } LogUtils.DoLog("End Loading Options"); }
public void Awake() { MainPanel = GetComponent <UIPanel>(); MainPanel.relativePosition = new Vector3(510f, 0.0f); MainPanel.width = 350; MainPanel.height = GetComponentInParent <UIComponent>().height; MainPanel.zOrder = 50; MainPanel.color = new Color32(255, 255, 255, 255); MainPanel.name = "AssetSelectorWindow"; MainPanel.autoLayoutPadding = new RectOffset(5, 5, 10, 10); MainPanel.autoLayout = true; MainPanel.autoLayoutDirection = LayoutDirection.Vertical; KlyteMonoUtils.CreateUIElement(out m_title, MainPanel.transform); m_title.textAlignment = UIHorizontalAlignment.Center; m_title.autoSize = false; m_title.autoHeight = true; m_title.width = MainPanel.width - 30f; m_title.relativePosition = new Vector3(5, 5); m_title.textScale = 0.9f; m_title.localeID = "K45_TLM_ASSETS_FOR_PREFIX"; m_helper = new UIHelperExtension(MainPanel); TLMUtils.doLog("Name"); m_prefixName = CreateMiniTextField("K45_TLM_PREFIX_NAME", OnPrefixNameChange); TLMUtils.doLog("ColorForModel"); m_useColorForModel = m_helper.AddCheckboxLocale("K45_TLM_USE_PREFIX_COLOR_FOR_VEHICLE", false, OnUseColorVehicleChange); KlyteMonoUtils.LimitWidth(m_useColorForModel.label, 340, true); m_useColorForModel.label.textScale = 1; TLMUtils.doLog("ColorSel"); CreateColorSelector(); TLMUtils.doLog("Palette"); m_paletteDD = CreateMiniDropdown("K45_TLM_PALETTE", SetPalettePrefix, new string[1]); ReloadPalettes(); TLMPaletteOptionsTab.onPaletteReloaded += ReloadPalettes; TLMUtils.doLog("Format"); m_formatDD = CreateMiniDropdown("K45_TLM_ICON", SetFormatPrefix, TLMLineIconExtension.getDropDownOptions(Locale.Get("K45_TLM_LINE_ICON_ENUM_TT_DEFAULT"))); }
private void CreateTitleLabel(UIPanel container, out UILabel label, string name, string text, uint width) { KlyteMonoUtils.CreateUIElement(out UIPanel nameContainer, container.transform, "GenNameContainer"); nameContainer.autoSize = false; nameContainer.width = width; nameContainer.height = 30; nameContainer.autoLayout = true; nameContainer.autoLayoutDirection = LayoutDirection.Horizontal; KlyteMonoUtils.CreateUIElement(out label, nameContainer.transform, name); KlyteMonoUtils.LimitWidthAndBox(label, width); label.autoSize = true; label.height = 30; label.padding = new RectOffset(3, 3, 4, 3); label.textAlignment = UIHorizontalAlignment.Center; label.text = text; label.verticalAlignment = UIVerticalAlignment.Middle; label.minimumSize = new Vector2(width, 0); }
protected void Start() { m_lastSortCriterionLines = LineSortCriterion.DEFAULT; UIComponent parent = GetComponent <UIComponent>(); KlyteMonoUtils.CreateUIElement(out m_autoNameAll, parent.transform); m_autoNameAll.relativePosition = new Vector3(parent.width - 50f, -5); m_autoNameAll.textScale = 0.6f; m_autoNameAll.width = 40; m_autoNameAll.height = 40; m_autoNameAll.tooltip = Locale.Get("K45_TLM_AUTO_NAME_ALL_TOOLTIP"); KlyteMonoUtils.InitButton(m_autoNameAll, true, "ButtonMenu"); m_autoNameAll.name = "AutoNameAll"; m_autoNameAll.isVisible = true; m_autoNameAll.normalFgSprite = KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_AutoNameIcon); m_autoNameAll.eventClick += (component, eventParam) => { foreach (UVMLineListItem item in mainPanel.GetComponentsInChildren <UVMLineListItem>()) { item.DoAutoName(); } }; KlyteMonoUtils.CreateUIElement(out m_autoColorAll, parent.transform); m_autoColorAll.relativePosition = new Vector3(parent.width - 90f, -5); m_autoColorAll.textScale = 0.6f; m_autoColorAll.width = 40; m_autoColorAll.height = 40; m_autoColorAll.tooltip = Locale.Get("K45_TLM_AUTO_COLOR_ALL_TOOLTIP"); KlyteMonoUtils.InitButton(m_autoColorAll, true, "ButtonMenu"); m_autoColorAll.name = "AutoColorAll"; m_autoColorAll.isVisible = true; m_autoColorAll.normalFgSprite = KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_AutoColorIcon); m_autoColorAll.eventClick += (component, eventParam) => { foreach (UVMLineListItem item in mainPanel.GetComponentsInChildren <UVMLineListItem>()) { item.DoAutoColor(); } }; }
public void Awake() { ControlContainer = GetComponent <UIPanel>(); ControlContainer.area = new Vector4(0, 0, 0, 0); ControlContainer.isVisible = false; ControlContainer.name = "AdrPanel"; KlyteMonoUtils.CreateUIElement(out m_mainPanel, ControlContainer.transform, "AdrListPanel", new Vector4(0, 0, 400, 600)); m_mainPanel.backgroundSprite = "MenuPanel2"; CreateTitleBar(); KlyteMonoUtils.CreateUIElement(out m_stripMain, m_mainPanel.transform, "AdrTabstrip", new Vector4(5, 45, m_mainPanel.width - 5, 40)); KlyteMonoUtils.CreateUIElement(out UITabContainer tabContainer, m_mainPanel.transform, "AdrTabContainer", new Vector4(5, 80, m_mainPanel.width - 5, m_mainPanel.height - 80)); m_stripMain.tabPages = tabContainer; CreateTab <AdrDistrictConfigTab>("ToolbarIconDistrict", "K45_ADR_CONFIG_PER_DISTRICT_TAB", "AdrPerDistrict"); CreateTab <AdrNeighborConfigTab>("IconRightArrow", "K45_ADR_CONFIG_NEIGHBOR_TAB", "AdrNeighbor"); CreateTab <AdrCitizenConfigTab>("IconCitizen", "K45_ADR_CONFIG_CITIZEN_TAB", "AdrCitizen"); CreateTab <AdrGlobalConfigTab>("ToolbarIconZoomOutGlobe", "K45_ADR_CONFIG_GLOBAL_TAB", "AdrGlobal"); }
public void Awake() { LogUtils.DoLog("AWAKE AdrMapBordersChart !"); UIPanel panel = GetComponent <UIPanel>(); panel.autoLayout = false; panel.useCenter = true; panel.wrapLayout = false; panel.tooltipLocaleID = "K45_ADR_CITY_NEIGHBORHOOD"; KlyteMonoUtils.CreateUIElement(out m_container, transform, "NeighborhoodContainer"); m_container.relativePosition = new Vector3((panel.width / 2f) - 190, (panel.height / 2f) - 190); m_container.width = 380; m_container.height = 380; m_container.autoLayout = false; m_container.useCenter = true; m_container.wrapLayout = false; m_container.tooltipLocaleID = "K45_ADR_CITY_NEIGHBORHOOD"; KlyteMonoUtils.CreateUIElement(out m_bordersInformation, m_container.transform, "Neighbors"); m_bordersInformation.spriteName = LineIconSpriteNames.K45_SquareIcon.ToString(); m_bordersInformation.relativePosition = new Vector3(0, 0); m_bordersInformation.width = 380; m_bordersInformation.height = 380; KlyteMonoUtils.CreateUIElement(out m_cityMap, m_bordersInformation.transform, "City"); m_cityMap.relativePosition = new Vector3(20, 20); m_cityMap.color = Color.gray; m_cityMap.width = 340; m_cityMap.height = 340; m_cityMap.tooltipLocaleID = "K45_ADR_CITY_AREA"; m_cityMap.eventVisibilityChanged += (x, y) => { if (y) { ProcessResourceTexture(); } }; }
private void CreateLineCharts() { KlyteMonoUtils.CreateUIElement(out m_agesChartPanel, Parent); m_agesChartPanel.relativePosition = new Vector3(450f, 45f); m_agesChartPanel.width = 140; m_agesChartPanel.height = 70; m_agesChartPanel.name = "AgesChartPanel"; m_agesChartPanel.autoLayout = false; m_agesChartPanel.useCenter = true; m_agesChartPanel.wrapLayout = false; KlyteMonoUtils.CreateUIElement(out UIPanel pieLegendPanel, m_agesChartPanel.transform); pieLegendPanel.relativePosition = new Vector3(70f, 0f); pieLegendPanel.width = 70; pieLegendPanel.height = 70; pieLegendPanel.name = "AgesChartLegendPanel"; pieLegendPanel.wrapLayout = false; pieLegendPanel.autoLayout = false; pieLegendPanel.useCenter = true; KlyteMonoUtils.CreateUIElement(out m_agesChart, m_agesChartPanel.transform); m_agesChart.spriteName = "PieChartWhiteBg"; m_agesChart.tooltipLocaleID = "ZONEDBUILDING_AGECHART"; m_agesChart.relativePosition = new Vector3(0, 0); m_agesChart.width = 70; m_agesChart.height = 70; m_agesChart.name = "AgesChart"; Color32 criancaColor = new Color32(254, 218, 155, 255); Color32 adolescenteColor = new Color32(205, 239, 145, 255); Color32 jovemColor = new Color32(189, 206, 235, 255); Color32 adultoColor = new Color32(255, 162, 162, 255); Color32 idosoColor = new Color32(100, 224, 206, 255); int y = 0; CriaFatiaELegenda(criancaColor, m_agesChart, pieLegendPanel, "ZONEDBUILDING_CHILDREN", 14 * y++); CriaFatiaELegenda(adolescenteColor, m_agesChart, pieLegendPanel, "ZONEDBUILDING_TEENS", 14 * y++); CriaFatiaELegenda(jovemColor, m_agesChart, pieLegendPanel, "ZONEDBUILDING_YOUNGS", 14 * y++); CriaFatiaELegenda(adultoColor, m_agesChart, pieLegendPanel, "ZONEDBUILDING_ADULTS", 14 * y++); CriaFatiaELegenda(idosoColor, m_agesChart, pieLegendPanel, "ZONEDBUILDING_SENIORS", 14 * y++); }
protected override void AwakeActions() { KlyteMonoUtils.CreateUIElement(out m_stripMain, MainPanel.transform, "WTSTabstrip", new Vector4(5, 40, MainPanel.width - 10, 40)); m_stripMain.startSelectedIndex = -1; m_stripMain.selectedIndex = -1; KlyteMonoUtils.CreateUIElement(out UITabContainer tabContainer, MainPanel.transform, "WTSTabContainer", new Vector4(0, 80, MainPanel.width, MainPanel.height - 80)); m_stripMain.tabPages = tabContainer; //m_stripMain.CreateTabLocalized<WTSPropPlacingTab2>("InfoIconEscapeRoutes", "K45_WTS_HIGHWAY_SIGN_CONFIG_TAB", "WTSHighwaySign"); //m_stripMain.CreateTabLocalized<WTSMileageMarkerTab3>("LocationMarkerNormal", "K45_WTS_MILEAGE_MARKERS_CONFIG_TAB", "WTSMileageMarkerTab"); //m_stripMain.CreateTabLocalized<WTSBuildingEditorTab2>("IconAssetBuilding", "K45_WTS_BUILDING_CONFIG_TAB", "WTSBuildingEditorTab"); m_stripMain.CreateTabLocalized <WTSPropLayoutEditor>("IconAssetProp", "K45_WTS_PROP_LIBRARY_EDITOR_TAB", "WTSBuildingEditorTab", false); m_stripMain.CreateTabLocalized <WTSRoadCornerEditor>("InfoIconTrafficRoutes", "K45_WTS_STREET_SIGN_CONFIG_TAB", "WTSStreetSign", false); m_stripMain.CreateTabLocalized <WTSBuildingLayoutEditor>("IconAssetBuilding", "K45_WTS_BUILDING_CONFIG_TAB", "WTSBuildingSettings", false); m_stripMain.CreateTabLocalized <WTSVehicleLayoutEditor>("IconAssetVehicle", "K45_WTS_VEHICLE_CONFIG_TAB", "WTSVehicleLayoutEditor", false); m_stripMain.CreateTabLocalized <WTSFontsSettings>(KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_AutoNameIcon), "K45_WTS_FONT_CONFIG_TAB", "WTSFontSettings", false); KlyteMonoUtils.CreateElement <WTSOnNetLiteUI>(UIView.GetAView().transform.Find("TSBar").gameObject.transform); }
public void Awake() { m_container = GetComponent <UIPanel>(); m_container.width = transform.GetComponentInParent <UIComponent>().width; m_container.height = 30; m_container.autoLayout = false; m_container.autoLayoutDirection = LayoutDirection.Horizontal; m_container.autoLayoutPadding = new RectOffset(2, 2, 2, 2); m_container.wrapLayout = false; m_container.name = "WealthReportLine"; m_container.eventSizeChanged += (x, y) => m_background.size = y; KlyteMonoUtils.CreateUIElement(out m_background, transform, "BG"); m_background.backgroundSprite = "InfoviewPanel"; Color32 backgroundColor = BackgroundColor; backgroundColor.a = (byte)((m_container.zOrder % 2 != 0) ? 127 : 255); m_background.color = backgroundColor; m_background.relativePosition = Vector3.zero; m_background.size = m_container.size; float xAdvance = 0; KlyteMonoUtils.CreateUIElement(out m_dateTime, m_container.transform, "DateTime"); m_dateTime.autoSize = true; m_dateTime.minimumSize = new Vector2(DATE_COLUMN_WIDTH, 30); m_dateTime.textScale = 0.7f; m_dateTime.textAlignment = UIHorizontalAlignment.Center; m_dateTime.relativePosition = new Vector3(0, 0); m_dateTime.verticalAlignment = UIVerticalAlignment.Middle; m_dateTime.padding = new RectOffset(3, 3, 5, 3); m_dateTime.text = "00:00\n25/12/2020"; KlyteMonoUtils.LimitWidthAndBox(m_dateTime); xAdvance += m_dateTime.minimumSize.x; AddColumns(ref xAdvance); }
public void Awake() { MainContainer = GetComponent <UIPanel>(); MainContainer.autoLayout = true; MainContainer.autoLayoutDirection = LayoutDirection.Horizontal; KlyteMonoUtils.CreateUIElement(out m_previewPanel, MainContainer.transform, "previewPanel", new UnityEngine.Vector4(0, 0, 0, 300)); m_previewPanel.autoLayout = false; m_previewPanel.disabledColor = Color.black; m_previewPanel.clipChildren = false; KlyteMonoUtils.CreateUIElement(out m_bg, m_previewPanel.transform, "previewSubPanel", new UnityEngine.Vector4(75, 0, WTSAtlasLoadingUtils.MAX_SIZE_IMAGE_IMPORT, WTSAtlasLoadingUtils.MAX_SIZE_IMAGE_IMPORT)); m_bg.autoSize = false; m_bg.transform.localScale = Vector3.one * Mathf.Min(MainContainer.width, MainContainer.height) / WTSAtlasLoadingUtils.MAX_SIZE_IMAGE_IMPORT; m_bg.clipChildren = true; KlyteMonoUtils.CreateUIElement(out UIPanel overrideSpriteContainer, MainContainer.transform, "overrideSpriteContainer", new UnityEngine.Vector4(0, 0, MainContainer.width - 66, 300)); overrideSpriteContainer.autoLayout = true; overrideSpriteContainer.autoLayoutDirection = LayoutDirection.Horizontal; KlyteMonoUtils.CreateUIElement(out UIPanel overrideSpriteSubContainer, overrideSpriteContainer.transform, "overrideSpriteSubContainer", new UnityEngine.Vector4(0, 0, overrideSpriteContainer.width, overrideSpriteContainer.height)); overrideSpriteSubContainer.backgroundSprite = KlyteResourceLoader.GetDefaultSpriteNameFor(LineIconSpriteNames.K45_SquareIcon, true); overrideSpriteSubContainer.autoLayout = false; overrideSpriteSubContainer.color = Color.gray; overrideSpriteSubContainer.autoLayoutDirection = LayoutDirection.Horizontal; OverrideSprite = overrideSpriteSubContainer.AddUIComponent <UISprite>(); OverrideSprite.size = new Vector2(300, 300); OverrideSprite.relativePosition = new Vector2(75, 0); overrideSpriteSubContainer.isVisible = false; RegisterTemplate(); m_layers = new UITemplateList <UITextureSprite>(m_bg, TEMPLATE_PREVIEW_LAYER_NAME); WTSHighwayShieldEditor.Instance.CurrentTabChanged += (x) => ReloadData(); }
private void CreateMainPanel() { MainPanel = GetComponent <UIPanel>(); MainPanel.relativePosition = new Vector3(510f, 0.0f); MainPanel.width = 350; MainPanel.height = GetComponentInParent <UIComponent>().height; MainPanel.zOrder = 50; MainPanel.color = new Color32(255, 255, 255, 255); MainPanel.name = "AssetSelectorWindow"; MainPanel.autoLayoutPadding = new RectOffset(5, 5, 10, 10); MainPanel.autoLayout = false; MainPanel.useCenter = true; MainPanel.wrapLayout = false; MainPanel.canFocus = true; KlyteMonoUtils.CreateUIElement(out m_title, MainPanel.transform); m_title.textAlignment = UIHorizontalAlignment.Center; m_title.autoSize = false; m_title.autoHeight = true; m_title.width = MainPanel.width - 30f; m_title.relativePosition = new Vector3(5, 5); m_title.textScale = 0.9f; m_title.localeID = "K45_TLM_ASSETS_FOR_PREFIX"; }
protected void CreateTitleRow(out UIPanel titleLine, UIComponent parent) { LogUtils.DoLog("Creating Title Row "); KlyteMonoUtils.CreateUIElement(out titleLine, parent.transform, "TLMtitleline", new Vector4(5, 0, parent.width - 10, 40)); titleLine.padding = new RectOffset(0, 0, 50, 0); m_createdTitleLine = titleLine; KlyteMonoUtils.CreateUIElement(out UILabel codColor, titleLine.transform, "codColor"); codColor.minimumSize = new Vector2(60, 0); codColor.area = new Vector4(80, 10, codColor.minimumSize.x, 18); KlyteMonoUtils.LimitWidthAndBox(codColor, (uint)codColor.width); codColor.textAlignment = UIHorizontalAlignment.Center; codColor.prefix = Locale.Get("PUBLICTRANSPORT_LINECOLOR"); codColor.text = "/"; codColor.suffix = Locale.Get("K45_TLM_CODE_SHORT"); codColor.eventClicked += CodColor_eventClicked; KlyteMonoUtils.CreateUIElement(out UILabel lineName, titleLine.transform, "lineName"); lineName.minimumSize = new Vector2(200, 0); lineName.area = new Vector4(140, 10, lineName.minimumSize.x, 18); KlyteMonoUtils.LimitWidthAndBox(lineName, (uint)lineName.width); lineName.textAlignment = UIHorizontalAlignment.Center; lineName.text = Locale.Get("PUBLICTRANSPORT_LINENAME"); lineName.eventClicked += LineName_eventClicked; KlyteMonoUtils.CreateUIElement(out UILabel stops, titleLine.transform, "stops"); stops.minimumSize = new Vector2(80, 0); stops.area = new Vector4(340, 10, stops.minimumSize.x, 18); KlyteMonoUtils.LimitWidthAndBox(stops, (uint)stops.width); stops.textAlignment = UIHorizontalAlignment.Center; stops.text = Locale.Get("PUBLICTRANSPORT_LINESTOPS"); stops.eventClicked += Stops_eventClicked; KlyteMonoUtils.CreateUIElement(out UILabel vehicles, titleLine.transform, "vehicles"); vehicles.minimumSize = new Vector2(110, 0); vehicles.area = new Vector4(430, 10, vehicles.minimumSize.x, 18); KlyteMonoUtils.LimitWidthAndBox(vehicles, (uint)vehicles.width); vehicles.textAlignment = UIHorizontalAlignment.Center; vehicles.text = Locale.Get("PUBLICTRANSPORT_VEHICLES"); vehicles.eventClicked += Vehicles_eventClicked; KlyteMonoUtils.CreateUIElement(out UILabel passengers, titleLine.transform, "passengers"); passengers.minimumSize = new Vector2(80, 0); passengers.area = new Vector4(540, 10, passengers.minimumSize.x, 18); KlyteMonoUtils.LimitWidthAndBox(passengers, (uint)passengers.width); passengers.textAlignment = UIHorizontalAlignment.Center; passengers.text = Locale.Get("PUBLICTRANSPORT_PASSENGERS"); passengers.eventClicked += Passengers_eventClicked; KlyteMonoUtils.CreateUIElement(out UILabel profitLW, titleLine.transform, "profit"); profitLW.minimumSize = new Vector2(150, 0); profitLW.area = new Vector4(625, 10, profitLW.minimumSize.x, 18); KlyteMonoUtils.LimitWidthAndBox(profitLW, (uint)profitLW.width); profitLW.textAlignment = UIHorizontalAlignment.Center; profitLW.text = Locale.Get(TLMController.IsRealTimeEnabled ? "K45_TLM_BALANCE_LAST_HOUR_HALF" : "K45_TLM_BALANCE_LAST_WEEK"); profitLW.eventClicked += Profit_eventClicked; AwakeShowLineButton(); LogUtils.DoLog("End creating Title Row "); }