Reenabled Stardew Music and fixed glitch where menus with no music cues would stop all music.
This commit is contained in:
parent
a6257c5d28
commit
dae3beac2d
|
@ -35,5 +35,10 @@ namespace StardewSymphonyRemastered
|
|||
/// Used to write a .json file for every possible option for a music pack. Use at your own risk!
|
||||
/// </summary>
|
||||
public bool writeAllConfigMusicOptions { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Used to completely disable the Stardew Valley OST.
|
||||
/// </summary>
|
||||
public bool disableStardewMusic { get; set; } = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2167,7 +2167,11 @@ namespace StardewSymphonyRemastered.Framework.Menus
|
|||
{
|
||||
if (this.drawMode == DrawMode.WeatherSelection || this.drawMode == DrawMode.TimeSelection || this.drawMode == DrawMode.LocationSelection || this.drawMode == DrawMode.DaySelection || this.drawMode == DrawMode.NothingElseToDisplay)
|
||||
{
|
||||
if (this.selectedJustLocation==false)
|
||||
if (this.drawMode == DrawMode.LocationSelection && this.selectedJustLocation == true)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!doesPackContainMusic())
|
||||
{
|
||||
|
|
|
@ -72,12 +72,32 @@ namespace StardewSymphonyRemastered.Framework
|
|||
{
|
||||
|
||||
if (this.currentMusicPack == null) return;
|
||||
if (this.currentMusicPack.isPlaying())
|
||||
if (StardewSymphonyRemastered.StardewSymphony.Config.disableStardewMusic==true)
|
||||
{
|
||||
return;
|
||||
if (this.currentMusicPack.isPlaying())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
string songName = Game1.currentSong.Name.ToLower();
|
||||
|
||||
if (this.currentMusicPack.isPlaying() || (Game1.currentSong.IsPlaying && !songName.Contains("ambient")) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
if (this.currentMusicPack.isPlaying())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (timer == null)
|
||||
{
|
||||
Random r = new Random(Game1.random.Next());
|
||||
|
@ -92,7 +112,7 @@ namespace StardewSymphonyRemastered.Framework
|
|||
timer.Enabled = true;
|
||||
timer.Elapsed += onTimerFinished;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -112,6 +132,9 @@ namespace StardewSymphonyRemastered.Framework
|
|||
//StardewSymphony.ModMonitor.Log("AHH THE TIMER FINISHED!");
|
||||
timer.Enabled = false;
|
||||
timer.Elapsed -= onTimerFinished;
|
||||
|
||||
|
||||
|
||||
selectMusic(SongSpecifics.getCurrentConditionalString());
|
||||
timer = null;
|
||||
}
|
||||
|
@ -292,6 +315,39 @@ namespace StardewSymphonyRemastered.Framework
|
|||
return listOfValidDictionaries;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void selectMenuMusic(string songListKey)
|
||||
{
|
||||
//Nullify the timer when new music is selected.
|
||||
if (this.timer != null)
|
||||
{
|
||||
this.timer = null;
|
||||
}
|
||||
|
||||
var listOfValidMusicPacks = getListOfApplicableMusicPacks(songListKey);
|
||||
|
||||
if (listOfValidMusicPacks.Count == 0) return;
|
||||
|
||||
|
||||
int randInt = packSelector.Next(0, listOfValidMusicPacks.Count - 1);
|
||||
|
||||
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);
|
||||
|
||||
StardewSymphony.menuChangedMusic = true;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
|
|
|
@ -66,13 +66,13 @@ namespace StardewSymphonyRemastered
|
|||
/// <param name="helper"></param>
|
||||
public override void Entry(IModHelper helper)
|
||||
{
|
||||
Config = helper.ReadConfig<Config>();
|
||||
|
||||
DefaultSoundBank = Game1.soundBank;
|
||||
DefaultWaveBank = Game1.waveBank;
|
||||
ModHelper = helper;
|
||||
ModMonitor = Monitor;
|
||||
Manifest = ModManifest;
|
||||
|
||||
Config = helper.ReadConfig<Config>();
|
||||
StardewModdingAPI.Events.SaveEvents.AfterLoad += SaveEvents_AfterLoad;
|
||||
// StardewModdingAPI.Events.EventArgsLocationsChanged += LocationEvents_CurrentLocationChanged;
|
||||
|
||||
|
@ -199,7 +199,8 @@ namespace StardewSymphonyRemastered
|
|||
/// <param name="e"></param>
|
||||
private void MenuEvents_MenuChanged(object sender, StardewModdingAPI.Events.EventArgsClickableMenuChanged e)
|
||||
{
|
||||
musicManager.selectMusic(SongSpecifics.getCurrentConditionalString());
|
||||
//var ok = musicManager.currentMusicPack.getNameOfCurrentSong();
|
||||
musicManager.selectMenuMusic(SongSpecifics.getCurrentConditionalString());
|
||||
}
|
||||
|
||||
private void SaveEvents_BeforeSave(object sender, EventArgs e)
|
||||
|
@ -233,12 +234,27 @@ namespace StardewSymphonyRemastered
|
|||
/// <param name="e"></param>
|
||||
private void GameEvents_UpdateTick(object sender, EventArgs e)
|
||||
{
|
||||
if (Game1.currentSong != null)
|
||||
if (musicManager == null) return;
|
||||
|
||||
if (Config.disableStardewMusic==true)
|
||||
{
|
||||
//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
|
||||
if (Game1.currentSong != null)
|
||||
{
|
||||
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
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (musicManager.currentMusicPack == null) return;
|
||||
if (Game1.currentSong != null && musicManager.currentMusicPack.isPlaying())
|
||||
{
|
||||
//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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"Name": "Stardew Symphony Remastered",
|
||||
"Author": "Alpha_Omegasis",
|
||||
"Version": "2.1.6",
|
||||
"Version": "2.1.7",
|
||||
"Description": "Adding more music to the game one beep at a time. Now with streaming!",
|
||||
"UniqueID": "Omegasis.StardewSymphonyRemastered",
|
||||
"EntryDll": "StardewSymphonyRemastered.dll",
|
||||
|
|
Loading…
Reference in New Issue