remove unused code

This commit is contained in:
Jesse Plamondon-Willard 2019-01-05 01:44:20 -05:00
parent 08d1e15e45
commit d0a81165e4
No known key found for this signature in database
GPG Key ID: 7D7C8097B62033CE
11 changed files with 75 additions and 493 deletions

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using StardewValley;
using StardewValley.Locations;
using StardustCore.Animations;
@ -77,17 +78,14 @@ namespace StardewSymphonyRemastered.Framework.Menus
public bool searchBoxSelected;
/// <summary>Construct an instance.</summary>
public MusicManagerMenu() { }
/// <summary>Construct an instance.</summary>
public MusicManagerMenu(float width, float height)
{
this.width = (int)width;
this.height = (int)height;
this.texturedStrings = new List<StardustCore.UIUtilities.SpriteFonts.Components.TexturedString>();
this.musicAlbumButtons = new List<StardustCore.UIUtilities.MenuComponents.Button>();
//thismusicAlbumButtons.Add(new Button("myButton", new Rectangle(100, 100, 64, 64), StardewSymphony.textureManager.getTexture("MusicNote").Copy(StardewSymphony.ModHelper), "mynote", new Rectangle(0, 0, 16, 16), 4f, new StardustCore.Animations.Animation(new Rectangle(0, 0, 16, 16)), Color.White, Color.White,new ButtonFunctionality(new DelegatePairing(hello,null),null,null),false)); //A button that does nothing on the left click.
this.musicAlbumButtons = new List<Button>();
//thismusicAlbumButtons.Add(new Button("myButton", new Rectangle(100, 100, 64, 64), StardewSymphony.textureManager.getTexture("MusicNote").Copy(StardewSymphony.ModHelper), "mynote", new Rectangle(0, 0, 16, 16), 4f, new Animation(new Rectangle(0, 0, 16, 16)), Color.White, Color.White,new ButtonFunctionality(new DelegatePairing(hello,null),null,null),false)); //A button that does nothing on the left click.
this.fancyButtons = new List<Button>();
@ -115,7 +113,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
else
{
float scale = 1.00f / (v.Value.musicPackInformation.getTexture().getTexture().Width / 64f);
this.musicAlbumButtons.Add(new Button(v.Key, new Rectangle(100 + (numOfButtons * 100), 125 + (rows * 100), 64, 64), v.Value.musicPackInformation.getTexture(), "", new Rectangle(0, 0, v.Value.musicPackInformation.getTexture().getTexture().Width, v.Value.musicPackInformation.getTexture().getTexture().Height), scale, new StardustCore.Animations.Animation(new Rectangle(0, 0, 16, 16)), StardustCore.IlluminateFramework.LightColorsList.Black, StardustCore.IlluminateFramework.LightColorsList.Black, new ButtonFunctionality(new DelegatePairing(null, new List<object>
this.musicAlbumButtons.Add(new Button(v.Key, new Rectangle(100 + (numOfButtons * 100), 125 + (rows * 100), 64, 64), v.Value.musicPackInformation.getTexture(), "", new Rectangle(0, 0, v.Value.musicPackInformation.getTexture().getTexture().Width, v.Value.musicPackInformation.getTexture().getTexture().Height), scale, new Animation(new Rectangle(0, 0, 16, 16)), StardustCore.IlluminateFramework.LightColorsList.Black, StardustCore.IlluminateFramework.LightColorsList.Black, new ButtonFunctionality(new DelegatePairing(null, new List<object>
{
v
}
@ -176,8 +174,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
{
if (this.framesSinceLastUpdate == updateNumber)
{
var state = Microsoft.Xna.Framework.Input.Keyboard.GetState();
if (state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Left) || state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.A))
var state = Keyboard.GetState();
if (state.IsKeyDown(Keys.Left) || state.IsKeyDown(Keys.A))
{
this.currentAlbumIndex--;
if (this.currentAlbumIndex < 0) this.currentAlbumIndex = this.musicAlbumButtons.Count - 1;
@ -186,7 +184,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
Game1.playSound("shwip");
}
if (state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Right) || state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.D))
if (state.IsKeyDown(Keys.Right) || state.IsKeyDown(Keys.D))
{
this.currentAlbumIndex++;
if (this.currentAlbumIndex == this.musicAlbumButtons.Count) this.currentAlbumIndex = 0;
@ -205,8 +203,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
{
if (this.framesSinceLastUpdate == updateNumber)
{
var state = Microsoft.Xna.Framework.Input.Keyboard.GetState();
if (state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Left) || state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.A))
var state = Keyboard.GetState();
if (state.IsKeyDown(Keys.Left) || state.IsKeyDown(Keys.A))
{
if (this.currentSongPageIndex > 0)
this.currentSongPageIndex--;
@ -215,7 +213,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
Game1.playSound("shwip");
}
if (state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Right) || state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.D))
if (state.IsKeyDown(Keys.Right) || state.IsKeyDown(Keys.D))
{
this.currentSongPageIndex++;
this.updateFancyButtons();
@ -231,8 +229,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
{
if (this.framesSinceLastUpdate == updateNumber)
{
var state = Microsoft.Xna.Framework.Input.Keyboard.GetState();
if (state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Left) || state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.A))
var state = Keyboard.GetState();
if (state.IsKeyDown(Keys.Left) || state.IsKeyDown(Keys.A))
{
if (this.locationPageIndex > 0)
this.locationPageIndex--;
@ -241,7 +239,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
Game1.playSound("shwip");
}
if (state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Right) || state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.D))
if (state.IsKeyDown(Keys.Right) || state.IsKeyDown(Keys.D))
{
this.locationPageIndex++;
this.updateFancyButtons();
@ -257,8 +255,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
{
if (this.framesSinceLastUpdate == updateNumber)
{
var state = Microsoft.Xna.Framework.Input.Keyboard.GetState();
if (state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Left) || state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.A))
var state = Keyboard.GetState();
if (state.IsKeyDown(Keys.Left) || state.IsKeyDown(Keys.A))
{
if (this.festivalPageIndex > 0)
this.festivalPageIndex--;
@ -267,7 +265,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
Game1.playSound("shwip");
}
if (state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Right) || state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.D))
if (state.IsKeyDown(Keys.Right) || state.IsKeyDown(Keys.D))
{
this.festivalPageIndex++;
this.updateFancyButtons();
@ -283,8 +281,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
{
if (this.framesSinceLastUpdate == updateNumber)
{
var state = Microsoft.Xna.Framework.Input.Keyboard.GetState();
if (state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Left) || state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.A))
var state = Keyboard.GetState();
if (state.IsKeyDown(Keys.Left) || state.IsKeyDown(Keys.A))
{
if (this.eventPageIndex > 0)
this.eventPageIndex--;
@ -293,7 +291,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
Game1.playSound("shwip");
}
if (state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Right) || state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.D))
if (state.IsKeyDown(Keys.Right) || state.IsKeyDown(Keys.D))
{
this.eventPageIndex++;
this.updateFancyButtons();
@ -309,8 +307,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
{
if (this.framesSinceLastUpdate == updateNumber)
{
var state = Microsoft.Xna.Framework.Input.Keyboard.GetState();
if (state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Left) || state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.A))
var state = Keyboard.GetState();
if (state.IsKeyDown(Keys.Left) || state.IsKeyDown(Keys.A))
{
if (this.menuPageIndex > 0)
this.menuPageIndex--;
@ -319,7 +317,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
Game1.playSound("shwip");
}
if (state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Right) || state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.D))
if (state.IsKeyDown(Keys.Right) || state.IsKeyDown(Keys.D))
{
this.menuPageIndex++;
this.updateFancyButtons();
@ -334,7 +332,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
/// <summary>Update the position of the album artwork when displaying it using the fancy buttons menu.</summary>
public virtual void updateFancyButtons()
public void updateFancyButtons()
{
//Album selection mode.
if (this.drawMode == DrawMode.AlbumFancySelection)
@ -378,7 +376,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
}
}
}
this.fancyButtons.Add(new Button("Outline", new Rectangle((int)placement.X + offsetX - 16, (int)placement.Y - 16, 64, 64), StardewSymphony.textureManager.getTexture("OutlineBox"), "", new Rectangle(0, 0, 16, 16), 6f, new StardustCore.Animations.Animation(new Rectangle(0, 0, 16, 16)), Color.White, Color.White, new ButtonFunctionality(null, null, new DelegatePairing(null, new List<object>())), false));
this.fancyButtons.Add(new Button("Outline", new Rectangle((int)placement.X + offsetX - 16, (int)placement.Y - 16, 64, 64), StardewSymphony.textureManager.getTexture("OutlineBox"), "", new Rectangle(0, 0, 16, 16), 6f, new Animation(new Rectangle(0, 0, 16, 16)), Color.White, Color.White, new ButtonFunctionality(null, null, new DelegatePairing(null, new List<object>())), false));
int count = 0;
foreach (var v in this.fancyButtons)
{
@ -389,7 +387,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
//v.hoverText = (string)pair.Key;
//Do something like current album name =
this.texturedStrings.Clear();
this.texturedStrings.Add(SpriteFonts.vanillaFont.ParseString("Current Album Name:" + (string)pair.Key, new Microsoft.Xna.Framework.Vector2(v.bounds.X / 2, v.bounds.Y + 128), v.textColor));
this.texturedStrings.Add(SpriteFonts.vanillaFont.ParseString("Current Album Name:" + pair.Key, new Vector2(v.bounds.X / 2, v.bounds.Y + 128), v.textColor));
v.hoverText = "";
}
count++;
@ -410,7 +408,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
{
//Allow 8 songs to be displayed per page.
Texture2DExtended texture = StardewSymphony.textureManager.getTexture("MusicNote");
float scale = 1.00f / ((float)texture.getTexture().Width / 64f);
float scale = 1.00f / (texture.getTexture().Width / 64f);
Song s = musicPackSongList.ElementAt(i);
Rectangle srcRect = new Rectangle(0, 0, texture.getTexture().Width, texture.getTexture().Height);
this.fancyButtons.Add(new Button(s.name, new Rectangle((int)placement2.X + 25, (int)placement2.Y + ((i % 6) * 100) + 100, 64, 64), texture, s.name, srcRect, scale, new Animation(srcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
@ -428,7 +426,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
{
//Allow 8 songs to be displayed per page.
Texture2DExtended texture = StardewSymphony.textureManager.getTexture("GreenBallon");
float scale = 1.00f / ((float)texture.getTexture().Height / 64f);
float scale = 1.00f / (texture.getTexture().Height / 64f);
Rectangle srcRect = new Rectangle(0, 0, texture.getTexture().Width, texture.getTexture().Height);
this.fancyButtons.Add(new Button(SongSpecifics.festivals.ElementAt(i), new Rectangle((int)placement2.X + 50, (int)placement2.Y + ((i % 6) * 100) + 100, 64, 64), texture, SongSpecifics.festivals.ElementAt(i), srcRect, scale, new Animation(srcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
}
@ -446,7 +444,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
//Allow 8 songs to be displayed per page.
Texture2DExtended texture = StardewSymphony.textureManager.getTexture("MenuIcon");
float scale = 1.00f / ((float)texture.getTexture().Width / 64f);
float scale = 1.00f / (texture.getTexture().Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, texture.getTexture().Width, texture.getTexture().Height);
this.fancyButtons.Add(new Button(SongSpecifics.menus.ElementAt(i), new Rectangle((int)placement2.X + 50, (int)placement2.Y + ((i % 6) * 100) + 100, 64, 64), texture, SongSpecifics.menus.ElementAt(i), srcRect, scale, new Animation(srcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
}
@ -464,7 +462,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
//Allow 8 songs to be displayed per page.
Texture2DExtended texture = StardewSymphony.textureManager.getTexture("StarIcon");
float scale = 1.00f / ((float)texture.getTexture().Width / 64f);
float scale = 1.00f / (texture.getTexture().Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, texture.getTexture().Width, texture.getTexture().Height);
this.fancyButtons.Add(new Button(SongSpecifics.events.ElementAt(i), new Rectangle((int)placement2.X + 50, (int)placement2.Y + ((i % 6) * 100) + 100, 64, 64), texture, SongSpecifics.events.ElementAt(i), srcRect, scale, new Animation(srcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
}
@ -489,7 +487,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
StardewSymphony.ModMonitor.Log("SPRING TEXTURE NULL!");
return;
}
float scale = 1.00f / ((float)springTexture.getTexture().Width / 64f);
float scale = 1.00f / (springTexture.getTexture().Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, springTexture.getTexture().Width, springTexture.getTexture().Height);
this.fancyButtons.Add(new Button("SeasonIcon", new Rectangle((int)seasonPlacement.X, (int)seasonPlacement.Y, 64, 64), springTexture, "Seasonal Music", srcRect, scale, new Animation(srcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
}
@ -504,7 +502,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
StardewSymphony.ModMonitor.Log("SUMMER TEXTURE NULL!");
return;
}
float scale = 1.00f / ((float)summerTexture.getTexture().Width / 64f);
float scale = 1.00f / (summerTexture.getTexture().Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, summerTexture.getTexture().Width, summerTexture.getTexture().Height);
this.fancyButtons.Add(new Button("SeasonIcon", new Rectangle((int)seasonPlacement.X, (int)seasonPlacement.Y, 64, 64), summerTexture, "Seasonal Music", srcRect, scale, new Animation(srcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
}
@ -519,7 +517,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
StardewSymphony.ModMonitor.Log("FALL TEXTURE NULL!");
return;
}
float scale = 1.00f / ((float)fallTexture.getTexture().Width / 64f);
float scale = 1.00f / (fallTexture.getTexture().Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, fallTexture.getTexture().Width, fallTexture.getTexture().Height);
this.fancyButtons.Add(new Button("SeasonIcon", new Rectangle((int)seasonPlacement.X, (int)seasonPlacement.Y, 64, 64), fallTexture, "Seasonal Music", srcRect, scale, new Animation(srcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
}
@ -534,7 +532,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
StardewSymphony.ModMonitor.Log("WINTER TEXTURE NULL!");
return;
}
float scale = 1.00f / ((float)winterTexture.getTexture().Width / 64f);
float scale = 1.00f / (winterTexture.getTexture().Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, winterTexture.getTexture().Width, winterTexture.getTexture().Height);
this.fancyButtons.Add(new Button("SeasonIcon", new Rectangle((int)seasonPlacement.X, (int)seasonPlacement.Y, 64, 64), winterTexture, "Seasonal Music", srcRect, scale, new Animation(srcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
}
@ -548,25 +546,25 @@ namespace StardewSymphonyRemastered.Framework.Menus
//Festival Icon placement.
Texture2DExtended festivalTexture = StardewSymphony.textureManager.getTexture("FestivalIcon");
float festivalScale = 1.00f / ((float)festivalTexture.getTexture().Width / 64f);
float festivalScale = 1.00f / (festivalTexture.getTexture().Width / 64f);
Rectangle festivalSrcRect = new Rectangle(0, 0, festivalTexture.getTexture().Width, festivalTexture.getTexture().Height);
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)));
//Event Icon placement.
Texture2DExtended eventTexture = StardewSymphony.textureManager.getTexture("EventIcon");
float eventScale = 1.00f / ((float)eventTexture.getTexture().Width / 64f);
float eventScale = 1.00f / (eventTexture.getTexture().Width / 64f);
Rectangle eventSrcRectangle = new Rectangle(0, 0, eventTexture.getTexture().Width, eventTexture.getTexture().Height);
this.fancyButtons.Add(new Button("EventIcon", new Rectangle((int)eventPlacement.X, (int)eventPlacement.Y, 64, 64), eventTexture, "Event Music", eventSrcRectangle, eventScale, new Animation(eventSrcRectangle), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
//Menu Icon placement.
Texture2DExtended menuTexture = StardewSymphony.textureManager.getTexture("MenuIcon");
float menuScale = 1.00f / ((float)menuTexture.getTexture().Width / 64f);
float menuScale = 1.00f / (menuTexture.getTexture().Width / 64f);
Rectangle menuSrcRectangle = new Rectangle(0, 0, menuTexture.getTexture().Width, menuTexture.getTexture().Height);
this.fancyButtons.Add(new Button("MenuIcon", new Rectangle((int)menuPlacement.X, (int)menuPlacement.Y, 64, 64), menuTexture, "Menu Music", menuSrcRectangle, menuScale, new Animation(menuSrcRectangle), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
//Menu Icon placement.
Texture2DExtended locationTexture = StardewSymphony.textureManager.getTexture("HouseIcon");
float locationScale = 1.00f / ((float)locationTexture.getTexture().Width / 64f);
float locationScale = 1.00f / (locationTexture.getTexture().Width / 64f);
Rectangle locationRect = new Rectangle(0, 0, locationTexture.getTexture().Width, locationTexture.getTexture().Height);
this.fancyButtons.Add(new Button("LocationButton", new Rectangle((int)locationPlacement.X, (int)locationPlacement.Y, 64, 64), locationTexture, "Location Music", locationRect, locationScale, new Animation(locationRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
}
@ -590,25 +588,25 @@ namespace StardewSymphonyRemastered.Framework.Menus
StardewSymphony.ModMonitor.Log("SPRING TEXTURE NULL!");
return;
}
float scale = 1.00f / ((float)springTexture.getTexture().Width / 64f);
float scale = 1.00f / (springTexture.getTexture().Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, springTexture.getTexture().Width, springTexture.getTexture().Height);
this.fancyButtons.Add(new Button("SpringButton", new Rectangle((int)springPlacement.X, (int)springPlacement.Y, 64, 64), springTexture, "Spring Music", srcRect, scale, new Animation(srcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
//Festival Icon placement.
Texture2DExtended festivalTexture = StardewSymphony.textureManager.getTexture("SummerIcon");
float festivalScale = 1.00f / ((float)festivalTexture.getTexture().Width / 64f);
float festivalScale = 1.00f / (festivalTexture.getTexture().Width / 64f);
Rectangle festivalSrcRect = new Rectangle(0, 0, festivalTexture.getTexture().Width, festivalTexture.getTexture().Height);
this.fancyButtons.Add(new Button("SummerButton", new Rectangle((int)summerPlacement.X, (int)summerPlacement.Y, 64, 64), festivalTexture, "Summer Music", festivalSrcRect, festivalScale, new Animation(festivalSrcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
//Event Icon placement.
Texture2DExtended eventTexture = StardewSymphony.textureManager.getTexture("FallIcon");
float eventScale = 1.00f / ((float)eventTexture.getTexture().Width / 64f);
float eventScale = 1.00f / (eventTexture.getTexture().Width / 64f);
Rectangle eventSrcRectangle = new Rectangle(0, 0, eventTexture.getTexture().Width, eventTexture.getTexture().Height);
this.fancyButtons.Add(new Button("FallButton", new Rectangle((int)fallPlacement.X, (int)fallPlacement.Y, 64, 64), eventTexture, "Fall Music", eventSrcRectangle, eventScale, new Animation(eventSrcRectangle), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
//Menu Icon placement.
Texture2DExtended menuTexture = StardewSymphony.textureManager.getTexture("WinterIcon");
float menuScale = 1.00f / ((float)menuTexture.getTexture().Width / 64f);
float menuScale = 1.00f / (menuTexture.getTexture().Width / 64f);
Rectangle menuSrcRectangle = new Rectangle(0, 0, menuTexture.getTexture().Width, menuTexture.getTexture().Height);
this.fancyButtons.Add(new Button("WinterButton", new Rectangle((int)winterPlacement.X, (int)winterPlacement.Y, 64, 64), menuTexture, "Winter Music", menuSrcRectangle, menuScale, new Animation(menuSrcRectangle), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
}
@ -688,7 +686,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
display = "Wedding Music";
}
float scale = 1.00f / ((float)texture.getTexture().Width / 64f);
float scale = 1.00f / (texture.getTexture().Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, texture.getTexture().Width, texture.getTexture().Height);
this.fancyButtons.Add(new Button(name, new Rectangle((int)placement2.X + 50, (int)placement2.Y + ((i % 7) * 100), 64, 64), texture, display, srcRect, scale, new Animation(srcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
@ -724,7 +722,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
{
StardewSymphony.ModMonitor.Log("HMM A TEXTURE IS NULL: " + i.ToString());
}
float scale = 1.00f / ((float)texture.getTexture().Width / 64f);
float scale = 1.00f / (texture.getTexture().Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, texture.getTexture().Width, texture.getTexture().Height);
this.fancyButtons.Add(new Button(name, new Rectangle((int)placement2.X + 50, (int)placement2.Y + ((i % 7) * 100), 64, 64), texture, display, srcRect, scale, new Animation(srcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
}
@ -756,7 +754,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
numOfEmptyCabin++;
}
Texture2DExtended texture2 = StardewSymphony.textureManager.getTexture("HouseIcon");
float scale2 = 1.00f / ((float)texture2.getTexture().Width / 64f);
float scale2 = 1.00f / (texture2.getTexture().Width / 64f);
Rectangle srcRect2 = new Rectangle(0, 0, texture2.getTexture().Width, texture2.getTexture().Height);
this.fancyButtons.Add(new Button(locName, new Rectangle((int)placement2.X + 25, (int)placement2.Y + ((i % 6) * 100) + 100, 64, 64), texture2, displayName, srcRect2, scale2, new Animation(srcRect2), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
@ -767,7 +765,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
string displayName = "Empty Cabin " + (numOfEmptyCabin);
numOfEmptyCabin++;
Texture2DExtended texture2 = StardewSymphony.textureManager.getTexture("HouseIcon");
float scale2 = 1.00f / ((float)texture2.getTexture().Width / 64f);
float scale2 = 1.00f / (texture2.getTexture().Width / 64f);
Rectangle srcRect2 = new Rectangle(0, 0, texture2.getTexture().Width, texture2.getTexture().Height);
this.fancyButtons.Add(new Button(locName, new Rectangle((int)placement2.X + 25, (int)placement2.Y + ((i % 6) * 100) + 100, 64, 64), texture2, displayName, srcRect2, scale2, new Animation(srcRect2), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
continue;
@ -778,7 +776,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
//Allow 8 songs to be displayed per page.
Texture2DExtended texture = StardewSymphony.textureManager.getTexture("HouseIcon");
float scale = 1.00f / ((float)texture.getTexture().Width / 64f);
float scale = 1.00f / (texture.getTexture().Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, texture.getTexture().Width, texture.getTexture().Height);
this.fancyButtons.Add(new Button(locName, new Rectangle((int)placement2.X + 25, (int)placement2.Y + ((i % 6) * 100) + 100, 64, 64), texture, locName, srcRect, scale, new Animation(srcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
}
@ -839,7 +837,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
display = "Saturday Music";
}
float scale = 1.00f / ((float)texture.getTexture().Width / 64f);
float scale = 1.00f / (texture.getTexture().Width / 64f);
Rectangle srcRect = new Rectangle(0, 0, texture.getTexture().Width, texture.getTexture().Height);
this.fancyButtons.Add(new Button(name, new Rectangle((int)placement2.X + 50, (int)placement2.Y + ((i % 7) * 100), 64, 64), texture, display, srcRect, scale, new Animation(srcRect), Color.White, Color.White, new ButtonFunctionality(null, null, null)));
}
@ -860,19 +858,6 @@ namespace StardewSymphonyRemastered.Framework.Menus
v.onRightClick();
}
}
if (this.drawMode == DrawMode.AlbumFancySelection)
{
int count = 0;
foreach (var v in this.fancyButtons)
{
count++;
//if (v.containsPoint(x, y)) v.onRightClick();
//this.currentAlbumIndex += count;
//if (this.currentAlbumIndex >= this.musicAlbumButtons.Count) this.currentAlbumIndex -= this.musicAlbumButtons.Count;
//this.updateFancyButtons();
}
}
}
/// <summary>Actions that occur when hovering over an icon.</summary>
@ -885,7 +870,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
if (v.containsPoint(x, y))
{
var pair = (KeyValuePair<string, MusicPack>)v.buttonFunctionality.hover.paramaters[0];
v.hoverText = (string)pair.Key;
v.hoverText = pair.Key;
v.onHover();
//StardewSymphony.ModMonitor.Log(pair.Key);
}
@ -896,7 +881,6 @@ namespace StardewSymphonyRemastered.Framework.Menus
if (this.drawMode == DrawMode.AlbumFancySelection)
{
int count = 0;
foreach (var v in this.fancyButtons)
{
if (v.containsPoint(x, y))
@ -905,13 +889,11 @@ namespace StardewSymphonyRemastered.Framework.Menus
continue;
var pair = (KeyValuePair<string, MusicPack>)v.buttonFunctionality.hover.paramaters[0];
v.hoverText = (string)pair.Key;
v.hoverText = pair.Key;
v.onHover();
}
else
v.hoverText = "";
count++;
}
}
}
@ -998,7 +980,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
int amountToShow = 6;
this.updateFancyButtons();
int amount = 0;
int amount;
if (0 + ((this.currentSongPageIndex + 1) * amountToShow) >= this.fancyButtons.Count)
{
amount = (0 + ((this.currentSongPageIndex + 1) * (amountToShow)) - this.fancyButtons.Count);
@ -1187,7 +1169,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
int amountToShow = 6;
this.updateFancyButtons();
int amount = 0;
int amount;
if (0 + ((this.locationPageIndex + 1) * amountToShow) >= this.fancyButtons.Count)
{
amount = (0 + ((this.locationPageIndex + 1) * (amountToShow)) - this.fancyButtons.Count);
@ -1233,7 +1215,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
int amountToShow = 6;
this.updateFancyButtons();
int amount = 0;
int amount;
if (0 + ((this.festivalPageIndex + 1) * amountToShow) >= this.fancyButtons.Count)
{
amount = (0 + ((this.festivalPageIndex + 1) * (amountToShow)) - this.fancyButtons.Count);
@ -1275,7 +1257,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
int amountToShow = 6;
this.updateFancyButtons();
int amount = 0;
int amount;
if (0 + ((this.menuPageIndex + 1) * amountToShow) >= this.fancyButtons.Count)
{
amount = (0 + ((this.menuPageIndex + 1) * (amountToShow)) - this.fancyButtons.Count);
@ -1317,7 +1299,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
int amountToShow = 6;
this.updateFancyButtons();
int amount = 0;
int amount;
if (0 + ((this.eventPageIndex + 1) * amountToShow) >= this.fancyButtons.Count)
{
amount = (0 + ((this.eventPageIndex + 1) * (amountToShow)) - this.fancyButtons.Count);
@ -1360,8 +1342,8 @@ namespace StardewSymphonyRemastered.Framework.Menus
{
if (button.containsPoint(x, y))
{
if (button.name != "SundayIcon" || button.name != "MondayIcon" || button.name != "TuesdayIcon" || button.name != "WednesdayIcon" || button.name != "ThursdayIcon" || button.name != "FridayIcon" || button.name != "SaturdayIcon")
if (button == null) continue;
//if (button.name != "SundayIcon" || button.name != "MondayIcon" || button.name != "TuesdayIcon" || button.name != "WednesdayIcon" || button.name != "ThursdayIcon" || button.name != "FridayIcon" || button.name != "SaturdayIcon")
// if (button == null) continue;
Vector2 position = new Vector2(this.width * .1f + 64, this.height * .05f + 576);
//Get any valid location button.
this.currentlySelectedDay = button.clone(position);
@ -1432,7 +1414,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
int amountToShow = 6;
this.currentMusicPackAlbum.draw(b);
int amount = 0;
int amount;
if (0 + ((this.currentSongPageIndex + 1) * amountToShow) >= this.fancyButtons.Count)
{
amount = (0 + ((this.currentSongPageIndex + 1) * (amountToShow)) - this.fancyButtons.Count);
@ -1541,7 +1523,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
}
//Deals with logic regarding different pages.
int amount = 0;
int amount;
if (0 + ((this.locationPageIndex + 1) * amountToShow) >= this.fancyButtons.Count)
{
amount = (0 + ((this.locationPageIndex + 1) * (amountToShow)) - this.fancyButtons.Count);
@ -1638,7 +1620,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
this.stopButton.draw(b);
int amount = 0;
int amount;
if (0 + ((this.eventPageIndex + 1) * amountToShow) >= this.fancyButtons.Count)
{
amount = (0 + ((this.eventPageIndex + 1) * (amountToShow)) - this.fancyButtons.Count);
@ -1685,7 +1667,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
this.playButton.draw(b);
this.stopButton.draw(b);
int amount = 0;
int amount;
if (0 + ((this.menuPageIndex + 1) * amountToShow) >= this.fancyButtons.Count)
{
amount = (0 + ((this.menuPageIndex + 1) * (amountToShow)) - this.fancyButtons.Count);
@ -1733,7 +1715,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
this.playButton.draw(b);
this.stopButton.draw(b);
int amount = 0;
int amount;
if (0 + ((this.festivalPageIndex + 1) * amountToShow) >= this.fancyButtons.Count)
{
amount = (0 + ((this.festivalPageIndex + 1) * (amountToShow)) - this.fancyButtons.Count);
@ -1853,16 +1835,6 @@ namespace StardewSymphonyRemastered.Framework.Menus
this.drawMouse(b);
}
public void PlayRandomSongFromSelectedMusicPack(List<object> param)
{
var info = (KeyValuePair<string, MusicPack>)param[0];
//StardewSymphony.ModMonitor.Log(info.ToString());
StardewSymphony.musicManager.swapMusicPacks(info.Key);
StardewSymphony.musicManager.playRandomSongFromPack(info.Key);
//info.Value.playRandomSong();
}
/// <summary>Select a album artwork and change the draw mode to go to the song selection screen.</summary>
public void selectAlbum(Button b)
{
@ -1871,7 +1843,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
this.currentMusicPackAlbum = b.clone(new Vector2(this.width * .1f + 64, this.height * .05f + 128));
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, false));
this.texturedStrings.Add(SpriteFonts.vanillaFont.ParseString("Name:" + b.name, new Vector2(this.width * .1f, this.height * .05f + 256), b.textColor, false));
this.drawMode = DrawMode.SongSelectionMode;
}
@ -1936,7 +1908,7 @@ namespace StardewSymphonyRemastered.Framework.Menus
public void deleteSong()
{
var info = (KeyValuePair<string, MusicPack>)this.currentMusicPackAlbum.buttonFunctionality.leftClick.paramaters[0];
if (this.drawMode == DrawMode.SelectedFestival)
{
info.Value.songInformation.removeSongFromFestivalList(this.currentSelectedSong.label);

View File

@ -8,60 +8,16 @@ namespace StardewSymphonyRemastered.Framework
{
public class MusicHexProcessor
{
/*********
** Properties
*********/
/// <summary>All of the music/soundbanks and their locations.</summary>
private readonly XACTMusicPack MasterList;
/// <summary>The registered soundbanks.</summary>
private readonly List<string> SoundBanks = new List<string>();
/// <summary>The callback to reset the game audio.</summary>
private readonly Action Reset;
/*********
** Public methods
*********/
/// <summary>Construct an instance.</summary>
/// <param name="masterList">All of the music/soundbanks and their locations.</param>
/// <param name="reset">The callback to reset the game audio.</param>
public MusicHexProcessor(XACTMusicPack masterList, Action reset)
{
this.MasterList = masterList;
this.Reset = reset;
}
/// <summary>Add a file path to the list of soundbanks.</summary>
/// <param name="path">The soundbank file path.</param>
public void AddSoundBank(string path)
{
this.SoundBanks.Add(path);
}
/// <summary>Process the soundbank.swb file's hex info and extract the song names from it.</summary>
public static List<string> ProcessSongNamesFromHex(XACTMusicPack musicPack, Action reset, string FileName)
{
List<string> cleanCueNames = new List<string>();
byte[] array = File.ReadAllBytes(FileName);
string rawName = FileName.Substring(0, FileName.Length - 4);
string cueName = rawName + "CueList.txt";
//Not used as the music pack can change between loads
/*
if (File.Exists(cueName))
{
string[] arr = File.ReadAllLines(cueName);
List<string> names = new List<string>();
foreach(var v in arr)
{
names.Add(v);
}
return names;
}
*/
string hexDumpContents = HexDump(array);
string rawHexName = rawName + "HexDump.txt";

View File

@ -108,36 +108,12 @@ namespace StardewSymphonyRemastered.Framework
this.currentMusicPack?.playSong(songName);
}
/// <summary>Resumes the paused song from the current music pack.</summary>
public void pauseSongFromCurrentPack()
{
this.currentMusicPack?.pauseSong();
}
/// <summary>Stops the song from the current music pack.</summary>
public void stopSongFromCurrentMusicPack()
{
this.currentMusicPack?.stopSong();
}
/// <summary>Resumes the song from the current music pack.</summary>
public void resumeSongFromCurrentMusicPack()
{
this.currentMusicPack?.resumeSong();
}
/// <summary>Returns the name of the currently playing song.</summary>
public string getNameOfCurrentlyPlayingSong()
{
return this.currentMusicPack?.getNameOfCurrentSong() ?? "";
}
/// <summary>Get the information associated with the current music pack.</summary>
public MusicPackMetaData getMusicPackInformation()
{
return this.currentMusicPack?.musicPackInformation;
}
/// <summary>Checks to see if the music pack has been loaded into the Music Manager.</summary>
public bool isMusicPackValid(string nameOfMusicPack)
{
@ -582,14 +558,5 @@ namespace StardewSymphonyRemastered.Framework
foreach (var pack in this.musicPacks)
pack.Value.songInformation.initializeEventMusic();
}
/// <summary>Play a random song from a given music pack.</summary>
public void playRandomSongFromPack(string musicPackName)
{
this.musicPacks.TryGetValue(musicPackName, out MusicPack musicPack);
this.currentMusicPack?.stopSong();
musicPack.playRandomSong();
this.currentMusicPack = musicPack;
}
}
}

View File

@ -12,25 +12,8 @@ namespace StardewSymphonyRemastered.Framework
public virtual void playSong(string name) { }
public virtual void pauseSong() { }
public virtual void stopSong() { }
public virtual void resumeSong() { }
public virtual void loadMusicFiles() { }
public virtual void swapSong(string songName) { }
public virtual string getNameOfCurrentSong()
{
return "";
}
public virtual void setModDirectoryFromFullDirectory() { }
public virtual void playRandomSong() { }
public virtual bool isPlaying()
{
return false;

View File

@ -37,16 +37,13 @@ namespace StardewSymphonyRemastered.Framework
}
}
/// <summary>Construct an instance.</summary>
public MusicPackMetaData() { }
/// <summary>Loads the music pack information from a json file.</summary>
public static MusicPackMetaData readFromJson(string path)
{
string json = Path.Combine(path, "MusicPackInformation.json");
var meta = StardewSymphony.ModHelper.ReadJsonFile<MusicPackMetaData>(json);
string[] pathParse = path.Split(new string[] { StardewSymphony.ModHelper.DirectoryPath }, StringSplitOptions.None);
string[] pathParse = path.Split(new[] { StardewSymphony.ModHelper.DirectoryPath }, StringSplitOptions.None);
try
{

View File

@ -1,88 +1,15 @@
using System.IO;
namespace StardewSymphonyRemastered.Framework
{
/// <summary>The class to be used to manage individual songs.</summary>
public class Song
{
/// <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.</summary>
private readonly string pathToSong;
/// <summary>The name of the song itself.</summary>
public string name;
/// <summary>The relative path to the song.</summary>
private readonly string relativePath;
/// <summary>Blank Constructor;</summary>
public Song() { }
/// <summary>Constructor to be used for WAV files.</summary>
public Song(string PathToSong)
public Song(string name)
{
this.pathToSong = PathToSong;
this.name = this.getNameFromPath(this.pathToSong);
this.relativePath = this.getRelativePathFromFullPath();
}
/// <summary>Constructor to be used for XACT music packs.</summary>
public Song(string PathToSong, string Name)
{
this.pathToSong = PathToSong;
this.name = Name;
this.relativePath = this.getRelativePathFromFullPath();
}
/// <summary>Parse the name of the file from the path provided.</summary>
public string getNameFromPath(string path)
{
return Path.GetFileNameWithoutExtension(path);
}
/// <summary>Get the relative path to this song from the full path on disk provided.</summary>
public string getRelativePathFromFullPath()
{
string[] spliter = this.pathToSong.Split(Path.DirectorySeparatorChar);
string relative = "";
int index = 0;
foreach (string str in spliter) //iterate across all of the strings until Content is found.
{
if (str == "Content")
{
//Once content is found add it to the relative string and append a newline character.
for (int i = index; i < spliter.Length; i++)
{
relative += spliter[i];
if (i != spliter.Length - 1)
relative += Path.DirectorySeparatorChar;
}
}
index++;
}
return relative; //Return the relative path string
}
/// <summary>Read the info from a .json file.</summary>
public static Song ReadFromJson(string path)
{
return StardewSymphony.ModHelper.ReadJsonFile<Song>(path);
}
/// <summary>Write the information of the instance to a .json file.</summary>
/// <param name="path">The path to which the json file is written to.</param>
public void writeToJson(string path)
{
StardewSymphony.ModHelper.WriteJsonFile<Song>(path, this);
}
public string getRelativePath()
{
return this.relativePath;
}
public string getPathToSong()
{
return this.pathToSong;
this.name = name;
}
}
}

View File

@ -11,12 +11,7 @@ namespace StardewSymphonyRemastered.Framework
/// <summary>The list of songs associated with a trigger.</summary>
public List<Song> songList;
/// <summary>Empty constructor.</summary>
public SongListNode() { }
/// <summary>Construct an instance.</summary>
/// <param name="Trigger"></param>
/// <param name="SongList"></param>
public SongListNode(string Trigger, List<Song> SongList)
{
this.trigger = Trigger;

View File

@ -107,7 +107,7 @@ namespace StardewSymphonyRemastered.Framework
/// <summary>Sum up some conditionals to parse the correct string key to access the songs list.</summary>
public static string getCurrentConditionalString(bool getJustLocation = false)
{
string key = "";
string key;
//Event id's are the number found before the : for the event in Content/events/<location>.yaml file where location is the name of the stardew valley location.
if (!getJustLocation)
@ -117,7 +117,7 @@ namespace StardewSymphonyRemastered.Framework
//Get the event id an hijack it with some different music
//String key="Event_EventName";
var reflected = StardewSymphony.ModHelper.Reflection.GetField<int>(Game1.CurrentEvent, "id", true);
var reflected = StardewSymphony.ModHelper.Reflection.GetField<int>(Game1.CurrentEvent, "id");
int id = reflected.GetValue();
key = id.ToString(); //get the event id. Really really messy.
@ -221,26 +221,6 @@ namespace StardewSymphonyRemastered.Framework
festivals.Add(name);
}
// 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 initializeEventsList()
{
//Do some logic here
//addEvent(12345.ToString());
}
/// <summary>Custom way to add in event to hijack music.</summary>
public static void addEvent(string id)
{
events.Add(id);
//Do some logic here
}
/// <summary>Add a location to the loctaion list.</summary>
public static void addLocation(string name)
{
locations.Add(name);
}
/// <summary>Get the name of the day of the week from what game day it is.</summary>
public static string getDayOfWeekString()
{
@ -340,10 +320,6 @@ namespace StardewSymphonyRemastered.Framework
}
}
public static string getCurrentMenuString()
{
return Game1.activeClickableMenu == null ? "" : Game1.activeClickableMenu.GetType().ToString();
}
#endregion
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
@ -352,13 +328,6 @@ namespace StardewSymphonyRemastered.Framework
#region
/// <summary>Adds the song's reference to a music pack.</summary>
/// <param name="song">The FULL namespace of the menu. Example is StardewValley.Menus.TitleMenu</param>
public void addSongToMusicPack(Song song)
{
this.listOfSongsWithoutTriggers.Add(song);
}
/// <summary>Initialize a basic list of menus supported.</summary>
public static void initializeMenuList()
{
@ -390,20 +359,6 @@ namespace StardewSymphonyRemastered.Framework
}
/// <summary>Add a menu to stardew symphony so that it may have unique music.</summary>
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)
{
err.ToString();
}
}
/// <summary>Add amenu to stardew symphony so that it may have unique music.</summary>
/// <param name="menuType">The type of menu to add in. Typically this is typeof(MyMenuClass)</param>
public static void addMenu(Type menuType)
@ -452,7 +407,7 @@ namespace StardewSymphonyRemastered.Framework
catch { }
}
}
/// <summary>Checks if the song exists at all in this music pack.</summary>
public bool isSongInList(string songName)
{
@ -501,7 +456,7 @@ namespace StardewSymphonyRemastered.Framework
if (pair.Key == key)
return pair;
}
return new KeyValuePair<string, List<Song>>("", null);
}
@ -515,12 +470,6 @@ namespace StardewSymphonyRemastered.Framework
return this.eventSongs;
}
public List<Song> getMenuMusic()
{
return null;
//return this.menuSongs();
}
/// <summary>Add a song name to a specific list of songs to play that will play under certain conditions.</summary>
public void addSongToTriggerList(string songListKey, string songName)
{

View File

@ -20,70 +20,24 @@ namespace StardewSymphonyRemastered.Framework
/// <summary>The currently playing sound.</summary>
public SoundEffectInstance sound;
bool loop;
/// <summary>The name of the music pack/</summary>
public string Name => this.musicPackInformation.name;
public Dictionary<string, SoundEffectInstance> sounds;
/// <summary>Construct an instance.</summary>
/// <param name="directoryToMusicPack"></param>
public WavMusicPack(string directoryToMusicPack, bool loop = false)
public WavMusicPack(string directoryToMusicPack)
{
this.directory = directoryToMusicPack;
this.setModDirectoryFromFullDirectory();
this.songsDirectory = Path.Combine(this.directory, "Songs");
this.songInformation = new SongSpecifics();
this.musicPackInformation = MusicPackMetaData.readFromJson(directoryToMusicPack);
this.loop = loop;
this.sounds = new Dictionary<string, SoundEffectInstance>();
/*
if (this.musicPackInformation == null)
{
//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","");
}
*/
//StardewSymphony.ModMonitor.Log(this.musicPackInformation.name.ToString());
this.loadMusicFiles();
}
/// <summary>A shortened directory name for display purposes.</summary>
public override void setModDirectoryFromFullDirectory()
{
string[] spliter = this.directory.Split(Path.DirectorySeparatorChar);
string directoryLocation = "";
for (int i = spliter.Length - 6; i < spliter.Length; i++)
{
directoryLocation += spliter[i];
if (i != spliter.Length - 1)
directoryLocation += Path.DirectorySeparatorChar;
}
}
/*
/// <summary>Load a wav file into the stream to be played.</summary>
public void LoadWavFromFileToStream(string file)
{
// Create a new SpriteBatch, which can be used to draw textures.
System.IO.Stream waveFileStream = File.OpenRead(file); //TitleContainer.OpenStream(file);
this.effect = SoundEffect.FromStream(waveFileStream);
this.sound=this.effect.CreateInstance();
this.currentSong = new Song(file);
waveFileStream.Dispose();
}
*/
/// <summary>Returns the name of the currently playing song.</summary>
public override string getNameOfCurrentSong()
{
return this.currentSong?.name ?? "";
}
/// <summary>Load in the music files from the pack's respective Directory/Songs folder. Typically Content/Music/Wav/FolderName/Songs</summary>
public override void loadMusicFiles()
private void loadMusicFiles()
{
List<string> wavFiles = Directory.GetFiles(this.songsDirectory, "*.wav").ToList();
wavFiles.AddRange(Directory.GetFiles(this.songsDirectory, "*.mp3"));
@ -94,7 +48,6 @@ namespace StardewSymphonyRemastered.Framework
MemoryStream memoryStream = new MemoryStream();
AudioFileReader fileReader = new AudioFileReader(wav);
fileReader.CopyTo(memoryStream);
byte[] wavData = memoryStream.ToArray();
SoundEffect eff = null;
@ -138,7 +91,7 @@ namespace StardewSymphonyRemastered.Framework
this.sounds.Add(name, instance);
//waveFileStream.Dispose();
Song song = new Song(wav);
Song song = new Song(name);
this.songInformation.listOfSongsWithoutTriggers.Add(song);
//listOfSongs.Add(song);
}
@ -146,12 +99,6 @@ namespace StardewSymphonyRemastered.Framework
StardewSymphony.ModMonitor.Log("Time to load WAV music pack: " + this.musicPackInformation.name + span.Subtract(DateTime.Now).ToString());
}
/// <summary>Used to pause the current song.</summary>
public override void pauseSong()
{
this.sound?.Pause();
}
/// <summary>Used to play a song.</summary>
public override void playSong(string name)
{
@ -170,20 +117,6 @@ namespace StardewSymphonyRemastered.Framework
}
}
public override void playRandomSong()
{
Random r = Game1.random;
int value = r.Next(0, this.songInformation.listOfSongsWithoutTriggers.Count);
Song s = this.songInformation.listOfSongsWithoutTriggers.ElementAt(value);
this.swapSong(s.name);
}
/// <summary>Used to resume the currently playing song.</summary>
public override void resumeSong()
{
this.sound?.Resume();
}
/// <summary>Used to stop the currently playing song.</summary>
public override void stopSong()
{
@ -195,35 +128,6 @@ namespace StardewSymphonyRemastered.Framework
this.currentSong = null;
}
/// <summary>Used to change from one playing song to another;</summary>
public override void swapSong(string songName)
{
this.stopSong();
this.playSong(songName);
}
/// <summary>Get the son's name from the path.</summary>
public string getSongNameFromPath(string path)
{
foreach (var song in this.songInformation.listOfSongsWithoutTriggers)
{
if (song.getPathToSong() == path)
return song.name;
}
return "";
}
/// <summary>Gets the song's path that shares the same name.</summary>
public string getSongPathFromName(string name)
{
foreach (var song in this.songInformation.listOfSongsWithoutTriggers)
{
if (song.name == name)
return song.getPathToSong();
}
return "";
}
public override bool isPlaying()
{
return this.sound?.State == SoundState.Playing;

View File

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.Xna.Framework.Audio;
using StardewValley;
@ -24,7 +21,6 @@ namespace StardewSymphonyRemastered.Framework
this.directory = directoryToXwb;
this.WaveBankPath = pathToWaveBank;
this.SoundBankPath = pathToSoundBank;
this.setModDirectoryFromFullDirectory();
this.songInformation = new SongSpecifics();
this.currentCue = null;
this.musicPackInformation = MusicPackMetaData.readFromJson(directoryToXwb);
@ -41,28 +37,20 @@ namespace StardewSymphonyRemastered.Framework
}
/// <summary>Load all of the generic music file names into the music pack's information.</summary>
public override void loadMusicFiles()
private void loadMusicFiles()
{
var listOfSongStrings = MusicHexProcessor.ProcessSongNamesFromHex(this, StardewSymphony.Reset, this.SoundBankPath);
List<Song> listofSongs = new List<Song>();
foreach (string songname in listOfSongStrings)
{
Song song = new Song(this.WaveBankPath, songname);
Song song = new Song(songname);
listofSongs.Add(song);
}
this.songInformation.listOfSongsWithoutTriggers = listofSongs;
}
public override void playRandomSong()
{
Random r = new Random();
int value = r.Next(0, this.songInformation.listOfSongsWithoutTriggers.Count);
Song s = this.songInformation.listOfSongsWithoutTriggers.ElementAt(value);
this.swapSong(s.name);
}
/// <summary>Get the cue from the list of songs.</summary>
/// <param name="name">The name of the song to get.</param>
private Cue getCue(string name)
@ -93,30 +81,6 @@ namespace StardewSymphonyRemastered.Framework
StardewSymphony.Reset();
}
/// <summary>Pause the currently playing song.</summary>
public override void pauseSong()
{
if (this.currentCue != null)
{
Game1.waveBank = this.WaveBank;
Game1.soundBank = this.SoundBank;
this.currentCue.Pause();
StardewSymphony.Reset();
}
}
/// <summary>Resume playing the current set cue.</summary>
public override void resumeSong()
{
if (this.currentCue != null)
{
Game1.waveBank = this.WaveBank;
Game1.soundBank = this.SoundBank;
this.currentCue.Resume();
StardewSymphony.Reset();
}
}
/// <summary>Stops the currently playing song and nulls the current song.</summary>
public override void stopSong()
{
@ -131,34 +95,6 @@ namespace StardewSymphonyRemastered.Framework
}
}
/// <summary>Stops the currently playing song and starts playing a new song.</summary>
/// <param name="newSongName">The name of the new song to play.</param>
public override void swapSong(string newSongName)
{
this.stopSong();
this.playSong(newSongName);
}
/// <summary>Returns the name of the currently playing song.</summary>
public override string getNameOfCurrentSong()
{
return this.currentCue?.Name ?? "";
}
/// <summary>Returns a shortened directory name for display purposes.</summary>
public override void setModDirectoryFromFullDirectory()
{
string[] spliter = this.WaveBankPath.Split(Path.DirectorySeparatorChar);
string directoryLocation = "";
for (int i = spliter.Length - 5; i < spliter.Length; i++)
{
directoryLocation += spliter[i];
if (i != spliter.Length - 1)
directoryLocation += Path.DirectorySeparatorChar;
}
}
public override bool isPlaying()
{
if (this.currentCue == null) return false;

View File

@ -41,9 +41,6 @@ namespace StardewSymphonyRemastered
public bool musicPacksInitialized;
public static bool festivalStart;
public static bool eventStart;
public static bool menuChangedMusic;
public static Config Config;
@ -94,7 +91,6 @@ namespace StardewSymphonyRemastered
//Initialize all of the lists upon creation during entry.
SongSpecifics.initializeMenuList();
SongSpecifics.initializeEventsList();
SongSpecifics.initializeFestivalsList();
this.initializeMusicPacks();