public ColouringHSVMenu(Rectangle bounds, Colours colours, Color activeColour = default, Action <Color> onTryColourAction = null, Action <Color> onFinalColourAction = null) : base(bounds, colours) { if (activeColour == default) { activeColour = Color.Black; } Int32 hue_slider_width = Convert.ToInt32(this.mBounds.Width * 0.15f); Int32 separator_width = Convert.ToInt32(this.mBounds.Width * 0.075f); this.colourPicker = new ColourPicker(new Rectangle(this.mBounds.X + hue_slider_width + separator_width, this.mBounds.Y, this.mBounds.Width - hue_slider_width - separator_width, this.mBounds.Height), colours, c => { this.colourPicker.mData.mHoverText = $"R: {c.R}, G: {c.G}, B: {c.B}{Environment.NewLine}#{c.R:X2}{c.G:X2}{c.B:X2}"; onTryColourAction?.Invoke(c); }, onFinalColourAction); this.hueSlider = new HueSlider(new Rectangle(this.mBounds.X, this.mBounds.Y, hue_slider_width, this.mBounds.Height), this.colourPicker.SetHueColour, this.colourPicker.SetHueColour); this.separatorBounds = new Rectangle(this.hueSlider.mBounds.Right, this.mBounds.Y - 4, separator_width, this.mBounds.Height + 8); this.SetColour(activeColour, false); this.mComponents.AddRange(new ICustomComponent[] { this.hueSlider, this.colourPicker }); }
// Constructors: #region Constructors public ColouringHEXMenu(Rectangle bounds, Colours colours, Action <Color, Color> onFinalColourAction) : base(bounds, colours) { this.chestTextBox = new CustomTextBox(new Rectangle(this.mBounds.X + 8, this.mBounds.Y + 8 + Game1.smallFont.GetSize().Y, this.mBounds.Width - 16, -1), colours * 0.75f, preText: "#", maxLength: 6, inputFilterFunction: CustomTextBox.gAcceptHexOnly, onTextChangedHandler: text => { if (this.chestTextBox.mText.Length == 6 && this.hingesTextBox.mText.Length == 6) { onFinalColourAction(text.AsXNAColor(), this.hingesTextBox.mText.AsXNAColor()); } }); this.hingesTextBox = new CustomTextBox(new Rectangle(this.mBounds.X + 8, this.chestTextBox.mBounds.Bottom + 8 + Game1.smallFont.GetSize().Y, this.mBounds.Width - 16, -1), colours * 0.75f, preText: "#", maxLength: 6, inputFilterFunction: CustomTextBox.gAcceptHexOnly, onTextChangedHandler: text => { if (this.chestTextBox.mText.Length == 6 && this.hingesTextBox.mText.Length == 6) { onFinalColourAction(this.chestTextBox.mText.AsXNAColor(), text.AsXNAColor()); } }); this.copyColoursButton = new CustomButton(new Rectangle(this.mBounds.X + 6, this.hingesTextBox.mBounds.Bottom + 8, (this.mBounds.Width - 20) / 2, this.mBounds.Bottom - this.hingesTextBox.mBounds.Bottom - 16), colours * 0.5f, "Copy", "", () => { sCopiedColors = new Tuple <String, String>(this.chestTextBox.mText, this.hingesTextBox.mText); this.pasteColoursButton.SetEnabled(true); }); this.pasteColoursButton = new CustomButton(new Rectangle(this.copyColoursButton.mBounds.Right + 8, this.copyColoursButton.mBounds.Y, this.copyColoursButton.mBounds.Width, this.copyColoursButton.mBounds.Height), colours * 0.5f, "Paste", "", () => { this.SetColours(sCopiedColors.Item1, sCopiedColors.Item2); onFinalColourAction(this.chestTextBox.mText.AsXNAColor(), this.hingesTextBox.mText.AsXNAColor()); }); if (sCopiedColors is null) { this.pasteColoursButton.SetEnabled(false); } this.mComponents.AddRange(new ICustomComponent[] { this.pasteColoursButton, this.copyColoursButton, this.hingesTextBox, this.chestTextBox }); }
public Data(Colours colours, Rectangle completeBounds, SpriteFont font, Int32 maxLength, ExtraText extraText, Handlers handlers) : base(colours, 0.86f + completeBounds.Y / 20000.0f, String.Empty) { this.mDetailedBounds = new DetailedBounds(completeBounds, font, extraText.mLabel); this.mExtraText = extraText; this.mFont = font; this.mHandlers = handlers; this.mMaxLength = maxLength; }
// Constructors: #region Constructors public CustomButton(Rectangle bounds, Colours colours, String text, String hoverText, Action onClickHandler) : base(bounds, colours, hoverText) { this.onClickHandler = onClickHandler; this.text = text; Vector2 text_size = Game1.smallFont.MeasureString(text); if (text == "+") { text_size.Y = 26.0f; } this.mTextPosition = new Vector2(this.mBounds.Center.X - text_size.X / 2.0f, this.mBounds.Center.Y - text_size.Y / 2.0f); }
// Constructors: #region Constructors public ISVObjectInCustomItemGrabMenu(ICustomItemGrabMenuItem hostMenuItem, Rectangle bounds, StardewValley.Object svObject, Boolean svObjectDrawShadow = false, Single svObjectScale = -1.0f, String componentName = "", EventHandler <ICustomMenu.MouseStateEx> onMouseClick = null, String hoverText = "", Colours textureTintColours = null) : base(hostMenuItem, bounds, true, componentName, onMouseClick, hoverText, textureTintColours) { this.objectDrawShadow = svObjectDrawShadow; this.objectScale = svObjectScale; this.SVObject = svObject; }
// Constructors: #region Constructors public BasicComponent(ICustomItemGrabMenuItem hostMenuItem, Rectangle bounds, Boolean raiseMouseClickEventOnRelease = true, String componentName = "", EventHandler <ICustomMenu.MouseStateEx> onMouseClickHandler = null, String hoverText = "", Colours textureTintColours = null) : base(hostMenuItem, bounds, raiseMouseClickEventOnRelease, componentName, onMouseClickHandler, hoverText, textureTintColours) { this.HostMenuItem = hostMenuItem; }
// Constructors: #region Constructors public CustomTextureButton(Rectangle bounds, Colours colours, Texture2D texture, String hoverText, Action onClickHandler) : base(bounds, colours, "", hoverText, onClickHandler) { this.texture = texture; }
public CustomClickableComponent(Rectangle bounds, Colours colours) : this(bounds, colours, String.Empty) { }
// Constructors: #region Constructors public CustomClickableComponent(Rectangle bounds, Colours colours, String hoverText) : base(bounds, String.Empty, String.Empty) { this.mData = new CustomComponentData(colours, 0.86f + bounds.Y / 20000.0f, hoverText); }
public ICustomItemGrabMenuItem(ICustomItemGrabMenu hostMenu, Rectangle bounds, Boolean raiseMouseClickEventOnRelease, Colours colours) : this(hostMenu, bounds, raiseMouseClickEventOnRelease, colours, String.Empty, String.Empty) { }
public ICustomItemGrabMenuItem(ICustomItemGrabMenu hostMenu, Rectangle bounds, Boolean raiseMouseClickEventOnRelease, Colours colours, String svItemName, String svItemLabel) : base(null, bounds, raiseMouseClickEventOnRelease, colours, svItemName, svItemLabel) { this.HostMenu = hostMenu; }
// Constructors: #region Constructors public ICustomItemGrabMenuItem(ICustomItemGrabMenu hostMenu, Rectangle bounds, Boolean raiseMouseClickEventOnRelease, Colours colours, StardewValley.Item svItem) : base(null, bounds, raiseMouseClickEventOnRelease, colours, svItem) { this.HostMenu = hostMenu; }
public CustomClickableTextureComponent(Rectangle bounds, Colours colours, Texture2D texture) : this(bounds, colours, texture, String.Empty) { }
// Constructors: #region Constructors public CustomClickableTextureComponent(Rectangle bounds, Colours colours, Texture2D texture, String hoverText) : base(bounds, texture, texture?.Bounds ?? Rectangle.Empty, texture is null ? 1.0f : Convert.ToSingle(bounds.Width / texture.Bounds.Width)) { this.mData = new CustomComponentData(colours, 0.86f + bounds.Y / 20000.0f, hoverText); }
public CustomButton(Rectangle bounds, Color backgroundColour, String text, String hoverText, Action onClickHandler) : this(bounds, Colours.GenerateFrom(backgroundColour), text, hoverText, onClickHandler) { }
public BasicComponent(ICustomItemGrabMenuItem hostMenuItem, Point point, Boolean raiseMouseClickEventOnRelease = true, String componentName = "", EventHandler <ICustomMenu.MouseStateEx> onMouseClickHandler = null, String hoverText = "", Colours textureTintColours = null) : this(hostMenuItem, new Rectangle(point.X, point.Y, -1, -1), raiseMouseClickEventOnRelease, componentName, onMouseClickHandler, hoverText, textureTintColours) { }
// Constructors: #region Constructors public ColourPicker(Rectangle bounds, Colours colours, Action <Color> onColourHovered, Action <Color> onColourChanged) : base(bounds, colours) { this.onColourHovered = onColourHovered; this.onColourChanged = onColourChanged; }
public CustomComponentData(Colours colours, Single layerDepth, String hoverText) { this.mColours = colours; this.mHoverText = hoverText; this.mLayerDepth = layerDepth; }