Mod config, log surpressing, menu/location music working, just need to polish the menu and I'll be done!

This commit is contained in:
2018-06-01 12:09:50 -07:00
parent 02d3ab39e5
commit 70885979ed
14 changed files with 241 additions and 139 deletions

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StardewSymphonyRemastered
{
public class Config
{
public bool EnableDebugLog { get; set; }=false;
public int MinimumDelayBetweenSongsInMilliseconds { get; set; }=5000;
public int MaximumDelayBetweenSongsInMilliseconds { get; set; }=60000;
public string KeyBinding { get; set; }="L";
}
}

View File

@ -14,12 +14,6 @@ using StardustCore.UIUtilities.SpriteFonts.Components;
namespace StardewSymphonyRemastered.Framework.Menus namespace StardewSymphonyRemastered.Framework.Menus
{ {
/*
* make buttons make sounds when clicked
* Make sound player mod?
*
*/
/// <summary> /// <summary>
/// Interface for the menu for selection music. /// Interface for the menu for selection music.
/// </summary> /// </summary>
@ -537,7 +531,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
Texture2DExtended springTexture = StardewSymphony.textureManager.getTexture("SpringIcon"); Texture2DExtended springTexture = StardewSymphony.textureManager.getTexture("SpringIcon");
if (springTexture == null) if (springTexture == null)
{ {
StardewSymphony.ModMonitor.Log("TEXTURE NULL!"); if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("SPRING TEXTURE NULL!");
return; return;
} }
float scale = 1.00f / ((float)springTexture.texture.Width / 64f); float scale = 1.00f / ((float)springTexture.texture.Width / 64f);
@ -550,7 +545,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
Texture2DExtended summerTexture = StardewSymphony.textureManager.getTexture("SummerIcon"); Texture2DExtended summerTexture = StardewSymphony.textureManager.getTexture("SummerIcon");
if (summerTexture == null) if (summerTexture == null)
{ {
StardewSymphony.ModMonitor.Log("TEXTURE NULL!"); if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("SUMMER TEXTURE NULL!");
return; return;
} }
float scale = 1.00f / ((float)summerTexture.texture.Width / 64f); float scale = 1.00f / ((float)summerTexture.texture.Width / 64f);
@ -563,7 +559,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
Texture2DExtended fallTexture = StardewSymphony.textureManager.getTexture("FallIcon"); Texture2DExtended fallTexture = StardewSymphony.textureManager.getTexture("FallIcon");
if (fallTexture == null) if (fallTexture == null)
{ {
StardewSymphony.ModMonitor.Log("TEXTURE NULL!"); if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("FALL TEXTURE NULL!");
return; return;
} }
float scale = 1.00f / ((float)fallTexture.texture.Width / 64f); float scale = 1.00f / ((float)fallTexture.texture.Width / 64f);
@ -576,7 +573,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
Texture2DExtended winterTexture = StardewSymphony.textureManager.getTexture("WinterIcon"); Texture2DExtended winterTexture = StardewSymphony.textureManager.getTexture("WinterIcon");
if (winterTexture == null) if (winterTexture == null)
{ {
StardewSymphony.ModMonitor.Log("TEXTURE NULL!"); if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("WINTER TEXTURE NULL!");
return; return;
} }
float scale = 1.00f / ((float)winterTexture.texture.Width / 64f); float scale = 1.00f / ((float)winterTexture.texture.Width / 64f);
@ -595,7 +593,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
this.fancyButtons.Add(new Button("FestivalIcon", new Rectangle((int)festivalPlacement.X, (int)festivalPlacement.Y, 64, 64), festivalTexture, "Festival Music", festivalSrcRect, festivalScale, new Animation(festivalSrcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null))); this.fancyButtons.Add(new Button("FestivalIcon", new Rectangle((int)festivalPlacement.X, (int)festivalPlacement.Y, 64, 64), festivalTexture, "Festival Music", festivalSrcRect, festivalScale, new Animation(festivalSrcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
if (festivalTexture == null) if (festivalTexture == null)
{ {
StardewSymphony.ModMonitor.Log("TEXTURE NULL!"); if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("FESTIVAL TEXTURE NULL!");
return; return;
} }
@ -607,7 +606,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
if (eventTexture == null) if (eventTexture == null)
{ {
StardewSymphony.ModMonitor.Log("TEXTURE NULL!"); if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("EVENT TEXTURE NULL!");
return; return;
} }
@ -619,7 +619,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
if (menuTexture == null) if (menuTexture == null)
{ {
StardewSymphony.ModMonitor.Log("TEXTURE NULL!"); if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("MENU TEXTURE NULL!");
return; return;
} }
} }
@ -898,35 +899,27 @@ namespace StardewSymphonyRemastered.Framework.Menus
{ {
if (v == null) if (v == null)
{ {
// StardewSymphony.ModMonitor.Log("v is null at count: " + count);
continue; continue;
} }
if (v.buttonFunctionality == null) if (v.buttonFunctionality == null)
{ {
// StardewSymphony.ModMonitor.Log("button functionality is null at count: " + count);
continue; continue;
} }
if (v.buttonFunctionality.hover == null) if (v.buttonFunctionality.hover == null)
{ {
// StardewSymphony.ModMonitor.Log("hover is null at count: " + count);
continue; continue;
} }
if (v.buttonFunctionality.hover.paramaters == null) if (v.buttonFunctionality.hover.paramaters == null)
{ {
// StardewSymphony.ModMonitor.Log("Params are null at count: " + count);
continue; continue;
} }
if (v.buttonFunctionality.hover.paramaters.Count==0) if (v.buttonFunctionality.hover.paramaters.Count==0)
{ {
//StardewSymphony.ModMonitor.Log("Params are 0 at count: " + count);
continue; continue;
} }
var pair = (KeyValuePair<string, MusicPack>)v.buttonFunctionality.hover.paramaters[0]; var pair = (KeyValuePair<string, MusicPack>)v.buttonFunctionality.hover.paramaters[0];
v.hoverText = (string)pair.Key; v.hoverText = (string)pair.Key;
//if (v.buttonFunctionality.hover != null) v.buttonFunctionality.hover.run();
//StardewSymphony.ModMonitor.Log(pair.Key);
v.onHover(); v.onHover();
//StardewSymphony.ModMonitor.Log(pair.Key);
} }
else else
{ {
@ -953,30 +946,35 @@ namespace StardewSymphonyRemastered.Framework.Menus
if(this.currentSelectedSong!=null && this.currentMusicPackAlbum!=null && this.playButton.containsPoint(x, y)) if(this.currentSelectedSong!=null && this.currentMusicPackAlbum!=null && this.playButton.containsPoint(x, y))
{ {
Game1.playSound("coin");
playSong(); playSong();
return; return;
} }
if (this.currentSelectedSong != null && this.currentMusicPackAlbum != null && this.stopButton.containsPoint(x, y)) if (this.currentSelectedSong != null && this.currentMusicPackAlbum != null && this.stopButton.containsPoint(x, y))
{ {
Game1.playSound("coin");
stopSong(); stopSong();
return; return;
} }
if (this.currentSelectedSong != null && this.currentMusicPackAlbum != null && this.addButton.containsPoint(x, y)) if (this.currentSelectedSong != null && this.currentMusicPackAlbum != null && this.addButton.containsPoint(x, y))
{ {
Game1.playSound("coin");
addSong(); addSong();
return; return;
} }
if (this.currentSelectedSong != null && this.currentMusicPackAlbum != null && this.deleteButton.containsPoint(x, y)) if (this.currentSelectedSong != null && this.currentMusicPackAlbum != null && this.deleteButton.containsPoint(x, y))
{ {
Game1.playSound("coin");
deleteSong(); deleteSong();
return; return;
} }
if (this.backButton.containsPoint(x, y)) if (this.backButton.containsPoint(x, y))
{ {
Game1.playSound("coin");
goBack(); goBack();
return; return;
} }
@ -988,6 +986,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
{ {
if (v.containsPoint(x, y)) if (v.containsPoint(x, y))
{ {
Game1.playSound("coin");
this.selectAlbum(v); this.selectAlbum(v);
v.onLeftClick(); v.onLeftClick();
} }
@ -1003,10 +1002,9 @@ namespace StardewSymphonyRemastered.Framework.Menus
{ {
if (v.containsPoint(x, y) && v.buttonFunctionality.leftClick != null) if (v.containsPoint(x, y) && v.buttonFunctionality.leftClick != null)
{ {
Game1.playSound("coin");
v.onLeftClick(); v.onLeftClick();
this.currentAlbumIndex += count - 3; this.currentAlbumIndex += count - 3;
//if (this.currentAlbumIndex >= this.musicAlbumButtons.Count) this.currentAlbumIndex -= (this.musicAlbumButtons.Count);
//StardewSymphony.ModMonitor.Log(this.currentAlbumIndex.ToString());
while (currentAlbumIndex < 0) while (currentAlbumIndex < 0)
{ {
this.currentAlbumIndex = (this.musicAlbumButtons.Count - (this.currentAlbumIndex * -1)); this.currentAlbumIndex = (this.musicAlbumButtons.Count - (this.currentAlbumIndex * -1));
@ -1018,9 +1016,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
count++; count++;
} }
} }
//this.updateFancyButtons();
this.selectAlbum(ok); this.selectAlbum(ok);
//return;
} }
if (this.drawMode == DrawMode.SongSelectionMode) if (this.drawMode == DrawMode.SongSelectionMode)
@ -1058,6 +1054,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
{ {
if (v.containsPoint(x, y)) if (v.containsPoint(x, y))
{ {
Game1.playSound("coin");
selectSong(v); selectSong(v);
songSelected = true; songSelected = true;
} }
@ -1105,7 +1102,11 @@ namespace StardewSymphonyRemastered.Framework.Menus
} }
} }
} }
if (buttonSelected == true) this.updateFancyButtons(); if (buttonSelected == true)
{
Game1.playSound("coin");
this.updateFancyButtons();
}
return; return;
} }
@ -1126,7 +1127,11 @@ namespace StardewSymphonyRemastered.Framework.Menus
} }
} }
} }
if (buttonSelected == true) this.updateFancyButtons(); if (buttonSelected == true)
{
Game1.playSound("coin");
this.updateFancyButtons();
}
return; return;
} }
@ -1147,7 +1152,11 @@ namespace StardewSymphonyRemastered.Framework.Menus
} }
} }
} }
if (buttonSelected == true) this.updateFancyButtons(); if (buttonSelected == true)
{
Game1.playSound("coin");
this.updateFancyButtons();
}
return; return;
} }
@ -1195,6 +1204,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
} }
if (songSelected == true) if (songSelected == true)
{ {
Game1.playSound("coin");
this.updateFancyButtons(); this.updateFancyButtons();
} }
return; return;
@ -1244,6 +1254,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
} }
if (songSelected == true) if (songSelected == true)
{ {
Game1.playSound("coin");
this.updateFancyButtons(); this.updateFancyButtons();
} }
return; return;
@ -1292,6 +1303,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
} }
if (songSelected == true) if (songSelected == true)
{ {
Game1.playSound("coin");
this.updateFancyButtons(); this.updateFancyButtons();
} }
return; return;
@ -1340,6 +1352,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
} }
if (songSelected == true) if (songSelected == true)
{ {
Game1.playSound("coin");
this.updateFancyButtons(); this.updateFancyButtons();
} }
return; return;
@ -1361,7 +1374,11 @@ namespace StardewSymphonyRemastered.Framework.Menus
buttonSelected = true; buttonSelected = true;
} }
} }
if (buttonSelected == true) this.updateFancyButtons(); if (buttonSelected == true)
{
Game1.playSound("coin");
this.updateFancyButtons();
}
return; return;
} }
@ -1916,12 +1933,6 @@ namespace StardewSymphonyRemastered.Framework.Menus
this.drawMouse(b); this.drawMouse(b);
} }
//Button Functionality
#region
private void hello(List<object> param)
{
StardewSymphony.ModMonitor.Log("Hello");
}
public void PlayRandomSongFromSelectedMusicPack(List<object> param) public void PlayRandomSongFromSelectedMusicPack(List<object> param)
{ {
@ -1940,9 +1951,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
{ {
if (b.label == "Null") return; if (b.label == "Null") return;
this.currentMusicPackAlbum = b.clone(new Vector2(this.width*.1f+64,this.height*.05f+128)); this.currentMusicPackAlbum = b.clone(new Vector2(this.width*.1f+64,this.height*.05f+128));
StardewSymphony.ModMonitor.Log("Album Selected!"+b.name);
this.texturedStrings.Clear(); this.texturedStrings.Clear();
this.texturedStrings.Add(SpriteFonts.vanillaFont.ParseString("Name:" + (string)b.name, new Microsoft.Xna.Framework.Vector2(this.width*.1f, this.height*.05f + 256), b.textColor)); this.texturedStrings.Add(SpriteFonts.vanillaFont.ParseString("Name:" + (string)b.name, new Microsoft.Xna.Framework.Vector2(this.width*.1f, this.height*.05f + 256), b.textColor,false));
this.drawMode = DrawMode.SongSelectionMode; this.drawMode = DrawMode.SongSelectionMode;
} }
@ -1962,8 +1972,10 @@ namespace StardewSymphonyRemastered.Framework.Menus
/// </summary> /// </summary>
public void playSong() public void playSong()
{ {
if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("Song Selected!" + this.currentSelectedSong.name); StardewSymphony.ModMonitor.Log("Song Selected!" + this.currentSelectedSong.name);
var info = (KeyValuePair<string, MusicPack>)this.currentMusicPackAlbum.buttonFunctionality.leftClick.paramaters[0]; var info = (KeyValuePair<string, MusicPack>)this.currentMusicPackAlbum.buttonFunctionality.leftClick.paramaters[0];
if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("Select Pack:" + info.Key); StardewSymphony.ModMonitor.Log("Select Pack:" + info.Key);
StardewSymphony.musicManager.swapMusicPacks(info.Key); StardewSymphony.musicManager.swapMusicPacks(info.Key);
StardewSymphony.musicManager.playSongFromCurrentPack(this.currentSelectedSong.name); StardewSymphony.musicManager.playSongFromCurrentPack(this.currentSelectedSong.name);
@ -1974,8 +1986,10 @@ namespace StardewSymphonyRemastered.Framework.Menus
/// </summary> /// </summary>
public void stopSong() public void stopSong()
{ {
if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("Song Selected!" + this.currentSelectedSong.name); StardewSymphony.ModMonitor.Log("Song Selected!" + this.currentSelectedSong.name);
var info = (KeyValuePair<string, MusicPack>)this.currentMusicPackAlbum.buttonFunctionality.leftClick.paramaters[0]; var info = (KeyValuePair<string, MusicPack>)this.currentMusicPackAlbum.buttonFunctionality.leftClick.paramaters[0];
if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("Select Pack:" + info.Key); StardewSymphony.ModMonitor.Log("Select Pack:" + info.Key);
StardewSymphony.musicManager.swapMusicPacks(info.Key); StardewSymphony.musicManager.swapMusicPacks(info.Key);
StardewSymphony.musicManager.stopSongFromCurrentMusicPack(); StardewSymphony.musicManager.stopSongFromCurrentMusicPack();
@ -2027,6 +2041,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
string seperator = "_"; string seperator = "_";
//Seasonal selection region //Seasonal selection region
#region #region
if (this.currentlySelectedOption !=null)
{
if (this.currentlySelectedOption.name == "SeasonIcon") if (this.currentlySelectedOption.name == "SeasonIcon")
{ {
if (Game1.currentSeason == "spring") key += "spring"; if (Game1.currentSeason == "spring") key += "spring";
@ -2034,6 +2050,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
if (Game1.currentSeason == "fall") key += "fall"; if (Game1.currentSeason == "fall") key += "fall";
if (Game1.currentSeason == "winter") key += "winter"; if (Game1.currentSeason == "winter") key += "winter";
} }
}
if (this.currentlySelectedWeather != null) if (this.currentlySelectedWeather != null)
{ {
if (this.currentlySelectedWeather.name == "SunnyIcon") key += seperator + "sunny"; if (this.currentlySelectedWeather.name == "SunnyIcon") key += seperator + "sunny";
@ -2065,6 +2082,13 @@ namespace StardewSymphonyRemastered.Framework.Menus
} }
#endregion #endregion
if (this.currentlySelectedMenu != null)
{
return this.currentlySelectedMenu.label;
}
if (this.currentlySelectedFestival != null) return this.currentlySelectedFestival.label;
if (this.currentlySelectedEvent != null) return this.currentlySelectedEvent.label;
return key; return key;
} }
@ -2163,6 +2187,5 @@ namespace StardewSymphonyRemastered.Framework.Menus
} }
#endregion
} }
} }

View File

@ -57,6 +57,7 @@ namespace StardewSymphonyRemastered.Framework
} }
else else
{ {
if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("ERROR: Music Pack " + nameOfNewMusicPack + " isn't valid for some reason.", StardewModdingAPI.LogLevel.Alert); StardewSymphony.ModMonitor.Log("ERROR: Music Pack " + nameOfNewMusicPack + " isn't valid for some reason.", StardewModdingAPI.LogLevel.Alert);
} }
} }
@ -153,6 +154,7 @@ namespace StardewSymphonyRemastered.Framework
{ {
if (isMusicPackValid(name) == false) if (isMusicPackValid(name) == false)
{ {
if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("Error, the music pack: " + name + " is not found. Please make sure it is loaded in and try again."); StardewSymphony.ModMonitor.Log("Error, the music pack: " + name + " is not found. Please make sure it is loaded in and try again.");
return null; return null;
} }
@ -266,11 +268,13 @@ namespace StardewSymphonyRemastered.Framework
} }
} }
if (subKey == "") break; if (subKey == "") break;
if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log(subKey,StardewModdingAPI.LogLevel.Alert); StardewSymphony.ModMonitor.Log(subKey,StardewModdingAPI.LogLevel.Alert);
listOfValidMusicPacks = getListOfApplicableMusicPacks(subKey); listOfValidMusicPacks = getListOfApplicableMusicPacks(subKey);
if (listOfValidMusicPacks.Count == 0) if (listOfValidMusicPacks.Count == 0)
{ {
//No valid songs to play at this time. //No valid songs to play at this time.
if (StardewSymphony.Config.EnableDebugLog)
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?"); 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; //return;
} }
@ -297,6 +301,7 @@ namespace StardewSymphonyRemastered.Framework
if (f == false) if (f == false)
{ {
if (StardewSymphony.Config.EnableDebugLog)
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.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; StardewSymphony.menuChangedMusic = false;
return; return;
@ -307,6 +312,7 @@ namespace StardewSymphonyRemastered.Framework
if (listOfValidMusicPacks.Count == 0) if (listOfValidMusicPacks.Count == 0)
{ {
//No valid songs to play at this time. //No valid songs to play at this time.
if (StardewSymphony.Config.EnableDebugLog)
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?"); 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; //return;
} }
@ -332,6 +338,7 @@ namespace StardewSymphonyRemastered.Framework
if (listOfValidMusicPacks.Count == 0) if (listOfValidMusicPacks.Count == 0)
{ {
//No valid songs to play at this time. //No valid songs to play at this time.
if (StardewSymphony.Config.EnableDebugLog)
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?"); 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; //return;
} }
@ -347,6 +354,7 @@ namespace StardewSymphonyRemastered.Framework
if (f == false) if (f == false)
{ {
//No valid songs to play at this time. //No valid songs to play at this time.
if (StardewSymphony.Config.EnableDebugLog)
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.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; StardewSymphony.menuChangedMusic = false;
return; return;
@ -361,6 +369,7 @@ namespace StardewSymphonyRemastered.Framework
//If I am trying to play a generic song and a non-generic song is playing, then play my generic song since I don't want to play the specific music anymore. //If I am trying to play a generic song and a non-generic song is playing, then play my generic song since I don't want to play the specific music anymore.
if (sizeList.Length < 3 && (this.currentMusicPack.isPlaying() && this.lastSongWasLocationSpecific==false)) if (sizeList.Length < 3 && (this.currentMusicPack.isPlaying() && this.lastSongWasLocationSpecific==false))
{ {
if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("Non specific music change detected. Not going to change the music this time"); StardewSymphony.ModMonitor.Log("Non specific music change detected. Not going to change the music this time");
return; return;
} }
@ -415,7 +424,9 @@ namespace StardewSymphonyRemastered.Framework
} }
else else
{ {
if (StardewSymphony.Config.EnableDebugLog)
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("Error: There are no songs to play across any music pack for the song key: " + songListKey + ".5 Are you sure you did this properly?");
if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("Also failed playing a festival event song."); StardewSymphony.ModMonitor.Log("Also failed playing a festival event song.");
StardewSymphony.menuChangedMusic = false; StardewSymphony.menuChangedMusic = false;
return false; return false;
@ -444,7 +455,9 @@ namespace StardewSymphonyRemastered.Framework
} }
else else
{ {
if (StardewSymphony.Config.EnableDebugLog)
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("Error: There are no songs to play across any music pack for the song key: " + songListKey + ".6 Are you sure you did this properly?");
if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("Also failed playing a generalized event song."); StardewSymphony.ModMonitor.Log("Also failed playing a generalized event song.");
StardewSymphony.menuChangedMusic = false; StardewSymphony.menuChangedMusic = false;
return false; return false;
@ -463,6 +476,8 @@ namespace StardewSymphonyRemastered.Framework
public void addMusicPack(MusicPack musicPack,bool displayLogInformation=false,bool displaySongs=false) public void addMusicPack(MusicPack musicPack,bool displayLogInformation=false,bool displaySongs=false)
{ {
if (displayLogInformation == true) if (displayLogInformation == true)
{
if (StardewSymphony.Config.EnableDebugLog)
{ {
StardewSymphony.ModMonitor.Log("Adding a new music pack!"); StardewSymphony.ModMonitor.Log("Adding a new music pack!");
@ -473,23 +488,17 @@ namespace StardewSymphonyRemastered.Framework
StardewSymphony.ModMonitor.Log(" Description:" + musicPack.musicPackInformation.description); StardewSymphony.ModMonitor.Log(" Description:" + musicPack.musicPackInformation.description);
StardewSymphony.ModMonitor.Log(" Version Info:" + musicPack.musicPackInformation.versionInfo); StardewSymphony.ModMonitor.Log(" Version Info:" + musicPack.musicPackInformation.versionInfo);
StardewSymphony.ModMonitor.Log(" Song List:"); StardewSymphony.ModMonitor.Log(" Song List:");
}
if (displaySongs == true) if (displaySongs == true)
{ {
foreach(var song in musicPack.songInformation.listOfSongsWithoutTriggers) foreach(var song in musicPack.songInformation.listOfSongsWithoutTriggers)
{ {
if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log(" " + song.name); StardewSymphony.ModMonitor.Log(" " + song.name);
} }
} }
} }
/*
if(musicPack.GetType()==typeof(WavMusicPack)){
foreach (var song in musicPack.songInformation.listOfSongsWithoutTriggers)
{
(musicPack as WavMusicPack).LoadWavFromFileToStream(song.pathToSong);
}
}
*/
this.musicPacks.Add(musicPack.musicPackInformation.name,musicPack); this.musicPacks.Add(musicPack.musicPackInformation.name,musicPack);
} }

View File

@ -75,7 +75,8 @@ namespace StardewSymphonyRemastered.Framework
/// </summary> /// </summary>
public virtual void writeToJson() public virtual void writeToJson()
{ {
StardewSymphony.ModMonitor.Log("Loading in music for this pack:"+this.musicPackInformation.name+". Please wait."); if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("Saving music for this pack:"+this.musicPackInformation.name+". Please wait.");
string data = Path.Combine(this.directory, "data"); string data = Path.Combine(this.directory, "data");
if (!Directory.Exists(data)) if (!Directory.Exists(data))
{ {
@ -84,6 +85,8 @@ namespace StardewSymphonyRemastered.Framework
foreach (var list in this.songInformation.listOfSongsWithTriggers) foreach (var list in this.songInformation.listOfSongsWithTriggers)
{ {
if (list.Value.Count == 0) continue; if (list.Value.Count == 0) continue;
if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("Saving music: " + list.Key + ". Please wait.");
SongListNode node = new SongListNode(list.Key, list.Value); SongListNode node = new SongListNode(list.Key, list.Value);
node.WriteToJson(Path.Combine(data, node.trigger+".json")); node.WriteToJson(Path.Combine(data, node.trigger+".json"));
} }
@ -94,7 +97,8 @@ namespace StardewSymphonyRemastered.Framework
/// </summary> /// </summary>
public virtual void readFromJson() public virtual void readFromJson()
{ {
StardewSymphony.ModMonitor.Log("Saving music for this pack:" + this.musicPackInformation.name + ". Please wait as this will take quite soem time."); if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("Loading music for this pack:" + this.musicPackInformation.name + ". Please wait as this will take quite some time.");
string data = Path.Combine(this.directory, "data"); string data = Path.Combine(this.directory, "data");
if (!Directory.Exists(data)) if (!Directory.Exists(data))
{ {
@ -106,9 +110,16 @@ namespace StardewSymphonyRemastered.Framework
SongListNode node = SongListNode.ReadFromJson(Path.Combine(data,file)); SongListNode node = SongListNode.ReadFromJson(Path.Combine(data,file));
var pair = this.songInformation.getSongList(node.trigger+".json"); var pair = this.songInformation.getSongList(node.trigger+".json");
foreach (var v in node.songList) foreach (var v in node.songList)
{
try
{ {
this.songInformation.addSongToTriggerList(node.trigger, v.name); this.songInformation.addSongToTriggerList(node.trigger, v.name);
} }
catch(Exception err)
{
}
}
} }
} }

View File

@ -42,6 +42,7 @@ namespace StardewSymphonyRemastered.Framework
catch(Exception err) catch(Exception err)
{ {
this.Icon = null; this.Icon = null;
if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log(err.ToString()); StardewSymphony.ModMonitor.Log(err.ToString());
} }
} }
@ -77,7 +78,8 @@ namespace StardewSymphonyRemastered.Framework
catch(Exception err) catch(Exception err)
{ {
err.ToString(); err.ToString();
//StardewSymphony.ModMonitor.Log(err.ToString()); if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log(err.ToString());
} }
return meta; return meta;
} }

View File

@ -15,7 +15,7 @@ namespace StardewSymphonyRemastered.Framework
/// <summary> /// <summary>
/// The path to the song. In the case of XACT songs this points to the .xwb file. For WAV files this points directly to the WAV file itself. /// The path to the song. In the case of XACT songs this points to the .xwb file. For WAV files this points directly to the WAV file itself.
/// </summary> /// </summary>
public string pathToSong; private string pathToSong;
/// <summary> /// <summary>
/// The name of the song itself. /// The name of the song itself.
@ -25,7 +25,7 @@ namespace StardewSymphonyRemastered.Framework
/// <summary> /// <summary>
/// The relative path to the song. /// The relative path to the song.
/// </summary> /// </summary>
public string relativePath; private string relativePath;
/// <summary> /// <summary>
/// Blank Constructor; /// Blank Constructor;
@ -116,5 +116,14 @@ namespace StardewSymphonyRemastered.Framework
StardewSymphony.ModHelper.WriteJsonFile<Song>(path, this); StardewSymphony.ModHelper.WriteJsonFile<Song>(path, this);
} }
public string getRelativePath()
{
return this.relativePath;
}
public string getPathToSong()
{
return this.pathToSong;
}
} }
} }

View File

@ -158,6 +158,7 @@ namespace StardewSymphonyRemastered.Framework
foreach (var v in Game1.locations) foreach (var v in Game1.locations)
{ {
locations.Add(v.Name); locations.Add(v.Name);
if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("Adding in song triggers for location: " + v.Name); StardewSymphony.ModMonitor.Log("Adding in song triggers for location: " + v.Name);
} }
@ -168,11 +169,13 @@ namespace StardewSymphonyRemastered.Framework
foreach(var building in farm.buildings) foreach(var building in farm.buildings)
{ {
locations.Add(building.nameOfIndoors); locations.Add(building.nameOfIndoors);
if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("Adding in song triggers for location: " + building.nameOfIndoors); StardewSymphony.ModMonitor.Log("Adding in song triggers for location: " + building.nameOfIndoors);
} }
} }
catch(Exception err) catch(Exception err)
{ {
if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log(err.ToString()); StardewSymphony.ModMonitor.Log(err.ToString());
} }
@ -428,7 +431,7 @@ namespace StardewSymphonyRemastered.Framework
} }
catch(Exception err) catch(Exception err)
{ {
err.ToString(); //err.ToString();
} }
} }
} }
@ -569,6 +572,7 @@ namespace StardewSymphonyRemastered.Framework
var song = getSongFromList(listOfSongsWithoutTriggers, songName); //Get the song from the master song pool var song = getSongFromList(listOfSongsWithoutTriggers, songName); //Get the song from the master song pool
if (song == null) if (song == null)
{ {
if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("For some reason you are trying to add a song that is null. The name of the song is "+ songName); StardewSymphony.ModMonitor.Log("For some reason you are trying to add a song that is null. The name of the song is "+ songName);
return; return;
} }
@ -583,6 +587,7 @@ namespace StardewSymphonyRemastered.Framework
var song = getSongFromList(listOfSongsWithoutTriggers, songName); //Get the song from the master song pool var song = getSongFromList(listOfSongsWithoutTriggers, songName); //Get the song from the master song pool
if (song == null) if (song == null)
{ {
if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("For some reason you are trying to add a song that is null. The name of the song is " + songName); StardewSymphony.ModMonitor.Log("For some reason you are trying to add a song that is null. The name of the song is " + songName);
return; return;
} }
@ -597,6 +602,7 @@ namespace StardewSymphonyRemastered.Framework
var song = getSongFromList(listOfSongsWithoutTriggers, songName); //Get the song from the master song pool var song = getSongFromList(listOfSongsWithoutTriggers, songName); //Get the song from the master song pool
if (song == null) if (song == null)
{ {
if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("For some reason you are trying to add a song that is null. The name of the song is " + songName); StardewSymphony.ModMonitor.Log("For some reason you are trying to add a song that is null. The name of the song is " + songName);
return; return;
} }

View File

@ -244,7 +244,7 @@ namespace StardewSymphonyRemastered.Framework
{ {
foreach(var song in this.songInformation.listOfSongsWithoutTriggers) foreach(var song in this.songInformation.listOfSongsWithoutTriggers)
{ {
if (song.pathToSong == path) return song.name; if (song.getPathToSong()== path) return song.name;
} }
return ""; return "";
} }
@ -258,7 +258,7 @@ namespace StardewSymphonyRemastered.Framework
{ {
foreach (var song in this.songInformation.listOfSongsWithoutTriggers) foreach (var song in this.songInformation.listOfSongsWithoutTriggers)
{ {
if (song.name == name) return song.pathToSong; if (song.name == name) return song.getPathToSong();
} }
return ""; return "";
} }

View File

@ -40,6 +40,7 @@ namespace StardewSymphonyRemastered.Framework
this.musicPackInformation = MusicPackMetaData.readFromJson(directoryToXwb); this.musicPackInformation = MusicPackMetaData.readFromJson(directoryToXwb);
if (this.musicPackInformation == null) if (this.musicPackInformation == null)
{ {
if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("Error: MusicPackInformation.json not found at: " + directoryToXwb + ". Blank information will be put in place.",StardewModdingAPI.LogLevel.Warn); StardewSymphony.ModMonitor.Log("Error: MusicPackInformation.json not found at: " + directoryToXwb + ". Blank information will be put in place.",StardewModdingAPI.LogLevel.Warn);
this.musicPackInformation = new MusicPackMetaData("???","???","","0.0.0",""); this.musicPackInformation = new MusicPackMetaData("???","???","","0.0.0","");
} }
@ -84,6 +85,7 @@ namespace StardewSymphonyRemastered.Framework
private Cue getCue(string name) { private Cue getCue(string name) {
if (this.songInformation.isSongInList(name) == false) if (this.songInformation.isSongInList(name) == false)
{ {
if (StardewSymphony.Config.EnableDebugLog)
StardewSymphony.ModMonitor.Log("Error! The song " + name + " could not be found in music pack " + this.musicPackInformation.name+". Please ensure that this song is part of this music pack located at: "+ this.WaveBankPath+ " or contact the music pack author: "+this.musicPackInformation.author,StardewModdingAPI.LogLevel.Error); StardewSymphony.ModMonitor.Log("Error! The song " + name + " could not be found in music pack " + this.musicPackInformation.name+". Please ensure that this song is part of this music pack located at: "+ this.WaveBankPath+ " or contact the music pack author: "+this.musicPackInformation.author,StardewModdingAPI.LogLevel.Error);
return null; return null;
} }

View File

@ -56,6 +56,8 @@ namespace StardewSymphonyRemastered
public static bool menuChangedMusic; public static bool menuChangedMusic;
public static Config Config;
public static TextureManager textureManager; public static TextureManager textureManager;
@ -65,6 +67,7 @@ namespace StardewSymphonyRemastered
/// <param name="helper"></param> /// <param name="helper"></param>
public override void Entry(IModHelper helper) public override void Entry(IModHelper helper)
{ {
Config = helper.ReadConfig<Config>();
DefaultSoundBank = Game1.soundBank; DefaultSoundBank = Game1.soundBank;
DefaultWaveBank = Game1.waveBank; DefaultWaveBank = Game1.waveBank;
ModHelper = helper; ModHelper = helper;
@ -153,6 +156,12 @@ namespace StardewSymphonyRemastered
musicManager.initializeFestivalMusic(); musicManager.initializeFestivalMusic();
musicManager.initializeEventMusic(); musicManager.initializeEventMusic();
foreach (var musicPack in musicManager.musicPacks)
{
musicPack.Value.readFromJson();
}
musicManager.selectMusic(SongSpecifics.getCurrentConditionalString());
} }
@ -181,12 +190,12 @@ namespace StardewSymphonyRemastered
private void SaveEvents_BeforeSave(object sender, EventArgs e) private void SaveEvents_BeforeSave(object sender, EventArgs e)
{ {
/* THIS IS WAY TO LONG to run. Better make it save individual lists when I am editing songs. // THIS IS WAY TO LONG to run. Better make it save individual lists when I am editing songs.
foreach(var musicPack in musicManager.musicPacks) foreach(var musicPack in musicManager.musicPacks)
{ {
musicPack.Value.writeToJson(); musicPack.Value.writeToJson();
} }
*/
} }
/// <summary> /// <summary>
@ -196,7 +205,7 @@ namespace StardewSymphonyRemastered
/// <param name="e"></param> /// <param name="e"></param>
private void ControlEvents_KeyPressed(object sender, StardewModdingAPI.Events.EventArgsKeyPressed e) private void ControlEvents_KeyPressed(object sender, StardewModdingAPI.Events.EventArgsKeyPressed e)
{ {
if (e.KeyPressed == Microsoft.Xna.Framework.Input.Keys.K) if (e.KeyPressed.ToString() == Config.KeyBinding)
{ {
Game1.activeClickableMenu = new Framework.Menus.MusicManagerMenu(Game1.viewport.Width,Game1.viewport.Height); Game1.activeClickableMenu = new Framework.Menus.MusicManagerMenu(Game1.viewport.Width,Game1.viewport.Height);
} }
@ -210,7 +219,6 @@ namespace StardewSymphonyRemastered
/// <param name="e"></param> /// <param name="e"></param>
private void GameEvents_UpdateTick(object sender, EventArgs e) private void GameEvents_UpdateTick(object sender, EventArgs e)
{ {
// ModMonitor.Log("HELLO WORLD");
if (Game1.currentSong != null) if (Game1.currentSong != null)
{ {
//ModMonitor.Log("STOP THE MUSIC!!!"); //ModMonitor.Log("STOP THE MUSIC!!!");
@ -221,10 +229,6 @@ namespace StardewSymphonyRemastered
} }
/// <summary> /// <summary>
/// Load in the music packs to the music manager. /// Load in the music packs to the music manager.
/// </summary> /// </summary>
@ -261,7 +265,6 @@ namespace StardewSymphonyRemastered
string dayIcon = Path.Combine(path, "TimeIcon_Day.png"); string dayIcon = Path.Combine(path, "TimeIcon_Day.png");
string nightIcon = Path.Combine(path, "TimeIcon_Night.png"); string nightIcon = Path.Combine(path, "TimeIcon_Night.png");
//Fun Icons //Fun Icons
string eventIcon = Path.Combine(path, "EventIcon.png"); string eventIcon = Path.Combine(path, "EventIcon.png");
string festivalIcon = Path.Combine(path, "FestivalIcon.png"); string festivalIcon = Path.Combine(path, "FestivalIcon.png");
@ -277,15 +280,12 @@ namespace StardewSymphonyRemastered
string stormIcon = Path.Combine(path, "WeatherIcon_Stormy.png"); string stormIcon = Path.Combine(path, "WeatherIcon_Stormy.png");
string weddingIcon = Path.Combine(path, "WeatherIcon_WeddingHeart.png"); string weddingIcon = Path.Combine(path, "WeatherIcon_WeddingHeart.png");
//Season Icons //Season Icons
string springIcon = Path.Combine(path, "SeasonIcon_Spring.png"); string springIcon = Path.Combine(path, "SeasonIcon_Spring.png");
string summerIcon = Path.Combine(path, "SeasonIcon_Summer.png"); string summerIcon = Path.Combine(path, "SeasonIcon_Summer.png");
string fallIcon = Path.Combine(path, "SeasonIcon_Fall.png"); string fallIcon = Path.Combine(path, "SeasonIcon_Fall.png");
string winterIcon = Path.Combine(path, "SeasonIcon_Winter.png"); string winterIcon = Path.Combine(path, "SeasonIcon_Winter.png");
//Day Icons //Day Icons
string mondayIcon = Path.Combine(path, "DayIcons_Monday.png"); string mondayIcon = Path.Combine(path, "DayIcons_Monday.png");
string tuesdayIcon = Path.Combine(path, "DayIcons_Tuesday.png"); string tuesdayIcon = Path.Combine(path, "DayIcons_Tuesday.png");
@ -296,15 +296,10 @@ namespace StardewSymphonyRemastered
string sundayIcon = Path.Combine(path, "DayIcons_Sunday.png"); string sundayIcon = Path.Combine(path, "DayIcons_Sunday.png");
string houseIcon = Path.Combine(path, "HouseIcon.png"); string houseIcon = Path.Combine(path, "HouseIcon.png");
string playButton = Path.Combine(path, "PlayButton.png"); string playButton = Path.Combine(path, "PlayButton.png");
string stopButton = Path.Combine(path, "StopButton.png"); string stopButton = Path.Combine(path, "StopButton.png");
string backButton = Path.Combine(path, "BackButton.png"); string backButton = Path.Combine(path, "BackButton.png");
textureManager.addTexture("MusicNote",new Texture2DExtended(ModHelper,StardustCore.Utilities.getRelativeDirectory("StardewSymphonyRemastered", musicNote))); textureManager.addTexture("MusicNote",new Texture2DExtended(ModHelper,StardustCore.Utilities.getRelativeDirectory("StardewSymphonyRemastered", musicNote)));
textureManager.addTexture("MusicDisk", new Texture2DExtended(ModHelper, StardustCore.Utilities.getRelativeDirectory("StardewSymphonyRemastered", musicCD))); textureManager.addTexture("MusicDisk", new Texture2DExtended(ModHelper, StardustCore.Utilities.getRelativeDirectory("StardewSymphonyRemastered", musicCD)));
textureManager.addTexture("MusicCD", new Texture2DExtended(ModHelper, StardustCore.Utilities.getRelativeDirectory("StardewSymphonyRemastered", musicCD))); textureManager.addTexture("MusicCD", new Texture2DExtended(ModHelper, StardustCore.Utilities.getRelativeDirectory("StardewSymphonyRemastered", musicCD)));
@ -405,7 +400,7 @@ namespace StardewSymphonyRemastered
/// <summary> /// <summary>
/// Load in the XACT music packs. /// Load in the XACT music packs.
/// </summary> /// </summary>
public static void loadXACTMusicPacks() public void loadXACTMusicPacks()
{ {
string[] listOfDirectories= Directory.GetDirectories(XACTMusicDirectory); string[] listOfDirectories= Directory.GetDirectories(XACTMusicDirectory);
foreach(string folder in listOfDirectories) foreach(string folder in listOfDirectories)
@ -417,22 +412,26 @@ namespace StardewSymphonyRemastered
string[] debug = Directory.GetFiles(folder); string[] debug = Directory.GetFiles(folder);
if (xwb.Length == 0) if (xwb.Length == 0)
{ {
if(Config.EnableDebugLog)
ModMonitor.Log("Error loading in attempting to load music pack from: " + folder + ". There is no wave bank music file: .xwb located in this directory. AKA there is no valid music here.", LogLevel.Error); ModMonitor.Log("Error loading in attempting to load music pack from: " + folder + ". There is no wave bank music file: .xwb located in this directory. AKA there is no valid music here.", LogLevel.Error);
return; return;
} }
if (xwb.Length >= 2) if (xwb.Length >= 2)
{ {
if (Config.EnableDebugLog)
ModMonitor.Log("Error loading in attempting to load music pack from: " + folder + ". There are too many wave bank music files or .xwbs located in this directory. Please ensure that there is only one music pack in this folder. You can make another music pack but putting a wave bank file in a different folder.", LogLevel.Error); ModMonitor.Log("Error loading in attempting to load music pack from: " + folder + ". There are too many wave bank music files or .xwbs located in this directory. Please ensure that there is only one music pack in this folder. You can make another music pack but putting a wave bank file in a different folder.", LogLevel.Error);
return; return;
} }
if (xsb.Length == 0) if (xsb.Length == 0)
{ {
if (Config.EnableDebugLog)
ModMonitor.Log("Error loading in attempting to load music pack from: " + folder + ". There is no sound bank music file: .xsb located in this directory. AKA there is no valid music here.", LogLevel.Error); ModMonitor.Log("Error loading in attempting to load music pack from: " + folder + ". There is no sound bank music file: .xsb located in this directory. AKA there is no valid music here.", LogLevel.Error);
return; return;
} }
if (xsb.Length >= 2) if (xsb.Length >= 2)
{ {
if (Config.EnableDebugLog)
ModMonitor.Log("Error loading in attempting to load music pack from: " + folder + ". There are too many sound bank music files or .xsbs located in this directory. Please ensure that there is only one sound reference file in this folder. You can make another music pack but putting a sound file in a different folder.", LogLevel.Error); ModMonitor.Log("Error loading in attempting to load music pack from: " + folder + ". There are too many sound bank music files or .xsbs located in this directory. Please ensure that there is only one sound reference file in this folder. You can make another music pack but putting a sound file in a different folder.", LogLevel.Error);
return; return;
} }
@ -443,12 +442,17 @@ namespace StardewSymphonyRemastered
if (!File.Exists(metaData)) if (!File.Exists(metaData))
{ {
if (Config.EnableDebugLog)
ModMonitor.Log("WARNING! Loading in a music pack from: " + folder + ". There is no MusicPackInformation.json associated with this music pack meaning that while songs can be played from this pack, no information about it will be displayed.", LogLevel.Error); ModMonitor.Log("WARNING! Loading in a music pack from: " + folder + ". There is no MusicPackInformation.json associated with this music pack meaning that while songs can be played from this pack, no information about it will be displayed.", LogLevel.Error);
} }
StardewSymphonyRemastered.Framework.XACTMusicPack musicPack = new XACTMusicPack(folder, waveBank,soundBank); StardewSymphonyRemastered.Framework.XACTMusicPack musicPack = new XACTMusicPack(folder, waveBank,soundBank);
musicPack.songInformation.initializeMenuMusic();
musicPack.readFromJson();
musicManager.addMusicPack(musicPack,true,true); musicManager.addMusicPack(musicPack,true,true);
musicPack.readFromJson();
} }
} }
@ -456,7 +460,7 @@ namespace StardewSymphonyRemastered
/// <summary> /// <summary>
/// Load in WAV music packs. /// Load in WAV music packs.
/// </summary> /// </summary>
public static void loadWAVMusicPacks() public void loadWAVMusicPacks()
{ {
string[] listOfDirectories = Directory.GetDirectories(WavMusicDirectory); string[] listOfDirectories = Directory.GetDirectories(WavMusicDirectory);
foreach (string folder in listOfDirectories) foreach (string folder in listOfDirectories)
@ -465,13 +469,17 @@ namespace StardewSymphonyRemastered
if (!File.Exists(metaData)) if (!File.Exists(metaData))
{ {
if (Config.EnableDebugLog)
ModMonitor.Log("WARNING! Loading in a music pack from: " + folder + ". There is no MusicPackInformation.json associated with this music pack meaning that while songs can be played from this pack, no information about it will be displayed.", LogLevel.Error); ModMonitor.Log("WARNING! Loading in a music pack from: " + folder + ". There is no MusicPackInformation.json associated with this music pack meaning that while songs can be played from this pack, no information about it will be displayed.", LogLevel.Error);
} }
StardewSymphonyRemastered.Framework.WavMusicPack musicPack = new WavMusicPack(folder); StardewSymphonyRemastered.Framework.WavMusicPack musicPack = new WavMusicPack(folder);
musicPack.songInformation.initializeMenuMusic();
musicPack.readFromJson();
musicManager.addMusicPack(musicPack,true,true); musicManager.addMusicPack(musicPack,true,true);
musicPack.readFromJson();
} }
} }

View File

@ -68,7 +68,8 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="StardustCore"> <Reference Include="StardustCore, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\StardustCore\bin\Release\StardustCore.dll</HintPath> <HintPath>..\..\StardustCore\bin\Release\StardustCore.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
@ -81,6 +82,7 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Config.cs" />
<Compile Include="Framework\Menus\MusicManagerMenu.cs" /> <Compile Include="Framework\Menus\MusicManagerMenu.cs" />
<Compile Include="Framework\Music\MusicPackMetaData.cs" /> <Compile Include="Framework\Music\MusicPackMetaData.cs" />
<Compile Include="Framework\Music\Song.cs" /> <Compile Include="Framework\Music\Song.cs" />

View File

@ -8,7 +8,12 @@ namespace StardewSymphonyRemastered
{ {
public static class StaticExtentions public static class StaticExtentions
{ {
/// <summary>
/// Checks if a given object is null.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="obj"></param>
/// <returns></returns>
public static bool isNull<T>(this T obj) public static bool isNull<T>(this T obj)
{ {
if (obj == null) return true; if (obj == null) return true;

View File

@ -14,18 +14,18 @@ namespace StardustCore.UIUtilities.SpriteFonts.Components
public Vector2 position; public Vector2 position;
public string label; public string label;
public TexturedString(string Label,Vector2 Position,List<TexturedCharacter> Characters) public TexturedString(string Label, Vector2 Position, List<TexturedCharacter> Characters, bool useRightPadding = true)
{ {
this.label = Label; this.label = Label;
this.characters = Characters; this.characters = Characters;
this.position = Position; this.position = Position;
setCharacterPositions(); setCharacterPositions(useRightPadding);
} }
/// <summary> /// <summary>
/// Sets the character positions relative to the string's position on screen. /// Sets the character positions relative to the string's position on screen.
/// </summary> /// </summary>
public void setCharacterPositions() public void setCharacterPositions(bool useRightPadding=true)
{ {
int index = 0; int index = 0;
TexturedCharacter lastSeenChar=new TexturedCharacter(); TexturedCharacter lastSeenChar=new TexturedCharacter();
@ -36,9 +36,16 @@ namespace StardustCore.UIUtilities.SpriteFonts.Components
c.position = new Vector2(this.position.X + c.spacing.LeftPadding,this.position.Y); c.position = new Vector2(this.position.X + c.spacing.LeftPadding,this.position.Y);
} }
else else
{
if (useRightPadding)
{ {
c.position = new Vector2(this.position.X + c.spacing.LeftPadding + lastSeenChar.spacing.RightPadding + lastSeenChar.texture.Width * index, this.position.Y); c.position = new Vector2(this.position.X + c.spacing.LeftPadding + lastSeenChar.spacing.RightPadding + lastSeenChar.texture.Width * index, this.position.Y);
} }
else
{
c.position = new Vector2(this.position.X + c.spacing.LeftPadding + lastSeenChar.texture.Width * index, this.position.Y);
}
}
//StardustCore.ModCore.ModMonitor.Log(c.character.ToString()); //StardustCore.ModCore.ModMonitor.Log(c.character.ToString());
//StardustCore.ModCore.ModMonitor.Log(c.position.ToString()); //StardustCore.ModCore.ModMonitor.Log(c.position.ToString());
lastSeenChar = c; lastSeenChar = c;
@ -50,23 +57,23 @@ namespace StardustCore.UIUtilities.SpriteFonts.Components
/// Adds a textured character to a textured string. /// Adds a textured character to a textured string.
/// </summary> /// </summary>
/// <param name="ch"></param> /// <param name="ch"></param>
public void addCharacterToEnd(TexturedCharacter ch) public void addCharacterToEnd(TexturedCharacter ch, bool useRightPadding = true)
{ {
this.characters.Add(ch); this.characters.Add(ch);
this.setCharacterPositions(); this.setCharacterPositions(useRightPadding);
} }
/// <summary> /// <summary>
/// Adds a list of textured characters to a textured string. /// Adds a list of textured characters to a textured string.
/// </summary> /// </summary>
/// <param name="chList"></param> /// <param name="chList"></param>
public void addCharactersToEnd(List<TexturedCharacter> chList) public void addCharactersToEnd(List<TexturedCharacter> chList, bool useRightPadding=true)
{ {
foreach(var ch in chList) foreach(var ch in chList)
{ {
this.characters.Add(ch); this.characters.Add(ch);
} }
this.setCharacterPositions(); this.setCharacterPositions(useRightPadding);
} }
/// <summary> /// <summary>
@ -76,11 +83,11 @@ namespace StardustCore.UIUtilities.SpriteFonts.Components
/// <param name="second"></param> /// <param name="second"></param>
/// <param name="NewPosition"></param> /// <param name="NewPosition"></param>
/// <returns></returns> /// <returns></returns>
public TexturedString addStrings(TexturedString first,TexturedString second,Vector2 NewPosition) public TexturedString addStrings(TexturedString first, TexturedString second, Vector2 NewPosition, bool useRightPadding = true)
{ {
var newString = first + second; var newString = first + second;
newString.position = NewPosition; newString.position = NewPosition;
newString.setCharacterPositions(); newString.setCharacterPositions(useRightPadding);
return newString; return newString;
} }

View File

@ -62,7 +62,7 @@ namespace StardustCore.UIUtilities.SpriteFonts.Fonts
/// <param name="Position"></param> /// <param name="Position"></param>
/// <param name="stringColor"></param> /// <param name="stringColor"></param>
/// <returns></returns> /// <returns></returns>
public TexturedString ParseString(string str, Vector2 Position, Color stringColor) public TexturedString ParseString(string str, Vector2 Position, Color stringColor, bool useRightPadding = true)
{ {
List<TexturedCharacter> characters = new List<TexturedCharacter>(); List<TexturedCharacter> characters = new List<TexturedCharacter>();
foreach (var chr in str) foreach (var chr in str)
@ -71,7 +71,7 @@ namespace StardustCore.UIUtilities.SpriteFonts.Fonts
c.drawColor = stringColor; c.drawColor = stringColor;
characters.Add(c); characters.Add(c);
} }
var tStr = new TexturedString(str,Position, characters); var tStr = new TexturedString(str,Position, characters,useRightPadding);
return tStr; return tStr;
} }
@ -83,7 +83,7 @@ namespace StardustCore.UIUtilities.SpriteFonts.Fonts
/// <param name="Position">The position to draw the textured string.</param> /// <param name="Position">The position to draw the textured string.</param>
/// <param name="stringColor">The color of the textured string.</param> /// <param name="stringColor">The color of the textured string.</param>
/// <returns></returns> /// <returns></returns>
public TexturedString ParseString(string label,string str, Vector2 Position, Color stringColor) public TexturedString ParseString(string label,string str, Vector2 Position, Color stringColor, bool useRightPadding = true)
{ {
List<TexturedCharacter> characters = new List<TexturedCharacter>(); List<TexturedCharacter> characters = new List<TexturedCharacter>();
foreach (var chr in str) foreach (var chr in str)
@ -92,7 +92,7 @@ namespace StardustCore.UIUtilities.SpriteFonts.Fonts
c.drawColor = stringColor; c.drawColor = stringColor;
characters.Add(c); characters.Add(c);
} }
var tStr = new TexturedString(label, Position, characters); var tStr = new TexturedString(label, Position, characters,false);
return tStr; return tStr;
} }