Example #1
0
        private UIButton InitZmButtonOnWorldInfoPanel(UIComponent parent)
        {
            KlyteMonoUtils.CreateUIElement(out UIButton saida, parent.transform, "ZmBuilding", new Vector4(-40, -40, 30, 30));
            saida.color             = Color.black;
            saida.focusedColor      = Color.black;
            saida.hoveredColor      = Color.cyan;
            saida.tooltipLocaleID   = "K45_ADR_ZERO_MARKER_DETAIL";
            saida.eventDoubleClick += SetZeroMarkBuilding;
            KlyteMonoUtils.InitButtonSameSprite(saida, "ParkLevelStar");
            saida.canFocus = false;

            return(saida);
        }
Example #2
0
 protected void Start()
 {
     if (WriteTheSignsMod.Controller.ConnectorADR.AddressesAvailable)
     {
         m_stripMain.CreateTabLocalized <WTSHighwayShieldEditor>("K45_WTS_HWSHIELD_00", "K45_WTS_HWSHIELDS_TAB", "WTSHighwayShieldsSettings", false);
     }
     if (!WriteTheSignsMod.Controller.BridgeUUI.IsUuiAvailable)
     {
         KlyteMonoUtils.CreateUIElement(out UIButton pickerOnSegment, m_stripMain.transform, "K45_WTS_SegmentPickerIcon", new Vector4(0, 0, 40, 40));
         KlyteMonoUtils.InitButtonSameSprite(pickerOnSegment, "K45_WTS_SegmentPickerIcon");
         pickerOnSegment.eventClicked += (x, y) => ToolsModifierControl.SetTool <SegmentEditorPickerTool>();
         pickerOnSegment.anchor        = UIAnchorStyle.Right | UIAnchorStyle.Top;
         pickerOnSegment.hoveredColor  = Color.cyan;
         m_stripMain.tabContainer.AttachUIComponent(new GameObject().AddComponent <UIPanel>().gameObject);
     }
 }
Example #3
0
        private UIButton InitBuildingEditOnWorldInfoPanel(UIComponent parent)
        {
            KlyteMonoUtils.CreateUIElement(out UIButton saida, parent.transform, "AddressesIcon", new Vector4(5, -40, 30, 30));
            saida.color           = Color.white;
            saida.tooltipLocaleID = "K45_ADR_BUILDING_ADDRESS";
            KlyteMonoUtils.InitButtonSameSprite(saida, AddressesMod.Instance.IconName);

            KlyteMonoUtils.CreateUIElement(out UILabel addressContainer, saida.transform, "Address");
            addressContainer.autoSize      = false;
            addressContainer.wordWrap      = true;
            addressContainer.area          = new Vector4(35, 1, parent.width - 40, 60);
            addressContainer.textAlignment = UIHorizontalAlignment.Left;
            addressContainer.useOutline    = true;
            addressContainer.text          = Environment.NewLine;
            addressContainer.textScale     = 0.6f;
            addressContainer.isInteractive = false;

            return(saida);
        }
Example #4
0
        private UIButton initBuildingEditOnWorldInfoPanel(UIPanel parent)
        {
            UIButton saida = parent.AddUIComponent <UIButton>();

            saida.relativePosition = new Vector3(-40, parent.height - 50);
            saida.width            = 30;
            saida.height           = 30;
            saida.name             = "VMCBuildingShortcut";
            saida.color            = new Color32(170, 170, 170, 255);
            saida.hoveredColor     = Color.white;
            saida.tooltipLocaleID  = "K45_VMC_GOTO_BUILDING_CONFIG_EDIT";
            KlyteMonoUtils.InitButtonSameSprite(saida, "VehiclesMasterControlIcon");
            saida.eventClick += (x, y) =>
            {
                FieldInfo prop       = typeof(WorldInfoPanel).GetField("m_InstanceID", BindingFlags.NonPublic | BindingFlags.Instance);
                ushort    buildingId = ((InstanceID)(prop.GetValue(parent.gameObject.GetComponent <WorldInfoPanel>()))).Building;
                VMCBuildingInfoPanel.instance.openInfo(buildingId);
            };
            return(saida);
        }
Example #5
0
        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).transform.localScale = Vector3.one;
            button.relativePosition   = Vector2.zero;
            button.name               = "StopButton";
            button.scaleFactor        = 1f;
            button.spritePadding.top  = 2;
            button.isTooltipLocalized = true;
            KlyteMonoUtils.InitButtonFg(button, false, "DistrictOptionBrushMedium");
            KlyteMonoUtils.InitButtonSameSprite(button, "");

            UILabel uilabel = button.Find <UILabel>("PassengerCount");

            panel.AttachUIComponent(uilabel.gameObject).transform.localScale = Vector3.one;
            uilabel.relativePosition  = new Vector3(38, 12);
            uilabel.processMarkup     = true;
            uilabel.isVisible         = true;
            uilabel.minimumSize       = new Vector2(175, 50);
            uilabel.verticalAlignment = UIVerticalAlignment.Middle;
            KlyteMonoUtils.LimitWidthAndBox(uilabel, 175, true);


            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(38, -6, 175, 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          = 18;
            lineNameField.padding.left         = 5;
            lineNameField.padding.bottom       = 14;
            KlyteMonoUtils.InitButtonFull(lineNameField, false, "TextFieldPanel");


            TLMUiTemplateUtils.GetTemplateDict()["StopButtonPanel"] = panel;
        }