private void OnSavedSwatchRenamed(SavedSwatch savedSwatch) { if (_ignoreEvents) { return; } // }
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; }
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; }
private void OnSaveClicked() { if (savedSwatches.Find(s => s.Color.r == currentColor.r && s.Color.g == currentColor.g && s.Color.b == currentColor.b) == null) { SavedSwatch newSwatch = new SavedSwatch() { Name = Translation.Instance.GetTranslation(TranslationID.LABEL_NEW_SWATCH), Color = currentColor }; AddSavedSwatch(newSwatch); savedSwatches.Add(newSwatch); Persistence.UpdateSavedSwatches(savedSwatches); } }
private void OnSaveClicked() { if (_ignoreEvents) { return; } if (_savedSwatches.Find(s => Math.Abs(s.Color.r - _currentColor.r) < float.Epsilon && Math.Abs(s.Color.g - _currentColor.g) < float.Epsilon && Math.Abs(s.Color.b - _currentColor.b) < float.Epsilon) != null) { return; } var newSwatch = new SavedSwatch() { Name = Translation.Instance.GetTranslation(TranslationID.LABEL_NEW_SWATCH), Color = _currentColor }; AddSavedSwatch(newSwatch); _savedSwatches.Add(newSwatch); Data.UpdateSavedSwatches(_savedSwatches, ColorID); }
public void Build(PanelType panelType, Layout layout, SavedSwatch savedSwatch) { base.Build(panelType, layout); this.savedSwatch = savedSwatch; swatchButton = AddUIComponent <SwatchButton>(); swatchButton.Build(savedSwatch.Color); textField = AddUIComponent <UITextField>(); textField.normalBgSprite = ""; textField.hoveredBgSprite = "ButtonSmallHovered"; textField.focusedBgSprite = "ButtonSmallHovered"; textField.size = new Vector2(187.0f, 19.0f); textField.font = UIUtil.Font; textField.textScale = 1f; textField.verticalAlignment = UIVerticalAlignment.Middle; textField.horizontalAlignment = UIHorizontalAlignment.Left; textField.padding = new RectOffset(5, 0, 3, 3); textField.builtinKeyNavigation = true; textField.isInteractive = true; textField.readOnly = false; textField.selectionSprite = "EmptySprite"; textField.selectOnFocus = true; textField.text = savedSwatch.Name; textField.atlas = Resources.DefaultAtlas; deleteButton = AddUIComponent <UIButton>(); deleteButton.normalBgSprite = ""; deleteButton.hoveredBgSprite = "DeleteLineButtonHover"; deleteButton.pressedBgSprite = "DeleteLineButtonPressed"; deleteButton.size = new Vector2(19.0f, 19.0f); deleteButton.atlas = Resources.DefaultAtlas; swatchButton.EventSwatchClicked += OnSwatchClicked; textField.eventTextChanged += OnTextChanged; deleteButton.eventClicked += OnDeleteClicked; deleteButton.eventMouseEnter += OnMouseEnter; deleteButton.eventMouseLeave += OnMouseLeave; eventMouseEnter += OnMouseEnter; eventMouseLeave += OnMouseLeave; }
public void Setup(SavedSwatch savedSwatch) { this.SavedSwatch = savedSwatch; _swatchButton = AddUIComponent <SwatchButton>(); _swatchButton.Build(savedSwatch.Color); _textField = AddUIComponent <UITextField>(); _textField.normalBgSprite = ""; _textField.hoveredBgSprite = "ButtonSmallHovered"; _textField.focusedBgSprite = "ButtonSmallHovered"; _textField.size = new Vector2(290.0f, 19.0f); _textField.font = UIUtils.Font; _textField.textScale = 0.8f; _textField.verticalAlignment = UIVerticalAlignment.Middle; _textField.horizontalAlignment = UIHorizontalAlignment.Left; _textField.padding = new RectOffset(5, 0, 4, 4); _textField.builtinKeyNavigation = true; _textField.isInteractive = true; _textField.readOnly = false; _textField.selectionSprite = "EmptySprite"; _textField.selectOnFocus = true; _textField.text = savedSwatch.Name; _textField.atlas = UISprites.DefaultAtlas; _deleteButton = AddUIComponent <UIButton>(); _deleteButton.normalBgSprite = ""; _deleteButton.hoveredBgSprite = "DeleteLineButtonHover"; _deleteButton.pressedBgSprite = "DeleteLineButtonPressed"; _deleteButton.size = new Vector2(19.0f, 19.0f); _deleteButton.atlas = UISprites.DefaultAtlas; _swatchButton.EventSwatchClicked += OnSwatchClicked; _textField.eventTextChanged += OnTextChanged; _deleteButton.eventClicked += OnDeleteClicked; _deleteButton.eventMouseEnter += OnMouseEnter; _deleteButton.eventMouseLeave += OnMouseLeave; eventMouseEnter += OnMouseEnter; eventMouseLeave += OnMouseLeave; }
private void OnSavedSwatchRenamed(SavedSwatch savedSwatch) { // }
internal void Setup(string v1, float panelWidth, float panelHeight, int v2, bool v3, LayoutDirection horizontal, LayoutStart topLeft, ColorID colorID, SavedSwatch savedSwatch) { Setup(v1, panelWidth, panelHeight, v2, v3, horizontal, topLeft); Setup(savedSwatch); ColorID = colorID; }