Finished delete functionality for Symphony menu. Added more hover text.

This commit is contained in:
JoshuaNavarro 2019-06-24 10:44:04 -07:00
parent bff69c2a96
commit 9595ece1bb
2 changed files with 179 additions and 44 deletions

View File

@ -20,12 +20,10 @@ using StardustCore.UIUtilities.SpriteFonts;
namespace StardewSymphonyRemastered.Framework.Menus
{
public class MusicManagerMenuV2 : IClickableMenuExtended
{ /// <summary>Interface for the menu for selection music.</summary>
{
/// <summary>The different displays for this menu.</summary>
///Add in stop button
///Add in delete funtionality
///Test to make sure it works
///Test to make sure it saves
public enum DrawMode
{
AlbumSelection,
@ -49,22 +47,57 @@ namespace StardewSymphonyRemastered.Framework.Menus
SeasonSelection,
}
/// <summary>
/// All the buttons that get displayed for the music pack albums.
/// </summary>
public List<Button> musicAlbumButtons;
/// <summary>
/// The currenty selected music pack button.
/// </summary>
public Button currentMusicPackAlbum;
/// <summary>
/// The currenty selected button for the song from the current msuic pack.
/// </summary>
public Button currentSelectedSong;
//public Button currentlySelectedOption; //The big button for season, menu, event, and festivals
/// <summary>
/// The current selected button for the weather conditional.
/// </summary>
public Button currentlySelectedWeather; //Used to display what weather the user selected
/// <summary>
/// The current selected button for the time conditional.
/// </summary>
public Button currentlySelectedTime;
/// <summary>
/// The current selected button for the time location.
/// </summary>
public Button currentlySelectedLocation;
/// <summary>
/// The current selected button for the day conditional.
/// </summary>
public Button currentlySelectedDay;
/// <summary>
/// The current selected button for the season conditional.
/// </summary>
public Button currentlySelectedSeason;
/// <summary>
/// The current selected button for the festival conditional.
/// </summary>
public Button currentlySelectedFestival;
/// <summary>
/// The current selected button for the event conditional.
/// </summary>
public Button currentlySelectedEvent;
/// <summary>
/// The current selected button for the time conditional.
/// </summary>
public Button currentlySelectedMenu;
/// <summary>
/// The add button that adds a conditional to the currently selected song.
/// </summary>
public Button addButton;
/// <summary>
/// The delete button that clears all conditionals from a song.
/// </summary>
public Button deleteButton;
public Button playButton;
public Button stopButton;
@ -220,27 +253,100 @@ namespace StardewSymphonyRemastered.Framework.Menus
return;
}
if (this.currentSelectedSong != null && this.currentMusicPackAlbum != null && this.stopButton.containsPoint(x, y))
if (this.stopButton.containsPoint(x, y) && this.currentSelectedSong!=null && this.currentMusicPackAlbum != null)
{
Game1.playSound("coin");
this.stopSong();
return;
}
if (this.currentSelectedSong != null && this.currentMusicPackAlbum != null && this.addButton.containsPoint(x, y))
if (this.addButton.containsPoint(x, y) && this.drawMode == DrawMode.DifferentSelectionTypesModePage)
{
Game1.playSound("coin");
this.addSong();
return;
}
if (this.currentSelectedSong != null && this.currentMusicPackAlbum != null && this.deleteButton.containsPoint(x, y))
if (this.deleteButton.containsPoint(x, y) && this.drawMode== DrawMode.DifferentSelectionTypesModePage)
{
Game1.playSound("coin");
this.deleteSong();
this.clearAllOptions();
return;
}
//Delete season
if (this.currentlySelectedSeason != null)
{
if (this.currentlySelectedSeason.containsPoint(x, y))
{
this.currentlySelectedSeason = null;
Game1.playSound("coin");
}
}
//Delete weather
if (this.currentlySelectedWeather != null)
{
if (this.currentlySelectedWeather.containsPoint(x, y))
{
this.currentlySelectedWeather = null;
Game1.playSound("coin");
}
}
//Delete time
if (this.currentlySelectedTime != null)
{
if (this.currentlySelectedTime.containsPoint(x, y))
{
this.currentlySelectedTime = null;
Game1.playSound("coin");
}
}
//Delete location
if (this.currentlySelectedLocation != null)
{
if (this.currentlySelectedLocation.containsPoint(x, y))
{
this.currentlySelectedLocation = null;
Game1.playSound("coin");
}
}
//Delete day
if (this.currentlySelectedDay != null)
{
if (this.currentlySelectedDay.containsPoint(x, y))
{
this.currentlySelectedDay = null;
Game1.playSound("coin");
}
}
//Delete festival
if (this.currentlySelectedFestival != null)
{
if (this.currentlySelectedFestival.containsPoint(x, y))
{
this.currentlySelectedFestival = null;
Game1.playSound("coin");
}
}
//Delete event
if (this.currentlySelectedEvent != null)
{
if (this.currentlySelectedEvent.containsPoint(x, y))
{
Game1.playSound("coin");
}
}
//Delete menu
if (this.currentlySelectedMenu != null)
{
if (this.currentlySelectedMenu.containsPoint(x, y))
{
this.currentlySelectedMenu = null;
Game1.playSound("coin");
}
}
if (this.drawMode == DrawMode.DifferentSelectionTypesModePage && this.saveButton.containsPoint(x, y))
{
this.CurrentMusicPack.SaveSettings();
@ -698,6 +804,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
}
}
}
/// <summary>
@ -785,6 +893,30 @@ namespace StardewSymphonyRemastered.Framework.Menus
hoverTextOver = true;
}
if (this.deleteButton.containsPoint(x, y) && this.drawMode == DrawMode.DifferentSelectionTypesModePage)
{
this.hoverText = "Clears all currently selected options." + Environment.NewLine + "This does NOT delete other conditionals." + Environment.NewLine + "This just clears the current options for addition of multiple conditionals.";
hoverTextOver = true;
}
if(this.playButton.containsPoint(x,y) && this.drawMode != DrawMode.SongSelectionMode && this.drawMode != DrawMode.AlbumFancySelection)
{
this.hoverText = "Play song";
hoverTextOver = true;
}
if (this.stopButton.containsPoint(x, y) && this.drawMode != DrawMode.SongSelectionMode && this.drawMode != DrawMode.AlbumFancySelection)
{
this.hoverText = "Stop song";
hoverTextOver = true;
}
if (this.backButton.containsPoint(x, y) && this.drawMode != DrawMode.AlbumFancySelection)
{
this.hoverText = "Go back";
hoverTextOver = true;
}
if (hoverTextOver == false)
{
this.hoverText = "";
@ -1604,17 +1736,23 @@ namespace StardewSymphonyRemastered.Framework.Menus
this.framesSinceLastUpdate++;
}
}
/// <summary>
/// Plays the currently selected song.
/// </summary>
public void playSong()
{
this.CurrentMusicPack.PlaySong(this.currentSelectedSong.name);
}
/// <summary>
/// Stops the currently selected song.
/// </summary>
public void stopSong()
{
this.CurrentMusicPack.StopSong();
}
/// <summary>
/// Adds a song conditional to the current song.
/// </summary>
private void addSong()
{
//Used to actually save the song.
@ -1690,7 +1828,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
return key;
}
private void deleteSong()
private void clearAllOptions()
{
//Check selections for draw mode and then remove if necessary
if (this.currentlySelectedSeason != null) this.currentlySelectedSeason = null;
@ -1701,8 +1840,6 @@ namespace StardewSymphonyRemastered.Framework.Menus
if (this.currentlySelectedEvent != null) this.currentlySelectedEvent = null;
if (this.currentlySelectedFestival != null) this.currentlySelectedFestival = null;
if (this.currentlySelectedMenu != null) this.currentlySelectedMenu = null;
this.goBack();
}
/// <summary>
/// Returns to a previous menu screen.
@ -2022,6 +2159,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
if (this.currentSelectedSong != null)
{
this.playButton.draw(b);
this.stopButton.draw(b);
if (this.drawMode == DrawMode.DaySelection || this.drawMode == DrawMode.EventSelection || this.drawMode == DrawMode.FestivalSelection || this.drawMode == DrawMode.LocationSelection || this.drawMode == DrawMode.MenuSelection || this.drawMode == DrawMode.SeasonSelection || this.drawMode == DrawMode.TimeSelection || this.drawMode == DrawMode.WeatherSelection || this.drawMode == DrawMode.DifferentSelectionTypesModePage)
{
this.backButton.draw(b);
@ -2035,15 +2173,11 @@ namespace StardewSymphonyRemastered.Framework.Menus
if (this.currentlySelectedMenu != null) this.currentlySelectedMenu.draw(b);
}
if (this.drawMode == DrawMode.DaySelection || this.drawMode == DrawMode.EventSelection || this.drawMode == DrawMode.FestivalSelection || this.drawMode == DrawMode.LocationSelection || this.drawMode == DrawMode.MenuSelection || this.drawMode == DrawMode.SeasonSelection || this.drawMode == DrawMode.TimeSelection || this.drawMode == DrawMode.WeatherSelection)
{
this.deleteButton.draw(b);
}
if (this.drawMode == DrawMode.DifferentSelectionTypesModePage)
{
this.addButton.draw(b);
this.saveButton.draw(b);
this.deleteButton.draw(b);
}
}

View File

@ -198,7 +198,8 @@ namespace StardewSymphonyRemastered
}
}
//Update volume.
//Update volume.0.
if (this.oldVolume < 0f)
{
this.oldVolume = Game1.options.musicVolumeLevel;