private void ReloadDistricts()
 {
     m_cachedDistricts              = DistrictUtils.GetValidDistricts();
     m_selectDistrict.items         = m_cachedDistricts.Keys.OrderBy(x => x).ToArray();
     m_selectDistrict.selectedValue = m_lastSelectedItem;
     SegmentUtils.UpdateSegmentNamesView();
 }
Beispiel #2
0
        private void ReloadDistricts()
        {
            m_cachedDistricts              = DistrictUtils.GetValidDistricts();
            m_selectDistrict.items         = m_cachedDistricts.Keys.OrderBy(x => x).ToArray();
            m_selectDistrict.selectedValue = m_lastSelectedItem;
            if (m_selectDistrict.selectedIndex < 0)
            {
                m_selectDistrict.selectedIndex = 0;
            }

            eventOnDistrictSelectionChanged?.Invoke();
        }
        public void Awake()
        {
            MainContainer = GetComponent <UIComponent>();

            m_uiHelperDistrict = new UIHelperExtension(MainContainer);

            ((UIScrollablePanel)m_uiHelperDistrict.Self).autoLayoutDirection = LayoutDirection.Horizontal;
            ((UIScrollablePanel)m_uiHelperDistrict.Self).wrapLayout          = true;
            ((UIScrollablePanel)m_uiHelperDistrict.Self).width = DefaultWidth;

            m_cachedDistricts      = DistrictUtils.GetValidDistricts();
            m_selectDistrict       = m_uiHelperDistrict.AddDropdownLocalized("K45_ADR_DISTRICT_TITLE", m_cachedDistricts.Keys.OrderBy(x => x).ToArray(), 0, OnDistrictSelect);
            m_selectDistrict.width = DefaultWidth;
            m_uiHelperDistrict.AddSpace(30);

            m_roadNameFile       = m_uiHelperDistrict.AddDropdownLocalized("K45_ADR_DISTRICT_NAME_FILE", new string[0], -1, OnChangeSelectedRoadName);
            m_roadNameFile.width = DefaultWidth;
            m_uiHelperDistrict.AddSpace(1);
            KlyteMonoUtils.LimitWidth((UIButton)m_uiHelperDistrict.AddButton(Locale.Get("K45_ADR_ROAD_NAME_FILES_RELOAD"), ReloadOptionsRoad), 380);
            m_uiHelperDistrict.AddSpace(20);

            m_prefixesFile       = m_uiHelperDistrict.AddDropdownLocalized("K45_ADR_STREETS_PREFIXES_NAME_FILE", new string[0], -1, OnChangeSelectedRoadPrefix);
            m_prefixesFile.width = DefaultWidth;
            m_uiHelperDistrict.AddSpace(1);
            KlyteMonoUtils.LimitWidth((UIButton)m_uiHelperDistrict.AddButton(Locale.Get("K45_ADR_STREETS_PREFIXES_FILES_RELOAD"), ReloadOptionsRoadPrefix), 380);
            m_uiHelperDistrict.AddSpace(40);

            m_prefixPostalCodeDistrict = m_uiHelperDistrict.AddTextField(Locale.Get("K45_ADR_DISTRICT_POSTAL_CODE"), null, "", OnChangePostalCodePrefixDistrict);
            m_prefixPostalCodeDistrict.numericalOnly = true;
            m_prefixPostalCodeDistrict.maxLength     = 3;

            m_colorDistrict        = m_uiHelperDistrict.AddColorPicker(Locale.Get("K45_ADR_DISTRICT_COLOR"), Color.white, OnChangeDistrictColor, out UILabel title);
            m_colorDistrict.width  = 20;
            m_colorDistrict.height = 20;
            KlyteMonoUtils.LimitWidth(title, 350);

            DistrictManagerOverrides.EventOnDistrictChanged += ReloadDistricts;
            ReloadDistricts();
        }
        public void Awake()
        {
            isLoading = true;

            MainContainer                     = GetComponent <UIPanel>();
            MainContainer.autoLayout          = true;
            MainContainer.autoLayoutDirection = LayoutDirection.Vertical;
            MainContainer.autoLayoutPadding   = new RectOffset(0, 0, 2, 2);

            m_uiHelperDistrict = new UIHelperExtension(MainContainer);


            m_cachedDistricts = DistrictUtils.GetValidDistricts();


            AddDropdown(Locale.Get("K45_ADR_DISTRICT_TITLE"), out m_selectDistrict, m_uiHelperDistrict, m_cachedDistricts.Keys.OrderBy(x => x).ToArray(), OnDistrictSelect);
            m_uiHelperDistrict.AddSpace(30);


            AddDropdown(Locale.Get("K45_ADR_DISTRICT_NAME_FILE"), out m_roadNameFile, m_uiHelperDistrict, new string[0], OnChangeSelectedRoadName);
            AddButtonInEditorRow(m_roadNameFile, Commons.UI.SpriteNames.CommonsSpriteNames.K45_Reload, ReloadOptionsRoad, "K45_ADR_ROAD_NAME_FILES_RELOAD");


            AddDropdown(Locale.Get("K45_ADR_STREETS_PREFIXES_NAME_FILE"), out m_prefixesFile, m_uiHelperDistrict, new string[0], OnChangeSelectedRoadPrefix);
            AddButtonInEditorRow(m_prefixesFile, Commons.UI.SpriteNames.CommonsSpriteNames.K45_Reload, ReloadOptionsRoadPrefix, "K45_ADR_STREETS_PREFIXES_FILES_RELOAD");


            AddIntField(Locale.Get("K45_ADR_DISTRICT_POSTAL_CODE"), out m_prefixPostalCodeDistrict, m_uiHelperDistrict, OnChangePostalCodePrefixDistrict, false);
            AddButtonInEditorRow(m_prefixPostalCodeDistrict, Commons.UI.SpriteNames.CommonsSpriteNames.K45_Delete, ResetPostalCode, "K45_ADR_RESET_POSTAL_CODE", false, 30);
            m_prefixPostalCodeDistrict.maxLength = 3;

            AddColorField(m_uiHelperDistrict, Locale.Get("K45_ADR_DISTRICT_COLOR"), out m_colorDistrict, (y) => OnChangeDistrictColor(y));
            m_colorDistrict.width  = 30;
            m_colorDistrict.height = 30;

            ReloadDistricts();
        }
Beispiel #5
0
 private void UpdateDistrictList(ref BuildingCityDataRuleXml reference)
 {
     var districts = DistrictUtils.GetValidParks().ToDictionary(x => x.Key, x => 0x100 | x.Value).Union(DistrictUtils.GetValidDistricts()).OrderBy(x => x.Value == 0 ? "" : x.Key).ToDictionary(x => x.Key, x => x.Value);
     ref DistrictPark[] parkBuffer = ref Singleton <DistrictManager> .instance.m_parks.m_buffer;
Beispiel #6
0
        protected override void AwakeActions()
        {
            controlContainer           = GetComponent <UIPanel>();
            controlContainer.area      = new Vector4(0, 0, 0, 0);
            controlContainer.isVisible = false;
            controlContainer.name      = "VMCPanel";

            KlyteMonoUtils.CreateUIElement(out mainPanel, controlContainer.transform, "VMCListPanel", new Vector4(0, 0, 875, 550));
            mainPanel.backgroundSprite = "MenuPanel2";

            CreateTitleBar();


            //KlyteMonoUtils.CreateUIElement(out m_StripMain, mainPanel.transform, "VMCTabstrip", new Vector4(5, 40, mainPanel.width - 10, 40));

            //KlyteMonoUtils.CreateUIElement(out UITabContainer tabContainer, mainPanel.transform, "VMCTabContainer", new Vector4(0, 80, mainPanel.width, mainPanel.height - 80));
            //m_StripMain.tabPages = tabContainer;

            //UIButton tabPerBuilding = CreateTabTemplate();
            //tabPerBuilding.normalFgSprite = "ToolbarIconMonuments";
            //tabPerBuilding.tooltip = Locale.Get("K45_VMC_CONFIG_PER_BUILDING_TAB");

            //KlyteMonoUtils.CreateUIElement(out UIPanel contentContainerPerBuilding, null);
            //contentContainerPerBuilding.name = "Container";
            //contentContainerPerBuilding.area = new Vector4(0, 40, mainPanel.width, mainPanel.height - 80);

            //m_StripMain.AddTab("VMCPerBuilding", tabPerBuilding.gameObject, contentContainerPerBuilding.gameObject);
            //CreateTitleRowBuilding(ref m_titleLineBuildings, contentContainerPerBuilding);
            //CreateSsdTabstrip(ref m_StripBuilings, ref m_StripBuilingsStrips, m_titleLineBuildings, contentContainerPerBuilding, true);

            //UIButton tabPerDistrict = CreateTabTemplate();
            //tabPerDistrict.normalFgSprite = "ToolbarIconDistrict";
            //tabPerDistrict.tooltip = Locale.Get("K45_VMC_CONFIG_PER_DISTRICT_TAB");

            KlyteMonoUtils.CreateUIElement(out UIPanel contentContainerPerDistrict, mainPanel.transform);
            contentContainerPerDistrict.name = "Container2";
            contentContainerPerDistrict.area = new Vector4(0, 50, mainPanel.width, mainPanel.height - 50);

            //m_StripMain.AddTab("VMCPerDistrict", tabPerDistrict.gameObject, contentContainerPerDistrict.gameObject);
            CreateSsdTabstrip(ref m_StripDistricts, ref m_StripDistrictsStrips, null, contentContainerPerDistrict);

            m_cachedDistricts = DistrictUtils.GetValidDistricts();

            m_selectDistrict = UIHelperExtension.CloneBasicDropDownLocalized("K45_VMC_DISTRICT_TITLE", m_cachedDistricts.Keys.OrderBy(x => x).ToArray(), OnDistrictSelect, 0, contentContainerPerDistrict);
            UIPanel container = m_selectDistrict.GetComponentInParent <UIPanel>();

            container.autoLayoutDirection         = LayoutDirection.Horizontal;
            container.autoFitChildrenHorizontally = true;
            container.autoFitChildrenVertically   = true;
            container.pivot            = UIPivotPoint.TopRight;
            container.anchor           = UIAnchorStyle.Top | UIAnchorStyle.Right;
            container.relativePosition = new Vector3(contentContainerPerDistrict.width - container.width - 10, 0);
            UILabel label = container.GetComponentInChildren <UILabel>();

            label.padding.top   = 10;
            label.padding.right = 10;

            VehiclesMasterControlMod.Controller.eventOnDistrictChanged += ReloadDistricts;

            //   m_StripMain.selectedIndex = -1;
            //   m_StripBuilings.selectedIndex = -1;
            m_StripDistricts.selectedIndex = -1;

            foreach (UITabstrip strip in m_StripDistrictsStrips.Values)
            {
                strip.selectedIndex = -1;
            }
            //foreach (UITabstrip strip in m_StripBuilingsStrips.Values)
            //{
            //    strip.selectedIndex = -1;
            //}

            mainPanel.eventVisibilityChanged += (x, y) =>
            {
                if (y)
                {
                    VehiclesMasterControlMod.Instance.ShowVersionInfoPopup();
                }
            };
        }