コード例 #1
0
        public void Awake()
        {
            m_container                     = transform.gameObject.AddComponent <UIPanel>();
            m_container.width               = transform.parent.gameObject.GetComponent <UIComponent>().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"), 150);

            KlyteMonoUtils.CreateUIElement(out UIButton add, m_container.transform, "RegenName");
            add.textScale = 1f;
            add.width     = 30;
            add.height    = 30;
            add.tooltip   = Locale.Get("K45_ADR_ADD_REG_CITY");
            KlyteMonoUtils.InitButton(add, true, "ButtonMenu");
            add.isVisible   = true;
            add.text        = "+";
            add.eventClick += (component, eventParam) => AdrNeighborhoodExtension.SetAzimuth(99, 0);
        }
コード例 #2
0
 private static UIButton CreateTabTemplate()
 {
     KlyteMonoUtils.CreateUIElement(out UIButton tabTemplate, null, "AdrTabTemplate");
     KlyteMonoUtils.InitButton(tabTemplate, false, "GenericTab");
     tabTemplate.autoSize             = false;
     tabTemplate.height               = 30;
     tabTemplate.foregroundSpriteMode = UIForegroundSpriteMode.Scale;
     return(tabTemplate);
 }
コード例 #3
0
 protected static UIButton ConfigureActionButton(UIComponent parent, CommonsSpriteNames spriteName)
 {
     KlyteMonoUtils.CreateUIElement(out UIButton actionButton, parent.transform, "Btn");
     KlyteMonoUtils.InitButton(actionButton, false, "ButtonMenu");
     actionButton.focusedBgSprite      = "";
     actionButton.autoSize             = false;
     actionButton.width                = 20;
     actionButton.height               = 20;
     actionButton.foregroundSpriteMode = UIForegroundSpriteMode.Scale;
     actionButton.normalFgSprite       = KlyteResourceLoader.GetDefaultSpriteNameFor(spriteName);
     return(actionButton);
 }
コード例 #4
0
        private void CreateTitleBar()
        {
            KlyteMonoUtils.CreateUIElement(out UILabel titlebar, m_mainPanel.transform, "AdrListPanel", new Vector4(75, 10, m_mainPanel.width - 150, 20));
            titlebar.autoSize      = false;
            titlebar.text          = "Addresses v" + AddressesMod.Version;
            titlebar.textAlignment = UIHorizontalAlignment.Center;

            KlyteMonoUtils.CreateUIElement(out UIButton closeButton, m_mainPanel.transform, "CloseButton", new Vector4(m_mainPanel.width - 37, 5, 32, 32));
            KlyteMonoUtils.InitButton(closeButton, false, "buttonclose", true);
            closeButton.hoveredBgSprite = "buttonclosehover";
            closeButton.eventClick     += (x, y) => AddressesMod.Instance.Controller.CloseAdrPanel();

            KlyteMonoUtils.CreateUIElement(out UISprite logo, m_mainPanel.transform, "AddressesIcon", new Vector4(22, 5f, 32, 32));
            logo.spriteName = AddressesMod.Instance.IconName;
        }
コード例 #5
0
        private void CreateTitleBar()
        {
            KlyteMonoUtils.CreateUIElement(out UILabel titlebar, MainPanel.transform, "TLMListPanel", new Vector4(75, 10, MainPanel.width - 150, 20));
            titlebar.autoSize      = false;
            titlebar.text          = "Transport Lines Manager v" + TransportLinesManagerMod.Version;
            titlebar.textAlignment = UIHorizontalAlignment.Center;

            KlyteMonoUtils.CreateUIElement(out UIButton closeButton, MainPanel.transform, "CloseButton", new Vector4(MainPanel.width - 37, 5, 32, 32));
            KlyteMonoUtils.InitButton(closeButton, false, "buttonclose", true);
            closeButton.hoveredBgSprite = "buttonclosehover";
            closeButton.eventClick     += (x, y) =>
            {
                TLMController.instance.CloseTLMPanel();
            };

            KlyteMonoUtils.CreateUIElement(out UISprite logo, MainPanel.transform, "TLMLogo", new Vector4(22, 5f, 32, 32));
            logo.spriteName = TransportLinesManagerMod.Instance.IconName;
        }
コード例 #6
0
        private void CreateTitleBar()
        {
            KlyteMonoUtils.CreateUIElement(out UILabel titlebar, mainPanel.transform, "VMCListPanel", new Vector4(75, 10, mainPanel.width - 150, 20));
            titlebar.autoSize      = false;
            titlebar.text          = VehiclesMasterControlMod.Instance.Name;
            titlebar.textAlignment = UIHorizontalAlignment.Center;

            KlyteMonoUtils.CreateUIElement(out UIButton closeButton, mainPanel.transform, "CloseButton", new Vector4(mainPanel.width - 37, 5, 32, 32));
            KlyteMonoUtils.InitButton(closeButton, false, "buttonclose", true);
            closeButton.hoveredBgSprite = "buttonclosehover";
            closeButton.eventClick     += (x, y) =>
            {
                VehiclesMasterControlMod.Instance.ClosePanel();
            };

            KlyteMonoUtils.CreateUIElement(out UISprite logo, mainPanel.transform, "VMCLogo", new Vector4(22, 5f, 32, 32));
            logo.spriteName = VehiclesMasterControlMod.Instance.IconName;
        }
コード例 #7
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;
        }
コード例 #8
0
        protected void Start()
        {
            m_lastSortCriterionLines = LineSortCriterion.DEFAULT;

            UIComponent parent = GetComponent <UIComponent>();

            KlyteMonoUtils.CreateUIElement(out m_autoNameAll, parent.transform);
            m_autoNameAll.relativePosition = new Vector3(parent.width - 50f, -5);
            m_autoNameAll.textScale        = 0.6f;
            m_autoNameAll.width            = 40;
            m_autoNameAll.height           = 40;
            m_autoNameAll.tooltip          = Locale.Get("K45_TLM_AUTO_NAME_ALL_TOOLTIP");
            KlyteMonoUtils.InitButton(m_autoNameAll, true, "ButtonMenu");
            m_autoNameAll.name           = "AutoNameAll";
            m_autoNameAll.isVisible      = true;
            m_autoNameAll.normalFgSprite = KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_AutoNameIcon);
            m_autoNameAll.eventClick    += (component, eventParam) =>
            {
                foreach (UVMLineListItem item in mainPanel.GetComponentsInChildren <UVMLineListItem>())
                {
                    item.DoAutoName();
                }
            };

            KlyteMonoUtils.CreateUIElement(out m_autoColorAll, parent.transform);
            m_autoColorAll.relativePosition = new Vector3(parent.width - 90f, -5);
            m_autoColorAll.textScale        = 0.6f;
            m_autoColorAll.width            = 40;
            m_autoColorAll.height           = 40;
            m_autoColorAll.tooltip          = Locale.Get("K45_TLM_AUTO_COLOR_ALL_TOOLTIP");
            KlyteMonoUtils.InitButton(m_autoColorAll, true, "ButtonMenu");
            m_autoColorAll.name           = "AutoColorAll";
            m_autoColorAll.isVisible      = true;
            m_autoColorAll.normalFgSprite = KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_AutoColorIcon);
            m_autoColorAll.eventClick    += (component, eventParam) =>
            {
                foreach (UVMLineListItem item in mainPanel.GetComponentsInChildren <UVMLineListItem>())
                {
                    item.DoAutoColor();
                }
            };
        }
コード例 #9
0
        private void CreateTitleBar()
        {
            KlyteMonoUtils.CreateUIElement(out UILabel titlebar, MainPanel.transform, $"{CommonProperties.Acronym}Title", new Vector4(0, 0, MainPanel.width - 150, 20));
            titlebar.position         = default;
            titlebar.autoSize         = false;
            titlebar.text             = $"{BasicIUserMod<U, C, T>.Instance.SimpleName} v{BasicIUserMod<U, C, T>.Version}";
            titlebar.textAlignment    = UIHorizontalAlignment.Center;
            titlebar.relativePosition = new Vector3(75, 13);

            KlyteMonoUtils.CreateUIElement(out UIButton closeButton, MainPanel.transform, "CloseButton", new Vector4(MainPanel.width - 37, 5, 32, 32));
            KlyteMonoUtils.InitButton(closeButton, false, "buttonclose", true);
            closeButton.hoveredBgSprite = "buttonclosehover";
            closeButton.eventClick     += (x, y) =>
            {
                BasicIUserMod <U, C, T> .Instance.ClosePanel();
            };

            KlyteMonoUtils.CreateUIElement(out UISprite logo, MainPanel.transform, $"{CommonProperties.Acronym}Logo", new Vector4(22, 5f, 32, 32));
            logo.spriteName = BasicIUserMod <U, C, T> .Instance.IconName;
        }
コード例 #10
0
        private void CreateRemoveUndesiredModelsButton()
        {
            KlyteMonoUtils.CreateUIElement <UIButton>(out UIButton removeUndesired, m_mainPanel.transform);
            removeUndesired.relativePosition = new Vector3(m_mainPanel.width - 25f, 10f);
            removeUndesired.textScale        = 0.6f;
            removeUndesired.width            = 20;
            removeUndesired.height           = 20;
            removeUndesired.tooltip          = Locale.Get("K45_VMC_REMOVE_UNWANTED_TOOLTIP");
            KlyteMonoUtils.InitButton(removeUndesired, true, "ButtonMenu");
            removeUndesired.name        = "DeleteLineButton";
            removeUndesired.isVisible   = true;
            removeUndesired.eventClick += (component, eventParam) => VMCTransportExtensionUtils.RemoveAllUnwantedVehicles();

            UISprite icon = removeUndesired.AddUIComponent <UISprite>();

            icon.relativePosition = new Vector3(2, 2);
            icon.width            = 18;
            icon.height           = 18;
            icon.spriteName       = "K45_RemoveUnwantedIcon";
        }
コード例 #11
0
        private void Awake()
        {
            CreateMainPanel();

            CreateScrollPanel();

            SetPreviewWindow();

            BindParentChanges();

            CreateRemoveUndesiredModelsButton();

            PopulateCheckboxes();

            ServiceSystemDefinition ssd = SingletonLite <T> .instance.GetSSD();

            bool allowColorChange = ssd.AllowColorChanging();

            if (allowColorChange)
            {
                KlyteMonoUtils.CreateUIElement(out UILabel lbl, m_mainPanel.transform, "DistrictColorLabel", new Vector4(5, m_mainPanel.height - 30, 120, 40));
                KlyteMonoUtils.LimitWidth(lbl, 120);
                lbl.autoSize = true;
                lbl.localeID = "K45_VMC_COLOR_LABEL";

                m_color = KlyteMonoUtils.CreateColorField(m_mainPanel);
                m_color.eventSelectedColorChanged += onChangeColor;

                KlyteMonoUtils.CreateUIElement(out UIButton resetColor, m_mainPanel.transform, "DistrictColorReset", new Vector4(m_mainPanel.width - 110, m_mainPanel.height - 35, 0, 0));
                KlyteMonoUtils.InitButton(resetColor, false, "ButtonMenu");
                KlyteMonoUtils.LimitWidth(resetColor, 100);
                resetColor.textPadding = new RectOffset(5, 5, 5, 2);
                resetColor.autoSize    = true;
                resetColor.localeID    = "K45_VMC_RESET_COLOR";
                resetColor.eventClick += onResetColor;
            }
            else
            {
                m_mainPanel.height -= 40;
            }
        }
コード例 #12
0
        private void CreateRemoveUndesiredModelsButton()
        {
            KlyteMonoUtils.CreateUIElement <UIButton>(out UIButton removeUndesired, MainPanel.transform);
            removeUndesired.relativePosition = new Vector3(MainPanel.width - 25f, 0f);
            removeUndesired.textScale        = 0.6f;
            removeUndesired.width            = 20;
            removeUndesired.height           = 20;
            removeUndesired.tooltip          = Locale.Get("K45_TLM_REMOVE_UNWANTED_TOOLTIP");
            KlyteMonoUtils.InitButton(removeUndesired, true, "ButtonMenu");
            removeUndesired.name        = "DeleteLineButton";
            removeUndesired.isVisible   = true;
            removeUndesired.eventClick += (component, eventParam) =>
            {
                TLMVehicleUtils.RemoveAllUnwantedVehicles();
            };

            UISprite icon = removeUndesired.AddUIComponent <UISprite>();

            icon.relativePosition = new Vector3(2, 2);
            icon.width            = 18;
            icon.height           = 18;
            icon.spriteName       = KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_RemoveUnwantedIcon);
        }
コード例 #13
0
        private void PopulateTitlePanel(UIPanel container)
        {
            container.width               = transform.parent.gameObject.GetComponent <UIComponent>().width;
            container.height              = 30;
            container.autoLayout          = true;
            container.autoLayoutDirection = LayoutDirection.Horizontal;
            container.autoLayoutPadding   = new RectOffset(2, 2, 2, 2);
            container.wrapLayout          = false;
            container.name = "AzimuthEditorTitle";

            CreateTitleLabel(container, out UILabel cityId, "StartHour", Locale.Get("K45_TLM_START_HOUR"), 50);
            CreateTitleLabel(container, out UILabel generatedName, "GenName", Locale.Get("K45_TLM_BUDGET"), 270);

            KlyteMonoUtils.CreateUIElement(out UIButton add, container.transform, "RegenName");
            add.textScale = 1f;
            add.width     = 30;
            add.height    = 30;
            add.tooltip   = Locale.Get("K45_TLM_ADD_BUDGET_DIVISION");
            KlyteMonoUtils.InitButton(add, true, "ButtonMenu");
            add.isVisible   = true;
            add.text        = "+";
            add.eventClick += (component, eventParam) => AddEntry();
        }
コード例 #14
0
        private void CreateDepotLineTemplate()
        {
            var     go    = new GameObject();
            UIPanel panel = go.AddComponent <UIPanel>();

            panel.size                = new Vector2(m_scrollablePanel.width - 40f, 36);
            panel.autoLayout          = true;
            panel.wrapLayout          = false;
            panel.autoLayoutDirection = LayoutDirection.Horizontal;

            UICheckBox uiCheckbox = UIHelperExtension.AddCheckbox(panel, "AAAAAA", false);

            uiCheckbox.name   = "DepotCheckbox";
            uiCheckbox.height = 29f;
            uiCheckbox.width  = 310f;
            uiCheckbox.label.processMarkup = true;
            uiCheckbox.label.textScale     = 0.8f;

            KlyteMonoUtils.CreateUIElement(out UIButton gotoButton, panel.transform, "GoTo", new Vector4(0, 0, 30, 30));
            KlyteMonoUtils.InitButton(gotoButton, true, "LineDetailButton");

            TLMUiTemplateUtils.GetTemplateDict()["K45_TLM_DepotSelectionTabLineTemplate"] = panel;
        }
コード例 #15
0
        private void Awake()
        {
            VMCTabPanel.eventOnDistrictSelectionChanged += onDistrictChanged;


            mainPanel            = GetComponentInChildren <UIScrollablePanel>();
            mainPanel.autoLayout = false;
            m_uiHelper           = new UIHelperExtension(mainPanel);

            KlyteMonoUtils.CreateUIElement(out UILabel lbl, mainPanel.transform, "DistrictColorLabel", new Vector4(5, 5, 250, 40));

            allowColorChange = SingletonLite <T> .instance.GetSSD().AllowColorChanging();

            if (allowColorChange)
            {
                KlyteMonoUtils.LimitWidth(lbl, 250);
                lbl.autoSize = true;
                lbl.localeID = "K45_VMC_DISTRICT_COLOR_LABEL";

                m_districtColor = KlyteMonoUtils.CreateColorField(mainPanel);
                m_districtColor.eventSelectedColorChanged += onChangeDistrictColor;

                KlyteMonoUtils.CreateUIElement(out UIButton resetColor, mainPanel.transform, "DistrictColorReset", new Vector4(290, 0, 0, 0));
                KlyteMonoUtils.InitButton(resetColor, false, "ButtonMenu");
                KlyteMonoUtils.LimitWidth(resetColor, 200);
                resetColor.textPadding = new RectOffset(5, 5, 5, 2);
                resetColor.autoSize    = true;
                resetColor.localeID    = "K45_VMC_RESET_COLOR";
                resetColor.eventClick += onResetColor;
            }
            ServiceSystemDefinition ssd = SingletonLite <T> .instance.GetSSD();

            IVMCDistrictExtension extension = SingletonLite <T> .instance.GetExtensionDistrict();

            KlyteMonoUtils.CreateElement(out m_assetSelectorWindow, mainPanel.transform);
            m_assetSelectorWindow.setTabContent(this);
        }
コード例 #16
0
        public void Awake()
        {
            m_container                     = transform.gameObject.AddComponent <UIPanel>();
            m_container.width               = transform.parent.gameObject.GetComponent <UIComponent>().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.text              = "0";
            m_azimuthInput.eventTextChanged += SendText;

            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 UIPanel nameContainer, m_container.transform, "GenNameContainer");
            nameContainer.autoSize            = false;
            nameContainer.width               = 150;
            nameContainer.height              = 30;
            nameContainer.autoLayout          = true;
            nameContainer.autoLayoutDirection = LayoutDirection.Horizontal;

            KlyteMonoUtils.CreateUIElement(out m_generatedName, nameContainer.transform, "GenName");
            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.textAlignment = UIHorizontalAlignment.Center;
            m_generatedName.minimumSize   = new Vector2(150, 0);
            KlyteMonoUtils.LimitWidth(m_generatedName, 150);

            KlyteMonoUtils.CreateUIElement(out m_regenerateName, m_container.transform, "RegenName");
            m_regenerateName.textScale = 1f;
            m_regenerateName.width     = 30;
            m_regenerateName.height    = 30;
            m_regenerateName.tooltip   = Locale.Get("K45_ADR_REGENERATE_NAME");
            KlyteMonoUtils.InitButton(m_regenerateName, true, "ButtonMenu");
            m_regenerateName.isVisible   = true;
            m_regenerateName.text        = "R";
            m_regenerateName.eventClick += (component, eventParam) =>
            {
                AdrNeighborhoodExtension.SetSeed(m_id, new Randomizer(new System.Random().Next()).UInt32(0xFEFFFFFF));
                OnRegenerate?.Invoke();
            };

            KlyteMonoUtils.CreateUIElement(out m_die, m_container.transform, "Delete");
            m_die.textScale = 1f;
            m_die.width     = 30;
            m_die.height    = 30;
            m_die.tooltip   = Locale.Get("K45_ADR_DELETE_STOP_NEIGHBOR");
            KlyteMonoUtils.InitButton(m_die, true, "ButtonMenu");
            m_die.isVisible   = true;
            m_die.text        = "X";
            m_die.eventClick += (component, eventParam) =>
            {
                AdrNeighborhoodExtension.SafeCleanEntry(m_id);
                OnDie?.Invoke();
            };
        }
コード例 #17
0
        protected sealed override void OnLevelLoadedInherit(LoadMode mode)
        {
            base.OnLevelLoadedInherit(mode);
            if (LoadUI && IsValidLoadMode(mode))
            {
                m_modsPanel = UIView.Find <UIPanel>("K45_ModsPanel");
                if (m_modsPanel is null)
                {
                    UIComponent uicomponent = UIView.Find("TSBar");
                    m_bg                  = uicomponent.AddUIComponent <UIPanel>();
                    m_bg.name             = "K45_MB";
                    m_bg.absolutePosition = new Vector2(ButtonPosX.value, ButtonPosY.value);
                    m_bg.width            = 40f;
                    m_bg.height           = 40f;
                    m_bg.zOrder           = 1;
                    UIButton doneButton = m_bg.AddUIComponent <UIButton>();
                    doneButton.normalBgSprite   = "GenericPanel";
                    doneButton.width            = 100f;
                    doneButton.height           = 50f;
                    doneButton.relativePosition = new Vector2(0f, -52);
                    doneButton.text             = "Done";
                    doneButton.hoveredTextColor = new Color32(0, byte.MaxValue, byte.MaxValue, 1);
                    doneButton.Hide();
                    doneButton.zOrder = 99;
                    UIDragHandle handle = m_bg.AddUIComponent <UIDragHandle>();
                    handle.name             = "K45_DragHandle";
                    handle.relativePosition = Vector2.zero;
                    handle.width            = m_bg.width - 5f;
                    handle.height           = m_bg.height - 5f;
                    handle.zOrder           = 0;
                    handle.target           = m_bg;
                    handle.Start();
                    handle.enabled = false;
                    m_bg.zOrder    = 9;

                    m_bg.isInteractive     = false;
                    handle.zOrder          = 10;
                    doneButton.eventClick += (component, ms) =>
                    {
                        doneButton.Hide();
                        handle.zOrder    = 10000;
                        handle.enabled   = false;
                        ButtonPosX.value = (int)m_bg.absolutePosition.x;
                        ButtonPosY.value = (int)m_bg.absolutePosition.y;
                    };
                    m_bg.color       = new Color32(96, 96, 96, byte.MaxValue);
                    m_modPanelButton = m_bg.AddUIComponent <UIButton>();
                    m_modPanelButton.disabledTextColor = new Color32(128, 128, 128, byte.MaxValue);
                    KlyteMonoUtils.InitButton(m_modPanelButton, false, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_K45Button), false);
                    m_modPanelButton.relativePosition        = new Vector3(10, 4f);
                    m_modPanelButton.size                    = new Vector2(32, 32);
                    m_modPanelButton.name                    = "K45_ModsButton";
                    m_modPanelButton.zOrder                  = 11;
                    m_modPanelButton.textScale               = 1.3f;
                    m_modPanelButton.textVerticalAlignment   = UIVerticalAlignment.Middle;
                    m_modPanelButton.textHorizontalAlignment = UIHorizontalAlignment.Center;
                    m_modPanelButton.tooltip                 = "Double click to move the button!";
                    m_modPanelButton.eventDoubleClick       += (component, ms) =>
                    {
                        handle.zOrder = 13;
                        doneButton.Show();
                        handle.enabled = true;
                    };

                    m_modsPanel                  = m_bg.AddUIComponent <UIPanel>();
                    m_modsPanel.name             = "K45_ModsPanel";
                    m_modsPanel.size             = new Vector2(875, 550);
                    m_modsPanel.relativePosition = new Vector3(0f, 7f);
                    m_modsPanel.isInteractive    = false;
                    m_modsPanel.Hide();

                    m_modPanelButton.eventClicked += TogglePanel;

                    KlyteMonoUtils.CreateTabsComponent(out m_modsTabstrip, out UITabContainer container, m_modsPanel.transform, "K45", new Vector4(52, -8, m_modsPanel.width - 52, 40), new Vector4(0, 32, m_modsPanel.width, m_modsPanel.height));
                    m_modsTabstrip.isInteractive = false;
                    container.isInteractive      = false;
                }
                else
                {
                    m_modPanelButton             = UIView.Find <UIButton>("K45_ModsButton");
                    m_modsTabstrip               = UIView.Find <UITabstrip>("K45_Tabstrip");
                    m_modsTabstrip.isInteractive = false;
                    m_modsTabstrip.tabContainer.isInteractive = false;
                }

                if (m_modPanelButton.color != (UseLowSaturationButton ? Color.gray : Color.white))
                {
                    ApplyButtonColor();
                }

                AddTab();
            }
        }
コード例 #18
0
        private void createInfoView()
        {
            //line info painel

            KlyteMonoUtils.CreateUIElement(out m_buildingInfoPanel, gameObject.transform);
            m_buildingInfoPanel.Hide();
            m_buildingInfoPanel.relativePosition  = new Vector3(394.0f, 70.0f);
            m_buildingInfoPanel.width             = 650;
            m_buildingInfoPanel.height            = 290;
            m_buildingInfoPanel.zOrder            = 50;
            m_buildingInfoPanel.color             = new Color32(255, 255, 255, 255);
            m_buildingInfoPanel.backgroundSprite  = "MenuPanel2";
            m_buildingInfoPanel.name              = "BuildingInfoPanel";
            m_buildingInfoPanel.autoLayoutPadding = new RectOffset(5, 5, 10, 10);
            m_buildingInfoPanel.autoLayout        = false;
            m_buildingInfoPanel.useCenter         = true;
            m_buildingInfoPanel.wrapLayout        = false;
            m_buildingInfoPanel.canFocus          = true;
            KlyteMonoUtils.CreateDragHandle(m_buildingInfoPanel, m_buildingInfoPanel, 35f);



            KlyteMonoUtils.CreateUIElement(out buildingTypeIcon, m_buildingInfoPanel.transform);
            buildingTypeIcon.autoSize             = false;
            buildingTypeIcon.relativePosition     = new Vector3(10f, 7f);
            buildingTypeIcon.width                = 30;
            buildingTypeIcon.height               = 30;
            buildingTypeIcon.name                 = "BuildingTypeIcon";
            buildingTypeIcon.clipChildren         = true;
            buildingTypeIcon.foregroundSpriteMode = UIForegroundSpriteMode.Scale;
            KlyteMonoUtils.CreateDragHandle(buildingTypeIcon, m_buildingInfoPanel);

            KlyteMonoUtils.CreateUIElement(out buildingTypeIconFg, buildingTypeIcon.transform);
            buildingTypeIconFg.autoSize         = false;
            buildingTypeIconFg.relativePosition = new Vector3(0, 0);
            buildingTypeIconFg.width            = 30;
            buildingTypeIconFg.height           = 30;
            buildingTypeIconFg.name             = "BuildingTypeIconFg";
            buildingTypeIconFg.clipChildren     = true;
            KlyteMonoUtils.CreateDragHandle(buildingTypeIconFg, m_buildingInfoPanel);

            KlyteMonoUtils.CreateUIElement(out buildingNameField, m_buildingInfoPanel.transform);
            buildingNameField.autoSize            = false;
            buildingNameField.relativePosition    = new Vector3(160f, 10f);
            buildingNameField.horizontalAlignment = UIHorizontalAlignment.Center;
            buildingNameField.text      = "NOME";
            buildingNameField.width     = 450;
            buildingNameField.height    = 25;
            buildingNameField.name      = "BuildingNameLabel";
            buildingNameField.maxLength = 256;
            buildingNameField.textScale = 1.5f;
            KlyteMonoUtils.UiTextFieldDefaults(buildingNameField);
            buildingNameField.eventGotFocus += (component, eventParam) =>
            {
                lastDepotName = buildingNameField.text;
            };
            buildingNameField.eventTextSubmitted += (component, eventParam) =>
            {
                if (lastDepotName != buildingNameField.text)
                {
                    saveBuildingName(buildingNameField);
                }
            };

            KlyteMonoUtils.CreateUIElement(out vehiclesInUseLabel, m_buildingInfoPanel.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;
            vehiclesInUseLabel.prefix           = Locale.Get("K45_VMC_VEHICLE_CAPACITY_LABEL") + ": ";

            KlyteMonoUtils.CreateUIElement(out upkeepCost, m_buildingInfoPanel.transform);
            upkeepCost.autoSize         = false;
            upkeepCost.relativePosition = new Vector3(10f, 75);
            upkeepCost.textAlignment    = UIHorizontalAlignment.Left;
            upkeepCost.width            = 250;
            upkeepCost.height           = 25;
            upkeepCost.name             = "UpkeepLabel";
            upkeepCost.textScale        = 0.8f;

            KlyteMonoUtils.CreateUIElement(out UIButton voltarButton2, m_buildingInfoPanel.transform);
            voltarButton2.relativePosition = new Vector3(m_buildingInfoPanel.width - 33f, 5f);
            voltarButton2.width            = 28;
            voltarButton2.height           = 28;
            KlyteMonoUtils.InitButton(voltarButton2, true, "DeleteLineButton");
            voltarButton2.name        = "LineInfoCloseButton";
            voltarButton2.eventClick += closeBuildingInfo;

            workerChart = new TLMWorkerChartPanel(panelTransform, new Vector3(400f, 90f));
            m_uiHelper  = new UIHelperExtension(m_buildingInfoPanel);
        }