示例#1
0
        private void CreateColorSelector()
        {
            m_prefixColor = m_helper.AddColorPicker("A", Color.clear, OnChangePrefixColor, out UILabel lbl, out UIPanel container);

            KlyteMonoUtils.LimitWidthAndBox(lbl, 260, true);
            lbl.isLocalized       = true;
            lbl.localeID          = "K45_TLM_PREFIX_COLOR_LABEL";
            lbl.verticalAlignment = UIVerticalAlignment.Middle;
            lbl.font      = UIHelperExtension.defaultFontCheckbox;
            lbl.textScale = 1;

            KlyteMonoUtils.CreateUIElement(out UIButton resetColor, container.transform, "PrefixColorReset", new Vector4(290, 0, 0, 0));
            KlyteMonoUtils.InitButton(resetColor, false, "ButtonMenu");
            KlyteMonoUtils.LimitWidth(resetColor, 80, true);
            resetColor.textPadding = new RectOffset(5, 5, 5, 2);
            resetColor.autoSize    = true;
            resetColor.localeID    = "K45_TLM_RESET_COLOR";
            resetColor.eventClick += OnResetColor;
        }
        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();
        }
示例#3
0
 public static void AddColorField(UIHelperExtension helper, string text, out UIColorField m_colorEditor, PropertyChangedEventHandler <Color> onSelectedColorChanged)
 {
     m_colorEditor = helper.AddColorPicker(text, Color.white, (x) => { });
     KlyteMonoUtils.LimitWidthAndBox(m_colorEditor.parent.GetComponentInChildren <UILabel>(), helper.Self.width / 2, true);
     m_colorEditor.eventSelectedColorChanged += onSelectedColorChanged;
 }
 public static void AddColorField(UIHelperExtension helper, string text, out UIColorField m_colorEditor, OnColorChanged onSelectedColorChanged, out UILabel label)
 {
     m_colorEditor = helper.AddColorPicker(text, Color.white, onSelectedColorChanged);
     label         = m_colorEditor.parent.GetComponentInChildren <UILabel>();
     KlyteMonoUtils.LimitWidthAndBox(label, helper.Self.width / 2, true);
 }