示例#1
0
        private void CreateTitleRowBuilding(ref UIPanel titleLine, UIComponent parent)
        {
            TLMUtils.createUIElement(out titleLine, parent.transform, "TLMtitleline", new Vector4(5, 80, parent.width - 10, 40));

            TLMUtils.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");

            TLMUtils.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("TLM_BUILDING_NAME_LABEL");

            TLMUtils.createUIElement(out UILabel vehicleCapacityLabel, titleLine.transform, "vehicleCapacityLabel");
            vehicleCapacityLabel.autoSize      = false;
            vehicleCapacityLabel.area          = new Vector4(400, 10, 200, 18);
            vehicleCapacityLabel.textAlignment = UIHorizontalAlignment.Center;
            vehicleCapacityLabel.text          = Locale.Get("TLM_VEHICLE_CAPACITY_LABEL");

            TLMUtils.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("TLM_DIRECTION_LABEL");
        }
        private void criaFatiaELegenda(Color c, UIRadialChartAge chart, UIPanel legendPanel, string localeID, float offsetY)
        {
            chart.AddSlice(c, c);
            UIPanel legendItemContainer = null;

            TLMUtils.createUIElement <UIPanel>(ref legendItemContainer, legendPanel.transform);
            legendItemContainer.width            = legendPanel.width;
            legendItemContainer.relativePosition = new Vector3(0f, offsetY);
            legendItemContainer.name             = "LegendItem";
            legendItemContainer.autoLayout       = false;
            legendItemContainer.useCenter        = true;
            legendItemContainer.wrapLayout       = false;
            legendItemContainer.height           = 20;
            UILabel legendColor = null;

            TLMUtils.createUIElement <UILabel>(ref legendColor, legendItemContainer.transform);
            legendColor.backgroundSprite = "EmptySprite";
            legendColor.width            = 10;
            legendColor.height           = 10;
            legendColor.relativePosition = new Vector3(0, 0);
            legendColor.color            = c;
            UILabel legendName = null;

            TLMUtils.createUIElement <UILabel>(ref legendName, legendItemContainer.transform);
            legendName.textAlignment     = UIHorizontalAlignment.Right;
            legendName.width             = legendItemContainer.width - 10;
            legendName.localeID          = localeID;
            legendName.textScale         = 0.6f;
            legendName.relativePosition  = new Vector3(15f, 2f);
            legendName.verticalAlignment = UIVerticalAlignment.Middle;
        }
示例#3
0
        private void CreateMainPanel()
        {
            TLMUtils.createUIElement(out m_mainPanel, m_parent.transform);
            m_mainPanel.Hide();
            m_mainPanel.relativePosition  = new Vector3(510f, 0.0f);
            m_mainPanel.width             = 350;
            m_mainPanel.height            = m_parent.GetComponent <UIComponent>().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;

            TLMUtils.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         = "TLM_ASSETS_FOR_PREFIX";
        }
        private void CreateMainPanel()
        {
            TLMUtils.createUIElement(out m_mainPanel, m_parent.transform);
            m_mainPanel.Hide();
            m_mainPanel.relativePosition  = new Vector3(m_parent.width, 0.0f);
            m_mainPanel.width             = 250;
            m_mainPanel.height            = m_parent.height;
            m_mainPanel.zOrder            = 50;
            m_mainPanel.color             = new Color32(255, 255, 255, 255);
            m_mainPanel.backgroundSprite  = "MenuPanel2";
            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;
            TLMUtils.createDragHandle(m_mainPanel, m_mainPanel, 35f);
            m_parent.eventVisibilityChanged += (component, value) =>
            {
                m_mainPanel.isVisible = value;
            };

            TLMUtils.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;
        }
示例#5
0
        private void AddVehicleToLinearMap(Color lineColor, ushort vehicleId)
        {
            UILabel vehicleLabel = null;
            int     fill, cap;

            TLMLineUtils.GetVehicleCapacityAndFill(vehicleId, Singleton <VehicleManager> .instance.m_vehicles.m_buffer[vehicleId], out fill, out cap);

            TLMUtils.createUIElement <UILabel>(ref vehicleLabel, lineStationsPanel.transform);
            vehicleLabel.autoSize          = false;
            vehicleLabel.text              = string.Format("{0}/{1}", fill, cap);
            vehicleLabel.useOutline        = true;
            vehicleLabel.width             = 50;
            vehicleLabel.height            = 33;
            vehicleLabel.pivot             = UIPivotPoint.TopCenter;
            vehicleLabel.verticalAlignment = UIVerticalAlignment.Middle;
            vehicleLabel.atlas             = TLMController.taLineNumber;

            vehicleLabel.padding          = new RectOffset(0, 0, 2, 0);
            vehicleLabel.textScale        = 0.6f;
            vehicleLabel.backgroundSprite = "VehicleLinearMap";
            vehicleLabel.color            = lineColor;
            vehicleLabel.textAlignment    = UIHorizontalAlignment.Center;
            vehicleLabel.tooltip          = Singleton <VehicleManager> .instance.GetVehicleName(vehicleId);

            vehicleLabel.eventClick += (x, y) =>
            {
                InstanceID id = default(InstanceID);
                id.Vehicle = vehicleId;
                Camera.main.GetComponent <CameraController>().SetTarget(id, Singleton <VehicleManager> .instance.m_vehicles.m_buffer[vehicleId].GetLastFramePosition(), true);
            };
            updateVehiclePosition(vehicleId, vehicleLabel);

            lineVehicles.Add(vehicleId, vehicleLabel);
        }
示例#6
0
        private void Awake()
        {
            if (m_instance != null)
            {
                throw new Exception("MULTIPLE INSTANTIATION!!!!!!!!");
            }
            m_instance                    = this;
            mainPanel                     = GetComponentInChildren <UIScrollablePanel>();
            mainPanel.autoLayout          = true;
            mainPanel.autoLayoutDirection = LayoutDirection.Vertical;
            m_uiHelper                    = new UIHelperExtension(mainPanel);

            TLMUtils.doLog("PrefixDD");

            m_prefixSelector = m_uiHelper.AddDropdownLocalized("TLM_PREFIX", new string[0], -1, onChangePrefix);

            ReloadPrefixOptions();
            TLMUtils.doLog("PrefixDD Panel");
            var ddPanel = m_prefixSelector.GetComponentInParent <UIPanel>();

            ConfigComponentPanel(m_prefixSelector);


            TLMUtils.doLog("SubPanel");
            TLMUtils.createUIElement(out UIPanel subpanel, mainPanel.transform, "Subpanel", new Vector4(0, 0, 500, 180));
            subpanel.autoLayout          = true;
            subpanel.autoLayoutDirection = LayoutDirection.Vertical;
            subpanel.autoSize            = true;
            m_subpanel = new UIHelperExtension(subpanel);

            TLMUtils.doLog("AssetSelector");
            TLMUtils.createUIElement(out m_panelAssetSelector, mainPanel.transform, "AssetSelector", new Vector4(0, 0, 0, 0.0001f));
            m_assetSelectorWindow = TLMUtils.createElement(ImplClassChildren, m_panelAssetSelector.transform).GetComponent <TLMAssetSelectorWindowPrefixTab <T> >();

            m_subpanel.self.isVisible = false;
            m_assetSelectorWindow.mainPanel.isVisible = false;

            TLMUtils.doLog("Name");
            m_prefixName = m_subpanel.AddTextField(Locale.Get("TLM_PREFIX_NAME"), null, "", onPrefixNameChange);
            ConfigComponentPanel(m_prefixName);

            TLMUtils.doLog("Price");
            m_prefixTicketPrice = m_subpanel.AddTextField(Locale.Get("TLM_TICKET_PRICE_LABEL"), null, "", onTicketChange);
            ConfigComponentPanel(m_prefixTicketPrice);

            TLMUtils.doLog("ColorForModel");
            m_useColorForModel = m_subpanel.AddCheckboxLocale("TLM_USE_PREFIX_COLOR_FOR_VEHICLE", false, onUseColorVehicleChange);
            TLMUtils.LimitWidth(m_useColorForModel.label, 420, true);

            TLMUtils.doLog("ColorSel");
            CreateColorSelector();

            TLMUtils.doLog("Budget");
            TLMUtils.createUIElement(out UIPanel m_budgetPanel, subpanel.transform, "BudgetPanel", new Vector4(0, 0, 460, 180));
            CreateBudgetSliders(m_budgetPanel);
            CreateToggleBudgetButtons(m_budgetPanel);

            GetComponent <UIComponent>().eventVisibilityChanged += (x, y) => forceRefresh();
            TLMConfigWarehouse.eventOnPropertyChanged           += OnWarehouseChange;
        }
        private void CreateScrollPanel()
        {
            TLMUtils.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.autoLayout          = true;
            m_scrollablePanel.clipChildren        = true;
            m_scrollablePanel.relativePosition    = new Vector3(5, 45);

            TLMUtils.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);


            TLMUtils.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;

            TLMUtils.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;

            TLMUtils.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_scrollablePanel.eventMouseLeave += (x, y) =>
            {
                m_previewPanel.isVisible = false;
            };

            m_uiHelper = new UIHelperExtension(m_scrollablePanel);
        }
示例#8
0
        protected override void CreateTitleRow(out UIPanel titleLine, UIComponent parent)
        {
            TLMUtils.createUIElement(out titleLine, parent.transform, "TLMtitleline", new Vector4(5, 0, parent.width - 10, 40));

            m_visibilityToggle = Instantiate(FindObjectOfType <UIView>().FindUIComponent <UICheckBox>("LineVisible"));
            m_visibilityToggle.transform.SetParent(titleLine.transform);
            m_visibilityToggle.eventCheckChanged += toggleAllLinesVisibility;

            TLMUtils.createUIElement(out UILabel codColor, titleLine.transform, "codColor");
            codColor.minimumSize = new Vector2(60, 0);
            codColor.area        = new Vector4(80, 10, codColor.minimumSize.x, 18);
            TLMUtils.LimitWidth(codColor, (uint)codColor.width);
            codColor.textAlignment = UIHorizontalAlignment.Center;
            codColor.prefix        = Locale.Get("PUBLICTRANSPORT_LINECOLOR");
            codColor.text          = "/";
            codColor.suffix        = Locale.Get("TLM_CODE_SHORT");
            codColor.eventClicked += CodColor_eventClicked;

            TLMUtils.createUIElement(out UILabel lineName, titleLine.transform, "lineName");
            lineName.minimumSize = new Vector2(200, 0);
            lineName.area        = new Vector4(140, 10, lineName.minimumSize.x, 18);
            TLMUtils.LimitWidth(lineName, (uint)lineName.width);
            lineName.textAlignment = UIHorizontalAlignment.Center;
            lineName.text          = Locale.Get("PUBLICTRANSPORT_LINENAME");
            lineName.eventClicked += LineName_eventClicked;;

            TLMUtils.createUIElement(out UILabel stops, titleLine.transform, "stops");
            stops.minimumSize = new Vector2(80, 0);
            stops.area        = new Vector4(340, 10, stops.minimumSize.x, 18);
            TLMUtils.LimitWidth(stops, (uint)stops.width);
            stops.textAlignment = UIHorizontalAlignment.Center;
            stops.text          = Locale.Get("PUBLICTRANSPORT_LINESTOPS");
            stops.eventClicked += Stops_eventClicked;;

            if (Singleton <T> .instance.GetTSD().hasVehicles())
            {
                TLMUtils.createUIElement(out UILabel vehicles, titleLine.transform, "vehicles");
                vehicles.minimumSize = new Vector2(110, 0);
                vehicles.area        = new Vector4(430, 10, vehicles.minimumSize.x, 18);
                TLMUtils.LimitWidth(vehicles, (uint)vehicles.width);
                vehicles.textAlignment = UIHorizontalAlignment.Center;
                vehicles.text          = Locale.Get("PUBLICTRANSPORT_VEHICLES");
                vehicles.eventClicked += Vehicles_eventClicked;;
            }

            TLMUtils.createUIElement(out UILabel passengers, titleLine.transform, "passengers");
            passengers.minimumSize = new Vector2(80, 0);
            passengers.area        = new Vector4(540, 10, passengers.minimumSize.x, 18);
            TLMUtils.LimitWidth(passengers, (uint)passengers.width);
            passengers.textAlignment = UIHorizontalAlignment.Center;
            passengers.text          = Locale.Get("PUBLICTRANSPORT_PASSENGERS");
            passengers.eventClicked += Passengers_eventClicked;

            AwakeDayNightOptions();
            AwakePrefixFilter();
        }
示例#9
0
        private void CreateTsdTabstrip(out UITabstrip strip, UIComponent parent, UiCategoryTab category)
        {
            TLMUtils.createUIElement(out strip, parent.transform, "TLMTabstrip", new Vector4(5, 0, parent.width - 10, 40));
            var effectiveOffsetY = strip.height;

            TLMUtils.createUIElement(out UITabContainer tabContainer, parent.transform, "TLMTabContainer", new Vector4(0, 40, parent.width, parent.height - 40));
            strip.tabPages = tabContainer;

            UIButton tabTemplate = CreateTabSubStripTemplate();

            UIComponent bodyContent = CreateContentTemplate(parent.width, parent.height - effectiveOffsetY - 10, category.isScrollable());

            foreach (var kv in TransportSystemDefinition.sysDefinitions)
            {
                Type[] components;
                Type   targetType;
                try
                {
                    targetType = KlyteUtils.GetImplementationForGenericType(category.getTabGenericContentImpl(), kv.Value);
                    components = new Type[] { targetType };
                }
                catch
                {
                    continue;
                }

                GameObject tab       = Instantiate(tabTemplate.gameObject);
                GameObject body      = Instantiate(bodyContent.gameObject);
                var        configIdx = kv.Key.toConfigIndex();
                String     name      = kv.Value.Name;
                TLMUtils.doLog($"configIdx = {configIdx};kv.Key = {kv.Key}; kv.Value= {kv.Value} ");
                String   bgIcon    = TLMConfigWarehouse.getBgIconForIndex(configIdx);
                String   fgIcon    = kv.Key.getTransportTypeIcon();
                UIButton tabButton = tab.GetComponent <UIButton>();
                tabButton.tooltip          = TLMConfigWarehouse.getNameForTransportType(configIdx);
                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.black;
                tabButton.disabledColor    = Color.gray;
                if (!string.IsNullOrEmpty(fgIcon))
                {
                    TLMUtils.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, components);
            }
        }
示例#10
0
        private void createLineCharts(Vector3 relativePos)
        {
            TLMUtils.createUIElement <UIPanel>(ref agesChartPanel, depotInfoPanel.transform);
            agesChartPanel.relativePosition = relativePos;
            agesChartPanel.width            = 140;
            agesChartPanel.height           = 70;
            agesChartPanel.name             = "WorkersPanel";
            agesChartPanel.autoLayout       = false;
            agesChartPanel.useCenter        = true;
            agesChartPanel.wrapLayout       = false;
            agesChartPanel.tooltipLocaleID  = "ZONEDBUILDING_WORKERCHART";

            UIPanel pieLegendPanel = null;

            TLMUtils.createUIElement <UIPanel>(ref pieLegendPanel, 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;

            TLMUtils.createUIElement <UIRadialChartAge>(ref workplaceChart, agesChartPanel.transform);
            workplaceChart.spriteName       = "PieChartWhiteBg";
            workplaceChart.relativePosition = new Vector3(0, 0);
            workplaceChart.width            = 70;
            workplaceChart.height           = 70;
            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;

            legendL0 = criaFatiaELegenda(unskill, workplaceChart, pieLegendPanel, "ZONEDBUILDING_UNEDUCATED", 14 * y++);
            legendL1 = criaFatiaELegenda(oneSchool, workplaceChart, pieLegendPanel, "ZONEDBUILDING_EDUCATED", 14 * y++);
            legendL2 = criaFatiaELegenda(twoSchool, workplaceChart, pieLegendPanel, "ZONEDBUILDING_WELLEDUCATED", 14 * y++);
            legendL3 = criaFatiaELegenda(threeSchool, workplaceChart, pieLegendPanel, "ZONEDBUILDING_HIGHLYEDUCATED", 14 * y++);

            TLMUtils.createUIElement <UIRadialChartAge>(ref workersChart, workplaceChart.transform);
            workersChart.spriteName       = "PieChartWhiteFg";
            workersChart.relativePosition = new Vector3(0, 0);
            workersChart.width            = 70;
            workersChart.height           = 70;
            workersChart.name             = "WorkersChart";
            criaFatiaELegenda(MultiplyColor(unskill, 0.5f), workersChart);
            criaFatiaELegenda(MultiplyColor(oneSchool, 0.5f), workersChart);
            criaFatiaELegenda(MultiplyColor(twoSchool, 0.5f), workersChart);
            criaFatiaELegenda(MultiplyColor(threeSchool, 0.5f), workersChart);
            legendFr = criaFatiaELegenda(Color.gray, workersChart, pieLegendPanel, "ZONEDBUILDING_JOBSAVAIL", 14 * y++);
        }
示例#11
0
 private void createLineStationsPanel()
 {
     TLMUtils.createUIElement <UIPanel>(ref lineStationsPanel, mainContainer.transform);
     lineStationsPanel.width            = 140;
     lineStationsPanel.height           = 30;
     lineStationsPanel.name             = "LineStationsPanel";
     lineStationsPanel.autoLayout       = false;
     lineStationsPanel.useCenter        = true;
     lineStationsPanel.wrapLayout       = false;
     lineStationsPanel.backgroundSprite = "GenericPanelWhite";
     lineStationsPanel.pivot            = UIPivotPoint.MiddleLeft;
     lineStationsPanel.relativePosition = new Vector3(60f, 10f);
     lineStationsPanel.color            = lineInfoPanel.controller.tm.GetLineColor(lineInfoPanel.lineIdSelecionado.TransportLine);
 }
 private void createLineStationsPanel()
 {
     TLMUtils.createUIElement(out lineStationsPanel, mainContainer.transform);
     lineStationsPanel.width            = 140;
     lineStationsPanel.height           = 30;
     lineStationsPanel.name             = "LineStationsPanel";
     lineStationsPanel.autoLayout       = false;
     lineStationsPanel.useCenter        = true;
     lineStationsPanel.wrapLayout       = false;
     lineStationsPanel.atlas            = TLMController.taLineNumber;
     lineStationsPanel.backgroundSprite = "LinearBg";
     lineStationsPanel.pivot            = UIPivotPoint.MiddleLeft;
     lineStationsPanel.relativePosition = new Vector3(75f, 10f);
     lineStationsPanel.color            = TLMController.instance.tm.GetLineColor(parent.CurrentSelectedId);
 }
示例#13
0
 private void SetPreviewWindow()
 {
     TLMUtils.createUIElement(out m_previewPanel, m_mainPanel.transform);
     m_previewPanel.backgroundSprite = "GenericPanel";
     m_previewPanel.width            = m_mainPanel.width - 15;
     m_previewPanel.height           = 140;
     m_previewPanel.relativePosition = new Vector3(7.5f, m_mainPanel.height - 150);
     TLMUtils.createUIElement(out m_preview, m_previewPanel.transform);
     this.m_preview.size             = m_previewPanel.size;
     this.m_preview.relativePosition = Vector3.zero;
     TLMUtils.createElement(out m_previewRenderer, m_mainPanel.transform);
     this.m_previewRenderer.size      = this.m_preview.size * 2f;
     this.m_preview.texture           = this.m_previewRenderer.texture;
     m_previewRenderer.zoom           = 3;
     m_previewRenderer.cameraRotation = 40;
 }
示例#14
0
        private void Awake()
        {
            m_instance                 = this;
            controlContainer           = GetComponent <UIPanel>();
            controlContainer.area      = new Vector4(0, 0, 0, 0);
            controlContainer.isVisible = false;
            controlContainer.name      = "TLMPanel";

            TLMUtils.createUIElement(out UIPanel _mainPanel, GetComponent <UIPanel>().transform, "TLMListPanel", new Vector4(0, 0, controlContainer.parent.width, controlContainer.parent.height));
            mainPanel = _mainPanel;
            mainPanel.backgroundSprite = "MenuPanel2";

            CreateTitleBar();

            TLMUtils.createUIElement(out m_StripMain, mainPanel.transform, "TLMTabstrip", new Vector4(5, 40, mainPanel.width - 10, 40));

            TLMUtils.createUIElement(out UITabContainer tabContainer, mainPanel.transform, "TLMTabContainer", new Vector4(0, 80, mainPanel.width, mainPanel.height - 80));
            m_StripMain.tabPages = tabContainer;

            foreach (UiCategoryTab tab in Enum.GetValues(typeof(UiCategoryTab)))
            {
                UIButton superTab = CreateTabTemplate();
                superTab.normalFgSprite = tab.getTabFgSprite();
                superTab.tooltip        = tab.getTabName();

                TLMUtils.createUIElement(out UIPanel content, null);
                content.name = "Container";
                content.area = new Vector4(0, 40, mainPanel.width, mainPanel.height - 80);

                m_StripMain.AddTab("TLMTab" + tab, superTab.gameObject, content.gameObject);
                CreateTsdTabstrip(out UITabstrip subStrip, content, tab);
                m_StripsSubcategories[tab] = subStrip;
                if (m_StripsSubcategories[tab].tabCount > 0)
                {
                    m_StripsSubcategories[tab].selectedIndex = 0;
                    m_StripsSubcategories[tab].selectedIndex = -1;
                }
                else
                {
                    m_StripsSubcategories[tab].enabled = false;
                }
            }
            m_StripMain.selectedIndex              = 0;
            m_StripMain.selectedIndex              = -1;
            m_StripMain.eventSelectedIndexChanged += SetViewMode;
            m_StripMain.eventVisibilityChanged    += OnOpenClosePanel;
        }
        private void createLineCharts()
        {
            TLMUtils.createUIElement <UIPanel>(ref agesChartPanel, lineInfoPanel.transform);
            agesChartPanel.relativePosition = new Vector3(450f, 60f);
            agesChartPanel.width            = 140;
            agesChartPanel.height           = 70;
            agesChartPanel.name             = "AgesChartPanel";
            agesChartPanel.autoLayout       = false;
            agesChartPanel.useCenter        = true;
            agesChartPanel.wrapLayout       = false;

            UIPanel pieLegendPanel = null;

            TLMUtils.createUIElement <UIPanel>(ref pieLegendPanel, 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;

            TLMUtils.createUIElement <UIRadialChartAge>(ref agesChart, agesChartPanel.transform);
            agesChart.spriteName       = "PieChartWhiteBg";
            agesChart.tooltipLocaleID  = "ZONEDBUILDING_AGECHART";
            agesChart.relativePosition = new Vector3(0, 0);
            agesChart.width            = 70;
            agesChart.height           = 70;
            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, agesChart, pieLegendPanel, "ZONEDBUILDING_CHILDREN", 14 * y++);
            criaFatiaELegenda(adolescenteColor, agesChart, pieLegendPanel, "ZONEDBUILDING_TEENS", 14 * y++);
            criaFatiaELegenda(jovemColor, agesChart, pieLegendPanel, "ZONEDBUILDING_YOUNGS", 14 * y++);
            criaFatiaELegenda(adultoColor, agesChart, pieLegendPanel, "ZONEDBUILDING_ADULTS", 14 * y++);
            criaFatiaELegenda(idosoColor, agesChart, pieLegendPanel, "ZONEDBUILDING_SENIORS", 14 * y++);
        }
示例#16
0
        private void CreateBudgetSliders(UIPanel reference)
        {
            TLMUtils.createUIElement(out m_lineBudgetSlidersTitle, reference.transform);
            m_lineBudgetSlidersTitle.autoSize         = false;
            m_lineBudgetSlidersTitle.relativePosition = new Vector3(0f, 0f);
            m_lineBudgetSlidersTitle.width            = 400f;
            m_lineBudgetSlidersTitle.height           = 36f;
            m_lineBudgetSlidersTitle.textScale        = 0.9f;
            m_lineBudgetSlidersTitle.textAlignment    = UIHorizontalAlignment.Center;
            m_lineBudgetSlidersTitle.name             = "LineBudgetSlidersTitle";
            m_lineBudgetSlidersTitle.font             = UIHelperExtension.defaultFontCheckbox;
            m_lineBudgetSlidersTitle.wordWrap         = true;

            var uiHelper = new UIHelperExtension(reference);

            for (int i = 0; i < m_budgetSliders.Length; i++)
            {
                m_budgetSliders[i] = GenerateVerticalBudgetMultiplierField(uiHelper, i);
            }
        }
        protected override void CreateTitleRow(out UIPanel titleLine, UIComponent parent)
        {
            TLMUtils.createUIElement(out titleLine, parent.transform, "TLMtitleline", new Vector4(5, 0, parent.width - 10, 40));

            TLMUtils.createUIElement(out UILabel districtTitle, titleLine.transform, "districtTitle");
            districtTitle.minimumSize = new Vector2(140, 0);
            districtTitle.area        = new Vector4(00, 10, districtTitle.minimumSize.x, 18);
            TLMUtils.LimitWidth(districtTitle, (uint)districtTitle.width);
            districtTitle.textAlignment = UIHorizontalAlignment.Center;
            districtTitle.text          = Locale.Get("TUTORIAL_ADVISER_TITLE", "District");
            districtTitle.eventClicked += District_eventClicked;

            TLMUtils.createUIElement(out UILabel lineName, titleLine.transform, "lineName");
            lineName.minimumSize = new Vector2(200, 0);
            lineName.area        = new Vector4(140, 10, lineName.minimumSize.x, 18);
            TLMUtils.LimitWidth(lineName, (uint)lineName.width);
            lineName.textAlignment = UIHorizontalAlignment.Center;
            lineName.text          = string.Format(Locale.Get("TLM_DEPOT_NAME_PATTERN"), Locale.Get("TLM_PUBLICTRANSPORT_OF_DEPOT", Singleton <T> .instance.GetTSD().toConfigIndex().ToString()));
            lineName.eventClicked += Name_eventClicked;

            TLMUtils.createUIElement(out UILabel prefixesServed, titleLine.transform, "prefixesServed");
            prefixesServed.minimumSize = new Vector2(210, 0);
            prefixesServed.area        = new Vector4(340, 10, prefixesServed.minimumSize.x, 18);
            TLMUtils.LimitWidth(prefixesServed, (uint)prefixesServed.width);
            prefixesServed.textAlignment = UIHorizontalAlignment.Center;
            prefixesServed.text          = Locale.Get("TLM_PREFIXES_SERVED");


            TLMUtils.createUIElement(out UILabel addRemove, titleLine.transform, "AddRemove");
            addRemove.minimumSize = new Vector2(180, 0);
            addRemove.area        = new Vector4(550, 10, addRemove.minimumSize.x, 18);
            TLMUtils.LimitWidth(addRemove, (uint)addRemove.width);
            addRemove.textAlignment = UIHorizontalAlignment.Center;
            addRemove.text          = Locale.Get("TLM_ADD_REMOVE");

            AwakePrefixFilter();
        }
示例#18
0
        private float addStationToLinearMap(string stationPrefix, string stationName, Vector3 location, float offsetX, List <ushort> intersections, string airport, string harbor, string taxi, string regionalTrainStation, ushort stationNodeId, ItemClass.SubService ss, bool simple = false)//, out float intersectionPanelHeight)
        {
            ushort           lineID = lineInfoPanel.lineIdSelecionado.TransportLine;
            TransportLine    t      = lineInfoPanel.controller.tm.m_lines.m_buffer[(int)lineID];
            TransportManager tm     = Singleton <TransportManager> .instance;

            UIButton stationButton = null;

            TLMUtils.createUIElement <UIButton>(ref stationButton, lineStationsPanel.transform);
            stationButton.relativePosition = new Vector3(offsetX, 15f);
            stationButton.width            = 20;
            stationButton.height           = 20;
            stationButton.name             = "Station [" + stationName + "]";
            TLMUtils.initButton(stationButton, true, "IconPolicyBaseCircle");

            UITextField stationLabel = null;

            TLMUtils.createUIElement <UITextField>(ref stationLabel, stationButton.transform);
            stationLabel.autoSize            = true;
            stationLabel.width               = 220;
            stationLabel.height              = 20;
            stationLabel.useOutline          = true;
            stationLabel.pivot               = UIPivotPoint.MiddleLeft;
            stationLabel.horizontalAlignment = UIHorizontalAlignment.Left;
            stationLabel.verticalAlignment   = UIVerticalAlignment.Middle;
            stationLabel.name             = "Station [" + stationName + "] Name";
            stationLabel.relativePosition = new Vector3(23f, -13f);
            stationLabel.text             = (!string.IsNullOrEmpty(stationPrefix) ? stationPrefix.Trim() + " " : "") + stationName.Trim();
            stationLabel.textScale        = Math.Max(0.5f, Math.Min(1, 24f / stationLabel.text.Length));

            TLMUtils.uiTextFieldDefaults(stationLabel);
            stationLabel.color           = new Color(0.3f, 0.3f, 0.3f, 1);
            stationLabel.textColor       = Color.white;
            stationLabel.cursorWidth     = 2;
            stationLabel.cursorBlinkTime = 100;
            stationLabel.eventGotFocus  += (x, y) =>
            {
                stationLabel.text = TLMUtils.getStationName(stationNodeId, lineID, ss);
            };
            stationLabel.eventTextSubmitted += (x, y) =>
            {
                TLMUtils.setStopName(y, stationNodeId, lineID, () =>
                {
                    stationLabel.text = TLMUtils.getFullStationName(stationNodeId, lineID, ss);
                    m_autoName        = TLMUtils.calculateAutoName(lineID);
                    lineInfoPanel.autoNameLabel.text = autoName;
                });
            };

            stationButton.gameObject.transform.localPosition    = new Vector3(0, 0, 0);
            stationButton.gameObject.transform.localEulerAngles = new Vector3(0, 0, 45);
            stationButton.eventClick += (component, eventParam) =>
            {
                lineInfoPanel.cameraController.SetTarget(lineInfoPanel.lineIdSelecionado, location, false);
                lineInfoPanel.cameraController.ClearTarget();
            };
            if (!simple)
            {
                stationOffsetX.Add(stationNodeId, offsetX);
                if (showIntersections)
                {
                    var otherLinesIntersections = TLMLineUtils.SortLines(intersections, t);

                    int intersectionCount = otherLinesIntersections.Count + (airport != string.Empty ? 1 : 0) + (taxi != string.Empty ? 1 : 0) + (harbor != string.Empty ? 1 : 0) + (regionalTrainStation != string.Empty ? 1 : 0);
                    if (intersectionCount > 0)
                    {
                        UIPanel intersectionsPanel = null;
                        TLMUtils.createUIElement <UIPanel>(ref intersectionsPanel, stationButton.transform);
                        intersectionsPanel.autoSize                  = false;
                        intersectionsPanel.autoLayout                = false;
                        intersectionsPanel.autoLayoutStart           = LayoutStart.TopLeft;
                        intersectionsPanel.autoLayoutDirection       = LayoutDirection.Horizontal;
                        intersectionsPanel.relativePosition          = new Vector3(-20, 10);
                        intersectionsPanel.wrapLayout                = false;
                        intersectionsPanel.autoFitChildrenVertically = true;

                        TLMLineUtils.PrintIntersections(airport, harbor, taxi, regionalTrainStation, intersectionsPanel, otherLinesIntersections);

                        intersectionsPanel.autoLayout = true;
                        intersectionsPanel.wrapLayout = true;
                        intersectionsPanel.width      = 55;
                        //
                        return(42f);
                    }
                    else
                    {
                        return(25f);
                    }
                }
                else if (showExtraStopInfo)
                {
                    float normalWidth = 42.5f;

                    NetNode stopNode = Singleton <NetManager> .instance.m_nodes.m_buffer[(int)stationNodeId];

                    int residents, tourists;
                    TLMLineUtils.GetQuantityPassengerWaiting(stationNodeId, out residents, out tourists);

                    UIPanel stationInfoStatsPanel = null;
                    TLMUtils.createUIElement <UIPanel>(ref stationInfoStatsPanel, stationButton.transform);
                    stationInfoStatsPanel.autoSize   = false;
                    stationInfoStatsPanel.autoLayout = false;
                    stationInfoStatsPanel.autoFitChildrenVertically = true;
                    stationInfoStatsPanel.autoLayoutStart           = LayoutStart.TopLeft;
                    stationInfoStatsPanel.autoLayoutDirection       = LayoutDirection.Horizontal;
                    stationInfoStatsPanel.relativePosition          = new Vector3(-20, 10);
                    stationInfoStatsPanel.autoLayout = true;
                    stationInfoStatsPanel.wrapLayout = true;
                    stationInfoStatsPanel.width      = normalWidth;

                    UILabel residentsWaiting = null;
                    TLMUtils.createUIElement <UILabel>(ref residentsWaiting, stationInfoStatsPanel.transform);
                    residentsWaiting.autoSize         = false;
                    residentsWaiting.useOutline       = true;
                    residentsWaiting.text             = residents.ToString();
                    residentsWaiting.tooltipLocaleID  = "TLM_RESIDENTS_WAITING";
                    residentsWaiting.backgroundSprite = "EmptySprite";
                    residentsWaiting.color            = new Color32(0x12, 0x68, 0x34, 255);
                    residentsWaiting.width            = normalWidth;
                    residentsWaiting.padding          = new RectOffset(0, 0, 4, 2);
                    residentsWaiting.height           = 20;
                    residentsWaiting.textScale        = 0.7f;
                    residentsWaiting.textAlignment    = UIHorizontalAlignment.Center;
                    residentCounters[stationNodeId]   = residentsWaiting;

                    UILabel touristsWaiting = null;
                    TLMUtils.createUIElement <UILabel>(ref touristsWaiting, stationInfoStatsPanel.transform);
                    touristsWaiting.autoSize         = false;
                    touristsWaiting.text             = tourists.ToString();
                    touristsWaiting.tooltipLocaleID  = "TLM_TOURISTS_WAITING";
                    touristsWaiting.useOutline       = true;
                    touristsWaiting.width            = normalWidth;
                    touristsWaiting.height           = 20;
                    touristsWaiting.padding          = new RectOffset(0, 0, 4, 2);
                    touristsWaiting.textScale        = 0.7f;
                    touristsWaiting.backgroundSprite = "EmptySprite";
                    touristsWaiting.color            = new Color32(0x1f, 0x25, 0x68, 255);
                    touristsWaiting.textAlignment    = UIHorizontalAlignment.Center;
                    touristCounters[stationNodeId]   = touristsWaiting;
                    //
                    return(normalWidth);
                }
                else
                {
                    return(25f);
                }
            }
            else
            {
                return(30f);
            }
        }
示例#19
0
        private void Awake()
        {
            base.component.eventZOrderChanged += delegate(UIComponent c, int r)
            {
                this.SetBackgroundColor();
            };
            this.m_LineIsVisible = base.Find <UICheckBox>("LineVisible");
            this.m_LineIsVisible.eventCheckChanged += (x, y) => ChangeLineVisibility(y);
            this.m_LineColor = base.Find <UIColorField>("LineColor");
            this.m_LineColor.normalBgSprite             = "";
            this.m_LineColor.focusedBgSprite            = "";
            this.m_LineColor.hoveredBgSprite            = "";
            this.m_LineColor.width                      = 40;
            this.m_LineColor.height                     = 40;
            this.m_LineColor.atlas                      = TLMController.taLineNumber;
            this.m_LineNumberFormatted                  = this.m_LineColor.GetComponentInChildren <UIButton>();
            m_LineNumberFormatted.textScale             = 1.5f;
            m_LineNumberFormatted.useOutline            = true;
            this.m_LineColor.eventSelectedColorChanged += new PropertyChangedEventHandler <Color>(this.OnColorChanged);
            this.m_LineName                        = base.Find <UILabel>("LineName");
            this.m_LineNameField                   = this.m_LineName.Find <UITextField>("LineNameField");
            this.m_LineNameField.maxLength         = 256;
            this.m_LineNameField.eventTextChanged += new PropertyChangedEventHandler <string>(this.OnRename);
            this.m_LineName.eventMouseEnter       += delegate(UIComponent c, UIMouseEventParameter r)
            {
                this.m_LineName.backgroundSprite = "TextFieldPanelHovered";
            };
            this.m_LineName.eventMouseLeave += delegate(UIComponent c, UIMouseEventParameter r)
            {
                this.m_LineName.backgroundSprite = string.Empty;
            };
            this.m_LineName.eventClick += delegate(UIComponent c, UIMouseEventParameter r)
            {
                this.m_LineNameField.Show();
                this.m_LineNameField.text = this.m_LineName.text;
                this.m_LineNameField.Focus();
            };
            this.m_LineNameField.eventLeaveFocus += delegate(UIComponent c, UIFocusEventParameter r)
            {
                this.m_LineNameField.Hide();
                this.m_LineName.text = this.m_LineNameField.text;
            };


            this.m_DayLine               = base.Find <UICheckBox>("DayLine");
            this.m_NightLine             = base.Find <UICheckBox>("NightLine");
            this.m_DayNightLine          = base.Find <UICheckBox>("DayNightLine");
            m_DisabledLine               = GameObject.Instantiate(base.Find <UICheckBox>("DayLine"), m_DayLine.transform.parent);
            this.m_DayLine.eventClicked += delegate(UIComponent comp, UIMouseEventParameter c)
            {
                ushort lineID = this.m_LineID;
                if (Singleton <SimulationManager> .exists && lineID != 0)
                {
                    m_LineOperation = Singleton <SimulationManager> .instance.AddAction(delegate
                    {
                        changeLineTime(true, false);
                    });
                }
            };
            this.m_NightLine.eventClicked += delegate(UIComponent comp, UIMouseEventParameter c)
            {
                ushort lineID = this.m_LineID;
                if (Singleton <SimulationManager> .exists && lineID != 0)
                {
                    m_LineOperation = Singleton <SimulationManager> .instance.AddAction(delegate
                    {
                        changeLineTime(false, true);
                    });
                }
            };
            this.m_DayNightLine.eventClicked += delegate(UIComponent comp, UIMouseEventParameter c)
            {
                ushort lineID = this.m_LineID;
                if (Singleton <SimulationManager> .exists && lineID != 0)
                {
                    m_LineOperation = Singleton <SimulationManager> .instance.AddAction(delegate
                    {
                        changeLineTime(true, true);
                    });
                }
            };

            m_DisabledLine.eventClicked += delegate(UIComponent comp, UIMouseEventParameter c)
            {
                ushort lineID = this.m_LineID;
                if (Singleton <SimulationManager> .exists && lineID != 0)
                {
                    m_LineOperation = Singleton <SimulationManager> .instance.AddAction(delegate
                    {
                        changeLineTime(false, false);
                    });
                }
            };


            if (TLMSingleton.isIPTLoaded)
            {
                m_DisabledLine.isEnabled = false;
                m_DisabledLine.isVisible = false;
            }
            else
            {
                m_NightLine.relativePosition    = new Vector3(678, 8);
                m_DayNightLine.relativePosition = new Vector3(704, 8);
            }

            this.m_LineStops      = base.Find <UILabel>("LineStops");
            this.m_LinePassengers = base.Find <UILabel>("LinePassengers");

            var tsd = Singleton <T> .instance.GetTSD();

            this.m_LineVehicles = base.Find <UILabel>("LineVehicles");
            if (tsd.hasVehicles())
            {
                m_LineVehicles.relativePosition = new Vector3(m_LineVehicles.relativePosition.x, 5, 0);
                m_lineBudgetLabel = GameObject.Instantiate(this.m_LineStops, m_LineStops.transform.parent);
            }
            else
            {
                Destroy(m_LineVehicles.gameObject);
            }

            this.m_Background               = base.Find("Background");
            this.m_BackgroundColor          = this.m_Background.color;
            this.m_mouseIsOver              = false;
            base.component.eventMouseEnter += new MouseEventHandler(this.OnMouseEnter);
            base.component.eventMouseLeave += new MouseEventHandler(this.OnMouseLeave);
            base.Find <UIButton>("DeleteLine").eventClick += delegate(UIComponent c, UIMouseEventParameter r)
            {
                if (this.m_LineID != 0)
                {
                    ConfirmPanel.ShowModal("CONFIRM_LINEDELETE", delegate(UIComponent comp, int ret)
                    {
                        if (ret == 1)
                        {
                            Singleton <SimulationManager> .instance.AddAction(delegate
                            {
                                Singleton <TransportManager> .instance.ReleaseLine(this.m_LineID);
                                GameObject.Destroy(gameObject);
                            });
                        }
                    });
                }
            };
            base.Find <UIButton>("ViewLine").eventClick += delegate(UIComponent c, UIMouseEventParameter r)
            {
                if (this.m_LineID != 0)
                {
                    Vector3    position   = Singleton <NetManager> .instance.m_nodes.m_buffer[(int)Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID].m_stops].m_position;
                    InstanceID instanceID = default(InstanceID);
                    instanceID.TransportLine = this.m_LineID;
                    TLMController.instance.lineInfoPanel.openLineInfo(lineID);
                    TLMController.instance.CloseTLMPanel();
                }
            };
            base.component.eventVisibilityChanged += delegate(UIComponent c, bool v)
            {
                if (v)
                {
                    this.RefreshData(true, true);
                }
            };

            //Auto color & Auto Name
            TLMUtils.createUIElement(out UIButton buttonAutoName, transform);
            buttonAutoName.pivot            = UIPivotPoint.TopRight;
            buttonAutoName.relativePosition = new Vector3(164, 2);
            buttonAutoName.text             = "A";
            buttonAutoName.textScale        = 0.6f;
            buttonAutoName.width            = 15;
            buttonAutoName.height           = 15;
            buttonAutoName.tooltip          = Locale.Get("TLM_AUTO_NAME_SIMPLE_BUTTON_TOOLTIP");
            TLMUtils.initButton(buttonAutoName, true, "ButtonMenu");
            buttonAutoName.name        = "AutoName";
            buttonAutoName.isVisible   = true;
            buttonAutoName.eventClick += (component, eventParam) =>
            {
                DoAutoName();
            };

            TLMUtils.createUIElement(out UIButton buttonAutoColor, transform);
            buttonAutoColor.pivot            = UIPivotPoint.TopRight;
            buttonAutoColor.relativePosition = new Vector3(90, 2);
            buttonAutoColor.text             = "A";
            buttonAutoColor.textScale        = 0.6f;
            buttonAutoColor.width            = 15;
            buttonAutoColor.height           = 15;
            buttonAutoColor.tooltip          = Locale.Get("TLM_AUTO_COLOR_SIMPLE_BUTTON_TOOLTIP");
            TLMUtils.initButton(buttonAutoColor, true, "ButtonMenu");
            buttonAutoColor.name        = "AutoColor";
            buttonAutoColor.isVisible   = true;
            buttonAutoColor.eventClick += (component, eventParam) =>
            {
                DoAutoColor();
            };

            m_lineIncompleteWarning = base.Find <UIPanel>("WarningIncomplete");

            if (tsd.hasVehicles())
            {
                TLMUtils.createUIElement(out m_perHourBudgetInfo, transform);
                m_perHourBudgetInfo.name              = "PerHourIndicator";
                m_perHourBudgetInfo.autoSize          = false;
                m_perHourBudgetInfo.autoHeight        = true;
                m_perHourBudgetInfo.anchor            = UIAnchorStyle.CenterHorizontal | UIAnchorStyle.CenterVertical;
                m_perHourBudgetInfo.width             = 180;
                m_perHourBudgetInfo.height            = m_perHourBudgetInfo.parent.height;
                m_perHourBudgetInfo.verticalAlignment = UIVerticalAlignment.Middle;
                m_perHourBudgetInfo.textAlignment     = UIHorizontalAlignment.Center;
                m_perHourBudgetInfo.textScale         = 1f;
                m_perHourBudgetInfo.localeID          = "TLM_PER_HOUR_BUDGET_ACTIVE_LABEL";
                m_perHourBudgetInfo.wordWrap          = true;
                m_perHourBudgetInfo.eventTextChanged += constraintedScale;
                constraintedScale(m_perHourBudgetInfo, "");
            }
        }
        private void Awake()
        {
            TLMUtils.clearAllVisibilityEvents(this.GetComponent <UIPanel>());
            base.component.eventZOrderChanged += delegate(UIComponent c, int r)
            {
                this.SetBackgroundColor();
            };
            this.m_LineIsVisible = base.Find <UICheckBox>("LineVisible");
            this.m_LineIsVisible.eventCheckChanged += delegate(UIComponent c, bool r)
            {
                if (this.m_LineID != 0)
                {
                    Singleton <SimulationManager> .instance.AddAction(delegate
                    {
                        if (r)
                        {
                            TransportLine[] expr_2A_cp_0            = Singleton <TransportManager> .instance.m_lines.m_buffer;
                            ushort expr_2A_cp_1                     = this.m_LineID;
                            expr_2A_cp_0[(int)expr_2A_cp_1].m_flags = (expr_2A_cp_0[(int)expr_2A_cp_1].m_flags & ~TransportLine.Flags.Hidden);
                        }
                        else
                        {
                            TransportLine[] expr_5C_cp_0            = Singleton <TransportManager> .instance.m_lines.m_buffer;
                            ushort expr_5C_cp_1                     = this.m_LineID;
                            expr_5C_cp_0[(int)expr_5C_cp_1].m_flags = (expr_5C_cp_0[(int)expr_5C_cp_1].m_flags | TransportLine.Flags.Hidden);
                        }
                    });
                }
            };
            this.m_LineColor = base.Find <UIColorField>("LineColor");
            this.m_LineColor.normalBgSprite             = "";
            this.m_LineColor.focusedBgSprite            = "";
            this.m_LineColor.hoveredBgSprite            = "";
            this.m_LineColor.width                      = 40;
            this.m_LineColor.height                     = 40;
            this.m_LineColor.atlas                      = TLMController.taLineNumber;
            this.m_LineNumberFormatted                  = this.m_LineColor.GetComponentInChildren <UIButton>();
            m_LineNumberFormatted.textScale             = 1.5f;
            m_LineNumberFormatted.useOutline            = true;
            this.m_LineColor.eventSelectedColorChanged += new PropertyChangedEventHandler <Color>(this.OnColorChanged);
            this.m_LineName                        = base.Find <UILabel>("LineName");
            this.m_LineNameField                   = this.m_LineName.Find <UITextField>("LineNameField");
            this.m_LineNameField.maxLength         = 256;
            this.m_LineNameField.eventTextChanged += new PropertyChangedEventHandler <string>(this.OnRename);
            this.m_LineName.eventMouseEnter       += delegate(UIComponent c, UIMouseEventParameter r)
            {
                this.m_LineName.backgroundSprite = "TextFieldPanelHovered";
            };
            this.m_LineName.eventMouseLeave += delegate(UIComponent c, UIMouseEventParameter r)
            {
                this.m_LineName.backgroundSprite = string.Empty;
            };
            this.m_LineName.eventClick += delegate(UIComponent c, UIMouseEventParameter r)
            {
                this.m_LineNameField.Show();
                this.m_LineNameField.text = this.m_LineName.text;
                this.m_LineNameField.Focus();
            };
            this.m_LineNameField.eventLeaveFocus += delegate(UIComponent c, UIFocusEventParameter r)
            {
                this.m_LineNameField.Hide();
                this.m_LineName.text = this.m_LineNameField.text;
            };


            this.m_DayLine      = base.Find <UICheckBox>("DayLine");
            this.m_NightLine    = base.Find <UICheckBox>("NightLine");
            this.m_DayNightLine = base.Find <UICheckBox>("DayNightLine");
            m_DisabledLine      = GameObject.Instantiate(base.Find <UICheckBox>("DayLine"));
            m_DisabledLine.transform.SetParent(m_DayLine.transform.parent);
            this.m_DayLine.eventClicked += delegate(UIComponent comp, UIMouseEventParameter c)
            {
                ushort lineID = this.m_LineID;
                if (Singleton <SimulationManager> .exists && lineID != 0)
                {
                    m_LineOperation = Singleton <SimulationManager> .instance.AddAction(delegate
                    {
                        changeLineTime(true, false);
                    });
                }
            };
            this.m_NightLine.eventClicked += delegate(UIComponent comp, UIMouseEventParameter c)
            {
                ushort lineID = this.m_LineID;
                if (Singleton <SimulationManager> .exists && lineID != 0)
                {
                    m_LineOperation = Singleton <SimulationManager> .instance.AddAction(delegate
                    {
                        changeLineTime(false, true);
                    });
                }
            };
            this.m_DayNightLine.eventClicked += delegate(UIComponent comp, UIMouseEventParameter c)
            {
                ushort lineID = this.m_LineID;
                if (Singleton <SimulationManager> .exists && lineID != 0)
                {
                    m_LineOperation = Singleton <SimulationManager> .instance.AddAction(delegate
                    {
                        changeLineTime(true, true);
                    });
                }
            };


            m_DisabledLine.eventClicked += delegate(UIComponent comp, UIMouseEventParameter c)
            {
                ushort lineID = this.m_LineID;
                if (Singleton <SimulationManager> .exists && lineID != 0)
                {
                    m_LineOperation = Singleton <SimulationManager> .instance.AddAction(delegate
                    {
                        changeLineTime(false, false);
                    });
                }
            };


            m_NightLine.relativePosition    = new Vector3(670, 8);
            m_DayNightLine.relativePosition = new Vector3(702, 8);


            //this.m_noBudgetWarn = GameObject.Instantiate(base.Find<UILabel>("LineName"));
            //m_noBudgetWarn.transform.SetParent(m_DayLine.transform.parent);
            //m_noBudgetWarn.isInteractive = false;
            //m_noBudgetWarn.relativePosition = new Vector3(615, 2);
            //m_noBudgetWarn.width = 145;
            //m_noBudgetWarn.isVisible = false;
            //m_noBudgetWarn.text = "";
            //m_noBudgetWarn.textScale = 0.9f;
            //m_noBudgetWarn.localeID = "TLM_LINE_DISABLED_NO_BUDGET";


            this.m_LineStops      = base.Find <UILabel>("LineStops");
            this.m_LinePassengers = base.Find <UILabel>("LinePassengers");
            this.m_LineVehicles   = base.Find <UILabel>("LineVehicles");
            //m_LinePassengers.relativePosition -= new Vector3(0, 6, 0);
            m_LineVehicles.relativePosition = new Vector3(m_LineVehicles.relativePosition.x, 5, 0);
            m_budgetEffective = GameObject.Instantiate(this.m_LineStops);
            m_budgetEffective.transform.SetParent(m_LineStops.transform.parent);
            //m_LineEarnings = GameObject.Instantiate(this.m_LinePassengers);
            //m_LineEarnings.transform.SetParent(m_LineStops.transform.parent);
            //m_LineEarnings.textColor = Color.green;
            this.m_Background               = base.Find("Background");
            this.m_BackgroundColor          = this.m_Background.color;
            this.m_mouseIsOver              = false;
            base.component.eventMouseEnter += new MouseEventHandler(this.OnMouseEnter);
            base.component.eventMouseLeave += new MouseEventHandler(this.OnMouseLeave);
            base.Find <UIButton>("DeleteLine").eventClick += delegate(UIComponent c, UIMouseEventParameter r)
            {
                if (this.m_LineID != 0)
                {
                    ConfirmPanel.ShowModal("CONFIRM_LINEDELETE", delegate(UIComponent comp, int ret)
                    {
                        if (ret == 1)
                        {
                            Singleton <SimulationManager> .instance.AddAction(delegate
                            {
                                Singleton <TransportManager> .instance.ReleaseLine(this.m_LineID);
                            });
                        }
                    });
                }
            };
            base.Find <UIButton>("ViewLine").eventClick += delegate(UIComponent c, UIMouseEventParameter r)
            {
                if (this.m_LineID != 0)
                {
                    Vector3    position   = Singleton <NetManager> .instance.m_nodes.m_buffer[(int)Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID].m_stops].m_position;
                    InstanceID instanceID = default(InstanceID);
                    instanceID.TransportLine = this.m_LineID;
                    TLMController.instance.lineInfoPanel.openLineInfo(lineID);
                    TLMController.instance.defaultListingLinesPanel.Hide();
                }
            };
            base.component.eventVisibilityChanged += delegate(UIComponent c, bool v)
            {
                if (v)
                {
                    this.RefreshData(true, true);
                }
            };

            //Auto color & Auto Name
            UIButton buttonAutoName = null;

            TLMUtils.createUIElement <UIButton>(ref buttonAutoName, transform);
            buttonAutoName.pivot            = UIPivotPoint.TopRight;
            buttonAutoName.relativePosition = new Vector3(164, 2);
            buttonAutoName.text             = "A";
            buttonAutoName.textScale        = 0.6f;
            buttonAutoName.width            = 15;
            buttonAutoName.height           = 15;
            buttonAutoName.tooltip          = Locale.Get("TLM_AUTO_NAME_SIMPLE_BUTTON_TOOLTIP");
            TLMUtils.initButton(buttonAutoName, true, "ButtonMenu");
            buttonAutoName.name        = "AutoName";
            buttonAutoName.isVisible   = true;
            buttonAutoName.eventClick += (component, eventParam) =>
            {
                DoAutoName();
            };

            UIButton buttonAutoColor = null;

            TLMUtils.createUIElement <UIButton>(ref buttonAutoColor, transform);
            buttonAutoColor.pivot            = UIPivotPoint.TopRight;
            buttonAutoColor.relativePosition = new Vector3(80, 2);
            buttonAutoColor.text             = "A";
            buttonAutoColor.textScale        = 0.6f;
            buttonAutoColor.width            = 15;
            buttonAutoColor.height           = 15;
            buttonAutoColor.tooltip          = Locale.Get("TLM_AUTO_COLOR_SIMPLE_BUTTON_TOOLTIP");
            TLMUtils.initButton(buttonAutoColor, true, "ButtonMenu");
            buttonAutoColor.name        = "AutoColor";
            buttonAutoColor.isVisible   = true;
            buttonAutoColor.eventClick += (component, eventParam) =>
            {
                DoAutoColor();
            };
        }
        private void createLineStationsLinearView()
        {
            TLMUtils.createUIElement(out mainContainer, parent.TransformLinearMap);
            mainContainer.absolutePosition = new Vector3(2f, TLMController.instance.uiView.fixedHeight - 300f);
            mainContainer.name             = "LineStationsLinearView";
            mainContainer.height           = 50;
            mainContainer.autoSize         = true;

            TLMUtils.createUIElement(out linearMapLineNumberFormat, mainContainer.transform);
            linearMapLineNumberFormat.autoSize          = false;
            linearMapLineNumberFormat.width             = 50;
            linearMapLineNumberFormat.height            = 50;
            linearMapLineNumberFormat.color             = new Color(1, 0, 0, 1);
            linearMapLineNumberFormat.pivot             = UIPivotPoint.MiddleLeft;
            linearMapLineNumberFormat.textAlignment     = UIHorizontalAlignment.Center;
            linearMapLineNumberFormat.verticalAlignment = UIVerticalAlignment.Middle;
            linearMapLineNumberFormat.name             = "LineFormat";
            linearMapLineNumberFormat.relativePosition = new Vector3(0f, 0f);
            linearMapLineNumberFormat.atlas            = TLMController.taLineNumber;
            TLMUtils.createDragHandle(linearMapLineNumberFormat, mainContainer);



            TLMUtils.createUIElement(out linearMapLineNumber, linearMapLineNumberFormat.transform);

            linearMapLineNumber.autoSize          = false;
            linearMapLineNumber.width             = linearMapLineNumberFormat.width;
            linearMapLineNumber.pivot             = UIPivotPoint.MiddleCenter;
            linearMapLineNumber.name              = "LineNumber";
            linearMapLineNumber.width             = 50;
            linearMapLineNumber.height            = 50;
            linearMapLineNumber.relativePosition  = new Vector3(-0.5f, 0.5f);
            linearMapLineNumber.autoHeight        = false;
            linearMapLineNumber.textAlignment     = UIHorizontalAlignment.Center;
            linearMapLineNumber.verticalAlignment = UIVerticalAlignment.Middle;


            TLMUtils.createUIElement(out linearMapLineTime, linearMapLineNumberFormat.transform);
            linearMapLineTime.autoSize          = false;
            linearMapLineTime.width             = 50;
            linearMapLineTime.height            = 50;
            linearMapLineTime.color             = new Color(1, 1, 1, 1);
            linearMapLineTime.pivot             = UIPivotPoint.MiddleLeft;
            linearMapLineTime.textAlignment     = UIHorizontalAlignment.Center;
            linearMapLineTime.verticalAlignment = UIVerticalAlignment.Middle;
            linearMapLineTime.name             = "LineTime";
            linearMapLineTime.relativePosition = new Vector3(0f, 0f);
            linearMapLineTime.atlas            = TLMController.taLineNumber;

            //if (parent.PrefixSelector)
            //{
            //    prefixSelector = UIHelperExtension.CloneBasicDropDownNoLabel(new string[] { "/", "B" }, (y) =>
            //    {
            //        SetSelectedPrefix(y);
            //    }, linearMapLineNumberFormat
            //    );
            //    prefixSelector.autoSize = false;
            //    prefixSelector.width = linearMapLineNumberFormat.width;
            //    prefixSelector.pivot = UIPivotPoint.MiddleCenter;
            //    prefixSelector.name = "LinePrefixSelector";
            //    prefixSelector.width = 50;
            //    prefixSelector.height = 50;
            //    prefixSelector.relativePosition = new Vector3(-0.5f, 0.5f);
            //    prefixSelector.textScale = 1;
            //    prefixSelector.textFieldPadding.top = 999999;
            //    prefixSelector.textFieldPadding.bottom = 999999;
            //    prefixSelector.textFieldPadding.left = 999999;
            //    prefixSelector.textFieldPadding.right = 999999;
            //    prefixSelector.normalBgSprite = null;
            //    prefixSelector.hoveredBgSprite = null;
            //    prefixSelector.focusedBgSprite = null;
            //    prefixSelector.zOrder = 999;
            //    var dragH = TLMUtils.createDragHandle(prefixSelector, mainContainer);

            //    dragH.eventClicked += (x, y) =>
            //    {
            //        prefixSelector.SimulateClick();
            //    };
            //    TransportManagerOverrides.OnLineRelease += () =>
            //        {
            //            TLMUtils.doLog("OnLineRelease");
            //            if (isVisible)
            //            {
            //                SetSelectedPrefix(prefixSelector.selectedIndex);
            //                UpdatePrefixSelector();
            //            }
            //        };

            //}

            if (parent.CanSwitchView)
            {
                TLMUtils.createUIElement(out infoToggle, mainContainer.transform);
                TLMUtils.initButton(infoToggle, true, "ButtonMenu");
                infoToggle.relativePosition = new Vector3(0f, 60f);
                infoToggle.width            = 50;
                infoToggle.height           = 70;
                infoToggle.wordWrap         = true;
                infoToggle.localeID         = "TLM_SHOW_EXTRA_INFO";
                infoToggle.isLocalized      = true;
                infoToggle.textScale        = 0.8f;
                infoToggle.eventClick      += (x, y) =>
                {
                    showIntersections = !showIntersections;
                    showExtraStopInfo = !showIntersections;
                    if (showIntersections)
                    {
                        infoToggle.localeID      = "TLM_SHOW_EXTRA_INFO";
                        distanceToggle.isVisible = true;
                    }
                    else
                    {
                        infoToggle.localeID      = "TLM_SHOW_LINE_INTEGRATION_SHORT";
                        distanceToggle.isVisible = false;
                    }
                    redrawLine();
                };


                TLMUtils.createUIElement(out distanceToggle, mainContainer.transform);
                TLMUtils.initButton(distanceToggle, true, "ButtonMenu");
                distanceToggle.relativePosition   = new Vector3(0f, 135f);
                distanceToggle.width              = 50;
                distanceToggle.height             = 20;
                distanceToggle.wordWrap           = true;
                distanceToggle.tooltipLocaleID    = "TLM_TOGGLE_DISTANCE_LINEAR_MAP";
                distanceToggle.isTooltipLocalized = true;
                distanceToggle.textScale          = 0.8f;
                distanceToggle.text        = "Δd";
                distanceToggle.eventClick += (x, y) =>
                {
                    TLMSingleton.showDistanceInLinearMap = !TLMSingleton.showDistanceInLinearMap;
                    redrawLine();
                };
            }

            createLineStationsPanel();
        }
示例#22
0
        private void createInfoView()
        {
            //line info painel

            TLMUtils.createUIElement(out depotInfoPanel, m_controller.mainRef.transform);
            depotInfoPanel.Hide();
            depotInfoPanel.relativePosition  = new Vector3(394.0f, 0.0f);
            depotInfoPanel.width             = 650;
            depotInfoPanel.height            = 290;
            depotInfoPanel.zOrder            = 50;
            depotInfoPanel.color             = new Color32(255, 255, 255, 255);
            depotInfoPanel.backgroundSprite  = "MenuPanel2";
            depotInfoPanel.name              = "DepotInfoPanel";
            depotInfoPanel.autoLayoutPadding = new RectOffset(5, 5, 10, 10);
            depotInfoPanel.autoLayout        = false;
            depotInfoPanel.useCenter         = true;
            depotInfoPanel.wrapLayout        = false;
            depotInfoPanel.canFocus          = true;
            TLMUtils.createDragHandle(depotInfoPanel, depotInfoPanel, 35f);



            TLMUtils.createUIElement(out lineTransportIconTypeLabel, depotInfoPanel.transform);
            lineTransportIconTypeLabel.autoSize         = false;
            lineTransportIconTypeLabel.relativePosition = new Vector3(10f, 12f);
            lineTransportIconTypeLabel.width            = 30;
            lineTransportIconTypeLabel.height           = 20;
            lineTransportIconTypeLabel.name             = "DepotTransportIcon";
            lineTransportIconTypeLabel.clipChildren     = true;
            lineTransportIconTypeLabel.eventClick      += (x, y) => {
                openDepotInfo(m_buildingIdSelecionado.Building, !m_secondary);
            };
            TLMUtils.createDragHandle(lineTransportIconTypeLabel, depotInfoPanel);


            TLMUtils.createUIElement(out depotNameField, depotInfoPanel.transform);
            depotNameField.autoSize            = false;
            depotNameField.relativePosition    = new Vector3(160f, 10f);
            depotNameField.horizontalAlignment = UIHorizontalAlignment.Center;
            depotNameField.text      = "NOME";
            depotNameField.width     = 450;
            depotNameField.height    = 25;
            depotNameField.name      = "DepotNameLabel";
            depotNameField.maxLength = 256;
            depotNameField.textScale = 1.5f;
            TLMUtils.uiTextFieldDefaults(depotNameField);
            depotNameField.eventGotFocus += (component, eventParam) => {
                lastDepotName = depotNameField.text;
            };
            depotNameField.eventLostFocus += (component, eventParam) => {
                if (lastDepotName != depotNameField.text)
                {
                    saveDepotName(depotNameField);
                }
            };

            TLMUtils.createUIElement(out vehiclesInUseLabel, depotInfoPanel.transform);
            vehiclesInUseLabel.autoSize         = false;
            vehiclesInUseLabel.relativePosition = new Vector3(10f, 60f);
            vehiclesInUseLabel.textAlignment    = UIHorizontalAlignment.Left;
            vehiclesInUseLabel.text             = "";
            vehiclesInUseLabel.width            = 550;
            vehiclesInUseLabel.height           = 25;
            vehiclesInUseLabel.name             = "VehiclesInUseLabel";
            vehiclesInUseLabel.textScale        = 0.8f;

            TLMUtils.createUIElement(out passengersLastWeek, depotInfoPanel.transform);
            passengersLastWeek.autoSize         = false;
            passengersLastWeek.relativePosition = new Vector3(10f, 90);
            passengersLastWeek.textAlignment    = UIHorizontalAlignment.Left;
            passengersLastWeek.text             = "";
            passengersLastWeek.width            = 550;
            passengersLastWeek.height           = 25;
            passengersLastWeek.name             = "PassengersLastWeek";
            passengersLastWeek.textScale        = 0.8f;

            TLMUtils.createUIElement(out upkeepCost, depotInfoPanel.transform);
            upkeepCost.autoSize         = false;
            upkeepCost.relativePosition = new Vector3(10f, 75);
            upkeepCost.textAlignment    = UIHorizontalAlignment.Left;
            upkeepCost.width            = 250;
            upkeepCost.height           = 25;
            upkeepCost.name             = "AvoidedTravelsLabel";
            upkeepCost.textScale        = 0.8f;

            TLMUtils.createUIElement(out prefixesSpawned, depotInfoPanel.transform);
            prefixesSpawned.autoSize         = false;
            prefixesSpawned.relativePosition = new Vector3(10f, 120f);
            prefixesSpawned.textAlignment    = UIHorizontalAlignment.Left;
            prefixesSpawned.localeID         = "TLM_PREFIXES_SPAWNED_DEPOT";
            prefixesSpawned.suffix           = ":";
            prefixesSpawned.width            = 350;
            prefixesSpawned.height           = 25;
            prefixesSpawned.name             = "TouristAndPassagersLabel";
            prefixesSpawned.textScale        = 0.8f;

            TLMUtils.createUIElement(out UIPanel prefixesPanel, depotInfoPanel.transform);
            prefixesPanel.autoSize         = false;
            prefixesPanel.relativePosition = new Vector3(10f, 135f);
            prefixesPanel.width            = 630;
            prefixesPanel.height           = 100;
            prefixesPanel.name             = "Prefixes Panel";
            prefixesPanel.autoLayout       = true;
            prefixesPanel.wrapLayout       = true;

            prefixesCheckboxes = new Dictionary <uint, UICheckBox>();
            for (uint i = 0; i <= 65; i++)
            {
                prefixesCheckboxes[i]       = prefixesPanel.AttachUIComponent(UITemplateManager.GetAsGameObject("OptionsCheckBoxTemplate")) as UICheckBox;
                prefixesCheckboxes[i].text  = i == 0 ? Locale.Get("TLM_UNPREFIXED") : i == 65 ? Locale.Get("TLM_REGIONAL") : i.ToString();
                prefixesCheckboxes[i].width = 50;
                prefixesCheckboxes[i].GetComponentInChildren <UILabel>().relativePosition = new Vector3(20, 2);
                uint j = i;
                prefixesCheckboxes[i].eventCheckChanged += (x, y) => {
                    if (TLMSingleton.instance != null && TLMSingleton.debugMode)
                    {
                        TLMUtils.doLog("prefixesCheckboxes[i].eventCheckChanged; j = {0}; check = {1}; loading = {2}", j, y, isLoading);
                    }
                    if (!isLoading)
                    {
                        togglePrefix(j, y, m_secondary);
                    }
                };
            }

            prefixesCheckboxes[0].width   = prefixesPanel.width / 2.1f;
            prefixesCheckboxes[65].width  = prefixesPanel.width / 2.1f;
            prefixesCheckboxes[65].zOrder = 0;

            TLMUtils.createUIElement(out UIButton voltarButton2, depotInfoPanel.transform);
            voltarButton2.relativePosition = new Vector3(depotInfoPanel.width - 33f, 5f);
            voltarButton2.width            = 28;
            voltarButton2.height           = 28;
            TLMUtils.initButton(voltarButton2, true, "DeleteLineButton");
            voltarButton2.name        = "LineInfoCloseButton";
            voltarButton2.eventClick += closeDepotInfo;

            workerChart = new TLMWorkerChartPanel(this.panelTransform, new Vector3(400f, 60f));

            TLMUtils.createUIElement(out UIButton addAllPrefixesButton, panelTransform);
            addAllPrefixesButton.relativePosition = new Vector3(300, 100f);
            addAllPrefixesButton.localeID         = "TLM_ADD_ALL";
            addAllPrefixesButton.isLocalized      = true;
            addAllPrefixesButton.textScale        = 0.6f;
            addAllPrefixesButton.width            = 80;
            addAllPrefixesButton.height           = 15;
            addAllPrefixesButton.tooltipLocaleID  = "TLM_ADD_ALL_PREFIX_TOOLTIP";
            TLMUtils.initButton(addAllPrefixesButton, true, "ButtonMenu");
            addAllPrefixesButton.name        = "AddAll";
            addAllPrefixesButton.isVisible   = true;
            addAllPrefixesButton.eventClick += (component, eventParam) => {
                TLMDepotAI.addAllPrefixesToDepot(m_buildingIdSelecionado.Building, m_secondary);
                updateCheckboxes();
            };

            TLMUtils.createUIElement(out UIButton removeAllPrefixesButton, panelTransform);
            removeAllPrefixesButton.relativePosition = new Vector3(300, 120f);
            removeAllPrefixesButton.localeID         = "TLM_REMOVE_ALL";
            removeAllPrefixesButton.isLocalized      = true;
            removeAllPrefixesButton.textScale        = 0.6f;
            removeAllPrefixesButton.width            = 80;
            removeAllPrefixesButton.height           = 15;
            removeAllPrefixesButton.tooltipLocaleID  = "TLM_REMOVE_ALL_PREFIX_TOOLTIP";
            TLMUtils.initButton(removeAllPrefixesButton, true, "ButtonMenu");
            removeAllPrefixesButton.name        = "RemoveAll";
            removeAllPrefixesButton.isVisible   = true;
            removeAllPrefixesButton.eventClick += (component, eventParam) => {
                TLMDepotAI.removeAllPrefixesFromDepot(m_buildingIdSelecionado.Building, m_secondary);
                updateCheckboxes();
            };
        }
示例#23
0
        private void createLineStationsLinearView()
        {
            TLMUtils.createUIElement <UIPanel>(ref mainContainer, lineInfoPanel.transform);
            mainContainer.absolutePosition = new Vector3(2f, lineInfoPanel.controller.uiView.fixedHeight - 300f);
            mainContainer.name             = "LineStationsLinearView";
            mainContainer.height           = 50;
            mainContainer.autoSize         = true;

            TLMUtils.createUIElement <UILabel>(ref linearMapLineNumberFormat, mainContainer.transform);
            linearMapLineNumberFormat.autoSize          = false;
            linearMapLineNumberFormat.width             = 50;
            linearMapLineNumberFormat.height            = 50;
            linearMapLineNumberFormat.color             = new Color(1, 0, 0, 1);
            linearMapLineNumberFormat.pivot             = UIPivotPoint.MiddleLeft;
            linearMapLineNumberFormat.textAlignment     = UIHorizontalAlignment.Center;
            linearMapLineNumberFormat.verticalAlignment = UIVerticalAlignment.Middle;
            linearMapLineNumberFormat.name             = "LineFormat";
            linearMapLineNumberFormat.relativePosition = new Vector3(0f, 0f);
            linearMapLineNumberFormat.atlas            = TLMController.taLineNumber;
            TLMUtils.createDragHandle(linearMapLineNumberFormat, mainContainer);

            TLMUtils.createUIElement <UILabel>(ref linearMapLineNumber, linearMapLineNumberFormat.transform);
            linearMapLineNumber.autoSize          = false;
            linearMapLineNumber.autoHeight        = false;
            linearMapLineNumber.width             = linearMapLineNumberFormat.width;
            linearMapLineNumber.pivot             = UIPivotPoint.MiddleCenter;
            linearMapLineNumber.textAlignment     = UIHorizontalAlignment.Center;
            linearMapLineNumber.verticalAlignment = UIVerticalAlignment.Middle;
            linearMapLineNumber.name             = "LineNumber";
            linearMapLineNumber.width            = 50;
            linearMapLineNumber.height           = 50;
            linearMapLineNumber.relativePosition = new Vector3(-0.5f, 0.5f);
            TLMUtils.createDragHandle(linearMapLineNumber, mainContainer);

            TLMUtils.createUIElement <UILabel>(ref linearMapLineTime, linearMapLineNumberFormat.transform);
            linearMapLineTime.autoSize          = false;
            linearMapLineTime.width             = 50;
            linearMapLineTime.height            = 50;
            linearMapLineTime.color             = new Color(1, 1, 1, 1);
            linearMapLineTime.pivot             = UIPivotPoint.MiddleLeft;
            linearMapLineTime.textAlignment     = UIHorizontalAlignment.Center;
            linearMapLineTime.verticalAlignment = UIVerticalAlignment.Middle;
            linearMapLineTime.name             = "LineTime";
            linearMapLineTime.relativePosition = new Vector3(0f, 0f);
            linearMapLineTime.atlas            = TLMController.taLineNumber;
            TLMUtils.createDragHandle(linearMapLineTime, mainContainer);

            TLMUtils.createUIElement <UIButton>(ref infoToggle, mainContainer.transform);
            TLMUtils.initButton(infoToggle, true, "ButtonMenu");
            infoToggle.relativePosition = new Vector3(0f, 60f);
            infoToggle.width            = 50;
            infoToggle.height           = 70;
            infoToggle.wordWrap         = true;
            infoToggle.localeID         = "TLM_SHOW_EXTRA_INFO";
            infoToggle.isLocalized      = true;
            infoToggle.textScale        = 0.8f;
            infoToggle.eventClick      += (x, y) =>
            {
                showIntersections = !showIntersections;
                showExtraStopInfo = !showIntersections;
                if (showIntersections)
                {
                    infoToggle.localeID = "TLM_SHOW_EXTRA_INFO";
                }
                else
                {
                    infoToggle.localeID = "TLM_SHOW_LINE_INTEGRATION_SHORT";
                }
                redrawLine();
            };

            createLineStationsPanel();
        }
示例#24
0
        private void createInfoView()
        {
            //line info painel

            TLMUtils.createUIElement <UIPanel>(ref lineInfoPanel, m_controller.mainRef.transform);
            lineInfoPanel.Hide();
            lineInfoPanel.relativePosition  = new Vector3(394.0f, 0.0f);
            lineInfoPanel.width             = 650;
            lineInfoPanel.height            = 290;
            lineInfoPanel.zOrder            = 50;
            lineInfoPanel.color             = new Color32(255, 255, 255, 255);
            lineInfoPanel.backgroundSprite  = "MenuPanel2";
            lineInfoPanel.name              = "LineInfoPanel";
            lineInfoPanel.autoLayoutPadding = new RectOffset(5, 5, 10, 10);
            lineInfoPanel.autoLayout        = false;
            lineInfoPanel.useCenter         = true;
            lineInfoPanel.wrapLayout        = false;
            lineInfoPanel.canFocus          = true;
            TLMUtils.createDragHandle(lineInfoPanel, lineInfoPanel, 35f);
            lineInfoPanel.eventVisibilityChanged += (component, value) =>
            {
                if (m_linearMap != null)
                {
                    m_linearMap.isVisible = value;
                }
            };



            TLMUtils.createUIElement <UILabel>(ref lineTransportIconTypeLabel, lineInfoPanel.transform);
            lineTransportIconTypeLabel.autoSize         = false;
            lineTransportIconTypeLabel.relativePosition = new Vector3(10f, 12f);
            lineTransportIconTypeLabel.width            = 30;
            lineTransportIconTypeLabel.height           = 20;
            lineTransportIconTypeLabel.name             = "LineTransportIcon";
            lineTransportIconTypeLabel.clipChildren     = true;
            TLMUtils.createDragHandle(lineTransportIconTypeLabel, lineInfoPanel);

            GameObject lpddgo = GameObject.Instantiate(UITemplateManager.GetAsGameObject(UIHelperExtension.kDropdownTemplate).GetComponent <UIPanel>().Find <UIDropDown>("Dropdown").gameObject);

            linePrefixDropDown = lpddgo.GetComponent <UIDropDown>();
            lineInfoPanel.AttachUIComponent(linePrefixDropDown.gameObject);
            linePrefixDropDown.isLocalized         = false;
            linePrefixDropDown.autoSize            = false;
            linePrefixDropDown.horizontalAlignment = UIHorizontalAlignment.Center;
            linePrefixDropDown.text                       = "";
            linePrefixDropDown.width                      = 40;
            linePrefixDropDown.height                     = 35;
            linePrefixDropDown.name                       = "LinePrefixDropDown";
            linePrefixDropDown.textScale                  = 1.6f;
            linePrefixDropDown.itemHeight                 = 35;
            linePrefixDropDown.itemPadding                = new RectOffset(2, 2, 2, 2);
            linePrefixDropDown.textFieldPadding           = new RectOffset(2, 2, 2, 2);
            linePrefixDropDown.eventSelectedIndexChanged += saveLineNumber;
            linePrefixDropDown.relativePosition           = new Vector3(70f, 3f);


            TLMUtils.createUIElement <UITextField>(ref lineNumberLabel, lineInfoPanel.transform);
            lineNumberLabel.autoSize            = false;
            lineNumberLabel.relativePosition    = new Vector3(80f, 3f);
            lineNumberLabel.horizontalAlignment = UIHorizontalAlignment.Center;
            lineNumberLabel.text           = "";
            lineNumberLabel.width          = 75;
            lineNumberLabel.height         = 35;
            lineNumberLabel.name           = "LineNumberLabel";
            lineNumberLabel.normalBgSprite = "EmptySprite";
            lineNumberLabel.textScale      = 1.6f;
            lineNumberLabel.padding        = new RectOffset(5, 5, 5, 5);
            lineNumberLabel.color          = new Color(0, 0, 0, 1);
            TLMUtils.uiTextFieldDefaults(lineNumberLabel);
            lineNumberLabel.numericalOnly   = true;
            lineNumberLabel.maxLength       = 4;
            lineNumberLabel.eventLostFocus += saveLineNumber;
            lineNumberLabel.zOrder          = 10;


            TLMUtils.createUIElement <UITextField>(ref lineNameField, lineInfoPanel.transform);
            lineNameField.autoSize            = false;
            lineNameField.relativePosition    = new Vector3(190f, 10f);
            lineNameField.horizontalAlignment = UIHorizontalAlignment.Center;
            lineNameField.text      = "NOME";
            lineNameField.width     = 450;
            lineNameField.height    = 25;
            lineNameField.name      = "LineNameLabel";
            lineNameField.maxLength = 256;
            lineNameField.textScale = 1.5f;
            TLMUtils.uiTextFieldDefaults(lineNameField);
            lineNameField.eventGotFocus += (component, eventParam) =>
            {
                lastLineName = lineNameField.text;
            };
            lineNameField.eventLostFocus += (component, eventParam) =>
            {
                if (lastLineName != lineNameField.text)
                {
                    saveLineName(lineNameField);
                }
                lineNameField.text = m_controller.tm.GetLineName(m_lineIdSelecionado.TransportLine);
            };

            TLMUtils.createUIElement <UILabel>(ref lineLenghtLabel, lineInfoPanel.transform);
            lineLenghtLabel.autoSize         = false;
            lineLenghtLabel.relativePosition = new Vector3(10f, 60f);
            lineLenghtLabel.textAlignment    = UIHorizontalAlignment.Left;
            lineLenghtLabel.text             = "";
            lineLenghtLabel.width            = 550;
            lineLenghtLabel.height           = 25;
            lineLenghtLabel.prefix           = "";
            lineLenghtLabel.suffix           = "";
            lineLenghtLabel.name             = "LineLenghtLabel";
            lineLenghtLabel.textScale        = 0.8f;

            TLMUtils.createUIElement <UILabel>(ref detailedStatsLabel, lineInfoPanel.transform);
            detailedStatsLabel.autoSize         = false;
            detailedStatsLabel.relativePosition = new Vector3(10f, 75f);
            detailedStatsLabel.textAlignment    = UIHorizontalAlignment.Left;
            detailedStatsLabel.width            = 550;
            detailedStatsLabel.height           = 25;
            detailedStatsLabel.name             = "ExtraInfoLabel";
            detailedStatsLabel.textScale        = 0.8f;
            detailedStatsLabel.prefix           = Locale.Get("TLM_LINE_EFFECTIVE_BUDGET") + ": ";

            TLMUtils.createUIElement <UILabel>(ref veiculosLinhaLabel, lineInfoPanel.transform);
            veiculosLinhaLabel.autoSize         = false;
            veiculosLinhaLabel.relativePosition = new Vector3(10f, 90);
            veiculosLinhaLabel.textAlignment    = UIHorizontalAlignment.Left;
            veiculosLinhaLabel.text             = "";
            veiculosLinhaLabel.width            = 550;
            veiculosLinhaLabel.height           = 25;
            veiculosLinhaLabel.name             = "VehiclesLineLabel";
            veiculosLinhaLabel.textScale        = 0.8f;

            TLMUtils.createUIElement <UILabel>(ref viagensEvitadasLabel, lineInfoPanel.transform);
            viagensEvitadasLabel.autoSize         = false;
            viagensEvitadasLabel.relativePosition = new Vector3(10f, 105);
            viagensEvitadasLabel.textAlignment    = UIHorizontalAlignment.Left;
            viagensEvitadasLabel.text             = "";
            viagensEvitadasLabel.width            = 250;
            viagensEvitadasLabel.height           = 25;
            viagensEvitadasLabel.name             = "AvoidedTravelsLabel";
            viagensEvitadasLabel.textScale        = 0.8f;

            TLMUtils.createUIElement <UILabel>(ref passageirosEturistasLabel, lineInfoPanel.transform);
            passageirosEturistasLabel.autoSize         = false;
            passageirosEturistasLabel.relativePosition = new Vector3(10f, 120f);
            passageirosEturistasLabel.textAlignment    = UIHorizontalAlignment.Left;
            passageirosEturistasLabel.text             = "";
            passageirosEturistasLabel.width            = 350;
            passageirosEturistasLabel.height           = 25;
            passageirosEturistasLabel.name             = "TouristAndPassagersLabel";
            passageirosEturistasLabel.textScale        = 0.8f;

            //TLMUtils.createUIElement<UILabel>(ref generalDebugLabel, lineInfoPanel.transform);
            //generalDebugLabel.autoSize = false;
            //generalDebugLabel.relativePosition = new Vector3(10f, 185f);
            //generalDebugLabel.textAlignment = UIHorizontalAlignment.Left;
            //generalDebugLabel.prefix = "DEBUG: DATA AVAIL = ";
            //generalDebugLabel.width = 350;
            //generalDebugLabel.height = 100;
            //generalDebugLabel.name = "CustosLabel";
            //generalDebugLabel.textScale = 0.8f;
            //generalDebugLabel.wordWrap = true;
            //generalDebugLabel.clipChildren = false;
            //generalDebugLabel.enabled = false && TransportLinesManagerMod.debugMode.value;
            TLMUtils.createUIElement <UILabel>(ref vehicleQuantitySetLabel, lineInfoPanel.transform);
            vehicleQuantitySetLabel.autoSize         = false;
            vehicleQuantitySetLabel.relativePosition = new Vector3(10f, 135f);
            vehicleQuantitySetLabel.textAlignment    = UIHorizontalAlignment.Left;
            vehicleQuantitySetLabel.localeID         = "TLM_SET_FIXED_VEHICLE_NUMBER_LINE";
            vehicleQuantitySetLabel.isLocalized      = true;
            vehicleQuantitySetLabel.width            = 300;
            vehicleQuantitySetLabel.height           = 40;
            vehicleQuantitySetLabel.name             = "FixedVehiclesLabel";
            vehicleQuantitySetLabel.textScale        = 0.8f;
            vehicleQuantitySetLabel.clipChildren     = false;
            vehicleQuantitySetLabel.zOrder           = 0;

            vehicleQuantitySet = UITextField.Instantiate(lineNumberLabel);
            vehicleQuantitySet.transform.SetParent(lineInfoPanel.transform);
            vehicleQuantitySet.relativePosition = new Vector3(120f, 165f);
            vehicleQuantitySet.size             = new Vector2(50, 30);
            vehicleQuantitySet.padding          = new RectOffset(0, 0, 0, 0);
            vehicleQuantitySet.textScale        = 0.8f;
            vehicleQuantitySet.numericalOnly    = true;
            vehicleQuantitySet.eventLostFocus  += (x, y) =>
            {
                TLMVehiclesLineManager.instance[this.lineIdSelecionado.TransportLine] = int.Parse(vehicleQuantitySet.text);
            };

            TLMUtils.createUIElement <UILabel>(ref m_autoNameLabel, lineInfoPanel.transform);
            m_autoNameLabel.autoSize         = false;
            m_autoNameLabel.relativePosition = new Vector3(10f, 180f);
            m_autoNameLabel.textAlignment    = UIHorizontalAlignment.Left;
            m_autoNameLabel.prefix           = Locale.Get("TLM_GENERATED_AUTO_NAME") + ": ";
            m_autoNameLabel.width            = 350;
            m_autoNameLabel.height           = 100;
            m_autoNameLabel.name             = "AutoNameLabel";
            m_autoNameLabel.textScale        = 0.8f;
            m_autoNameLabel.wordWrap         = true;
            m_autoNameLabel.clipChildren     = false;

            lineColorPicker = GameObject.Instantiate(PublicTransportWorldInfoPanel.FindObjectOfType <UIColorField>().gameObject).GetComponent <UIColorField>();
            //
            lineInfoPanel.AttachUIComponent(lineColorPicker.gameObject);
            lineColorPicker.name                       = "LineColorPicker";
            lineColorPicker.relativePosition           = new Vector3(50f, 10f);
            lineColorPicker.enabled                    = true;
            lineColorPicker.anchor                     = UIAnchorStyle.Top & UIAnchorStyle.Left;
            lineColorPicker.eventSelectedColorChanged += (UIComponent component, Color value) =>
            {
                TLMUtils.setLineColor(m_lineIdSelecionado.TransportLine, value);
                updateLineUI(value);
            };

            lineTime = UIHelperExtension.CloneBasicDropDown(Locale.Get("TRANSPORT_LINE_ACTIVITY"), new string[] {
                Locale.Get("TRANSPORT_LINE_DAYNNIGHT"),
                Locale.Get("TRANSPORT_LINE_DAY"),
                Locale.Get("TRANSPORT_LINE_NIGHT"),
                Locale.Get("TLM_TRANSPORT_LINE_DISABLED")
            }, changeLineTime, lineInfoPanel, out lineTimeTitle);
            lineTime.parent.relativePosition = new Vector3(120f, 220f);

            UIButton deleteLine = null;

            TLMUtils.createUIElement <UIButton>(ref deleteLine, lineInfoPanel.transform);
            deleteLine.relativePosition = new Vector3(10f, lineInfoPanel.height - 40f);
            deleteLine.localeID         = "LINE_DELETE";
            deleteLine.isLocalized      = true;
            deleteLine.autoSize         = true;
            deleteLine.textPadding      = new RectOffset(3, 3, 3, 3);
            TLMUtils.initButton(deleteLine, true, "ButtonMenu");
            deleteLine.name        = "DeleteLineButton";
            deleteLine.color       = new Color(1, 0, 0, 1);
            deleteLine.eventClick += (UIComponent component, UIMouseEventParameter eventParam) =>
            {
                Singleton <SimulationManager> .instance.AddAction(delegate
                {
                    Singleton <TransportManager> .instance.ReleaseLine(m_lineIdSelecionado.TransportLine);
                });

                closeLineInfo(component, eventParam);
            };
            UIButton voltarButton2 = null;

            TLMUtils.createUIElement <UIButton>(ref voltarButton2, lineInfoPanel.transform);
            voltarButton2.relativePosition = new Vector3(lineInfoPanel.width - 250f, lineInfoPanel.height - 40f);
            voltarButton2.localeID         = "CLOSE";
            voltarButton2.isLocalized      = true;
            voltarButton2.width            = 240;
            voltarButton2.height           = 30;
            TLMUtils.initButton(voltarButton2, true, "ButtonMenu");
            voltarButton2.name        = "LineInfoCloseButton";
            voltarButton2.eventClick += closeLineInfo;

            UIButton autoName = null;

            TLMUtils.createUIElement <UIButton>(ref autoName, lineInfoPanel.transform);
            autoName.relativePosition = new Vector3(lineInfoPanel.width - 250f, lineInfoPanel.height - 80f);
            autoName.localeID         = "TLM_USE_AUTO_NAME";
            autoName.isLocalized      = true;
            autoName.width            = 240;
            autoName.height           = 30;
            TLMUtils.initButton(autoName, true, "ButtonMenu");
            autoName.name        = "AutoNameButton";
            autoName.eventClick += (component, eventParam) =>
            {
                lineNameField.text = m_linearMap.autoName;
                saveLineName(lineNameField);
            };

            UIButton autoColor = null;

            TLMUtils.createUIElement <UIButton>(ref autoColor, lineInfoPanel.transform);
            autoColor.relativePosition = new Vector3(lineInfoPanel.width - 250f, lineInfoPanel.height - 120f);
            autoColor.localeID         = "TLM_PICK_COLOR_FROM_PALETTE";
            autoColor.isLocalized      = true;
            autoColor.tooltipLocaleID  = "TLM_PICK_COLOR_FROM_PALETTE_TOOLTIP";
            autoColor.width            = 240;
            autoColor.height           = 30;
            TLMUtils.initButton(autoColor, true, "ButtonMenu");
            autoColor.name          = "AutoNameButton";
            autoColor.eventMouseUp += (component, eventParam) =>
            {
                lineColorPicker.selectedColor = m_controller.AutoColor(m_lineIdSelecionado.TransportLine);
                updateLineUI(lineColorPicker.selectedColor);
            };


            agesPanel   = new TLMAgesChartPanel(this);
            m_linearMap = new TLMLinearMap(this);
        }
示例#25
0
        private void Awake()
        {
            TLMUtils.clearAllVisibilityEvents(this.GetComponent <UIPanel>());
            base.component.eventZOrderChanged += delegate(UIComponent c, int r)
            {
                this.SetBackgroundColor();
            };
            GameObject.Destroy(base.Find <UICheckBox>("LineVisible").gameObject);
            GameObject.Destroy(base.Find <UIColorField>("LineColor").gameObject);

            this.m_depotName                        = base.Find <UILabel>("LineName");
            this.m_depotNameField                   = this.m_depotName.Find <UITextField>("LineNameField");
            this.m_depotNameField.maxLength         = 256;
            this.m_depotNameField.eventTextChanged += new PropertyChangedEventHandler <string>(this.OnRename);
            this.m_depotName.eventMouseEnter       += delegate(UIComponent c, UIMouseEventParameter r)
            {
                this.m_depotName.backgroundSprite = "TextFieldPanelHovered";
            };
            this.m_depotName.eventMouseLeave += delegate(UIComponent c, UIMouseEventParameter r)
            {
                this.m_depotName.backgroundSprite = string.Empty;
            };
            this.m_depotName.eventClick += delegate(UIComponent c, UIMouseEventParameter r)
            {
                this.m_depotNameField.Show();
                this.m_depotNameField.text = this.m_depotName.text;
                this.m_depotNameField.Focus();
            };
            this.m_depotNameField.eventLeaveFocus += delegate(UIComponent c, UIFocusEventParameter r)
            {
                this.m_depotNameField.Hide();
                this.m_depotName.text = this.m_depotNameField.text;
            };

            GameObject.Destroy(base.Find <UICheckBox>("DayLine").gameObject);
            GameObject.Destroy(base.Find <UICheckBox>("NightLine").gameObject);
            GameObject.Destroy(base.Find <UICheckBox>("DayNightLine").gameObject);


            this.m_prefixOptions = UIHelperExtension.CloneBasicDropDownNoLabel(new string[] { }, onChangePrefixSelected, gameObject.GetComponent <UIPanel>());

            m_prefixOptions.area = new Vector4(600, 3, 80, 33);

            var m_DayLine = base.Find <UICheckBox>("DayLine");

            GameObject.Destroy(base.Find <UICheckBox>("NightLine").gameObject);
            GameObject.Destroy(base.Find <UICheckBox>("DayNightLine").gameObject);
            GameObject.Destroy(m_DayLine.gameObject);

            m_districtName                  = base.Find <UILabel>("LineStops");
            m_districtName.size             = new Vector2(175, 18);
            m_districtName.relativePosition = new Vector3(0, 10);
            m_districtName.pivot            = UIPivotPoint.MiddleCenter;
            m_districtName.wordWrap         = true;
            m_districtName.autoHeight       = true;



            GameObject.Destroy(base.Find <UILabel>("LinePassengers").gameObject);
            this.m_prefixesServed             = base.Find <UILabel>("LineVehicles");
            this.m_prefixesServed.size        = new Vector2(220, 35);
            this.m_prefixesServed.autoHeight  = true;
            this.m_prefixesServed.maximumSize = new Vector2(0, 36);
            this.m_prefixesServed.textScale   = 0.7f;
            this.m_prefixesServed.width       = 170;

            this.m_Background               = base.Find("Background");
            this.m_BackgroundColor          = this.m_Background.color;
            this.m_mouseIsOver              = false;
            base.component.eventMouseEnter += new MouseEventHandler(this.OnMouseEnter);
            base.component.eventMouseLeave += new MouseEventHandler(this.OnMouseLeave);
            GameObject.Destroy(base.Find <UIButton>("DeleteLine").gameObject);
            base.Find <UIButton>("ViewLine").eventClick += delegate(UIComponent c, UIMouseEventParameter r)
            {
                if (this.m_buildingID != 0)
                {
                    Vector3    position   = Singleton <BuildingManager> .instance.m_buildings.m_buffer[(int)this.m_buildingID].m_position;
                    InstanceID instanceID = default(InstanceID);
                    instanceID.Building = this.m_buildingID;
                    TLMController.instance.depotInfoPanel.openDepotInfo(m_buildingID);
                    ToolsModifierControl.cameraController.SetTarget(instanceID, position, true);
                    TLMController.instance.defaultListingLinesPanel.Hide();
                }
            };
            base.component.eventVisibilityChanged += delegate(UIComponent c, bool v)
            {
                if (v)
                {
                    this.m_prefixOptions.items = new string[] { };
                    this.RefreshData();
                }
            };

            //Buttons
            TLMUtils.createUIElement <UIButton>(ref m_addPrefixButton, transform);
            m_addPrefixButton.pivot            = UIPivotPoint.TopRight;
            m_addPrefixButton.relativePosition = new Vector3(730, 2);
            m_addPrefixButton.text             = Locale.Get("TLM_ADD");
            m_addPrefixButton.textScale        = 0.6f;
            m_addPrefixButton.width            = 50;
            m_addPrefixButton.height           = 15;
            m_addPrefixButton.tooltip          = Locale.Get("TLM_ADD_PREFIX_TOOLTIP");
            TLMUtils.initButton(m_addPrefixButton, true, "ButtonMenu");
            m_addPrefixButton.name        = "Add";
            m_addPrefixButton.isVisible   = true;
            m_addPrefixButton.eventClick += (component, eventParam) =>
            {
                uint prefix = m_prefixOptions.selectedIndex == m_prefixOptions.items.Length - 1 ? 65 : (uint)m_prefixOptions.selectedIndex;
                TLMDepotAI.addPrefixToDepot(buildingId, prefix);
                m_addPrefixButton.isVisible    = false;
                m_removePrefixButton.isVisible = true;
            };

            TLMUtils.createUIElement <UIButton>(ref m_removePrefixButton, transform);
            m_removePrefixButton.pivot            = UIPivotPoint.TopRight;
            m_removePrefixButton.relativePosition = new Vector3(780, 2);
            m_removePrefixButton.text             = Locale.Get("TLM_REMOVE");
            m_removePrefixButton.textScale        = 0.6f;
            m_removePrefixButton.width            = 50;
            m_removePrefixButton.height           = 15;
            m_removePrefixButton.tooltip          = Locale.Get("TLM_REMOVE_PREFIX_TOOLTIP");
            TLMUtils.initButton(m_removePrefixButton, true, "ButtonMenu");
            m_removePrefixButton.name        = "Remove";
            m_removePrefixButton.isVisible   = true;
            m_removePrefixButton.eventClick += (component, eventParam) =>
            {
                uint prefix = m_prefixOptions.selectedIndex == m_prefixOptions.items.Length - 1 ? 65 : (uint)m_prefixOptions.selectedIndex;
                TLMDepotAI.removePrefixFromDepot(buildingId, prefix);
                m_addPrefixButton.isVisible    = true;
                m_removePrefixButton.isVisible = false;
            };


            TLMUtils.createUIElement <UIButton>(ref m_addAllPrefixesButton, transform);
            m_addAllPrefixesButton.pivot            = UIPivotPoint.TopRight;
            m_addAllPrefixesButton.relativePosition = new Vector3(730, 20);
            m_addAllPrefixesButton.text             = Locale.Get("TLM_ADD_ALL_SHORT");;
            m_addAllPrefixesButton.textScale        = 0.6f;
            m_addAllPrefixesButton.width            = 50;
            m_addAllPrefixesButton.height           = 15;
            m_addAllPrefixesButton.tooltip          = Locale.Get("TLM_ADD_ALL_PREFIX_TOOLTIP");
            TLMUtils.initButton(m_addAllPrefixesButton, true, "ButtonMenu");
            m_addAllPrefixesButton.name        = "AddAll";
            m_addAllPrefixesButton.isVisible   = true;
            m_addAllPrefixesButton.eventClick += (component, eventParam) =>
            {
                TLMDepotAI.addAllPrefixesToDepot(buildingId);
                m_addPrefixButton.isVisible    = false;
                m_removePrefixButton.isVisible = true;
            };


            TLMUtils.createUIElement <UIButton>(ref m_removeAllPrefixesButton, transform);
            m_removeAllPrefixesButton.pivot            = UIPivotPoint.TopRight;
            m_removeAllPrefixesButton.relativePosition = new Vector3(780, 20);
            m_removeAllPrefixesButton.text             = Locale.Get("TLM_REMOVE_ALL_SHORT");
            m_removeAllPrefixesButton.textScale        = 0.6f;
            m_removeAllPrefixesButton.width            = 50;
            m_removeAllPrefixesButton.height           = 15;
            m_removeAllPrefixesButton.tooltip          = Locale.Get("TLM_REMOVE_ALL_PREFIX_TOOLTIP");
            TLMUtils.initButton(m_removeAllPrefixesButton, true, "ButtonMenu");
            m_removeAllPrefixesButton.name        = "RemoveAll";
            m_removeAllPrefixesButton.isVisible   = true;
            m_removeAllPrefixesButton.eventClick += (component, eventParam) =>
            {
                TLMDepotAI.removeAllPrefixesFromDepot(buildingId);
                m_addPrefixButton.isVisible    = true;
                m_removePrefixButton.isVisible = false;
            };
        }
示例#26
0
        private void CreateToggleBudgetButtons(UIPanel reference)
        {
            TLMUtils.createUIElement(out m_enableBudgetPerHour, reference.transform);
            m_enableBudgetPerHour.relativePosition = new Vector3(reference.width - 65f, 0f);
            m_enableBudgetPerHour.textScale        = 0.6f;
            m_enableBudgetPerHour.width            = 40;
            m_enableBudgetPerHour.height           = 40;
            m_enableBudgetPerHour.tooltip          = Locale.Get("TLM_USE_PER_PERIOD_BUDGET");
            TLMUtils.initButton(m_enableBudgetPerHour, true, "ButtonMenu");
            m_enableBudgetPerHour.name        = "EnableBudgetPerHour";
            m_enableBudgetPerHour.isVisible   = true;
            m_enableBudgetPerHour.eventClick += (component, eventParam) =>
            {
                IBudgetableExtension bte;
                uint idx;
                var  tsdRef = tsd;
                bte = TLMLineUtils.getExtensionFromTransportSystemDefinition(ref tsdRef);
                idx = (uint)SelectedPrefix;

                uint[] saveData    = bte.GetBudgetsMultiplier(idx);
                uint[] newSaveData = new uint[8];
                for (int i = 0; i < 8; i++)
                {
                    newSaveData[i] = saveData[0];
                }
                bte.SetBudgetMultiplier(idx, newSaveData);
                updateSliders();
            };

            var icon = m_enableBudgetPerHour.AddUIComponent <UISprite>();

            icon.relativePosition = new Vector3(2, 2);
            icon.atlas            = TLMController.taTLM;
            icon.width            = 36;
            icon.height           = 36;
            icon.spriteName       = "PerHourIcon";


            TLMUtils.createUIElement(out m_disableBudgetPerHour, reference.transform);
            m_disableBudgetPerHour.relativePosition = new Vector3(reference.width - 65f, 0f);
            m_disableBudgetPerHour.textScale        = 0.6f;
            m_disableBudgetPerHour.width            = 40;
            m_disableBudgetPerHour.height           = 40;
            m_disableBudgetPerHour.tooltip          = Locale.Get("TLM_USE_SINGLE_BUDGET");
            TLMUtils.initButton(m_disableBudgetPerHour, true, "ButtonMenu");
            m_disableBudgetPerHour.name        = "DisableBudgetPerHour";
            m_disableBudgetPerHour.isVisible   = true;
            m_disableBudgetPerHour.eventClick += (component, eventParam) =>
            {
                IBudgetableExtension bte;
                uint idx;
                var  tsdRef = tsd;
                bte = TLMLineUtils.getExtensionFromTransportSystemDefinition(ref tsdRef);
                idx = (uint)SelectedPrefix;

                uint[] saveData    = bte.GetBudgetsMultiplier(idx);
                uint[] newSaveData = new uint[] { saveData[0] };
                bte.SetBudgetMultiplier(idx, newSaveData);

                updateSliders();
            };

            icon = m_disableBudgetPerHour.AddUIComponent <UISprite>();
            icon.relativePosition = new Vector3(2, 2);
            icon.atlas            = TLMController.taTLM;
            icon.width            = 36;
            icon.height           = 36;
            icon.spriteName       = "24hLineIcon";
        }
示例#27
0
        private void CreatePrefixSelectorUI()
        {
            this.m_prefixOptions = UIHelperExtension.CloneBasicDropDownNoLabel(new string[] { }, onChangePrefixSelected, gameObject.GetComponent <UIPanel>());
            m_prefixOptions.area = new Vector4(550, 3, 80, 33);

            m_prefixesServed                   = base.Find <UILabel>("LineVehicles");
            m_prefixesServed.autoSize          = true;
            m_prefixesServed.textScale         = 0.6f;
            m_prefixesServed.pivot             = UIPivotPoint.TopLeft;
            m_prefixesServed.verticalAlignment = UIVerticalAlignment.Middle;
            m_prefixesServed.minimumSize       = new Vector2(210, 35);
            TLMUtils.LimitWidth(m_prefixesServed);


            //Buttons
            TLMUtils.createUIElement(out m_addPrefixButton, transform);
            m_addPrefixButton.pivot            = UIPivotPoint.TopRight;
            m_addPrefixButton.relativePosition = new Vector3(680, 2);
            m_addPrefixButton.text             = Locale.Get("TLM_ADD");
            m_addPrefixButton.textScale        = 0.6f;
            m_addPrefixButton.width            = 50;
            m_addPrefixButton.height           = 15;
            m_addPrefixButton.tooltip          = Locale.Get("TLM_ADD_PREFIX_TOOLTIP");
            TLMUtils.initButton(m_addPrefixButton, true, "ButtonMenu");
            m_addPrefixButton.name        = "Add";
            m_addPrefixButton.isVisible   = true;
            m_addPrefixButton.eventClick += (component, eventParam) =>
            {
                uint prefix = m_prefixOptions.selectedIndex == m_prefixOptions.items.Length - 1 ? 65 : (uint)m_prefixOptions.selectedIndex;
                TLMDepotAI.addPrefixToDepot(buildingId, prefix, secondary);
                m_addPrefixButton.isVisible    = false;
                m_removePrefixButton.isVisible = true;
            };

            TLMUtils.createUIElement(out m_removePrefixButton, transform);
            m_removePrefixButton.pivot            = UIPivotPoint.TopRight;
            m_removePrefixButton.relativePosition = new Vector3(730, 2);
            m_removePrefixButton.text             = Locale.Get("TLM_REMOVE");
            m_removePrefixButton.textScale        = 0.6f;
            m_removePrefixButton.width            = 50;
            m_removePrefixButton.height           = 15;
            m_removePrefixButton.tooltip          = Locale.Get("TLM_REMOVE_PREFIX_TOOLTIP");
            TLMUtils.initButton(m_removePrefixButton, true, "ButtonMenu");
            m_removePrefixButton.name        = "Remove";
            m_removePrefixButton.isVisible   = true;
            m_removePrefixButton.eventClick += (component, eventParam) =>
            {
                uint prefix = m_prefixOptions.selectedIndex == m_prefixOptions.items.Length - 1 ? 65 : (uint)m_prefixOptions.selectedIndex;
                TLMDepotAI.removePrefixFromDepot(buildingId, prefix, secondary);
                m_addPrefixButton.isVisible    = true;
                m_removePrefixButton.isVisible = false;
            };


            TLMUtils.createUIElement(out m_addAllPrefixesButton, transform);
            m_addAllPrefixesButton.pivot            = UIPivotPoint.TopRight;
            m_addAllPrefixesButton.relativePosition = new Vector3(680, 20);
            m_addAllPrefixesButton.text             = Locale.Get("TLM_ADD_ALL_SHORT");
            ;
            m_addAllPrefixesButton.textScale = 0.6f;
            m_addAllPrefixesButton.width     = 50;
            m_addAllPrefixesButton.height    = 15;
            m_addAllPrefixesButton.tooltip   = Locale.Get("TLM_ADD_ALL_PREFIX_TOOLTIP");
            TLMUtils.initButton(m_addAllPrefixesButton, true, "ButtonMenu");
            m_addAllPrefixesButton.name        = "AddAll";
            m_addAllPrefixesButton.isVisible   = true;
            m_addAllPrefixesButton.eventClick += (component, eventParam) =>
            {
                TLMDepotAI.addAllPrefixesToDepot(buildingId, secondary);
                m_addPrefixButton.isVisible    = false;
                m_removePrefixButton.isVisible = true;
            };


            TLMUtils.createUIElement(out m_removeAllPrefixesButton, transform);
            m_removeAllPrefixesButton.pivot            = UIPivotPoint.TopRight;
            m_removeAllPrefixesButton.relativePosition = new Vector3(730, 20);
            m_removeAllPrefixesButton.text             = Locale.Get("TLM_REMOVE_ALL_SHORT");
            m_removeAllPrefixesButton.textScale        = 0.6f;
            m_removeAllPrefixesButton.width            = 50;
            m_removeAllPrefixesButton.height           = 15;
            m_removeAllPrefixesButton.tooltip          = Locale.Get("TLM_REMOVE_ALL_PREFIX_TOOLTIP");
            TLMUtils.initButton(m_removeAllPrefixesButton, true, "ButtonMenu");
            m_removeAllPrefixesButton.name        = "RemoveAll";
            m_removeAllPrefixesButton.isVisible   = true;
            m_removeAllPrefixesButton.eventClick += (component, eventParam) =>
            {
                TLMDepotAI.removeAllPrefixesFromDepot(buildingId, secondary);
                m_addPrefixButton.isVisible    = true;
                m_removePrefixButton.isVisible = false;
            };
        }
        private float addStationToLinearMap(string stationPrefix, string stationName, Vector3 location, float offsetX, List <ushort> intersections,
                                            string airport, string harbor, string taxi, string regionalTrainStation, string cableCarStation,
                                            ushort stationNodeId, ItemClass.SubService ss, Color lineColor, bool simple)//, out float intersectionPanelHeight)
        {
            ushort           lineID = parent.CurrentSelectedId;
            TransportLine    t      = TLMController.instance.tm.m_lines.m_buffer[(int)lineID];
            TransportManager tm     = Singleton <TransportManager> .instance;

            if (stationName == null)
            {
                stationName = "???";
            }

            TLMUtils.createUIElement(out UIButton stationButton, lineStationsPanel.transform);
            stationButton.relativePosition = new Vector3(offsetX - 13, 15f);
            stationButton.width            = 20;
            stationButton.height           = 20;
            stationButton.color            = lineColor;
            stationButton.name             = "Station [" + stationName + "]";
            stationButton.atlas            = TLMController.taLineNumber;
            stationButton.tooltip          = stationName + "(id:" + stationNodeId + ")";
            TLMUtils.initButton(stationButton, true, "LinearStation");

            TLMUtils.createUIElement(out DroppableStationInfo dsi, stationButton.transform);
            dsi.nodeId = stationNodeId;
            dsi.name   = "DSI Station [" + stationName + "] - " + stationNodeId;

            TLMUtils.createUIElement(out UITextField stationLabel, stationButton.transform);
            stationLabel.autoSize            = true;
            stationLabel.width               = 220;
            stationLabel.height              = 20;
            stationLabel.useOutline          = true;
            stationLabel.pivot               = UIPivotPoint.MiddleLeft;
            stationLabel.horizontalAlignment = UIHorizontalAlignment.Left;
            stationLabel.verticalAlignment   = UIVerticalAlignment.Middle;
            stationLabel.name             = "Station [" + stationName + "] Name";
            stationLabel.relativePosition = new Vector3(23f, -13f);
            stationLabel.text             = (!string.IsNullOrEmpty(stationPrefix) ? stationPrefix.Trim() + " " : "") + stationName.Trim();
            stationLabel.textScale        = Math.Max(0.5f, Math.Min(1, 24f / stationLabel.text.Length));

            TLMUtils.uiTextFieldDefaults(stationLabel);
            stationLabel.color           = new Color(0.3f, 0.3f, 0.3f, 1);
            stationLabel.textColor       = Color.white;
            stationLabel.cursorWidth     = 2;
            stationLabel.cursorBlinkTime = 100;
            stationLabel.eventGotFocus  += (x, y) =>
            {
                stationLabel.text = TLMLineUtils.getStationName(stationNodeId, lineID, ss);
            };
            stationLabel.eventTextSubmitted += (x, y) =>
            {
                TLMLineUtils.setStopName(y, stationNodeId, lineID, () =>
                {
                    stationLabel.text = TLMLineUtils.getFullStationName(stationNodeId, lineID, ss);
                    m_autoName        = TLMLineUtils.calculateAutoName(lineID, true);
                    parent.OnRenameStationAction(autoName);
                });
            };

            stationButton.gameObject.transform.localPosition    = new Vector3(0, 0, 0);
            stationButton.gameObject.transform.localEulerAngles = new Vector3(0, 0, 45);
            stationButton.eventClick += (component, eventParam) =>
            {
                GameObject gameObject = GameObject.FindGameObjectWithTag("MainCamera");
                if (gameObject != null)
                {
                    var        cameraController = gameObject.GetComponent <CameraController>();
                    InstanceID x = default(InstanceID);
                    x.TransportLine = parent.CurrentSelectedId;
                    cameraController.SetTarget(x, location, false);
                    cameraController.ClearTarget();
                }
            };
            if (!simple)
            {
                if (!stationOffsetX.ContainsKey(stationNodeId))
                {
                    stationOffsetX.Add(stationNodeId, offsetX);
                }
                if (showIntersections)
                {
                    var     otherLinesIntersections = TLMLineUtils.SortLines(intersections, t);
                    UILabel distance          = null;
                    int     intersectionCount = otherLinesIntersections.Count + (airport != string.Empty ? 1 : 0) + (taxi != string.Empty ? 1 : 0) + (harbor != string.Empty ? 1 : 0) + (regionalTrainStation != string.Empty ? 1 : 0) + (cableCarStation != string.Empty ? 1 : 0);

                    if ((TLMSingleton.showDistanceInLinearMap || parent.ForceShowStopsDistances) && offsetX > 0)
                    {
                        NetSegment seg = Singleton <NetManager> .instance.m_segments.m_buffer[Singleton <NetManager> .instance.m_nodes.m_buffer[stationNodeId].m_segment0];
                        if (seg.m_endNode != stationNodeId)
                        {
                            seg = Singleton <NetManager> .instance.m_segments.m_buffer[Singleton <NetManager> .instance.m_nodes.m_buffer[stationNodeId].m_segment1];
                        }
                        if (seg.m_endNode != stationNodeId)
                        {
                            seg = Singleton <NetManager> .instance.m_segments.m_buffer[Singleton <NetManager> .instance.m_nodes.m_buffer[stationNodeId].m_segment2];
                        }
                        if (seg.m_endNode != stationNodeId)
                        {
                            seg = Singleton <NetManager> .instance.m_segments.m_buffer[Singleton <NetManager> .instance.m_nodes.m_buffer[stationNodeId].m_segment3];
                        }
                        if (seg.m_endNode != stationNodeId)
                        {
                            seg = Singleton <NetManager> .instance.m_segments.m_buffer[Singleton <NetManager> .instance.m_nodes.m_buffer[stationNodeId].m_segment4];
                        }
                        if (seg.m_endNode != stationNodeId)
                        {
                            seg = Singleton <NetManager> .instance.m_segments.m_buffer[Singleton <NetManager> .instance.m_nodes.m_buffer[stationNodeId].m_segment5];
                        }
                        if (seg.m_endNode != stationNodeId)
                        {
                            seg = Singleton <NetManager> .instance.m_segments.m_buffer[Singleton <NetManager> .instance.m_nodes.m_buffer[stationNodeId].m_segment6];
                        }
                        if (seg.m_endNode != stationNodeId)
                        {
                            seg = Singleton <NetManager> .instance.m_segments.m_buffer[Singleton <NetManager> .instance.m_nodes.m_buffer[stationNodeId].m_segment7];
                        }
                        if (seg.m_endNode != stationNodeId)
                        {
                            seg = default(NetSegment);
                        }
                        TLMUtils.createUIElement(out UIPanel distContainer, stationButton.transform);
                        distContainer.size             = new Vector2(0, 0);
                        distContainer.relativePosition = new Vector3(0, 0, 0);
                        TLMUtils.createUIElement(out distance, distContainer.transform);
                        distance.autoSize   = false;
                        distance.useOutline = true;
                        if (seg.Equals(default(NetSegment)))
                        {
                            distance.text  = "???";
                            distance.color = Color.red;
                        }
                        else
                        {
                            distance.text = (int)seg.m_averageLength + "m";
                        }
                        distance.textScale         = 0.7f;
                        distance.textAlignment     = UIHorizontalAlignment.Center;
                        distance.verticalAlignment = UIVerticalAlignment.Middle;
                        distance.name                       = "dist.";
                        distance.font                       = UIHelperExtension.defaultFontCheckbox;
                        distance.width                      = 50f;
                        distance.height                     = 50;
                        distance.relativePosition           = new Vector3(-42, 0);
                        distance.transform.localEulerAngles = new Vector3(0, 0, 45);
                        distance.isInteractive              = false;
                    }

                    if (intersectionCount > 0)
                    {
                        TLMUtils.createUIElement(out UIPanel intersectionsPanel, stationButton.transform);
                        intersectionsPanel.autoSize                  = false;
                        intersectionsPanel.autoLayout                = false;
                        intersectionsPanel.autoLayoutStart           = LayoutStart.TopLeft;
                        intersectionsPanel.autoLayoutDirection       = LayoutDirection.Horizontal;
                        intersectionsPanel.relativePosition          = new Vector3(-20, 10);
                        intersectionsPanel.wrapLayout                = false;
                        intersectionsPanel.autoFitChildrenVertically = true;

                        TLMLineUtils.PrintIntersections(airport, harbor, taxi, regionalTrainStation, cableCarStation, intersectionsPanel, otherLinesIntersections);
                        intersectionsPanel.autoLayout = true;
                        intersectionsPanel.wrapLayout = true;
                        intersectionsPanel.width      = 55;
                        //
                        return(42f);
                    }
                    else
                    {
                        TLMUtils.initButton(stationButton, true, "LinearHalfStation");
                        if (offsetX == 0)
                        {
                            stationButton.relativePosition = new Vector3(offsetX - 13, 15f);
                            return(31f);
                        }
                        else if (distance == null)
                        {
                            stationButton.relativePosition = new Vector3(offsetX - 23, 15f);
                            return(21f);
                        }
                        else
                        {
                            return(42f);
                        }
                    }
                }
                else if (showExtraStopInfo)
                {
                    float normalWidth = 42.5f;

                    NetNode stopNode = Singleton <NetManager> .instance.m_nodes.m_buffer[(int)stationNodeId];

                    TLMLineUtils.GetQuantityPassengerWaiting(stationNodeId, out int residents, out int tourists, out int ttb);

                    TLMUtils.createUIElement(out UIPanel stationInfoStatsPanel, stationButton.transform);
                    stationInfoStatsPanel.autoSize   = false;
                    stationInfoStatsPanel.autoLayout = false;
                    stationInfoStatsPanel.autoFitChildrenVertically = true;
                    stationInfoStatsPanel.autoLayoutStart           = LayoutStart.TopLeft;
                    stationInfoStatsPanel.autoLayoutDirection       = LayoutDirection.Horizontal;
                    stationInfoStatsPanel.relativePosition          = new Vector3(-20, 10);
                    stationInfoStatsPanel.autoLayout = true;
                    stationInfoStatsPanel.wrapLayout = true;
                    stationInfoStatsPanel.width      = normalWidth;

                    TLMUtils.createUIElement(out UILabel residentsWaiting, stationInfoStatsPanel.transform);
                    residentsWaiting.autoSize         = false;
                    residentsWaiting.useOutline       = true;
                    residentsWaiting.text             = residents.ToString();
                    residentsWaiting.tooltipLocaleID  = "TLM_RESIDENTS_WAITING";
                    residentsWaiting.backgroundSprite = "EmptySprite";
                    residentsWaiting.color            = new Color32(0x12, 0x68, 0x34, 255);
                    residentsWaiting.width            = normalWidth;
                    residentsWaiting.padding          = new RectOffset(0, 0, 4, 2);
                    residentsWaiting.height           = 20;
                    residentsWaiting.textScale        = 0.7f;
                    residentsWaiting.textAlignment    = UIHorizontalAlignment.Center;
                    residentCounters[stationNodeId]   = residentsWaiting;

                    TLMUtils.createUIElement(out UILabel touristsWaiting, stationInfoStatsPanel.transform);
                    touristsWaiting.autoSize         = false;
                    touristsWaiting.text             = tourists.ToString();
                    touristsWaiting.tooltipLocaleID  = "TLM_TOURISTS_WAITING";
                    touristsWaiting.useOutline       = true;
                    touristsWaiting.width            = normalWidth;
                    touristsWaiting.height           = 20;
                    touristsWaiting.padding          = new RectOffset(0, 0, 4, 2);
                    touristsWaiting.textScale        = 0.7f;
                    touristsWaiting.backgroundSprite = "EmptySprite";
                    touristsWaiting.color            = new Color32(0x1f, 0x25, 0x68, 255);
                    touristsWaiting.textAlignment    = UIHorizontalAlignment.Center;
                    touristCounters[stationNodeId]   = touristsWaiting;

                    TLMUtils.createUIElement(out UILabel timeTilBored, stationInfoStatsPanel.transform);
                    timeTilBored.autoSize         = false;
                    timeTilBored.text             = tourists.ToString();
                    timeTilBored.tooltipLocaleID  = "TLM_TIME_TIL_BORED";
                    timeTilBored.useOutline       = true;
                    timeTilBored.width            = normalWidth;
                    timeTilBored.height           = 20;
                    timeTilBored.padding          = new RectOffset(0, 0, 4, 2);
                    timeTilBored.textScale        = 0.7f;
                    timeTilBored.backgroundSprite = "EmptySprite";
                    timeTilBored.color            = new Color32(0x1f, 0x25, 0x68, 255);
                    timeTilBored.textAlignment    = UIHorizontalAlignment.Center;
                    ttbTimers[stationNodeId]      = timeTilBored;
                    //
                    return(normalWidth);
                }
                else
                {
                    return(30f);
                }
            }
            else
            {
                return(30f);
            }
        }
        private void createToolbox()
        {
            TLMUtils.createUIElement(out mainContainer, m_controller.TransformLinearMap);
            mainContainer.absolutePosition = new Vector3(2f, TLMController.instance.uiView.fixedHeight - 300f);
            mainContainer.name             = "TLMLineCreationToolbox";
            mainContainer.height           = 190;
            mainContainer.width            = 180;
            mainContainer.backgroundSprite = "MenuPanel2";
            mainContainer.relativePosition = new Vector3(320f, 57f);

            uiHelper = new UIHelperExtension(mainContainer);

            TLMUtils.createUIElement(out UILabel title, mainContainer.transform);
            title.autoSize          = false;
            title.width             = mainContainer.width;
            title.height            = 30;
            title.color             = new Color(1, 0, 0, 1);
            title.pivot             = UIPivotPoint.MiddleLeft;
            title.textAlignment     = UIHorizontalAlignment.Center;
            title.verticalAlignment = UIVerticalAlignment.Middle;
            title.name             = "Title";
            title.relativePosition = new Vector3(0, 5);
            title.atlas            = TLMController.taLineNumber;
            title.localeID         = "TLM_PREFIX_SELECTOR_WIN_TITLE";
            TLMUtils.createDragHandle(title, mainContainer);


            GameObject lpddgo = GameObject.Instantiate(UITemplateManager.GetAsGameObject(UIHelperExtension.kDropdownTemplate).GetComponent <UIPanel>().Find <UIDropDown>("Dropdown").gameObject, mainContainer.transform);

            linePrefixDropDown                            = lpddgo.GetComponent <UIDropDown>();
            linePrefixDropDown.isLocalized                = false;
            linePrefixDropDown.autoSize                   = false;
            linePrefixDropDown.horizontalAlignment        = UIHorizontalAlignment.Center;
            linePrefixDropDown.text                       = "";
            linePrefixDropDown.width                      = 75;
            linePrefixDropDown.height                     = 30;
            linePrefixDropDown.name                       = "LinePrefixDropDown";
            linePrefixDropDown.textScale                  = 1.6f;
            linePrefixDropDown.itemHeight                 = 35;
            linePrefixDropDown.itemPadding                = new RectOffset(2, 2, 2, 2);
            linePrefixDropDown.textFieldPadding           = new RectOffset(2, 2, 2, 2);
            linePrefixDropDown.eventSelectedIndexChanged += setNextLinePrefix;
            linePrefixDropDown.relativePosition           = new Vector3(5f, 45f);
            linePrefixDropDown.normalBgSprite             = "OptionsDropboxListbox";
            linePrefixDropDown.horizontalAlignment        = UIHorizontalAlignment.Center;

            TLMUtils.createUIElement(out lineNumberTxtBox, mainContainer.transform);
            lineNumberTxtBox.autoSize            = false;
            lineNumberTxtBox.relativePosition    = new Vector3(85f, 45f);
            lineNumberTxtBox.horizontalAlignment = UIHorizontalAlignment.Center;
            lineNumberTxtBox.text           = "";
            lineNumberTxtBox.width          = 90;
            lineNumberTxtBox.height         = 30;
            lineNumberTxtBox.name           = "LineNumberLabel";
            lineNumberTxtBox.normalBgSprite = "EmptySprite";
            lineNumberTxtBox.textScale      = 1.6f;
            lineNumberTxtBox.padding        = new RectOffset(0, 0, 0, 0);
            lineNumberTxtBox.color          = new Color(0, 0, 0, 1);
            TLMUtils.uiTextFieldDefaults(lineNumberTxtBox);
            lineNumberTxtBox.numericalOnly   = true;
            lineNumberTxtBox.maxLength       = 4;
            lineNumberTxtBox.eventLostFocus += setNextLineNumber;;
            lineNumberTxtBox.zOrder          = 10;
            lineNumberTxtBox.text            = "0";

            TLMUtils.createUIElement(out lineFormat, mainContainer.transform);
            lineFormat.autoSize          = false;
            lineFormat.width             = 80;
            lineFormat.height            = 80;
            lineFormat.color             = new Color(1, 0, 0, 1);
            lineFormat.pivot             = UIPivotPoint.MiddleLeft;
            lineFormat.textAlignment     = UIHorizontalAlignment.Center;
            lineFormat.verticalAlignment = UIVerticalAlignment.Middle;
            lineFormat.name             = "LineFormat";
            lineFormat.relativePosition = new Vector3(55f, 80f);
            lineFormat.atlas            = TLMController.taLineNumber;
            TLMUtils.createDragHandle(lineFormat, mainContainer);

            TLMUtils.createUIElement(out lineNumber, lineFormat.transform);
            lineNumber.autoSize          = false;
            lineNumber.width             = lineFormat.width;
            lineNumber.pivot             = UIPivotPoint.MiddleCenter;
            lineNumber.name              = "LineNumber";
            lineNumber.width             = 80;
            lineNumber.height            = 80;
            lineNumber.relativePosition  = new Vector3(-0.5f, 0.5f);
            lineNumber.autoHeight        = false;
            lineNumber.textAlignment     = UIHorizontalAlignment.Center;
            lineNumber.verticalAlignment = UIVerticalAlignment.Middle;

            prefixIncrementChk = uiHelper.AddCheckboxLocale("TLM_AUTOINCREMENT_PREFIX", false, delegate(bool value)
            {
                if (TLMSingleton.debugMode)
                {
                    TLMUtils.doLog("Type = " + TLMConfigWarehouse.getConfigIndexForTransportInfo(transportTool.m_prefab) + "|prop=" + (TLMConfigWarehouse.getConfigIndexForTransportInfo(transportTool.m_prefab) | TLMConfigWarehouse.ConfigIndex.PREFIX_INCREMENT) + "|valToSet = " + value);
                }
                TLMConfigWarehouse.setCurrentConfigBool(TLMConfigWarehouse.getConfigIndexForTransportInfo(transportTool.m_prefab) | TLMConfigWarehouse.ConfigIndex.PREFIX_INCREMENT, value);
            });
            prefixIncrementChk.relativePosition = new Vector3(5f, 162.5f);
        }