private void CreateAssetLineTemplate() { var go = new GameObject(); UIPanel panel = go.AddComponent <UIPanel>(); panel.size = new Vector2(m_scrollablePanel.width - 40f, 36); panel.autoLayout = true; panel.wrapLayout = false; panel.autoLayoutDirection = LayoutDirection.Horizontal; UICheckBox uiCheckbox = UIHelperExtension.AddCheckbox(panel, "AAAAAA", false); uiCheckbox.name = "AssetCheckbox"; uiCheckbox.height = 29f; uiCheckbox.width = 290f; uiCheckbox.label.processMarkup = true; uiCheckbox.label.textScale = 0.8f; KlyteMonoUtils.CreateUIElement(out UITextField capEditField, panel.transform, "Cap", new Vector4(0, 0, 50, 30)); KlyteMonoUtils.UiTextFieldDefaults(capEditField); KlyteMonoUtils.InitButtonFull(capEditField, false, "OptionsDropboxListbox"); capEditField.isTooltipLocalized = true; capEditField.tooltipLocaleID = "K45_TLM_ASSET_CAPACITY_FIELD_DESCRIPTION"; capEditField.numericalOnly = true; capEditField.maxLength = 6; capEditField.padding = new RectOffset(2, 2, 4, 2); TLMUiTemplateUtils.GetTemplateDict()["K45_TLM_AssetSelectionTabLineTemplate"] = panel; }
private static void AddNewStopTemplate() { var go = new GameObject(); UIPanel panel = go.AddComponent <UIPanel>(); panel.size = new Vector2(36, 36); UIButton button = UITemplateManager.Get <UIButton>("StopButton"); panel.AttachUIComponent(button.gameObject); button.relativePosition = Vector2.zero; button.name = "StopButton"; UILabel uilabel = button.Find <UILabel>("PassengerCount"); panel.AttachUIComponent(uilabel.gameObject); uilabel.relativePosition = new Vector3(32, 12); uilabel.processMarkup = true; uilabel.isVisible = true; uilabel.minimumSize = new Vector2(180, 50); uilabel.verticalAlignment = UIVerticalAlignment.Middle; UIPanel connectionPanel = panel.AddUIComponent <UIPanel>(); connectionPanel.name = "ConnectionPanel"; connectionPanel.relativePosition = new Vector3(-50, 5); connectionPanel.size = new Vector3(50, 40); connectionPanel.autoLayout = true; connectionPanel.wrapLayout = true; connectionPanel.autoLayoutDirection = LayoutDirection.Vertical; connectionPanel.autoLayoutStart = LayoutStart.TopRight; UILabel distLabel = panel.AddUIComponent <UILabel>(); distLabel.name = "Distance"; distLabel.relativePosition = new Vector3(-12, 37); distLabel.textAlignment = UIHorizontalAlignment.Center; distLabel.textScale = 0.65f; distLabel.suffix = "m"; distLabel.useOutline = true; distLabel.minimumSize = new Vector2(60, 0); distLabel.outlineColor = Color.black; KlyteMonoUtils.CreateUIElement(out UITextField lineNameField, panel.transform, "StopNameField", new Vector4(uilabel.relativePosition.x, uilabel.relativePosition.y, 180, 50)); lineNameField.maxLength = 256; lineNameField.isVisible = false; lineNameField.verticalAlignment = UIVerticalAlignment.Middle; lineNameField.horizontalAlignment = UIHorizontalAlignment.Left; lineNameField.selectionSprite = "EmptySprite"; lineNameField.builtinKeyNavigation = true; lineNameField.textScale = uilabel.textScale; lineNameField.padding.top = 14; lineNameField.padding.bottom = 24; KlyteMonoUtils.InitButtonFull(lineNameField, false, "TextFieldPanel"); TLMUiTemplateUtils.GetTemplateDict()["StopButtonPanel"] = panel; }
private void CreateDepotLineTemplate() { var go = new GameObject(); UIPanel panel = go.AddComponent <UIPanel>(); panel.size = new Vector2(m_scrollablePanel.width - 40f, 36); panel.autoLayout = true; panel.wrapLayout = false; panel.autoLayoutDirection = LayoutDirection.Horizontal; UICheckBox uiCheckbox = UIHelperExtension.AddCheckbox(panel, "AAAAAA", false); uiCheckbox.name = "DepotCheckbox"; uiCheckbox.height = 29f; uiCheckbox.width = 310f; uiCheckbox.label.processMarkup = true; uiCheckbox.label.textScale = 0.8f; KlyteMonoUtils.CreateUIElement(out UIButton gotoButton, panel.transform, "GoTo", new Vector4(0, 0, 30, 30)); KlyteMonoUtils.InitButton(gotoButton, true, "LineDetailButton"); TLMUiTemplateUtils.GetTemplateDict()["K45_TLM_DepotSelectionTabLineTemplate"] = panel; }