Skip to content

Commit

Permalink
Fix bug when menu is clicked while remapping
Browse files Browse the repository at this point in the history
  • Loading branch information
Annosz committed Oct 18, 2020
1 parent 976b2ee commit 971b67e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 40 deletions.
21 changes: 0 additions & 21 deletions SDVModTest/Options/ModOptionsPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -334,27 +334,6 @@ public override void draw(SpriteBatch batch)
}
if (_hoverText != "")
IClickableMenu.drawHoverText(batch, _hoverText, Game1.smallFont);

//if (Game1.options.hardwareCursor)
//{
// Game1.spriteBatch.Draw(
// Game1.mouseCursors,
// new Vector2(
// Game1.getMouseX(),
// Game1.getMouseY()),
// new Rectangle?(
// Game1.getSourceRectForStandardTileSheet(
// Game1.mouseCursors,
// Game1.mouseCursor,
// 16,
// 16)),
// Color.White,
// 0.0f,
// Vector2.Zero,
// (float)(Game1.pixelZoom + (Game1.dialogueButtonScale / 150.0)),
// SpriteEffects.None,
// 1f);
//}
}
}
}
12 changes: 0 additions & 12 deletions SDVModTest/Options/ModOptionsPageButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,6 @@ public void OnButtonPressed(object sender, ButtonPressedEventArgs e)
OnLeftClicked?.Invoke(this, null);
}
}

//if (e.NewState.LeftButton != ButtonState.Pressed || !(Game1.activeClickableMenu is GameMenu))
//{
// _hasClicked = false;
//}
//else if ((Game1.activeClickableMenu as GameMenu).currentTab != 3 &&
// isWithinBounds(e.NewPosition.X, e.NewPosition.Y) &&
// !_hasClicked)
//{
// receiveLeftClick(e.NewPosition.X, e.NewPosition.Y);

//}
}

public override void draw(SpriteBatch b)
Expand Down
13 changes: 6 additions & 7 deletions SDVModTest/Options/ModOptionsPageHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,17 @@ public void Dispose()

private void OnButtonLeftClicked(object sender, EventArgs e)
{
if (Game1.activeClickableMenu is GameMenu)
if (Game1.activeClickableMenu is GameMenu
&& !GameMenu.forcePreventClose) // Do not activate when an action is being remapped
{
SetActiveClickableMenuToModOptionsPage();
Game1.playSound("smallSelect");
}
}

/// <summary>Raised after a game menu is opened, closed, or replaced.</summary>
/// <param name="sender">The event sender.</param>
/// <param name="e">The event arguments.</param>
private void ToggleModOptions(object sender, MenuChangedEventArgs e)
{
// remove from old menu
// Remove from old menu
if (e.OldMenu != null)
{
_helper.Events.Display.RenderedActiveMenu -= DrawButton;
Expand All @@ -136,7 +134,7 @@ private void ToggleModOptions(object sender, MenuChangedEventArgs e)
}
}

// add to new menu
// Add to new menu
if (e.NewMenu is GameMenu newMenu)
{
if (_modOptionsPageButton == null)
Expand All @@ -163,7 +161,8 @@ private void SetActiveClickableMenuToModOptionsPage()
private void DrawButton(object sender, EventArgs e)
{
if (Game1.activeClickableMenu is GameMenu gameMenu &&
gameMenu.currentTab != 3) //don't render when the map is showing
gameMenu.currentTab != 3 // Do not render when the map is showing
&& !GameMenu.forcePreventClose) // Do not render when an action is being remapped
{
if (gameMenu.currentTab == _modOptionsTabPageNumber)
{
Expand Down

0 comments on commit 971b67e

Please sign in to comment.