Пример #1
0
        private void CreateTextField()
        {
            _textFieldPanel = _saveMixPanel.AddUIComponent <PanelBase>();
            _textFieldPanel.Setup("Name Text Field", 340.0f, 30.0f);
            var nameLabel = _textFieldPanel.AddUIComponent <UILabel>();

            nameLabel.pivot                            = UIPivotPoint.MiddleRight;
            nameLabel.font                             = UIUtils.Font;
            nameLabel.padding                          = new RectOffset(0, 0, 8, 4);
            nameLabel.text                             = Translation.Instance.GetTranslation(TranslationID.LABEL_NAME);
            nameLabel.relativePosition                 = new Vector3(110.0f - nameLabel.width, 0.0f);
            _saveMixTextField                          = _textFieldPanel.AddUIComponent <UITextField>();
            _saveMixTextField.atlas                    = UISprites.DefaultAtlas;
            _saveMixTextField.size                     = new Vector2(220.0f, 30.0f);
            _saveMixTextField.padding                  = new RectOffset(4, 4, 6, 6);
            _saveMixTextField.builtinKeyNavigation     = true;
            _saveMixTextField.isInteractive            = true;
            _saveMixTextField.readOnly                 = false;
            _saveMixTextField.selectOnFocus            = true;
            _saveMixTextField.horizontalAlignment      = UIHorizontalAlignment.Center;
            _saveMixTextField.selectionSprite          = "EmptySprite";
            _saveMixTextField.selectionBackgroundColor = new Color32(0, 172, 234, 255);
            _saveMixTextField.normalBgSprite           = "TextFieldPanelHovered";
            _saveMixTextField.textColor                = Color.black;
            _saveMixTextField.textScale                = 1.0f;
            _saveMixTextField.color                    = new Color32(255, 255, 255, 255);
            _saveMixTextField.relativePosition         = new Vector3(120.0f, 0.0f);
            _saveMixTextField.eventTextSubmitted      += OnTextfieldTextSubmitted;
            _saveMixTextField.eventKeyPress           += OnTextfieldKeyPress;
            _saveMixTextField.eventLostFocus          += OnTextfieldLostFocus;
            _saveMixTextField.eventTextChanged        += OnTextFieldTextChanged;
        }
Пример #2
0
        private void CreateDropDown()
        {
            var panel = _selectMixPanel.AddUIComponent <UIPanel>();

            panel.size         = new Vector2(340.0f, 30.0f);
            _selectMixDropDown = panel.AddUIComponent <UIDropDown>();
            _selectMixDropDown.relativePosition           = Vector3.zero;
            _selectMixDropDown.atlas                      = UISprites.DefaultAtlas;
            _selectMixDropDown.size                       = new Vector2(340f, 30f);
            _selectMixDropDown.listBackground             = "StylesDropboxListbox";
            _selectMixDropDown.itemHeight                 = 30;
            _selectMixDropDown.itemHover                  = "ListItemHover";
            _selectMixDropDown.itemHighlight              = "ListItemHighlight";
            _selectMixDropDown.normalBgSprite             = "CMStylesDropbox";
            _selectMixDropDown.hoveredBgSprite            = "CMStylesDropboxHovered";
            _selectMixDropDown.listWidth                  = 340;
            _selectMixDropDown.listHeight                 = 500;
            _selectMixDropDown.listPosition               = UIDropDown.PopupListPosition.Below;
            _selectMixDropDown.foregroundSpriteMode       = UIForegroundSpriteMode.Stretch;
            _selectMixDropDown.popupColor                 = Color.white;
            _selectMixDropDown.popupTextColor             = new Color32(170, 170, 170, 255);
            _selectMixDropDown.textScale                  = 0.8f;
            _selectMixDropDown.verticalAlignment          = UIVerticalAlignment.Middle;
            _selectMixDropDown.horizontalAlignment        = UIHorizontalAlignment.Left;
            _selectMixDropDown.textFieldPadding           = new RectOffset(12, 0, 10, 0);
            _selectMixDropDown.itemPadding                = new RectOffset(12, 0, 10, 0);
            _selectMixDropDown.triggerButton              = _selectMixDropDown;
            _selectMixDropDown.eventDropdownOpen         += OnDropDownOpen;
            _selectMixDropDown.eventDropdownClose        += OnDropDownClose;
            _selectMixDropDown.eventSelectedIndexChanged += OnSelectedIndexChanged;
        }
Пример #3
0
        private void CreatePanels()
        {
            _panelLeft.AddUIComponent <RainProbabilityDayPanel>();
            _panelLeft.CreateSpace(1.0f, 5.0f);
            _panelLeft.AddUIComponent <RainProbabilityNightPanel>();
            _panelLeft.CreateSpace(1.0f, 5.0f);
            _panelLeft.AddUIComponent <FogProbabilityDayPanel>();
            _panelLeft.CreateSpace(1.0f, 5.0f);
            _panelLeft.AddUIComponent <FogProbabilityNightPanel>();
            _panelLeft.CreateSpace(1.0f, 5.0f);
            _panelLeft.AddUIComponent <NorthernLightsProbabilityPanel>();
            _panelLeft.CreateSpace(1.0f, 5.0f);

            _panelCenter.AddUIComponent <MinTemperatureDayPanel>();
            _panelCenter.CreateSpace(1.0f, 5.0f);
            _panelCenter.AddUIComponent <MaxTemperatureDayPanel>();
            _panelCenter.CreateSpace(1.0f, 5.0f);
            _panelCenter.AddUIComponent <MinTemperatureNightPanel>();
            _panelCenter.CreateSpace(1.0f, 5.0f);
            _panelCenter.AddUIComponent <MaxTemperatureNightPanel>();
            _panelCenter.CreateSpace(1.0f, 5.0f);

            _panelRight.AddUIComponent <MinTemperatureRainPanel>();
            _panelRight.CreateSpace(1.0f, 5.0f);
            _panelRight.AddUIComponent <MaxTemperatureRainPanel>();
            _panelRight.CreateSpace(1.0f, 5.0f);
            _panelRight.AddUIComponent <MinTemperatureFogPanel>();
            _panelRight.CreateSpace(1.0f, 5.0f);
            _panelRight.AddUIComponent <MaxTemperatureFogPanel>();
            _panelRight.CreateSpace(1.0f, 5.0f);
        }
Пример #4
0
 private void CreateResetButton()
 {
     resetButton = buttonsPanel.AddUIComponent <ButtonPanel>();
     resetButton.Build(PanelType.None, new Layout(new Vector2(0.0f, 40.0f), true, LayoutDirection.Horizontal, LayoutStart.TopLeft, 0));
     resetButton.SetAnchor(UIAnchorStyle.Left | UIAnchorStyle.CenterVertical);
     resetButton.SetText(Translation.Instance.GetTranslation(TranslationID.BUTTON_RESET));
     resetButton.EventButtonClicked += OnResetClicked;
 }
Пример #5
0
 private void CreateRightSideTexturePanels()
 {
     _panelRight.AddUIComponent <PavementDiffusePanel>();
     _panelRight.CreateSpace(1.0f, 5.0f);
     _panelRight.AddUIComponent <OilDiffusePanel>();
     _panelRight.CreateSpace(1.0f, 5.0f);
     _panelRight.AddUIComponent <OreDiffusePanel>();
     _panelRight.CreateSpace(1.0f, 5.0f);
 }
Пример #6
0
 private void CreateLeftSideTexturePanels()
 {
     _panelLeft.AddUIComponent <GrassDiffusePanel>();
     _panelLeft.CreateSpace(1.0f, 5.0f);
     _panelLeft.AddUIComponent <RuinedDiffusePanel>();
     _panelLeft.CreateSpace(1.0f, 5.0f);
     _panelLeft.AddUIComponent <GravelDiffusePanel>();
     _panelLeft.CreateSpace(1.0f, 5.0f);
 }
Пример #7
0
 private void CreateMiddleTexturePanels()
 {
     _panelCenter.AddUIComponent <CliffDiffusePanel>();
     _panelCenter.CreateSpace(1.0f, 5.0f);
     _panelCenter.AddUIComponent <SandDiffusePanel>();
     _panelCenter.CreateSpace(1.0f, 5.0f);
     _panelCenter.AddUIComponent <CliffSandNormalPanel>();
     _panelCenter.CreateSpace(1.0f, 5.0f);
 }
Пример #8
0
 private void CreateContainers()
 {
     _container = AddUIComponent <PanelBase>();
     _container.Setup("Structures Container", 0.0f, 460.0f, 5, true);
     _container.autoFitChildrenVertically = true;
     _panelLeft = _container.AddUIComponent <PanelBase>();
     _panelLeft.Setup("Structures Panel Left", 350.0f, 0.0f, 0, true, LayoutDirection.Vertical);
     _panelRight = _container.AddUIComponent <PanelBase>();
     _panelRight.Setup("Structures Panel Right", 350.0f, 0.0f, 0, true, LayoutDirection.Vertical);
 }
Пример #9
0
 private void CreateLeftSideTexturePanels()
 {
     _panelLeft.AddUIComponent <UpwardRoadDiffusePanel>();
     _panelLeft.CreateSpace(1.0f, 5.0f);
     _panelLeft.AddUIComponent <DownwardRoadDiffusePanel>();
     _panelLeft.CreateSpace(1.0f, 5.0f);
     _panelLeft.AddUIComponent <BuildingBaseDiffusePanel>();
     _panelLeft.CreateSpace(1.0f, 5.0f);
     _panelLeft.AddUIComponent <BuildingBaseNormalPanel>();
 }
Пример #10
0
 private void CreateRightSideTexturePanels()
 {
     _panelRight.AddUIComponent <BuildingFloorDiffusePanel>();
     _panelRight.CreateSpace(1.0f, 5.0f);
     _panelRight.AddUIComponent <BuildingBurntDiffusePanel>();
     _panelRight.CreateSpace(1.0f, 5.0f);
     _panelRight.AddUIComponent <BuildingAbandonedDiffusePanel>();
     _panelRight.CreateSpace(1.0f, 5.0f);
     _panelRight.AddUIComponent <LightColorPalettePanel>();
 }
Пример #11
0
 private void CreateContainers()
 {
     _container = AddUIComponent <PanelBase>();
     _container.Setup("Atmosphere Container", 0.0f, 460.0f, 5, true);
     _container.autoFitChildrenVertically = true;
     _panelLeft = _container.AddUIComponent <PanelBase>();
     _panelLeft.Setup("Atmosphere Panel Left", 350.0f, 0.0f, 0, true, LayoutDirection.Vertical);
     _panelCenter = _container.AddUIComponent <PanelBase>();
     _panelCenter.Setup("Atmosphere Panel Center", 350.0f, 0.0f, 0, true, LayoutDirection.Vertical);
     _panelRight = _container.AddUIComponent <PanelBase>();
     _panelRight.Setup("Atmosphere Panel Right", 350.0f, 0.0f, 0, true, LayoutDirection.Vertical);
     _panelRight.autoLayoutPadding = new RectOffset(0, 0, 0, 8);
 }
Пример #12
0
 private void CreateColorsPanel()
 {
     _colorsPanel = AddUIComponent <PanelBase>();
     _colorsPanel.Setup("Colors Panel", 360.0f, 0.0f, 0, true, LayoutDirection.Vertical);
     _waterCleanColorPanel = _colorsPanel.AddUIComponent <WaterCleanPanel>();
     _waterCleanColorPanel.EventVisibilityChanged += OnColorPanelVisibilityChanged;
     _space1 = _colorsPanel.CreateSpace(1.0f, 5.0f);
     _waterUnderColorPanel = _colorsPanel.AddUIComponent <WaterUnderPanel>();
     _waterUnderColorPanel.EventVisibilityChanged += OnColorPanelVisibilityChanged;
     _space2 = _colorsPanel.CreateSpace(1.0f, 5.0f);
     _waterDirtyColorPanel = _colorsPanel.AddUIComponent <WaterDirtyPanel>();
     _waterDirtyColorPanel.EventVisibilityChanged += OnColorPanelVisibilityChanged;
     _colorsPanel.CreateSpace(1.0f, 5.0f);
 }
Пример #13
0
        private void AddSwatch(Color32 color)
        {
            SwatchButton button = swatchesPanel.AddUIComponent <SwatchButton>();

            button.Build(color);
            button.EventSwatchClicked += OnSwatchClicked;
        }
Пример #14
0
        public static UIPanel CreateSpace(this PanelBase parent, float width, float height)
        {
            var panel = parent.AddUIComponent <UIPanel>();

            panel.size = new Vector2(width, height);
            return(panel);
        }
Пример #15
0
        private UILabel CreateLabel(string text)
        {
            UILabel label = rgbPanel.AddUIComponent <UILabel>();

            label.font              = UIUtil.Font;
            label.textColor         = UIUtil.TextColor;
            label.text              = text;
            label.autoSize          = false;
            label.autoHeight        = false;
            label.size              = new Vector2(15.0f, 25.0f);
            label.verticalAlignment = UIVerticalAlignment.Middle;
            label.textAlignment     = UIHorizontalAlignment.Right;
            label.padding           = new RectOffset(0, 0, 5, 0);
            label.atlas             = Resources.DefaultAtlas;
            return(label);
        }
Пример #16
0
        private void SetupRgbPanel()
        {
            _rgbPanel.Setup("RGB Panel", 0.0f, 25.0f, 5, true);
            _rgbPanel.padding            = new RectOffset(55, 0, 0, 5);
            _colorPanel                  = _rgbPanel.AddUIComponent <UIPanel>();
            _colorPanel.backgroundSprite = "WhiteRect";
            _colorPanel.size             = new Vector2(28.0f, 25.0f);
            _colorPanel.color            = Controller.GetCurrentColor(ColorID);
            _colorPanel.atlas            = UISprites.DefaultAtlas;

            Color32 color32 = _colorPanel.color;

            CreateLabel(Translation.Instance.GetTranslation(TranslationID.LABEL_RED));
            _redTextField = CreateTextfield(color32.r.ToString());
            CreateLabel(Translation.Instance.GetTranslation(TranslationID.LABEL_GREEN));
            _greenTextField = CreateTextfield(color32.g.ToString());
            CreateLabel(Translation.Instance.GetTranslation(TranslationID.LABEL_BLUE));
            _blueTextField = CreateTextfield(color32.b.ToString());
        }
Пример #17
0
        private void AddSavedSwatch(SavedSwatch savedSwatch)
        {
            SavedSwatchPanel savedSwatchPanel = savedSwatchesPanel.AddUIComponent <SavedSwatchPanel>();

            savedSwatchPanel.Build(PanelType.None, new Layout(new Vector2(256.0f, 24.0f), true, LayoutDirection.Horizontal, LayoutStart.TopLeft, 0), savedSwatch);
            savedSwatchPanel.autoLayoutPadding   = new RectOffset(5, 0, 5, 0);
            savedSwatchPanel.EventSwatchClicked += OnSavedSwatchClicked;
            savedSwatchPanel.EventRemoveSwatch  += OnSavedSwatchRemoved;
            savedSwatchPanel.EventSwatchRenamed += OnSavedSwatchRenamed;
        }
Пример #18
0
        private void CreateDetailPanel()
        {
            DetailPanel = _panelRight.AddUIComponent <PanelBase>();
            DetailPanel.Setup("Terrain Detail Panel", 350.0f, 231.0f, 5, bgSprite: "WhiteRect");
            DetailPanelInner = DetailPanel.AddUIComponent <PanelBase>();
            DetailPanelInner.Setup("Terrain Detail Panel Inside", 1.0f, 1.0f, 5, true, LayoutDirection.Vertical);
            DetailPanelInner.anchor = UIAnchorStyle.CenterHorizontal | UIAnchorStyle.CenterVertical;

            UILabel label = DetailPanelInner.AddUIComponent <UILabel>();

            label.font             = UIUtils.Font;
            label.textScale        = 1.0f;
            label.padding          = new RectOffset(4, 0, 4, 0);
            label.relativePosition = Vector2.zero;
            label.text             = Translation.Instance.GetTranslation(TranslationID.LABEL_TITLE_DETAIL);

            GrassDetail = DetailPanelInner.AddUIComponent <CheckboxPanel>();
            bool   grassState       = Controller.GetValue <bool>(ValueID.GrassDetailEnabled);
            string grassLabelText   = Translation.Instance.GetTranslation(TranslationID.LABEL_VALUE_GRASSDETAIL);
            string grassTooltipText = Translation.Instance.GetTranslation(TranslationID.TOOLTIP_VALUE_GRASSDETAIL);

            GrassDetail.Initialize(grassState, grassLabelText, grassTooltipText);
            GrassDetail.EventCheckboxStateChanged += OnDetailStateChanged;

            FertileDetail = DetailPanelInner.AddUIComponent <CheckboxPanel>();
            bool   fertileState       = Controller.GetValue <bool>(ValueID.FertileDetailEnabled);
            string fertileLabelText   = Translation.Instance.GetTranslation(TranslationID.LABEL_VALUE_FERTILEDETAIL);
            string fertileTooltipText = Translation.Instance.GetTranslation(TranslationID.TOOLTIP_VALUE_FERTILEDETAIL);

            FertileDetail.Initialize(fertileState, fertileLabelText, fertileTooltipText);
            FertileDetail.EventCheckboxStateChanged += OnDetailStateChanged;

            CliffDetail = DetailPanelInner.AddUIComponent <CheckboxPanel>();
            bool   cliffState       = Controller.GetValue <bool>(ValueID.RocksDetailEnabled);
            string cliffLabelText   = Translation.Instance.GetTranslation(TranslationID.LABEL_VALUE_CLIFFDETAIL);
            string cliffTooltipText = Translation.Instance.GetTranslation(TranslationID.TOOLTIP_VALUE_CLIFFDETAIL);

            CliffDetail.Initialize(cliffState, cliffLabelText, cliffTooltipText);
            CliffDetail.EventCheckboxStateChanged += OnDetailStateChanged;

            DetailPanelInner.autoFitChildrenHorizontally = true;
        }
Пример #19
0
        private void CreateLabels()
        {
            _labelsPanel = AddUIComponent <PanelBase>();
            _labelsPanel.Setup("Labels Panel", 255.0f, 64.0f, 0, true, LayoutDirection.Vertical);
            _labelsPanel.autoFitChildrenHorizontally = true;

            _nameLabel           = _labelsPanel.AddUIComponent <UILabel>();
            _nameLabel.autoSize  = false;
            _nameLabel.size      = new Vector2(width, 33.0f);
            _nameLabel.padding   = new RectOffset(5, 0, 8, 0);
            _nameLabel.textScale = 1.0f;
            _nameLabel.font      = UIUtils.BoldFont;

            _authorLabel           = _labelsPanel.AddUIComponent <UILabel>();
            _authorLabel.autoSize  = false;
            _authorLabel.size      = new Vector2(width, 33.0f);
            _authorLabel.padding   = new RectOffset(5, 0, 2, 0);
            _authorLabel.textScale = 0.8f;
            _authorLabel.font      = UIUtils.BoldFont;
        }
Пример #20
0
        private void AddSavedSwatch(SavedSwatch savedSwatch)
        {
            var savedSwatchPanel = _savedSwatchesPanel.AddUIComponent <SavedSwatchPanel>();

            savedSwatchPanel.Setup("Saved Swatch", 256.0f, 24.0f, 0, true, LayoutDirection.Horizontal, LayoutStart.TopLeft, ColorID, savedSwatch);
            savedSwatchPanel.SavedSwatch         = savedSwatch;
            savedSwatchPanel.autoLayoutPadding   = new RectOffset(0, 5, 5, 5);
            savedSwatchPanel.EventSwatchClicked += OnSavedSwatchClicked;
            savedSwatchPanel.EventRemoveSwatch  += OnSavedSwatchRemoved;
            savedSwatchPanel.EventSwatchRenamed += OnSavedSwatchRenamed;
        }
Пример #21
0
        private void CreatePanels()
        {
            _panelLeft.AddUIComponent <LongitudePanel>();
            _panelLeft.CreateSpace(1.0f, 5.0f);
            _panelLeft.AddUIComponent <LatitudePanel>();
            _panelLeft.CreateSpace(1.0f, 5.0f);
            _panelLeft.AddUIComponent <SunSizePanel>();
            _panelLeft.CreateSpace(1.0f, 5.0f);
            _panelLeft.AddUIComponent <SunAnisotropyPanel>();
            _panelLeft.CreateSpace(1.0f, 5.0f);
            _panelLeft.AddUIComponent <ExposurePanel>();
            _panelLeft.CreateSpace(1.0f, 5.0f);

            _panelCenter.AddUIComponent <RayleighPanel>();
            _panelCenter.CreateSpace(1.0f, 5.0f);
            _panelCenter.AddUIComponent <MiePanel>();
            _panelCenter.CreateSpace(1.0f, 5.0f);
            _panelCenter.AddUIComponent <StarsIntensityPanel>();
            _panelCenter.CreateSpace(1.0f, 5.0f);
            _panelCenter.AddUIComponent <OuterSpaceIntensityPanel>();
            _panelCenter.CreateSpace(1.0f, 5.0f);
            _panelCenter.AddUIComponent <MoonSizePanel>();
            _panelCenter.CreateSpace(1.0f, 5.0f);


            _skyTint = _panelRight.AddUIComponent <SkyTintPanel>();
            _skyTint.EventVisibilityChanged += OnColorPanelVisibilityChanged;
            _earlyNightZenithColor           = _panelRight.AddUIComponent <EarlyNightZenithPanel>();
            _earlyNightZenithColor.EventVisibilityChanged += OnColorPanelVisibilityChanged;
            _lateNightZenithColor = _panelRight.AddUIComponent <LateNightZenithPanel>();
            _lateNightZenithColor.EventVisibilityChanged += OnColorPanelVisibilityChanged;
            _nightHorizonColor = _panelRight.AddUIComponent <NightHorizonPanel>();
            _nightHorizonColor.EventVisibilityChanged += OnColorPanelVisibilityChanged;
            _moonInnerCorona = _panelRight.AddUIComponent <MoonInnerCoronaPanel>();
            _moonInnerCorona.EventVisibilityChanged += OnColorPanelVisibilityChanged;
            _moonOuterCorona = _panelRight.AddUIComponent <MoonOuterCoronaPanel>();
            _moonOuterCorona.EventVisibilityChanged += OnColorPanelVisibilityChanged;
            _moonTexture = _panelRight.AddUIComponent <MoonTexturePanel>();
        }
Пример #22
0
        private void CreateLabels()
        {
            labelDefault                   = labelPanel.AddUIComponent <UILabel>();
            labelDefault.autoSize          = false;
            labelDefault.autoHeight        = true;
            labelDefault.width             = 190.0f;
            labelDefault.textAlignment     = UIHorizontalAlignment.Left;
            labelDefault.verticalAlignment = UIVerticalAlignment.Middle;
            labelDefault.text              = Translation.Instance.GetTranslation(TranslationID.LABEL_DISTANCE);
            labelDefault.textColor         = UIUtil.TextColor;
            labelDefault.font              = UIUtil.Font;
            labelDefault.atlas             = Resources.DefaultAtlas;

            labelValue                   = labelPanel.AddUIComponent <UILabel>();
            labelValue.autoSize          = false;
            labelValue.autoHeight        = true;
            labelValue.width             = 190.0f;
            labelValue.textAlignment     = UIHorizontalAlignment.Right;
            labelValue.verticalAlignment = UIVerticalAlignment.Middle;
            labelValue.textColor         = UIUtil.TextColor;
            labelValue.font              = UIUtil.Font;
            labelValue.atlas             = Resources.DefaultAtlas;
        }
Пример #23
0
        private void CreateUIElements()
        {
            _topPanel = AddUIComponent <UIPanel>();
            string colorButtonTooltip = Translation.Instance.GetTranslation(TranslationID.TOOLTIP_OPENCOLORPICKER);

            _colorButton = UIUtils.CreateButton(_topPanel, new Vector2(22.0f, 22.0f), tooltip: colorButtonTooltip, backgroundSprite: "WhiteRect", atlas: UISprites.DefaultAtlas);
            _colorLabel  = _topPanel.AddUIComponent <UILabel>();
            string loadTooltip = Translation.Instance.GetTranslation(TranslationID.TOOLTIP_LOADFROMTHEME);

            _loadButton = UIUtils.CreateButton(_topPanel, new Vector2(22.0f, 22.0f), tooltip: loadTooltip, backgroundSprite: "ThemesIcon", atlas: UISprites.Atlas);
            string resetTooltip = Translation.Instance.GetTranslation(TranslationID.TOOLTIP_RESET);

            _resetButton   = UIUtils.CreateButton(_topPanel, new Vector2(22.0f, 22.0f), tooltip: resetTooltip, backgroundSprite: "", foregroundSprite: "UndoIcon", atlas: UISprites.Atlas);
            _savedSwatches = Data.GetSavedSwatches(ColorID);
            if (Mod.InGame)
            {
                var field = UITemplateManager.Get <UIPanel>("LineTemplate").Find <UIColorField>("LineColor");
                field        = Instantiate(field);
                _colorPicker = Instantiate(field.colorPicker);
                AttachUIComponent(_colorPicker.gameObject);
                var hsb = _colorPicker.component.Find <UITextureSprite>("HSBField");
                var hue = _colorPicker.component.Find <UISlider>("HueSlider");
                hsb.relativePosition = new Vector3(55.0f, 7.0f);
                hue.relativePosition = new Vector3(267.0f, 7.0f);
            }
            _rgbPanel     = AddUIComponent <PanelBase>();
            _buttonsPanel = AddUIComponent <PanelBase>();
            _closeButton  = _buttonsPanel.AddUIComponent <ButtonPanel>();
            _saveButton   = _buttonsPanel.AddUIComponent <ButtonPanel>();

            RefreshSavedSwatchesPanel();
            this.CreateSpace(1.0f, 0.1f);

            color = UIColor;
            autoFitChildrenHorizontally = true;
        }
Пример #24
0
        private void CreateRGBPanel()
        {
            rgbPanel = AddUIComponent <PanelBase>();
            rgbPanel.Build(PanelType.None, new Layout(new Vector2(0.0f, 35.0f), true, LayoutDirection.Horizontal, LayoutStart.TopLeft, 5));
            rgbPanel.padding = new RectOffset(10, 0, 5, 0);

            colorPanel = rgbPanel.AddUIComponent <UIPanel>();
            colorPanel.backgroundSprite = "WhiteRect";
            colorPanel.size             = new Vector2(28.0f, 25.0f);
            colorPanel.color            = NetworkSkinPanelController.Color.SelectedColor;
            colorPanel.atlas            = Resources.DefaultAtlas;

            Color32 color32 = colorPanel.color;

            CreateLabel(Translation.Instance.GetTranslation(TranslationID.LABEL_RED));
            redTextField = CreateTextfield(color32.r.ToString());
            CreateLabel(Translation.Instance.GetTranslation(TranslationID.LABEL_GREEN));
            greenTextField = CreateTextfield(color32.g.ToString());
            CreateLabel(Translation.Instance.GetTranslation(TranslationID.LABEL_BLUE));
            blueTextField = CreateTextfield(color32.b.ToString());
        }
Пример #25
0
        private void CreateDropDown()
        {
            var panel = _loadLutPanel.AddUIComponent <UIPanel>();

            panel.size       = new Vector2(340.0f, 30.0f);
            _loadLutDropDown = panel.AddUIComponent <UIDropDown>();
            _loadLutDropDown.relativePosition = Vector3.zero;
            _loadLutDropDown.atlas            = UISprites.DefaultAtlas;
            _loadLutDropDown.size             = new Vector2(340f, 30f);
            _loadLutDropDown.listBackground   = "StylesDropboxListbox";
            _loadLutDropDown.itemHeight       = 30;
            _loadLutDropDown.itemHover        = "ListItemHover";
            _loadLutDropDown.itemHighlight    = "ListItemHighlight";
            _loadLutDropDown.normalBgSprite   = "CMStylesDropbox";
            _loadLutDropDown.hoveredBgSprite  = "CMStylesDropboxHovered";
            _loadLutDropDown.listWidth        = 340;
            _loadLutDropDown.listHeight       = 500;
            Vector2 screenRes = UIView.GetAView().GetScreenResolution();

            _loadLutDropDown.listPosition               = _loadLutDropDown.absolutePosition.y > screenRes.y / 2.0f ? UIDropDown.PopupListPosition.Above : UIDropDown.PopupListPosition.Below;
            _loadLutDropDown.foregroundSpriteMode       = UIForegroundSpriteMode.Stretch;
            _loadLutDropDown.popupColor                 = Color.white;
            _loadLutDropDown.popupTextColor             = new Color32(170, 170, 170, 255);
            _loadLutDropDown.textScale                  = 0.8f;
            _loadLutDropDown.verticalAlignment          = UIVerticalAlignment.Middle;
            _loadLutDropDown.horizontalAlignment        = UIHorizontalAlignment.Left;
            _loadLutDropDown.textFieldPadding           = new RectOffset(12, 0, 10, 0);
            _loadLutDropDown.itemPadding                = new RectOffset(12, 0, 10, 0);
            _loadLutDropDown.triggerButton              = _loadLutDropDown;
            _loadLutDropDown.isLocalized                = true;
            _loadLutDropDown.localeID                   = LocaleID.BUILTIN_COLORCORRECTION;
            _loadLutDropDown.listScrollbar              = Controller.Scrollbar;
            _loadLutDropDown.eventDropdownOpen         += OnDropDownOpen;
            _loadLutDropDown.eventDropdownClose        += OnDropDownClose;
            _loadLutDropDown.eventSelectedIndexChanged += OnSelectedIndexChanged;
        }