Symphony now takes priority over StardewValley music. Can be changed simply by adding in a StardewValley Music Pack. Also Music Album Icons!
This commit is contained in:
parent
fd53797c5f
commit
dad514a6d6
|
@ -42,7 +42,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.buttons.Add(new Button(v.Key, new Rectangle(100 + (numOfButtons * 100), 100 + (rows * 100), 64, 64), v.Value.musicPackInformation.Icon, "", new Rectangle(0, 0, 16, 16), 4f, new StardustCore.Animations.Animation(new Rectangle(0, 0, 16, 16)), StardustCore.IlluminateFramework.LightColorsList.Black, Color.White, new ButtonFunctionality(new DelegatePairing(displayMusicPack, new List<object>
|
this.buttons.Add(new Button(v.Key, new Rectangle(100 + (numOfButtons * 100), 125 + (rows * 100), 64, 64), v.Value.musicPackInformation.Icon, "", new Rectangle(0, 0, 16, 16), 4f, new StardustCore.Animations.Animation(new Rectangle(0, 0, 16, 16)), StardustCore.IlluminateFramework.LightColorsList.Black, Color.White, new ButtonFunctionality(new DelegatePairing(displayMusicPack, new List<object>
|
||||||
{
|
{
|
||||||
(object)v
|
(object)v
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using StardustCore.UIUtilities;
|
using StardustCore.UIUtilities;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -59,16 +60,24 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static MusicPackMetaData readFromJson(string path)
|
public static MusicPackMetaData readFromJson(string path)
|
||||||
{
|
{
|
||||||
var meta=StardewSymphony.ModHelper.ReadJsonFile<MusicPackMetaData>(path);
|
string json = Path.Combine(path, "MusicPackInformation.json");
|
||||||
|
var meta=StardewSymphony.ModHelper.ReadJsonFile<MusicPackMetaData>(json);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
meta.Icon = new Texture2DExtended(StardewSymphony.ModHelper, meta.pathToMusicPackIcon + ".png");
|
try
|
||||||
|
{
|
||||||
|
meta.Icon = new Texture2DExtended(StardewSymphony.ModHelper, StardewSymphony.getRelativeDirectory(Path.Combine(path, meta.pathToMusicPackIcon + ".png")));
|
||||||
|
}
|
||||||
|
catch(Exception errr)
|
||||||
|
{
|
||||||
|
meta.Icon = new Texture2DExtended(StardewSymphony.ModHelper, StardewSymphony.getRelativeDirectory(Path.Combine(path, meta.pathToMusicPackIcon)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(Exception err)
|
catch(Exception err)
|
||||||
{
|
{
|
||||||
|
//StardewSymphony.ModMonitor.Log(err.ToString());
|
||||||
}
|
}
|
||||||
return StardewSymphony.ModHelper.ReadJsonFile<MusicPackMetaData>(path);
|
return meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -45,13 +45,14 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
this.setModDirectoryFromFullDirectory();
|
this.setModDirectoryFromFullDirectory();
|
||||||
this.songsDirectory = Path.Combine(this.directory, "Songs");
|
this.songsDirectory = Path.Combine(this.directory, "Songs");
|
||||||
this.songInformation = new SongSpecifics();
|
this.songInformation = new SongSpecifics();
|
||||||
this.musicPackInformation = MusicPackMetaData.readFromJson(Path.Combine(directoryToMusicPack, "MusicPackInformation.json"));
|
this.musicPackInformation = MusicPackMetaData.readFromJson(directoryToMusicPack);
|
||||||
|
|
||||||
if (this.musicPackInformation == null)
|
if (this.musicPackInformation == null)
|
||||||
{
|
{
|
||||||
StardewSymphony.ModMonitor.Log("Error: MusicPackInformation.json not found at: " + directoryToMusicPack + ". Blank information will be put in place.", StardewModdingAPI.LogLevel.Warn);
|
//StardewSymphony.ModMonitor.Log("Error: MusicPackInformation.json not found at: " + directoryToMusicPack + ". Blank information will be put in place.", StardewModdingAPI.LogLevel.Warn);
|
||||||
this.musicPackInformation = new MusicPackMetaData("???", "???", "", "0.0.0","");
|
//this.musicPackInformation = new MusicPackMetaData("???", "???", "", "0.0.0","");
|
||||||
}
|
}
|
||||||
|
StardewSymphony.ModMonitor.Log(this.musicPackInformation.name.ToString());
|
||||||
this.loadMusicFiles();
|
this.loadMusicFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
this.setModDirectoryFromFullDirectory();
|
this.setModDirectoryFromFullDirectory();
|
||||||
this.songInformation = new SongSpecifics();
|
this.songInformation = new SongSpecifics();
|
||||||
this.currentCue = null;
|
this.currentCue = null;
|
||||||
this.musicPackInformation = MusicPackMetaData.readFromJson(Path.Combine(directoryToXwb, "MusicPackInformation.json"));
|
this.musicPackInformation = MusicPackMetaData.readFromJson(directoryToXwb);
|
||||||
if (this.musicPackInformation == null)
|
if (this.musicPackInformation == null)
|
||||||
{
|
{
|
||||||
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);
|
||||||
|
|
|
@ -105,6 +105,7 @@ 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)
|
||||||
{
|
{
|
||||||
|
if (Game1.currentSong != null) Game1.currentSong.Stop(AudioStopOptions.Immediate);
|
||||||
if (musicPacksInitialized == false)
|
if (musicPacksInitialized == false)
|
||||||
{
|
{
|
||||||
initializeMusicPacks();
|
initializeMusicPacks();
|
||||||
|
@ -299,6 +300,35 @@ namespace StardewSymphonyRemastered
|
||||||
Game1.soundBank = DefaultSoundBank;
|
Game1.soundBank = DefaultSoundBank;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used to splice the mod directory to get relative paths.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string getShortenedDirectory(string path)
|
||||||
|
{
|
||||||
|
string lol = (string)path.Clone();
|
||||||
|
string[] spliter = lol.Split(new string[] { ModHelper.DirectoryPath }, StringSplitOptions.None);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return spliter[1];
|
||||||
|
}
|
||||||
|
catch (Exception err)
|
||||||
|
{
|
||||||
|
return spliter[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used to finish cleaning up absolute asset paths into a shortened relative path.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string getRelativeDirectory(string path)
|
||||||
|
{
|
||||||
|
string s = getShortenedDirectory(path);
|
||||||
|
return s.Remove(0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue