diff --git a/GeneralMods/StardewSymphony/StardewSymphony.cs b/GeneralMods/StardewSymphony/StardewSymphony.cs
index 614d3704..1dc12dd0 100644
--- a/GeneralMods/StardewSymphony/StardewSymphony.cs
+++ b/GeneralMods/StardewSymphony/StardewSymphony.cs
@@ -166,6 +166,7 @@ namespace Omegasis.StardewSymphony
if (!Context.IsWorldReady)
return;
+
this.SelectMusic();
}
diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Menus/MusicManagerMenu.cs b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Menus/MusicManagerMenu.cs
index 9e15db99..87688a32 100644
--- a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Menus/MusicManagerMenu.cs
+++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Menus/MusicManagerMenu.cs
@@ -16,9 +16,20 @@ using StardustCore.UIUtilities.SpriteFonts.Components;
namespace StardewSymphonyRemastered.Framework.Menus
{
-
+ /* TODO: Make the different menus for the conditional keys
+ * Normal (locations, season, weather,date, time)
+ * Festival
+ * Event
+ *
+ */
+ ///
+ /// Interface for the menu for selection music.
+ ///
public class MusicManagerMenu : IClickableMenuExtended
{
+ ///
+ /// The different displays for this menu.
+ ///
public enum DrawMode
{
AlbumSelection,
@@ -26,15 +37,15 @@ namespace StardewSymphonyRemastered.Framework.Menus
SongSelectionMode,
}
- public List musicAlbumButtons;
+ public List musicAlbumButtons;
public Button currentMusicPackAlbum;
public Button currentSelectedSong;
public DrawMode drawMode;
public int currentAlbumIndex;
public int currentSongPageIndex;
- public List fancyButtons;
- public int framesSinceLastUpdate;
+ public List fancyButtons; //List that holds all of the buttons for the fancy album menu.
+ public int framesSinceLastUpdate; //Used to control how fast we can cycle through the menu.
public bool searchBoxSelected;
@@ -278,7 +289,12 @@ namespace StardewSymphonyRemastered.Framework.Menus
}
}
-
+ ///
+ /// Functionality that occurs when right clicking a menu component.
+ ///
+ ///
+ ///
+ ///
public override void receiveRightClick(int x, int y, bool playSound = true)
{
if (this.drawMode == DrawMode.AlbumSelection)
@@ -303,6 +319,11 @@ namespace StardewSymphonyRemastered.Framework.Menus
}
}
+ ///
+ /// Actions that occur when hovering over an icon.
+ ///
+ ///
+ ///
public override void performHoverAction(int x, int y)
{
if (this.drawMode == DrawMode.AlbumSelection)
@@ -374,6 +395,12 @@ namespace StardewSymphonyRemastered.Framework.Menus
}
}
+ ///
+ /// Functionality that occurs when left clicking a menu component.
+ ///
+ ///
+ ///
+ ///
public override void receiveLeftClick(int x, int y, bool playSound = true)
{
if (this.drawMode == DrawMode.AlbumSelection)
diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/MusicManager.cs b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/MusicManager.cs
index a14416f6..c5557a7e 100644
--- a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/MusicManager.cs
+++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/MusicManager.cs
@@ -190,6 +190,49 @@ namespace StardewSymphonyRemastered.Framework
return listOfValidDictionaries;
}
+ public Dictionary> getListOfApplicableMusicPacksForFestivals()
+ {
+ Dictionary> listOfValidDictionaries = new Dictionary>();
+ foreach (var v in this.musicPacks)
+ {
+ try
+ {
+ var songList = v.Value.songInformation.getFestivalMusic();
+ if (songList.Count > 0)
+ {
+ listOfValidDictionaries.Add(v.Value, songList);
+ }
+ }
+ catch (Exception err)
+ {
+
+ }
+ }
+ return listOfValidDictionaries;
+ }
+
+
+ public Dictionary> getListOfApplicableMusicPacksForEvents()
+ {
+ Dictionary> listOfValidDictionaries = new Dictionary>();
+ foreach (var v in this.musicPacks)
+ {
+ try
+ {
+ var songList = v.Value.songInformation.getEventMusic();
+ if (songList.Count > 0)
+ {
+ listOfValidDictionaries.Add(v.Value, songList);
+ }
+ }
+ catch (Exception err)
+ {
+
+ }
+ }
+ return listOfValidDictionaries;
+ }
+
///
/// Selects the actual song to be played right now based off of the selector key. The selector key should be called when the player's location changes.
///
@@ -223,7 +266,7 @@ namespace StardewSymphonyRemastered.Framework
if (listOfValidMusicPacks.Count == 0)
{
//No valid songs to play at this time.
- StardewSymphony.ModMonitor.Log("Error: There are no songs to play across any music pack for the song key: " + subKey + ". Are you sure you did this properly?");
+ StardewSymphony.ModMonitor.Log("Error: There are no songs to play across any music pack for the song key: " + subKey + ". 1 Are you sure you did this properly?");
//return;
}
}
@@ -244,15 +287,22 @@ namespace StardewSymphonyRemastered.Framework
}
if (string.IsNullOrEmpty(subKey))
{
- StardewSymphony.ModMonitor.Log("Error: There are no songs to play across any music pack for the song key: " + songListKey + ". Are you sure you did this properly?");
- return;
+
+ bool f = checkGenericMusic(songListKey);
+
+ if (f == false)
+ {
+ StardewSymphony.ModMonitor.Log("Error: There are no songs to play across any music pack for the song key: " + songListKey + ".2 Are you sure you did this properly?");
+ StardewSymphony.menuChangedMusic = false;
+ return;
+ }
}
StardewSymphony.ModMonitor.Log(subKey, StardewModdingAPI.LogLevel.Alert);
listOfValidMusicPacks = getListOfApplicableMusicPacks(subKey);
if (listOfValidMusicPacks.Count == 0)
{
//No valid songs to play at this time.
- StardewSymphony.ModMonitor.Log("Error: There are no songs to play across any music pack for the song key: " + subKey + ". Are you sure you did this properly?");
+ StardewSymphony.ModMonitor.Log("Error: There are no songs to play across any music pack for the song key: " + subKey + ".3 Are you sure you did this properly?");
//return;
}
//Try to get more specific.
@@ -277,19 +327,28 @@ namespace StardewSymphonyRemastered.Framework
if (listOfValidMusicPacks.Count == 0)
{
//No valid songs to play at this time.
- StardewSymphony.ModMonitor.Log("Error: There are no songs to play across any music pack for the song key: " + subKey + ". Are you sure you did this properly?");
+ StardewSymphony.ModMonitor.Log("Error: There are no songs to play across any music pack for the song key: " + subKey + ".4 Are you sure you did this properly?");
//return;
}
}
}
+ //If the list of valid packs are 0, check if I'm currently at an event or festival and try to play a generalized song from there.
if (listOfValidMusicPacks.Count == 0)
{
- //No valid songs to play at this time.
- StardewSymphony.ModMonitor.Log("Error: There are no songs to play across any music pack for the song key: " + songListKey + ". Are you sure you did this properly?");
- return;
+
+ bool f= checkGenericMusic(songListKey);
+
+ if (f == false)
+ {
+ //No valid songs to play at this time.
+ StardewSymphony.ModMonitor.Log("Error: There are no songs to play across any music pack for the song key: " + songListKey + ".7 Are you sure you did this properly?");
+ StardewSymphony.menuChangedMusic = false;
+ return;
+ }
}
+ //If there is a valid key for the place/time/event/festival I am at, play it!
int randInt = packSelector.Next(0, listOfValidMusicPacks.Count-1);
@@ -306,6 +365,72 @@ namespace StardewSymphonyRemastered.Framework
}
+ public bool checkGenericMusic(string songListKey)
+ {
+ if (Game1.CurrentEvent != null)
+ {
+ if (Game1.CurrentEvent.isFestival)
+ {
+ //Try to play a generalized festival song.
+ var listOfFestivalPacks = this.getListOfApplicableMusicPacksForFestivals();
+ if (listOfFestivalPacks.Count > 0)
+ {
+ int randFestivalPack = packSelector.Next(0, listOfFestivalPacks.Count - 1);
+
+ var festivalMusicPackPair = listOfFestivalPacks.ElementAt(randFestivalPack);
+
+ //used to swap the music packs and stop the last playing song.
+ this.swapMusicPacks(festivalMusicPackPair.Key.musicPackInformation.name);
+
+ int randFestivalPack2 = songSelector.Next(0, festivalMusicPackPair.Value.Count);
+
+ var festivalSongName = festivalMusicPackPair.Value.ElementAt(randFestivalPack2);
+
+ this.currentMusicPack.playSong(festivalSongName.name);
+ StardewSymphony.menuChangedMusic = false;
+ return true;
+ }
+ else
+ {
+ StardewSymphony.ModMonitor.Log("Error: There are no songs to play across any music pack for the song key: " + songListKey + ".5 Are you sure you did this properly?");
+ StardewSymphony.ModMonitor.Log("Also failed playing a festival event song.");
+ StardewSymphony.menuChangedMusic = false;
+ return false;
+ }
+ }
+ else
+ {
+ //Try to play a generalized event song.
+ var listOfEventPacks = this.getListOfApplicableMusicPacksForEvents();
+ if (listOfEventPacks.Count > 0)
+ {
+ int randEventPack = packSelector.Next(0, listOfEventPacks.Count - 1);
+
+ var eventMusicPackPair = listOfEventPacks.ElementAt(randEventPack);
+
+ //used to swap the music packs and stop the last playing song.
+ this.swapMusicPacks(eventMusicPackPair.Key.musicPackInformation.name);
+
+ int randEventPack2 = songSelector.Next(0, eventMusicPackPair.Value.Count);
+
+ var eventSongName = eventMusicPackPair.Value.ElementAt(randEventPack2);
+
+ this.currentMusicPack.playSong(eventSongName.name);
+ StardewSymphony.menuChangedMusic = false;
+ return true;
+ }
+ else
+ {
+ StardewSymphony.ModMonitor.Log("Error: There are no songs to play across any music pack for the song key: " + songListKey + ".6 Are you sure you did this properly?");
+ StardewSymphony.ModMonitor.Log("Also failed playing a generalized event song.");
+ StardewSymphony.menuChangedMusic = false;
+ return false;
+ }
+ }
+ }
+ return false;
+ }
+
///
/// Adds a valid xwb music pack to the list of music packs available.
///
@@ -346,7 +471,9 @@ namespace StardewSymphonyRemastered.Framework
this.musicPacks.Add(musicPack.musicPackInformation.name,musicPack);
}
-
+ ///
+ /// Initializes all of the potential key triggers for playing songs.
+ ///
public void initializeSeasonalMusic()
{
foreach(var pack in this.musicPacks)
@@ -355,6 +482,43 @@ namespace StardewSymphonyRemastered.Framework
}
}
+ ///
+ /// Initializes all of the potential key triggers for playing songs.
+ ///
+ public void initializeMenuMusic()
+ {
+ foreach (var pack in this.musicPacks)
+ {
+ pack.Value.songInformation.initializeMenuMusic();
+ }
+ }
+
+ ///
+ /// Initializes all of the potential key triggers for playing songs.
+ ///
+ public void initializeFestivalMusic()
+ {
+ foreach (var pack in this.musicPacks)
+ {
+ pack.Value.songInformation.initializeFestivalMusic();
+ }
+ }
+
+ ///
+ /// Initializes all of the potential key triggers for playing songs.
+ ///
+ public void initializeEventMusic()
+ {
+ foreach (var pack in this.musicPacks)
+ {
+ pack.Value.songInformation.initializeEventMusic();
+ }
+ }
+
+ ///
+ /// Play a random song from a given music pack.
+ ///
+ ///
public void playRandomSongFromPack(string musicPackName)
{
this.musicPacks.TryGetValue(musicPackName, out MusicPack musicPack);
diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/SongSpecifics.cs b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/SongSpecifics.cs
index 3b622bec..4614cde6 100644
--- a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/SongSpecifics.cs
+++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/SongSpecifics.cs
@@ -9,28 +9,31 @@ namespace StardewSymphonyRemastered.Framework
{
///
/// Stores information about what songs play when.
- ///
- /// TODO: Festivals and events
///
public class SongSpecifics
{
- public Dictionary> listOfSongsWithTriggers; //triggerName,
+ public Dictionary> listOfSongsWithTriggers; //triggerName, . Seasonal music
- public Dictionary> eventSongs;
- public Dictionary> festivalSongs;
+ public List listOfSongsWithoutTriggers;
- public List listOfSongsWithoutTriggers;
+
+ public List festivalSongs;
+ public List eventSongs;
public static List locations = new List();
public static List festivals = new List();
public static List events = new List();
+ ///
+ /// Keeps track of the menus that support custom music with this mod.
+ ///
+ public static List menus = new List();
+
string[] seasons;
string[] weather;
string[] daysOfWeek;
string[] timesOfDay;
- List menus;
public static char seperator = '_';
///
@@ -52,7 +55,6 @@ namespace StardewSymphonyRemastered.Framework
"rainy",
"debris",
"lightning",
- "festival",
"snow",
"wedding"
};
@@ -71,17 +73,13 @@ namespace StardewSymphonyRemastered.Framework
"day",
"night"
};
- menus = new List();
-
- menus.Add(typeof(StardewValley.Menus.TitleMenu).ToString().Replace('.', seperator));
listOfSongsWithTriggers = new Dictionary>();
- eventSongs = new Dictionary>();
- festivalSongs = new Dictionary>();
-
this.listOfSongsWithoutTriggers = new List();
- this.addMenuMusic();
+ this.eventSongs = new List();
+ this.festivalSongs = new List();
+
}
@@ -100,23 +98,41 @@ namespace StardewSymphonyRemastered.Framework
{
string key = "";
bool foundMenuString = false;
- if (Game1.eventUp == true)
+ //Event id's are the number found before the : for the event in Content/events/.yaml file where location is the name of the stardew valley location.
+ if (Game1.eventUp == true && Game1.CurrentEvent.isFestival==false)
{
//Get the event id an hijack it with some different music
//String key="Event_EventName";
+
+ var reflected = StardewSymphony.ModHelper.Reflection.GetField(Game1.CurrentEvent, "id", true);
+
+ int id = reflected.GetValue();
+ key= id.ToString(); //get the event id. Really really messy.
+ return key;
+
}
else if (Game1.isFestival())
{
- //hijack the name of the festival and load some different songs
- // string s="Festival_FestivalName";
+ //hijack the date of the festival and load some different songs
+ // string s="Festival name"
+ key = Game1.CurrentEvent.FestivalName;
+ return key;
}
else if (Game1.activeClickableMenu!=null)
{
- if (Game1.activeClickableMenu.GetType() == typeof(StardewValley.Menus.TitleMenu))
+ String name = Game1.activeClickableMenu.GetType().ToString().Replace('.', seperator);
+ //Iterate through all of the potential menu options and check if it is valid.
+ foreach (var menuNamespaceName in menus)
{
- key = Game1.activeClickableMenu.GetType().ToString().Replace('.',seperator);
- foundMenuString = true;
+ if (name == menuNamespaceName)
+ {
+ key =name;
+ foundMenuString = true;
+ StardewSymphony.menuChangedMusic = true;
+ return key;
+ }
}
+ return ""; //No menu found so don't event try to change the music.
}
else
@@ -137,26 +153,52 @@ namespace StardewSymphonyRemastered.Framework
///
/// Initialize the location lists with the names of all of the major locations in the game.
///
- public static void addLocations()
+ public static void initializeLocationsList()
{
+ //Give stardew symphony access to have unique music at any game location.
foreach (var v in Game1.locations)
{
locations.Add(v.name);
StardewSymphony.ModMonitor.Log("Adding in song triggers for location: " + v.name);
}
+
+ //Try to get stardew symphony to recognize builds on the farm and try to give those buildings unique soundtracks as well.
+ try
+ {
+ var farm = (Farm)Game1.getLocationFromName("Farm");
+ foreach(var building in farm.buildings)
+ {
+ locations.Add(building.nameOfIndoors);
+ StardewSymphony.ModMonitor.Log("Adding in song triggers for location: " + building.nameOfIndoors);
+ }
+ }
+ catch(Exception err)
+ {
+ StardewSymphony.ModMonitor.Log(err.ToString());
+ }
+
}
///
- /// TODO: Find a way to get all of the festivals in the game for this list. Perhapse have a way to check the season and day of the month and equivilate it to something.
- /// Initialize list of festivals for the game.
+ /// Initializes a list of the festivals included in vanilla stardew valley to be allowed to have custom music options.
+ /// Initialized by festival name
///
- public static void addFestivals()
+ public static void initializeFestivalsList()
{
- //Do some logic for festivals here.
+ addFestival("Egg Festival"); //Egg festival
+ addFestival("Flower Dance"); //Flower dance
+ addFestival("Luau"); //luau
+ addFestival("Dance Of The Moonlight Jellies"); //moonlight jellies
+ addFestival("Stardew Valley Fair"); //fall fair
+ addFestival("Spirit's Eve"); //spirits eve
+ addFestival("Festival of Ice"); //festival of ice
+ addFestival("Feast of the Winter Star"); //festival of winter star
}
///
- /// Add a specific new festival to the list
+ /// Add a specific new festival to the list. Must be in the format seasonDay.
+ /// Ex) spring13
+ /// Ex) fall27
///
public static void addFestival(string name)
{
@@ -167,17 +209,19 @@ namespace StardewSymphonyRemastered.Framework
/// TODO: Get a list of all of the vanilla events in the game. But how to determine what event is playing is the question.
///
///
- public static void addEvents()
+ public static void initializeEventsList()
{
//Do some logic here
+ //addEvent(12345.ToString());
}
///
/// TODO: Custom way to add in event to hijack music.
///
///
- public static void addEvent(string name)
+ public static void addEvent(string id)
{
+ events.Add(id);
//Do some logic here
}
@@ -244,14 +288,15 @@ namespace StardewSymphonyRemastered.Framework
///
public static string getWeatherString()
{
- if (Game1.weatherIcon == Game1.weather_sunny) return "sunny";
- if (Game1.weatherIcon == Game1.weather_rain) return "rainy";
- if (Game1.weatherIcon == Game1.weather_debris) return "lightning";
- if (Game1.weatherIcon == Game1.weather_lightning) return "debris"; //????
- if (Game1.weatherIcon == Game1.weather_festival) return "festival";
- if (Game1.weatherIcon == Game1.weather_snow) return "snow";
- if (Game1.weatherIcon == Game1.weather_wedding) return "wedding";
- return "";
+
+ if (Game1.isRaining && Game1.isLightning==false) return "rainy";
+ if (Game1.isLightning) return "lightning";
+ 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.
}
///
@@ -270,7 +315,14 @@ namespace StardewSymphonyRemastered.Framework
///
public static string getLocationString()
{
- return Game1.currentLocation.name;
+ try
+ {
+ return Game1.currentLocation.name;
+ }
+ catch(Exception err)
+ {
+ return "";
+ }
}
public static string getCurrentMenuString()
@@ -284,24 +336,136 @@ namespace StardewSymphonyRemastered.Framework
// Non-Static Methods //
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
+
+
+
#region
///
/// Adds the song's reference to a music pack.
///
- ///
+ /// The FULL namespace of the menu. Example is StardewValley.Menus.TitleMenu
public void addSongToMusicPack(Song song)
{
this.listOfSongsWithoutTriggers.Add(song);
}
- public void addMenuMusic()
+ ///
+ /// Initialize a basic list of menus supported.
+ ///
+ public static void initializeMenuList()
+ {
+ addMenu(typeof(StardewValley.Menus.TitleMenu)); //Of course!
+ addMenu(typeof(StardewValley.Menus.AboutMenu)); //Sure, though I doubt many people look at this menu.
+ addMenu(typeof(StardewValley.Menus.Billboard)); //The billboard in town.
+ addMenu(typeof(StardewValley.Menus.BlueprintsMenu)); // the crafting menu.
+ //addMenu(typeof(StardewValley.Menus.BobberBar)); //Fishing.
+ addMenu(typeof(StardewValley.Menus.Bundle)); //Definitely could be fun. Custom bundle menu music.
+ addMenu(typeof(StardewValley.Menus.CarpenterMenu)); //Building a thing with robbin
+ addMenu(typeof(StardewValley.Menus.CataloguePage)); //???
+ addMenu(typeof(StardewValley.Menus.CharacterCustomization)); //Yea!
+ addMenu(typeof(StardewValley.Menus.CollectionsPage));
+ addMenu(typeof(StardewValley.Menus.CooperativeMenu));
+ addMenu(typeof(StardewValley.Menus.CraftingPage));
+ addMenu(typeof(StardewValley.Menus.Fish)); //Music when fishing
+ addMenu(typeof(StardewValley.Menus.GameMenu)); //Err default inventory page?
+ addMenu(typeof(StardewValley.Menus.GeodeMenu)); //Flint
+ addMenu(typeof(StardewValley.Menus.LoadGameMenu)); //Loading the game.
+ addMenu(typeof(StardewValley.Menus.LevelUpMenu)); //Leveling up
+ addMenu(typeof(StardewValley.Menus.LetterViewerMenu)); //Viewing your mail
+ addMenu(typeof(StardewValley.Menus.MapPage)); //Looking at the map
+ addMenu(typeof(StardewValley.Menus.MuseumMenu)); //Arranging things in the museum
+ addMenu(typeof(StardewValley.Menus.NamingMenu)); //Naming an animal
+ addMenu(typeof(StardewValley.Menus.PurchaseAnimalsMenu)); //Buying an animal.
+ addMenu(typeof(StardewValley.Menus.SaveGameMenu)); //Saving the game / end of night
+ addMenu(typeof(StardewValley.Menus.ShippingMenu)); //Shipping screen.
+ addMenu(typeof(StardewValley.Menus.ShopMenu)); //Buying things
+
+ }
+
+ ///
+ /// Add a menu to stardew symphony so that it may have unique music.
+ ///
+ ///
+ public static void addMenu(string name)
+ {
+ try
+ {
+ name = name.Replace('.', seperator); //Sanitize the name passed in to use my parsing conventions.
+ menus.Add(name);
+ }
+ catch(Exception err)
+ {
+
+ }
+ }
+
+ ///
+ /// Add amenu to stardew symphony so that it may have unique music.
+ ///
+ /// The type of menu to add in. Typically this is typeof(MyMenuClass)
+ public static void addMenu(Type menuType)
+ {
+ try
+ {
+ string name = menuType.ToString().Replace('.', seperator); //Sanitize the name passed in to use my parsing conventions.
+ menus.Add(name); //Add the sanitized menu name to the list of menus that have custom music.
+ }
+ catch(Exception err)
+ {
+
+ }
+ }
+
+ ///
+ /// Initialize the music packs with music from all passed in menus.
+ ///
+ public void initializeMenuMusic()
{
foreach(var v in menus)
{
- this.listOfSongsWithTriggers.Add(v, new List());
+ try
+ {
+ this.listOfSongsWithTriggers.Add(v, new List());
+ }
+ catch(Exception err)
+ {
+
+ }
}
}
+ public void initializeFestivalMusic()
+ {
+ foreach (var v in festivals)
+ {
+ try
+ {
+ this.listOfSongsWithTriggers.Add(v, new List());
+ }
+ catch (Exception err)
+ {
+
+ }
+ }
+ }
+
+ public void initializeEventMusic()
+ {
+ foreach (var v in events)
+ {
+ try
+ {
+ this.listOfSongsWithTriggers.Add(v, new List());
+ }
+ catch (Exception err)
+ {
+
+ }
+ }
+ }
+
+
+
///
/// Checks if the song exists at all in this music pack.
///
@@ -366,48 +530,55 @@ namespace StardewSymphonyRemastered.Framework
public KeyValuePair>getSongList(string key)
{
string keyPhrase = "";
+ string keyPhraseInfo = "";
try
{
keyPhrase= key.Split(seperator).ElementAt(0);
+ keyPhraseInfo= key.Split(seperator).ElementAt(1);
}
catch(Exception err)
{
keyPhrase = key;
}
- if (keyPhrase == "event")
- {
-
- foreach (KeyValuePair> pair in eventSongs)
- {
- if (pair.Key == key) return pair;
- }
-
- //return new KeyValuePair>(key, eventSongs[key]);
- }
- else if (keyPhrase == "festival")
- {
-
- foreach (KeyValuePair> pair in festivalSongs)
- {
- if (pair.Key == key) return pair;
- }
-
- //return new KeyValuePair>(key, festivalSongs[key]);
- }
- else
- {
-
+
+ //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]);
+
+
+ //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);
}
+ public List getFestivalMusic()
+ {
+ return this.festivalSongs;
+ }
+
+ public List getEventMusic()
+ {
+ return this.eventSongs;
+ }
+
///
/// Add a song name to a specific list of songs to play that will play under certain conditions.
///
diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/StardewSymphony.cs b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/StardewSymphony.cs
index a4d993c9..78579fc4 100644
--- a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/StardewSymphony.cs
+++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/StardewSymphony.cs
@@ -19,10 +19,21 @@ namespace StardewSymphonyRemastered
/// TODO:
/// -Make way to swap between album menu draw modes
/// -make a currently playing menu off to the side to tell you what song is playing from what album.
+ /// Make songs work for festivals and events.
+ /// Finish making triggers menus
/// 3.Make interface.
/// 5.Release
/// 6.Make videos documenting how to make this mod work.
/// 7.Make way to generate new music packs.
+ ///
+ ///
+ /// Add mod config to have silent rain option.
+ /// Add in song delay function.
+ /// Add in shuffle song button that just selects music but probably plays a different song. same as musicManager.selectmusic(getConditionalString);
+ ///
+ ///
+ /// Notes:
+ /// All mods must add events/locations/festivals/menu information to this mod during the Entry function of their mod because once the game does it's first update tick, that's when all of the packs are initialized with all of their music.
///
public class StardewSymphony : Mod
{
@@ -43,6 +54,14 @@ namespace StardewSymphonyRemastered
public bool musicPacksInitialized;
+
+ public static bool festivalStart;
+ public static bool eventStart;
+
+ public static bool menuChangedMusic;
+
+
+
public static TextureManager textureManager;
///
/// Entry point for the mod.
@@ -60,6 +79,13 @@ namespace StardewSymphonyRemastered
StardewModdingAPI.Events.GameEvents.UpdateTick += GameEvents_UpdateTick;
StardewModdingAPI.Events.ControlEvents.KeyPressed += ControlEvents_KeyPressed;
StardewModdingAPI.Events.SaveEvents.BeforeSave += SaveEvents_BeforeSave;
+
+ StardewModdingAPI.Events.MenuEvents.MenuChanged += MenuEvents_MenuChanged;
+ StardewModdingAPI.Events.MenuEvents.MenuClosed += MenuEvents_MenuClosed;
+
+ StardewModdingAPI.Events.GameEvents.FirstUpdateTick += GameEvents_FirstUpdateTick;
+
+
musicManager = new MusicManager();
MusicPath = Path.Combine(ModHelper.DirectoryPath, "Content", "Music");
@@ -74,8 +100,71 @@ namespace StardewSymphonyRemastered
this.createBlankWAVTemplate();
musicPacksInitialized = false;
+ menuChangedMusic = false;
-
+
+ //Initialize all of the lists upon creation during entry.
+ SongSpecifics.initializeMenuList();
+ SongSpecifics.initializeEventsList();
+ SongSpecifics.initializeFestivalsList();
+
+ initializeMusicPacks();
+ }
+
+ ///
+ /// Ran once all of teh entry methods are ran. This will ensure that all custom music from other mods has been properly loaded in.
+ ///
+ ///
+ ///
+ private void GameEvents_FirstUpdateTick(object sender, EventArgs e)
+ {
+ if (musicPacksInitialized == false)
+ {
+ musicManager.initializeMenuMusic(); //Initialize menu music that has been added to SongSpecifics.menus from all other mods during their Entry function.
+ musicManager.initializeFestivalMusic();//Initialize festival music that has been added to SongSpecifics.menus from all other mods during their Entry function.
+ musicManager.initializeEventMusic();//Initialize event music that has been added to SongSpecifics.menus from all other mods during their Entry function.
+ //Note that locations should also be added to SongSpecifics.locations during the mod's respective Entry function.
+ musicPacksInitialized = true;
+ //musicManager.selectMusic(SongSpecifics.getCurrentConditionalString());
+ }
+ }
+
+ ///
+ /// Events to occur after the game has loaded in.
+ ///
+ ///
+ ///
+ private void SaveEvents_AfterLoad(object sender, EventArgs e)
+ {
+
+ //Locaion initialization MUST occur after load. Anything else can occur before.
+ SongSpecifics.initializeLocationsList(); //Gets all Game locations once the player has loaded the game, and all buildings on the player's farm and adds them to a location list.
+ musicManager.initializeSeasonalMusic(); //Initialize the seasonal music using all locations gathered in the location list.
+
+ }
+
+
+ ///
+ /// Choose new music when a menu is closed.
+ ///
+ ///
+ ///
+ private void MenuEvents_MenuClosed(object sender, StardewModdingAPI.Events.EventArgsClickableMenuClosed e)
+ {
+ if (menuChangedMusic == true)
+ {
+ musicManager.selectMusic(SongSpecifics.getCurrentConditionalString());
+ }
+ }
+
+ ///
+ /// Choose new music when a menu is opened.
+ ///
+ ///
+ ///
+ private void MenuEvents_MenuChanged(object sender, StardewModdingAPI.Events.EventArgsClickableMenuChanged e)
+ {
+ musicManager.selectMusic(SongSpecifics.getCurrentConditionalString());
}
private void SaveEvents_BeforeSave(object sender, EventArgs e)
@@ -88,6 +177,11 @@ namespace StardewSymphonyRemastered
*/
}
+ ///
+ /// Fires when a key is pressed to open the music selection menu.
+ ///
+ ///
+ ///
private void ControlEvents_KeyPressed(object sender, StardewModdingAPI.Events.EventArgsKeyPressed e)
{
if (e.KeyPressed == Microsoft.Xna.Framework.Input.Keys.K)
@@ -104,15 +198,29 @@ namespace StardewSymphonyRemastered
///
private void GameEvents_UpdateTick(object sender, EventArgs e)
{
- if (Game1.currentSong != null) Game1.currentSong.Stop(AudioStopOptions.Immediate);
- if (musicPacksInitialized == false)
+ // ModMonitor.Log("HELLO WORLD");
+ if (Game1.currentSong != null)
{
- initializeMusicPacks();
- musicPacksInitialized = true;
- musicManager.selectMusic(SongSpecifics.getCurrentConditionalString());
+ //ModMonitor.Log("STOP THE MUSIC!!!");
+ Game1.currentSong.Stop(AudioStopOptions.Immediate); //stop the normal songs from playing over the new songs
+ Game1.currentSong.Stop(AudioStopOptions.AsAuthored);
+ Game1.nextMusicTrack = ""; //same as above line
}
+
}
+ ///
+ /// Raised when the player changes locations. This should determine the next song to play.
+ ///
+ ///
+ ///
+ private void LocationEvents_CurrentLocationChanged(object sender, StardewModdingAPI.Events.EventArgsCurrentLocationChanged e)
+ {
+ musicManager.selectMusic(SongSpecifics.getCurrentConditionalString());
+ }
+
+
+
///
/// Load in the music packs to the music manager.
///
@@ -267,30 +375,6 @@ namespace StardewSymphonyRemastered
}
}
- ///
- /// Raised when the player changes locations. This should determine the next song to play.
- ///
- ///
- ///
- private void LocationEvents_CurrentLocationChanged(object sender, StardewModdingAPI.Events.EventArgsCurrentLocationChanged e)
- {
- musicManager.selectMusic(SongSpecifics.getCurrentConditionalString());
- }
-
- ///
- /// Events to occur after the game has loaded in.
- ///
- ///
- ///
- private void SaveEvents_AfterLoad(object sender, EventArgs e)
- {
- StardewSymphonyRemastered.Framework.SongSpecifics.addLocations();
- StardewSymphonyRemastered.Framework.SongSpecifics.addFestivals();
- StardewSymphonyRemastered.Framework.SongSpecifics.addEvents();
- musicManager.initializeSeasonalMusic();
-
- }
-
///
/// Reset the music files for the game.