diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Content/Graphics/MusicMenu/PlayButton.png b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Content/Graphics/MusicMenu/PlayButton.png new file mode 100644 index 00000000..0c463117 Binary files /dev/null and b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Content/Graphics/MusicMenu/PlayButton.png differ diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Content/Graphics/MusicMenu/StopButton.png b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Content/Graphics/MusicMenu/StopButton.png new file mode 100644 index 00000000..efff666c Binary files /dev/null and b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Content/Graphics/MusicMenu/StopButton.png differ diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Menus/MusicManagerMenu.cs b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Menus/MusicManagerMenu.cs index a529770b..a617fa55 100644 --- a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Menus/MusicManagerMenu.cs +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Menus/MusicManagerMenu.cs @@ -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. + * */ /// @@ -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(); + 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)); + + + } /// /// 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)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)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)this.currentMusicPackAlbum.buttonFunctionality.leftClick.paramaters[0]; + info.Value.songInformation.addSongToTriggerList(generateSongTriggerKeyFromSelection(), this.currentSelectedSong.label); + } + + public void deleteSong() + { + var info = (KeyValuePair)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 } diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/MusicManager.cs b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/MusicManager.cs index 9b4863d0..43d7b5d0 100644 --- a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/MusicManager.cs +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/MusicManager.cs @@ -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); diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/MusicPack.cs b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/MusicPack.cs index f1c36620..27bd61c4 100644 --- a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/MusicPack.cs +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/MusicPack.cs @@ -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); } } diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/SongSpecifics.cs b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/SongSpecifics.cs index f2fb5ecf..9a640df8 100644 --- a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/SongSpecifics.cs +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/SongSpecifics.cs @@ -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 /// public void initializeSeasonalMusic() { - foreach (var loc in locations) - { - foreach (var season in seasons) - { - listOfSongsWithTriggers.Add(loc + seperator + season, new List()); - foreach(var Weather in weather) - { - listOfSongsWithTriggers.Add(loc + seperator + season + seperator + Weather, new List()); - foreach(var day in daysOfWeek) - { - listOfSongsWithTriggers.Add(loc + seperator + season + seperator + Weather + seperator + day, new List()); - foreach(var time in timesOfDay) - { - listOfSongsWithTriggers.Add(loc + seperator + season + seperator + Weather + seperator + day + seperator + time, new List()); - } - } - } - } - } - - //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()); - foreach (var Weather in weather) + foreach(var weather in this.weather) { - listOfSongsWithTriggers.Add( season + seperator + Weather, new List()); - foreach (var day in daysOfWeek) + listOfSongsWithTriggers.Add(season + seperator + weather,new List()); + foreach(var time in this.timesOfDay) { - listOfSongsWithTriggers.Add(season + seperator + Weather + seperator + day, new List()); - foreach (var time in timesOfDay) + listOfSongsWithTriggers.Add(season + seperator + weather+seperator+time, new List()); + foreach(var loc in locations) { - listOfSongsWithTriggers.Add(season + seperator + Weather + seperator + day + seperator + time, new List()); + listOfSongsWithTriggers.Add(season + seperator + weather + seperator + time+seperator+loc, new List()); + foreach(var day in this.daysOfWeek) + { + listOfSongsWithTriggers.Add(season + seperator + weather + seperator + time + seperator + loc+seperator+day, new List()); + } } } } @@ -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> 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> pair in listOfSongsWithTriggers) - { - //StardewSymphony.ModMonitor.Log(pair.Key); - if (pair.Key == key) return pair; - } - - //return new KeyValuePair>(key, listOfSongsWithTriggers[key]); return new KeyValuePair>("",null); @@ -580,16 +550,29 @@ namespace StardewSymphonyRemastered.Framework return this.eventSongs; } + public List getMenuMusic() + { + return null; + //return this.menuSongs(); + } + /// /// Add a song name to a specific list of songs to play that will play under certain conditions. /// /// /// - 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 } /// @@ -597,7 +580,7 @@ namespace StardewSymphonyRemastered.Framework /// /// /// - 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 /// public Song getSongFromList(List 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; } diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/XACTMusicPack.cs b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/XACTMusicPack.cs index 0d4671bb..968255c9 100644 --- a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/XACTMusicPack.cs +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/XACTMusicPack.cs @@ -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(); } diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/StardewSymphony.cs b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/StardewSymphony.cs index e0f36006..bb97a15e 100644 --- a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/StardewSymphony.cs +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/StardewSymphony.cs @@ -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); diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/StardewSymphonyRemastered.csproj b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/StardewSymphonyRemastered.csproj index 8995dbff..4243a63c 100644 --- a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/StardewSymphonyRemastered.csproj +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/StardewSymphonyRemastered.csproj @@ -141,6 +141,9 @@ Always + + Always + Always @@ -159,6 +162,9 @@ Always + + Always + Always diff --git a/GeneralMods/StardustCore/UIUtilities/MenuComponents/Button.cs b/GeneralMods/StardustCore/UIUtilities/MenuComponents/Button.cs index f63b7b3b..1135dba6 100644 --- a/GeneralMods/StardustCore/UIUtilities/MenuComponents/Button.cs +++ b/GeneralMods/StardustCore/UIUtilities/MenuComponents/Button.cs @@ -256,6 +256,11 @@ namespace StardustCore.UIUtilities.MenuComponents return EmptyButton(); } + public string getDisplayText() + { + return this.label; + } + } }