Symphony can now add songs to triggers for changing location. Need to find a way to surpress always changing songs when changing location if it isn't location specific.

This commit is contained in:
2018-05-28 03:17:36 -07:00
parent 7c693c9051
commit eb90e537a5
10 changed files with 203 additions and 91 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

View File

@ -24,6 +24,11 @@ namespace StardewSymphonyRemastered.Framework.Menus
*
* Figure out positioning for icons on fancy icons
*
* Need to do menu layout for menu/festival/event music.
* Ned to make play/stop/add/delete/back buttons.
*
* //Make all the functionality work.
*
*/
/// <summary>
@ -40,7 +45,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
AlbumFancySelection,
SongSelectionMode,
DifferntSelectionTypesMode, //Used for locations, events, festivals, menus (house, exclamation mark, star, and list/book icons respectively)
DifferentSelectionTypesMode, //Used for locations, events, festivals, menus (house, exclamation mark, star, and list/book icons respectively)
WeatherSelection,
FestivalSelection,
EventSelection,
@ -61,6 +66,13 @@ namespace StardewSymphonyRemastered.Framework.Menus
public Button currentlySelectedLocation;
public Button currentlySelectedDay;
public Button addButton;
public Button deleteButton;
public Button playButton;
public Button stopButton;
public DrawMode drawMode;
public int currentAlbumIndex;
public int currentSongPageIndex;
@ -153,8 +165,20 @@ namespace StardewSymphonyRemastered.Framework.Menus
this.searchBoxSelected = false;
this.menuTextures = new List<Texture2DExtended>();
Vector2 playPos= new Vector2(this.width * .1f + 128 + 32, this.height * .05f + 128); //Put it to the right of the music disk
this.playButton = new Button("PlayButton", new Rectangle((int)playPos.X, (int)playPos.Y, 64, 64), StardewSymphony.textureManager.getTexture("PlayButton"), "", new Rectangle(0, 0, 16, 16), 4f, new Animation(new Rectangle(0, 0, 16, 16)), Color.White, Color.White, new ButtonFunctionality(null, null, null));
}
Vector2 stopPos = new Vector2(this.width * .1f + 192 + 32, this.height * .05f + 128); //Put it to the right of the music disk
this.stopButton = new Button("StopButton", new Rectangle((int)stopPos.X, (int)stopPos.Y, 64, 64), StardewSymphony.textureManager.getTexture("StopButton"), "", new Rectangle(0, 0, 16, 16), 4f, new Animation(new Rectangle(0, 0, 16, 16)), Color.White, Color.White, new ButtonFunctionality(null, null, null));
Vector2 addPos = new Vector2(this.width * .1f + 256 + 32, this.height * .05f + 128); //Put it to the right of the music disk
this.addButton = new Button("AddIcon", new Rectangle((int)addPos.X, (int)addPos.Y, 64, 64), StardewSymphony.textureManager.getTexture("AddIcon"), "", new Rectangle(0, 0, 32, 32), 2f, new Animation(new Rectangle(0, 0, 32, 32)), Color.White, Color.White, new ButtonFunctionality(null, null, null));
Vector2 delPos = new Vector2(this.width * .1f + 320 + 32, this.height * .05f + 128); //Put it to the right of the music disk
this.deleteButton = new Button("DeleteIcon", new Rectangle((int)delPos.X, (int)delPos.Y, 64, 64), StardewSymphony.textureManager.getTexture("DeleteIcon"), "", new Rectangle(0, 0, 32, 32), 2f, new Animation(new Rectangle(0, 0, 32, 32)), Color.White, Color.White, new ButtonFunctionality(null, null, null));
}
/// <summary>
/// Runs every game tick to check for stuff.
@ -347,7 +371,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
}
//Options selection mode.
if (this.drawMode == DrawMode.DifferntSelectionTypesMode)
if (this.drawMode == DrawMode.DifferentSelectionTypesMode)
{
this.fancyButtons.Clear();
@ -775,6 +799,32 @@ namespace StardewSymphonyRemastered.Framework.Menus
{
bool buttonSelected = false;
if(this.currentSelectedSong!=null && this.currentMusicPackAlbum!=null && this.playButton.containsPoint(x, y))
{
playSong();
return;
}
if (this.currentSelectedSong != null && this.currentMusicPackAlbum != null && this.stopButton.containsPoint(x, y))
{
stopSong();
return;
}
if (this.currentSelectedSong != null && this.currentMusicPackAlbum != null && this.addButton.containsPoint(x, y))
{
addSong();
return;
}
if (this.currentSelectedSong != null && this.currentMusicPackAlbum != null && this.deleteButton.containsPoint(x, y))
{
deleteSong();
return;
}
if (this.drawMode == DrawMode.AlbumSelection)
{
foreach (var v in this.musicAlbumButtons)
@ -863,7 +913,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
}
//Left click an option.
if(this.drawMode == DrawMode.DifferntSelectionTypesMode)
if(this.drawMode == DrawMode.DifferentSelectionTypesMode)
{
foreach(var button in this.fancyButtons)
{
@ -1055,7 +1105,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
}
if (this.drawMode == DrawMode.DifferntSelectionTypesMode)
if (this.drawMode == DrawMode.DifferentSelectionTypesMode)
{
Vector4 placement = new Vector4(this.width * .1f, this.height * .05f, 4 * 100, 128 * 2);
this.drawDialogueBoxBackground((int)placement.X, (int)placement.Y, (int)placement.Z, (int)placement.W, new Color(new Vector4(this.dialogueBoxBackgroundColor.ToVector3(), 255)));
@ -1080,35 +1130,6 @@ namespace StardewSymphonyRemastered.Framework.Menus
}
if (this.drawMode == DrawMode.DifferntSelectionTypesMode)
{
Vector4 placement = new Vector4(this.width * .1f, this.height * .05f, 4 * 100, 128 * 2);
this.drawDialogueBoxBackground((int)placement.X, (int)placement.Y, (int)placement.Z, (int)placement.W, new Color(new Vector4(this.dialogueBoxBackgroundColor.ToVector3(), 255)));
Vector4 placement2 = new Vector4(this.width * .2f + 400, this.height * .05f, 5 * 100, this.height * .95f);
this.drawDialogueBoxBackground((int)placement2.X, (int)placement2.Y, (int)placement2.Z, (int)placement2.W, new Color(new Vector4(this.dialogueBoxBackgroundColor.ToVector3(), 255)));
//make 3rd dialogue box option;
this.currentMusicPackAlbum.draw(b);
this.currentSelectedSong.draw(b);
//this.currentlySelectedOption.draw(b);
foreach (Button button in fancyButtons)
{
button.draw(b);
}
foreach (var v in this.texturedStrings)
{
v.draw(b);
}
}
this.drawMouse(b);
if (this.drawMode == DrawMode.WeatherSelection)
{
Vector4 placement = new Vector4(this.width * .1f, this.height * .05f, 4 * 100, 128 * 2);
@ -1275,6 +1296,17 @@ namespace StardewSymphonyRemastered.Framework.Menus
}
//Draw the add, delete, play, and stop buttons.
if(this.currentSelectedSong!=null && this.currentMusicPackAlbum != null)
{
if (this.drawMode == DrawMode.WeatherSelection || this.drawMode == DrawMode.TimeSelection || this.drawMode == DrawMode.LocationSelection || this.drawMode == DrawMode.DaySelection || this.drawMode == DrawMode.NothingElseToDisplay || this.drawMode == DrawMode.FestivalSelection || this.drawMode == DrawMode.EventSelection || this.drawMode == DrawMode.MenuSelection)
{
this.addButton.draw(b);
this.deleteButton.draw(b);
}
this.playButton.draw(b);
this.stopButton.draw(b);
}
this.drawMouse(b);
}
@ -1323,11 +1355,87 @@ namespace StardewSymphonyRemastered.Framework.Menus
StardewSymphony.musicManager.swapMusicPacks(info.Key);
StardewSymphony.musicManager.playSongFromCurrentPack(b.name);
*/
this.drawMode = DrawMode.DifferntSelectionTypesMode;
this.drawMode = DrawMode.DifferentSelectionTypesMode;
//this.updateFancyButtons();
}
public void playSong()
{
StardewSymphony.ModMonitor.Log("Song Selected!" + this.currentSelectedSong.name);
var info = (KeyValuePair<string, MusicPack>)this.currentMusicPackAlbum.buttonFunctionality.leftClick.paramaters[0];
StardewSymphony.ModMonitor.Log("Select Pack:" + info.Key);
StardewSymphony.musicManager.swapMusicPacks(info.Key);
StardewSymphony.musicManager.playSongFromCurrentPack(this.currentSelectedSong.name);
}
public void stopSong()
{
StardewSymphony.ModMonitor.Log("Song Selected!" + this.currentSelectedSong.name);
var info = (KeyValuePair<string, MusicPack>)this.currentMusicPackAlbum.buttonFunctionality.leftClick.paramaters[0];
StardewSymphony.ModMonitor.Log("Select Pack:" + info.Key);
StardewSymphony.musicManager.swapMusicPacks(info.Key);
StardewSymphony.musicManager.stopSongFromCurrentMusicPack();
}
public void addSong()
{
var info = (KeyValuePair<string, MusicPack>)this.currentMusicPackAlbum.buttonFunctionality.leftClick.paramaters[0];
info.Value.songInformation.addSongToTriggerList(generateSongTriggerKeyFromSelection(), this.currentSelectedSong.label);
}
public void deleteSong()
{
var info = (KeyValuePair<string, MusicPack>)this.currentMusicPackAlbum.buttonFunctionality.leftClick.paramaters[0];
info.Value.songInformation.removeSongFromTriggerList(generateSongTriggerKeyFromSelection(), this.currentSelectedSong.label);
}
public string generateSongTriggerKeyFromSelection()
{
string key = "";
string seperator = "_";
//Seasonal selection region
#region
if (this.currentlySelectedOption.name == "SeasonIcon")
{
if (Game1.currentSeason == "spring") key += "spring";
if (Game1.currentSeason == "summer") key += "summer";
if (Game1.currentSeason == "fall") key += "fall";
if (Game1.currentSeason == "winter") key += "winter";
}
if (this.currentlySelectedWeather != null)
{
if (this.currentlySelectedWeather.name == "SunnyIcon") key += seperator + "sunny";
if (this.currentlySelectedWeather.name == "RainyIcon") key += seperator + "rain";
if (this.currentlySelectedWeather.name == "WeatherDebrisIcon") key += seperator + "debris";
if (this.currentlySelectedWeather.name == "WeatherFestivalIcon") key += seperator + "festival";
if (this.currentlySelectedWeather.name == "SnowIcon") key += seperator + "snow";
if (this.currentlySelectedWeather.name == "StormIcon") key += seperator + "lightning";
if (this.currentlySelectedWeather.name == "WeddingIcon") key += seperator + "wedding";
}
if (this.currentlySelectedTime != null)
{
if (this.currentlySelectedTime.name == "DayIcon") key += seperator + "day";
if (this.currentlySelectedTime.name == "NightIcon") key += seperator + "night";
}
if (this.currentlySelectedLocation != null)
{
key += seperator + this.currentlySelectedLocation.label;
}
if (this.currentlySelectedDay != null)
{
if (this.currentlySelectedDay.name == "SundayIcon") key += seperator + "sunday";
if (this.currentlySelectedDay.name == "MondayIcon") key += seperator + "monday";
if (this.currentlySelectedDay.name == "TuesdayIcon") key += seperator + "tuesday";
if (this.currentlySelectedDay.name == "WednesdayIcon") key += seperator + "wednesday";
if (this.currentlySelectedDay.name == "ThursdayIcon") key += seperator + "thursday";
if (this.currentlySelectedDay.name == "FridayIcon") key += seperator + "friday";
if (this.currentlySelectedDay.name == "SaturdayIcon") key += seperator + "saturday";
}
#endregion
return key;
}
#endregion
}

View File

@ -354,11 +354,13 @@ namespace StardewSymphonyRemastered.Framework
var musicPackPair = listOfValidMusicPacks.ElementAt(randInt);
//used to swap the music packs and stop the last playing song.
this.swapMusicPacks(musicPackPair.Key.musicPackInformation.name);
int randInt2 = songSelector.Next(0, musicPackPair.Value.Count);
var songName = musicPackPair.Value.ElementAt(randInt2);
this.currentMusicPack.playSong(songName.name);

View File

@ -101,7 +101,7 @@ namespace StardewSymphonyRemastered.Framework
var pair = this.songInformation.getSongList(node.trigger+".json");
foreach (var v in node.songList)
{
this.songInformation.addSongToList(node.trigger, v.name);
this.songInformation.addSongToTriggerList(node.trigger, v.name);
}
}

View File

@ -293,7 +293,6 @@ namespace StardewSymphonyRemastered.Framework
if (Game1.isDebrisWeather) return "debris"; //????
if (Game1.isSnowing) return "snow";
if (Game1.weddingToday) return "wedding";
return "sunny"; //If none of the other weathers, make it sunny.
}
@ -474,6 +473,10 @@ namespace StardewSymphonyRemastered.Framework
public bool isSongInList(string songName)
{
Song s = getSongFromList(listOfSongsWithoutTriggers, songName);
if (s == null)
{
return false;
}
return listOfSongsWithoutTriggers.Contains(s);
}
@ -482,39 +485,22 @@ namespace StardewSymphonyRemastered.Framework
/// </summary>
public void initializeSeasonalMusic()
{
foreach (var loc in locations)
{
foreach (var season in seasons)
{
listOfSongsWithTriggers.Add(loc + seperator + season, new List<Song>());
foreach(var Weather in weather)
{
listOfSongsWithTriggers.Add(loc + seperator + season + seperator + Weather, new List<Song>());
foreach(var day in daysOfWeek)
{
listOfSongsWithTriggers.Add(loc + seperator + season + seperator + Weather + seperator + day, new List<Song>());
foreach(var time in timesOfDay)
{
listOfSongsWithTriggers.Add(loc + seperator + season + seperator + Weather + seperator + day + seperator + time, new List<Song>());
}
}
}
}
}
//Add in some default seasonal music because maybe a location doesn't have some music?
foreach (var season in seasons)
foreach(var season in seasons)
{
listOfSongsWithTriggers.Add(season, new List<Song>());
foreach (var Weather in weather)
foreach(var weather in this.weather)
{
listOfSongsWithTriggers.Add( season + seperator + Weather, new List<Song>());
foreach (var day in daysOfWeek)
listOfSongsWithTriggers.Add(season + seperator + weather,new List<Song>());
foreach(var time in this.timesOfDay)
{
listOfSongsWithTriggers.Add(season + seperator + Weather + seperator + day, new List<Song>());
foreach (var time in timesOfDay)
listOfSongsWithTriggers.Add(season + seperator + weather+seperator+time, new List<Song>());
foreach(var loc in locations)
{
listOfSongsWithTriggers.Add(season + seperator + Weather + seperator + day + seperator + time, new List<Song>());
listOfSongsWithTriggers.Add(season + seperator + weather + seperator + time+seperator+loc, new List<Song>());
foreach(var day in this.daysOfWeek)
{
listOfSongsWithTriggers.Add(season + seperator + weather + seperator + time + seperator + loc+seperator+day, new List<Song>());
}
}
}
}
@ -549,22 +535,6 @@ namespace StardewSymphonyRemastered.Framework
if (pair.Key == key) return pair;
}
//This is just the plain song name with no extra info.
foreach (KeyValuePair<string, List<Song>> pair in listOfSongsWithTriggers)
{
//StardewSymphony.ModMonitor.Log(pair.Key);
if (pair.Key == key) return pair;
}
//This is just the plain song name with no extra info.
foreach (KeyValuePair<string, List<Song>> pair in listOfSongsWithTriggers)
{
//StardewSymphony.ModMonitor.Log(pair.Key);
if (pair.Key == key) return pair;
}
//return new KeyValuePair<string, List<string>>(key, listOfSongsWithTriggers[key]);
return new KeyValuePair<string, List<Song>>("",null);
@ -580,16 +550,29 @@ namespace StardewSymphonyRemastered.Framework
return this.eventSongs;
}
public List<Song> getMenuMusic()
{
return null;
//return this.menuSongs();
}
/// <summary>
/// Add a song name to a specific list of songs to play that will play under certain conditions.
/// </summary>
/// <param name="songListKey"></param>
/// <param name="songName"></param>
public void addSongToList(string songListKey,string songName)
public void addSongToTriggerList(string songListKey,string songName)
{
var songKeyPair = getSongList(songListKey);
var song = getSongFromList(songKeyPair.Value, songName);
songKeyPair.Value.Add(song);
var songKeyPair = getSongList(songListKey); //Get the trigger list
var song = getSongFromList(listOfSongsWithoutTriggers, songName); //Get the song from the master song pool
if (song == null)
{
StardewSymphony.ModMonitor.Log("For some reason you are trying to add a song that is null. The name of the song is "+ songName);
return;
}
songKeyPair.Value.Add(song); //add the song from master pool to the trigger list
}
/// <summary>
@ -597,7 +580,7 @@ namespace StardewSymphonyRemastered.Framework
/// </summary>
/// <param name="songListKey"></param>
/// <param name="songName"></param>
public void removeSongFromList(string songListKey,string songName)
public void removeSongFromTriggerList(string songListKey,string songName)
{
var songKeyPair = getSongList(songListKey);
var song = getSongFromList(songKeyPair.Value, songName);
@ -612,9 +595,12 @@ namespace StardewSymphonyRemastered.Framework
/// <returns></returns>
public Song getSongFromList(List<Song> songList,string songName)
{
foreach(var song in songList)
foreach (var song in songList)
{
if (song.name == songName) return song;
if (song.name == songName)
{
return song;
}
}
return null;
}

View File

@ -89,7 +89,7 @@ namespace StardewSymphonyRemastered.Framework
}
else
{
return this.SoundBank.GetCue(name);
return this.SoundBank.GetCue(name);
}
}
@ -107,7 +107,6 @@ namespace StardewSymphonyRemastered.Framework
Game1.waveBank = this.WaveBank;
Game1.soundBank = this.SoundBank;
this.currentCue.Play();
StardewSymphony.Reset();
}

View File

@ -298,6 +298,9 @@ namespace StardewSymphonyRemastered
string houseIcon = Path.Combine(path, "HouseIcon.png");
string playButton = Path.Combine(path, "PlayButton.png");
string stopButton = Path.Combine(path, "StopButton.png");
@ -338,6 +341,9 @@ namespace StardewSymphonyRemastered
textureManager.addTexture("HouseIcon", new Texture2DExtended(ModHelper, StardustCore.Utilities.getRelativeDirectory("StardewSymphonyRemastered", houseIcon)));
textureManager.addTexture("PlayButton", new Texture2DExtended(ModHelper, StardustCore.Utilities.getRelativeDirectory("StardewSymphonyRemastered", playButton)));
textureManager.addTexture("StopButton", new Texture2DExtended(ModHelper, StardustCore.Utilities.getRelativeDirectory("StardewSymphonyRemastered", stopButton)));
if (!Directory.Exists(MusicPath)) Directory.CreateDirectory(MusicPath);
if (!Directory.Exists(WavMusicDirectory)) Directory.CreateDirectory(WavMusicDirectory);

View File

@ -141,6 +141,9 @@
<Content Include="Content\Graphics\MusicMenu\OutlineBox.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\MusicMenu\PlayButton.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\MusicMenu\RedBallon.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
@ -159,6 +162,9 @@
<Content Include="Content\Graphics\MusicMenu\StarIcon.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\MusicMenu\StopButton.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\MusicMenu\TimeIcon_Day.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>

View File

@ -256,6 +256,11 @@ namespace StardustCore.UIUtilities.MenuComponents
return EmptyButton();
}
public string getDisplayText()
{
return this.label;
}
}
}