// Component event handlers: #region Component event handlers private void _componentOnClick(Object sender, ICustomMenu.MouseStateEx mouseState) { switch ((sender as BaseTypes.ICustomItemGrabMenuItem.BasicComponent).Name) { case "openPanelBTN": _isShowingColourEditors.Flip(); _colourPalette.SetVisible(_isShowingColourEditors); this.HostMenu.SourceInventoryOptions.SetVisible(!_isShowingColourEditors); break; case "palette": var pos_as_point = mouseState.Pos.AsXNAPoint(); this.HostMenu.GetSourceAs <Chest>().playerChoiceColor.Value = _colourPalette.GetColourAt(pos_as_point.X, pos_as_point.Y); break; } }