public void Start()
 {
     CreateTemplateColorItem();
     m_colorFieldTemplateListColors = new UITemplateList <UIPanel>(m_colorListScroll, COLOR_SELECTOR_TEMPLATE);
     if (canEdit)
     {
         KlyteMonoUtils.InitCircledButton(m_colorListScroll, out m_addColor, CommonsSpriteNames.K45_Plus, (x, y) => AddColor(), "", 36);
         DefaultEditorUILib.AddButtonInEditorRow(m_paletteSelect, CommonsSpriteNames.K45_Plus, () => AddPalette(), "K45_TLM_ADDPALETTE", true, (int)m_paletteSelect.height);
     }
 }
Beispiel #2
0
        public void Awake()
        {
            m_container                     = GetComponent <UIPanel>();
            m_container.width               = m_container.parent.width;
            m_container.height              = 30;
            m_container.autoLayout          = true;
            m_container.autoLayoutDirection = LayoutDirection.Horizontal;
            m_container.autoLayoutPadding   = new RectOffset(2, 2, 2, 2);
            m_container.wrapLayout          = false;
            m_container.name                = "AzimuthEditorTitle";



            CreateTitleLabel(out UILabel m_cityId, "CityId", "#", 30);
            CreateTitleLabel(out UILabel m_azimuthInput, "StartAzimuth", Locale.Get("K45_ADR_AZIMUTH_GRADOS_TITLE"), 50);
            CreateTitleLabel(out UILabel m_direction, "Direction", Locale.Get("K45_ADR_DIRECTION_TITLE"), 60);
            CreateTitleLabel(out UILabel m_generatedName, "GenName", Locale.Get("K45_ADR_GEN_NAME_TITLE"), m_container.width - 247.5f);

            DefaultEditorUILib.AddButtonInEditorRow(m_generatedName, CommonsSpriteNames.K45_Plus, () => AdrNeighborhoodExtension.SetAzimuth(99, 0), "K45_ADR_ADD_REG_CITY", false, 30);
        }
        public void Awake()
        {
            m_container                     = GetComponent <UIPanel>();
            m_container.width               = m_container.parent.width;
            m_container.height              = 30;
            m_container.autoLayout          = true;
            m_container.autoLayoutDirection = LayoutDirection.Horizontal;
            m_container.autoLayoutPadding   = new RectOffset(2, 2, 2, 2);
            m_container.wrapLayout          = false;
            m_container.name                = "AzimuthInputLine";

            KlyteMonoUtils.CreateUIElement(out m_cityId, m_container.transform, "CityId");
            m_cityId.autoSize         = false;
            m_cityId.relativePosition = new Vector3(0, 0);
            m_cityId.backgroundSprite = "EmptySprite";
            m_cityId.width            = 30;
            m_cityId.height           = 30;
            m_cityId.textScale        = 1.3f;
            m_cityId.padding          = new RectOffset(3, 3, 4, 3);
            m_cityId.useOutline       = true;
            m_cityId.textAlignment    = UIHorizontalAlignment.Center;

            KlyteMonoUtils.CreateUIElement(out m_azimuthInput, m_container.transform, "StartAzimuth");
            KlyteMonoUtils.UiTextFieldDefaults(m_azimuthInput);
            m_azimuthInput.normalBgSprite    = "OptionsDropboxListbox";
            m_azimuthInput.width             = 50;
            m_azimuthInput.height            = 28;
            m_azimuthInput.textScale         = 1.6f;
            m_azimuthInput.maxLength         = 3;
            m_azimuthInput.numericalOnly     = true;
            m_azimuthInput.allowNegative     = true;
            m_azimuthInput.text              = "0";
            m_azimuthInput.eventTextChanged += SendText;
            m_azimuthInput.eventMouseWheel  += DefaultEditorUILib.RollInteger;

            KlyteMonoUtils.CreateUIElement(out m_direction, m_container.transform, "Direction");
            m_direction.autoSize      = false;
            m_direction.width         = 60;
            m_direction.height        = 30;
            m_direction.textScale     = 1.125f;
            m_direction.textAlignment = UIHorizontalAlignment.Center;
            m_direction.padding       = new RectOffset(3, 3, 5, 3);

            KlyteMonoUtils.CreateUIElement(out m_generatedName, m_container.transform, "GenName");
            KlyteMonoUtils.UiTextFieldDefaults(m_generatedName);
            m_generatedName.autoSize            = true;
            m_generatedName.height              = 30;
            m_generatedName.textScale           = 1.125f;
            m_generatedName.padding             = new RectOffset(3, 3, 5, 3);
            m_generatedName.text                = "???";
            m_generatedName.horizontalAlignment = UIHorizontalAlignment.Center;
            m_generatedName.width               = m_container.width - 235;
            m_generatedName.eventTextSubmitted += SetFixedName;
            m_generatedName.submitOnFocusLost   = true;


            m_die = DefaultEditorUILib.AddButtonInEditorRow(m_generatedName, CommonsSpriteNames.K45_X, () =>
            {
                AdrNeighborhoodExtension.SafeCleanEntry(m_id);
                OnDie?.Invoke();
            }, "K45_ADR_DELETE_STOP_NEIGHBOR", false, 30);

            DefaultEditorUILib.AddButtonInEditorRow(m_generatedName, CommonsSpriteNames.K45_Reload, () =>
            {
                AdrNeighborhoodExtension.SetSeed(m_id, new Randomizer(new System.Random().Next()).UInt32(0xFEFFFFFF));
                OnRegenerate?.Invoke();
            }, "K45_ADR_REGENERATE_NAME", false, 30);
        }