Пример #1
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;
        }
Пример #2
0
        private void CreateColorSelector()
        {
            TLMUtils.createUIElement(out UIPanel panelColorSelector, m_subpanel.self.transform, "ColorSelector", new Vector4(500, 60, 0, 0));
            panelColorSelector.autoLayout                  = true;
            panelColorSelector.autoLayoutDirection         = LayoutDirection.Horizontal;
            panelColorSelector.autoLayoutPadding           = new RectOffset(3, 3, 0, 0);
            panelColorSelector.autoFitChildrenHorizontally = true;
            panelColorSelector.autoFitChildrenVertically   = true;

            TLMUtils.createUIElement(out UILabel lbl, panelColorSelector.transform, "PrefixColorLabel", new Vector4(5, 12, 250, 40));
            TLMUtils.LimitWidth(lbl, 250, true);
            lbl.localeID          = "TLM_PREFIX_COLOR_LABEL";
            lbl.verticalAlignment = UIVerticalAlignment.Middle;
            lbl.font = UIHelperExtension.defaultFontCheckbox;

            m_prefixColor = KlyteUtils.CreateColorField(panelColorSelector);
            m_prefixColor.eventSelectedColorChanged += onChangePrefixColor;

            TLMUtils.createUIElement(out UIButton resetColor, panelColorSelector.transform, "PrefixColorReset", new Vector4(290, 0, 0, 0));
            TLMUtils.initButton(resetColor, false, "ButtonMenu");
            TLMUtils.LimitWidth(resetColor, 200);
            resetColor.textPadding = new RectOffset(5, 5, 5, 2);
            resetColor.autoSize    = true;
            resetColor.localeID    = "TLM_RESET_COLOR";
            resetColor.eventClick += onResetColor;
        }
Пример #3
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();
        }
Пример #4
0
        private void ConfigComponentPanel(UIComponent reference)
        {
            reference.GetComponentInParent <UIPanel>().autoLayoutDirection = LayoutDirection.Horizontal;
            reference.GetComponentInParent <UIPanel>().wrapLayout          = false;
            reference.GetComponentInParent <UIPanel>().height = 40;
            TLMUtils.createElement(out UIPanel labelContainer, reference.parent.transform);
            labelContainer.size   = new Vector2(210, reference.height);
            labelContainer.zOrder = 0;
            UILabel lbl = reference.parent.GetComponentInChildren <UILabel>();

            lbl.transform.SetParent(labelContainer.transform);
            lbl.textAlignment    = UIHorizontalAlignment.Left;
            lbl.relativePosition = new Vector3(0, lbl.relativePosition.y);
            TLMUtils.LimitWidth(lbl, 200);
            lbl.height            = reference.height;
            lbl.verticalAlignment = UIVerticalAlignment.Middle;
            lbl.pivot             = UIPivotPoint.TopCenter;
        }
        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();
        }
        internal void LoadSettingsUI(UIHelperExtension helper)
        {
            try
            {
                foreach (Transform child in helper.self.transform)
                {
                    GameObject.Destroy(child.gameObject);
                }
            }
            catch
            {
            }

            if (TLMSingleton.instance != null && TLMSingleton.debugMode)
            {
                TLMUtils.doLog("Loading Options");
            }
            loadTLMLocale(false);
            string[] namingOptionsSufixo = new string[] {
                Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 0)),
                Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 1)),
                Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 2)),
                Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 3)),
                Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 4)),
                Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 5)),
                Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 6)),
                Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 14))
            };
            string[] namingOptionsPrefixo = new string[] {
                Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 0)),
                Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 1)),
                Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 2)),
                Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 3)),
                Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 4)),
                Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 5)),
                Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 6)),
                Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 7)),
                Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 8)),
                Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 9)),
                Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 10)),
                Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 11)),
                Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 12)),
                Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 13)),
                Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 14))
            };
            string[] namingOptionsSeparador = new string[] {
                Locale.Get("TLM_SEPARATOR", Enum.GetName(typeof(Separador), 0)),
                Locale.Get("TLM_SEPARATOR", Enum.GetName(typeof(Separador), 1)),
                Locale.Get("TLM_SEPARATOR", Enum.GetName(typeof(Separador), 2)),
                Locale.Get("TLM_SEPARATOR", Enum.GetName(typeof(Separador), 3)),
                Locale.Get("TLM_SEPARATOR", Enum.GetName(typeof(Separador), 4)),
                Locale.Get("TLM_SEPARATOR", Enum.GetName(typeof(Separador), 5)),
            };

            helper.self.eventVisibilityChanged += delegate(UIComponent component, bool b)
            {
                if (b)
                {
                    showVersionInfoPopup();
                }
            };

            overrideWorldInfoPanelLineOption = (UICheckBox)helper.AddCheckboxLocale("TLM_OVERRIDE_DEFAULT_LINE_INFO", m_savedOverrideDefaultLineInfoPanel.value, toggleOverrideDefaultLineInfoPanel);

            helper.AddSpace(10);

            configSelector = (UIDropDown)helper.AddDropdownLocalized("TLM_SHOW_CONFIG_FOR", optionsForLoadConfig, 0, reloadData);
            if (TLMSingleton.instance != null && TLMSingleton.debugMode)
            {
                TLMUtils.doLog("Loading Group 1");
            }
            foreach (TLMConfigWarehouse.ConfigIndex transportType in new TLMConfigWarehouse.ConfigIndex[] {
                TLMConfigWarehouse.ConfigIndex.PLANE_CONFIG,
                TLMConfigWarehouse.ConfigIndex.BLIMP_CONFIG,
                TLMConfigWarehouse.ConfigIndex.SHIP_CONFIG,
                TLMConfigWarehouse.ConfigIndex.FERRY_CONFIG,
                TLMConfigWarehouse.ConfigIndex.BUS_CONFIG,
                TLMConfigWarehouse.ConfigIndex.TRAM_CONFIG,
                TLMConfigWarehouse.ConfigIndex.MONORAIL_CONFIG,
                TLMConfigWarehouse.ConfigIndex.METRO_CONFIG,
                TLMConfigWarehouse.ConfigIndex.TRAIN_CONFIG,
                TLMConfigWarehouse.ConfigIndex.TOUR_PED_CONFIG,
                TLMConfigWarehouse.ConfigIndex.TOUR_BUS_CONFIG
            })
            {
                UIHelperExtension group1 = helper.AddGroupExtended(string.Format(Locale.Get("TLM_CONFIGS_FOR"), TLMConfigWarehouse.getNameForTransportType(transportType)));
                lineTypesPanels[transportType]             = group1.self.GetComponentInParent <UIPanel>();
                ((UIPanel)group1.self).autoLayoutDirection = LayoutDirection.Horizontal;
                ((UIPanel)group1.self).backgroundSprite    = "EmptySprite";
                ((UIPanel)group1.self).wrapLayout          = true;
                var systemColor = TLMConfigWarehouse.getColorForTransportType(transportType);
                ((UIPanel)group1.self).color = new Color32((byte)(systemColor.r * 0.7f), (byte)(systemColor.g * 0.7f), (byte)(systemColor.b * 0.7f), 0xff);
                ((UIPanel)group1.self).width = 730;
                group1.AddSpace(30);
                UIDropDown prefixDD                 = generateDropdownConfig(group1, Locale.Get("TLM_PREFIX"), namingOptionsPrefixo, transportType | TLMConfigWarehouse.ConfigIndex.PREFIX);
                var        separatorContainer       = generateDropdownConfig(group1, Locale.Get("TLM_SEPARATOR"), namingOptionsSeparador, transportType | TLMConfigWarehouse.ConfigIndex.SEPARATOR).transform.parent.GetComponent <UIPanel>();
                UIDropDown suffixDD                 = generateDropdownConfig(group1, Locale.Get("TLM_SUFFIX"), namingOptionsSufixo, transportType | TLMConfigWarehouse.ConfigIndex.SUFFIX);
                var        suffixDDContainer        = suffixDD.transform.parent.GetComponent <UIPanel>();
                UIDropDown nonPrefixDD              = generateDropdownConfig(group1, Locale.Get("TLM_IDENTIFIER_NON_PREFIXED"), namingOptionsSufixo, transportType | TLMConfigWarehouse.ConfigIndex.NON_PREFIX);
                var        prefixedPaletteContainer = generateDropdownStringValueConfig(group1, Locale.Get("TLM_PALETTE_PREFIXED"), TLMAutoColorPalettes.paletteList, transportType | TLMConfigWarehouse.ConfigIndex.PALETTE_MAIN).transform.parent.GetComponent <UIPanel>();
                var        paletteLabel             = generateDropdownStringValueConfig(group1, Locale.Get("TLM_PALETTE_UNPREFIXED"), TLMAutoColorPalettes.paletteList, transportType | TLMConfigWarehouse.ConfigIndex.PALETTE_SUBLINE).transform.parent.GetComponentInChildren <UILabel>();
                var        zerosContainer           = generateCheckboxConfig(group1, Locale.Get("TLM_LEADING_ZEROS_SUFFIX"), transportType | TLMConfigWarehouse.ConfigIndex.LEADING_ZEROS);
                var        prefixAsSuffixContainer  = generateCheckboxConfig(group1, Locale.Get("TLM_INVERT_PREFIX_SUFFIX_ORDER"), transportType | TLMConfigWarehouse.ConfigIndex.INVERT_PREFIX_SUFFIX);
                generateCheckboxConfig(group1, Locale.Get("TLM_RANDOM_ON_PALETTE_OVERFLOW"), transportType | TLMConfigWarehouse.ConfigIndex.PALETTE_RANDOM_ON_OVERFLOW);
                var autoColorBasedContainer = generateCheckboxConfig(group1, Locale.Get("TLM_AUTO_COLOR_BASED_ON_PREFIX"), transportType | TLMConfigWarehouse.ConfigIndex.PALETTE_PREFIX_BASED);
                var prefixIncrement         = generateCheckboxConfig(group1, Locale.Get("TLM_LINENUMBERING_BASED_IN_PREFIX"), transportType | TLMConfigWarehouse.ConfigIndex.PREFIX_INCREMENT);
                PropertyChangedEventHandler <int> updateFunction = delegate(UIComponent c, int sel)
                {
                    bool isPrefixed = (ModoNomenclatura)sel != ModoNomenclatura.Nenhum;
                    separatorContainer.isVisible       = isPrefixed;
                    prefixedPaletteContainer.isVisible = isPrefixed;
                    prefixIncrement.isVisible          = isPrefixed;
                    suffixDDContainer.isVisible        = isPrefixed;
                    zerosContainer.isVisible           = isPrefixed && (ModoNomenclatura)suffixDD.selectedIndex == ModoNomenclatura.Numero;
                    prefixAsSuffixContainer.isVisible  = isPrefixed && (ModoNomenclatura)suffixDD.selectedIndex == ModoNomenclatura.Numero && (ModoNomenclatura)prefixDD.selectedIndex != ModoNomenclatura.Numero;
                    autoColorBasedContainer.isVisible  = isPrefixed;
                    paletteLabel.text = isPrefixed ? Locale.Get("TLM_PALETTE_UNPREFIXED") : Locale.Get("TLM_PALETTE");
                };
                prefixDD.eventSelectedIndexChanged += updateFunction;
                suffixDD.eventSelectedIndexChanged += delegate(UIComponent c, int sel)
                {
                    bool isPrefixed = (ModoNomenclatura)prefixDD.selectedIndex != ModoNomenclatura.Nenhum;
                    zerosContainer.isVisible          = isPrefixed && (ModoNomenclatura)sel == ModoNomenclatura.Numero;
                    prefixAsSuffixContainer.isVisible = isPrefixed && (ModoNomenclatura)sel == ModoNomenclatura.Numero && (ModoNomenclatura)prefixDD.selectedIndex != ModoNomenclatura.Numero;
                };
                updateFunction.Invoke(null, prefixDD.selectedIndex);
            }
            UIHelperExtension group72 = helper.AddGroupExtended(Locale.Get("TLM_DEFAULT_PRICE"));

            ((UIPanel)group72.self).autoLayoutDirection = LayoutDirection.Horizontal;
            ((UIPanel)group72.self).wrapLayout          = true;
            ((UIPanel)group72.self).width = 730;
            foreach (TLMConfigWarehouse.ConfigIndex ci in TLMConfigWarehouse.configurableTicketTransportCategories)
            {
                var textField      = generateNumberFieldConfig(group72, TLMConfigWarehouse.getNameForTransportType(ci), TLMConfigWarehouse.ConfigIndex.DEFAULT_TICKET_PRICE | ci);
                var textFieldPanel = textField.GetComponentInParent <UIPanel>();
                textFieldPanel.autoLayoutDirection       = LayoutDirection.Horizontal;
                textFieldPanel.autoFitChildrenVertically = true;
                textFieldPanel.GetComponentInChildren <UILabel>().minimumSize = new Vector2(420, 0);
                group72.AddSpace(2);
            }

            if (TLMSingleton.instance != null && TLMSingleton.debugMode)
            {
                TLMUtils.doLog("Loading Group 2");
            }
            UIHelperExtension group7 = helper.AddGroupExtended(Locale.Get("TLM_NEAR_LINES_CONFIG"));

            group7.AddCheckbox(Locale.Get("TLM_NEAR_LINES_SHOW_IN_SERVICES_BUILDINGS"), m_savedShowNearLinesInCityServicesWorldInfoPanel.value, toggleShowNearLinesInCityServicesWorldInfoPanel);
            group7.AddCheckbox(Locale.Get("TLM_NEAR_LINES_SHOW_IN_ZONED_BUILDINGS"), m_savedShowNearLinesInZonedBuildingWorldInfoPanel.value, toggleShowNearLinesInZonedBuildingWorldInfoPanel);
            group7.AddSpace(20);
            generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_BUS"), TLMConfigWarehouse.ConfigIndex.BUS_SHOW_IN_LINEAR_MAP);
            generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_METRO"), TLMConfigWarehouse.ConfigIndex.METRO_SHOW_IN_LINEAR_MAP);
            generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_TRAIN"), TLMConfigWarehouse.ConfigIndex.TRAIN_SHOW_IN_LINEAR_MAP);
            generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_SHIP"), TLMConfigWarehouse.ConfigIndex.SHIP_SHOW_IN_LINEAR_MAP);
            generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_PLANE"), TLMConfigWarehouse.ConfigIndex.PLANE_SHOW_IN_LINEAR_MAP);
            if (Singleton <LoadingManager> .instance.SupportsExpansion(ICities.Expansion.AfterDark))
            {
                generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_TAXI"), TLMConfigWarehouse.ConfigIndex.TAXI_SHOW_IN_LINEAR_MAP);
            }
            if (Singleton <LoadingManager> .instance.SupportsExpansion(ICities.Expansion.Snowfall))
            {
                generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_TRAM"), TLMConfigWarehouse.ConfigIndex.TRAM_SHOW_IN_LINEAR_MAP);
            }
            if (Singleton <LoadingManager> .instance.SupportsExpansion(ICities.Expansion.NaturalDisasters))
            {
                generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_EVAC_BUS"), TLMConfigWarehouse.ConfigIndex.EVAC_BUS_SHOW_IN_LINEAR_MAP);
            }
            if (Singleton <LoadingManager> .instance.SupportsExpansion(ICities.Expansion.InMotion))
            {
                generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_FERRY"), TLMConfigWarehouse.ConfigIndex.FERRY_SHOW_IN_LINEAR_MAP);
                generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_BLIMP"), TLMConfigWarehouse.ConfigIndex.BLIMP_SHOW_IN_LINEAR_MAP);
                generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_MONORAIL"), TLMConfigWarehouse.ConfigIndex.MONORAIL_SHOW_IN_LINEAR_MAP);
                generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_CABLE_CAR"), TLMConfigWarehouse.ConfigIndex.CABLE_CAR_SHOW_IN_LINEAR_MAP);
            }
            if (Singleton <LoadingManager> .instance.SupportsExpansion(ICities.Expansion.Parks))
            {
                generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_TOUR_BUS"), TLMConfigWarehouse.ConfigIndex.TOUR_BUS_CONFIG_SHOW_IN_LINEAR_MAP);
                generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_TOUR_PED"), TLMConfigWarehouse.ConfigIndex.TOUR_PED_CONFIG_SHOW_IN_LINEAR_MAP);
            }

            UIHelperExtension group8 = helper.AddGroupExtended(Locale.Get("TLM_AUTOMATION_CONFIG"));

            generateCheckboxConfig(group8, Locale.Get("TLM_AUTO_COLOR_ENABLED"), TLMConfigWarehouse.ConfigIndex.AUTO_COLOR_ENABLED);
            generateCheckboxConfig(group8, Locale.Get("TLM_AUTO_NAME_ENABLED"), TLMConfigWarehouse.ConfigIndex.AUTO_NAME_ENABLED);
            generateCheckboxConfig(group8, Locale.Get("TLM_USE_CIRCULAR_AUTO_NAME"), TLMConfigWarehouse.ConfigIndex.CIRCULAR_IN_SINGLE_DISTRICT_LINE);
            generateCheckboxConfig(group8, Locale.Get("TLM_ADD_LINE_NUMBER_AUTO_NAME"), TLMConfigWarehouse.ConfigIndex.ADD_LINE_NUMBER_IN_AUTONAME);

            UIHelperExtension group13 = helper.AddGroupExtended(Locale.Get("TLM_AUTO_NAME_SETTINGS_PUBLIC_TRANSPORT"));

            ((UIPanel)group13.self).autoLayoutDirection = LayoutDirection.Horizontal;
            ((UIPanel)group13.self).wrapLayout          = true;
            ((UIPanel)group13.self).width = 730;

            group13.AddSpace(1);
            group13.AddLabel(Locale.Get("TLM_AUTO_NAME_SETTINGS_PUBLIC_TRANSPORT_DESC"));
            group13.AddSpace(1);
            foreach (TLMConfigWarehouse.ConfigIndex ci in TLMConfigWarehouse.configurableAutoNameTransportCategories)
            {
                generateCheckboxConfig(group13, TLMConfigWarehouse.getNameForTransportType(ci), TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_USE_FOR_AUTO_NAMING_REF | ci).width = 300;
                var textFieldPanel = generateTextFieldConfig(group13, Locale.Get("TLM_PREFIX_OPTIONAL"), TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_AUTO_NAMING_REF_TEXT | ci).GetComponentInParent <UIPanel>();
                textFieldPanel.autoLayoutDirection       = LayoutDirection.Horizontal;
                textFieldPanel.autoFitChildrenVertically = true;
                group13.AddSpace(1);
            }

            UIHelperExtension group14 = helper.AddGroupExtended(Locale.Get("TLM_AUTO_NAME_SETTINGS_OTHER"));

            ((UIPanel)group14.self).autoLayoutDirection = LayoutDirection.Horizontal;
            ((UIPanel)group14.self).wrapLayout          = true;
            ((UIPanel)group14.self).width = 730;
            foreach (TLMConfigWarehouse.ConfigIndex ci in TLMConfigWarehouse.configurableAutoNameCategories)
            {
                generateCheckboxConfig(group14, TLMConfigWarehouse.getNameForServiceType(ci), TLMConfigWarehouse.ConfigIndex.USE_FOR_AUTO_NAMING_REF | ci).width = 300;
                var textFieldPanel = generateTextFieldConfig(group14, Locale.Get("TLM_PREFIX_OPTIONAL"), TLMConfigWarehouse.ConfigIndex.AUTO_NAMING_REF_TEXT | ci).GetComponentInParent <UIPanel>();
                textFieldPanel.autoLayoutDirection       = LayoutDirection.Horizontal;
                textFieldPanel.autoFitChildrenVertically = true;
                group14.AddSpace(2);
            }

            UIHelperExtension group15 = helper.AddGroupExtended(Locale.Get("TLM_AUTO_NAME_SETTINGS_PUBLIC_AREAS"));

            ((UIPanel)group15.self).autoLayoutDirection = LayoutDirection.Horizontal;
            ((UIPanel)group15.self).wrapLayout          = true;
            ((UIPanel)group15.self).width = 730;
            foreach (TLMConfigWarehouse.ConfigIndex ci in TLMConfigWarehouse.extraAutoNameCategories)
            {
                generateCheckboxConfig(group15, TLMConfigWarehouse.getNameForServiceType(ci), TLMConfigWarehouse.ConfigIndex.USE_FOR_AUTO_NAMING_REF | ci).width = 300;
                var textFieldPanel = generateTextFieldConfig(group15, Locale.Get("TLM_PREFIX_OPTIONAL"), TLMConfigWarehouse.ConfigIndex.AUTO_NAMING_REF_TEXT | ci).GetComponentInParent <UIPanel>();
                textFieldPanel.autoLayoutDirection       = LayoutDirection.Horizontal;
                textFieldPanel.autoFitChildrenVertically = true;
                group15.AddSpace(2);
            }

            TLMUtils.doLog("Loading Group 3");

            var fiPalette = TLMUtils.EnsureFolderCreation(TLMSingleton.palettesFolder);

            UIHelperExtension group6 = helper.AddGroupExtended(Locale.Get("TLM_CUSTOM_PALETTE_CONFIG"));

            ((group6.self) as UIPanel).autoLayoutDirection = LayoutDirection.Horizontal;
            ((group6.self) as UIPanel).wrapLayout          = true;
            group6.AddLabel(Locale.Get("TLM_PALETTE_FOLDER_LABEL") + ":");
            var namesFilesButton = ((UIButton)group6.AddButton("/", () => { ColossalFramework.Utils.OpenInFileBrowser(fiPalette.FullName); }));

            namesFilesButton.textColor = Color.yellow;
            TLMUtils.LimitWidth(namesFilesButton, 710);
            namesFilesButton.text = fiPalette.FullName + Path.DirectorySeparatorChar;
            ((UIButton)group6.AddButton(Locale.Get("TLM_RELOAD_PALETTES"), delegate()
            {
                TLMAutoColorPalettes.Reload();
                updateDropDowns();
            })).width = 710;

            NumberedColorList colorList = null;

            editorSelector = group6.AddDropdown(Locale.Get("TLM_PALETTE_VIEW"), TLMAutoColorPalettes.paletteListForEditing, 0, delegate(int sel)
            {
                if (sel <= 0 || sel >= TLMAutoColorPalettes.paletteListForEditing.Length)
                {
                    colorList.Disable();
                }
                else
                {
                    colorList.colorList = TLMAutoColorPalettes.getColors(TLMAutoColorPalettes.paletteListForEditing[sel]);
                    colorList.Enable();
                }
            }) as UIDropDown;
            editorSelector.GetComponentInParent <UIPanel>().width = 710;
            editorSelector.width = 710;

            colorList = group6.AddNumberedColorList(null, new List <Color32>(), (c) => { }, null, null);
            colorList.m_atlasToUse = TLMController.taLineNumber;
            colorList.m_spriteName = "SubwayIcon";

            if (TLMSingleton.instance != null && TLMSingleton.debugMode)
            {
                TLMUtils.doLog("Loading Group 4");
            }
            UIHelperExtension group9 = helper.AddGroupExtended(Locale.Get("TLM_BETAS_EXTRA_INFO"));

            group9.AddDropdownLocalized("TLM_MOD_LANG", TLMLocaleUtils.getLanguageIndex(), currentLanguageId.value, delegate(int idx)
            {
                currentLanguageId.value = idx;
                loadTLMLocale(true);
            });
            group9.AddButton(Locale.Get("TLM_DRAW_CITY_MAP"), TLMMapDrawer.drawCityMap);
            group9.AddCheckbox(Locale.Get("TLM_DEBUG_MODE"), m_debugMode.value, delegate(bool val) { m_debugMode.value = val; });
            group9.AddLabel("Version: " + version + " rev" + typeof(TLMSingleton).Assembly.GetName().Version.Revision);
            group9.AddLabel(Locale.Get("TLM_ORIGINAL_KC_VERSION") + " " + string.Join(".", TLMResourceLoader.instance.loadResourceString("TLMVersion.txt").Split(".".ToCharArray()).Take(3).ToArray()));
            group9.AddButton(Locale.Get("TLM_RELEASE_NOTES"), delegate()
            {
                showVersionInfoPopup(true);
            });

            if (TLMSingleton.instance != null && TLMSingleton.debugMode)
            {
                TLMUtils.doLog("End Loading Options");
            }
        }
Пример #7
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;
            };
        }
Пример #8
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);
            GameObject.Destroy(base.Find <UIPanel>("WarningIncomplete"));

            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();
                Singleton <BuildingManager> .instance.StartCoroutine(TLMUtils.setBuildingName(this.m_buildingID, this.m_depotNameField.text, () =>
                {
                    this.m_depotName.text = this.m_depotNameField.text;
                    Invalidate();
                }));
            };

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

            m_districtName                  = base.Find <UILabel>("LineStops");
            m_districtName.minimumSize      = new Vector2(140, 18);
            m_districtName.relativePosition = new Vector3(0, 10);
            m_districtName.pivot            = UIPivotPoint.TopLeft;
            m_districtName.wordWrap         = false;
            m_districtName.autoSize         = true;
            TLMUtils.LimitWidth(m_districtName, (uint)m_districtName.minimumSize.x);

            if (Singleton <T> .instance.GetTSD().isShelterAiDepot())
            {
                GameObject.Destroy(base.Find <UILabel>("LineVehicles").gameObject);
            }
            else
            {
                CreatePrefixSelectorUI();
            }

            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;
                    ToolsModifierControl.cameraController.SetTarget(instanceID, position, true);
                    if (!Singleton <T> .instance.GetTSD().isShelterAiDepot())
                    {
                        TLMController.instance.depotInfoPanel.openDepotInfo(m_buildingID, secondary);
                        TLMController.instance.CloseTLMPanel();
                    }
                }
            };
            base.component.eventVisibilityChanged += delegate(UIComponent c, bool v)
            {
                if (v)
                {
                    if (m_prefixOptions != null)
                    {
                        m_prefixOptions.items = new string[] { }
                    }
                    ;
                    RefreshData();
                }
            };
        }