Play some randome music and play wav packs.
This commit is contained in:
parent
ed899b49d9
commit
1bbf3f2503
Binary file not shown.
After Width: | Height: | Size: 270 B |
|
@ -29,14 +29,29 @@ namespace StardewSymphonyRemastered.Framework.Menus
|
||||||
int rows = 0;
|
int rows = 0;
|
||||||
foreach(var v in StardewSymphony.musicManager.musicPacks)
|
foreach(var v in StardewSymphony.musicManager.musicPacks)
|
||||||
{
|
{
|
||||||
this.buttons.Add(new Button(v.Key, new Rectangle(100+(numOfButtons*100), 100+(rows*100), 64, 64), StardewSymphony.textureManager.getTexture("MusicNote").Copy(StardewSymphony.ModHelper), "", 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(displayMusicPack, new List<object>
|
if (v.Value.musicPackInformation.Icon == null)
|
||||||
|
{
|
||||||
|
this.buttons.Add(new Button(v.Key, new Rectangle(100 + (numOfButtons * 100), 125 + (rows * 100), 64, 64), StardewSymphony.textureManager.getTexture("MusicDisk"), "", new Rectangle(0, 0, 16, 16), 4f, new StardustCore.Animations.Animation(new Rectangle(0, 0, 16, 16)), StardustCore.IlluminateFramework.Colors.randomColor(), Color.White, new ButtonFunctionality(new DelegatePairing(displayMusicPack, new List<object>
|
||||||
{
|
{
|
||||||
(object)v
|
(object)v
|
||||||
}
|
}
|
||||||
),null, new DelegatePairing(null,new List<object>(){
|
), null, new DelegatePairing(null, new List<object>(){
|
||||||
(object)v
|
(object)v
|
||||||
}
|
}
|
||||||
)), false));
|
)), false));
|
||||||
|
}
|
||||||
|
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>
|
||||||
|
{
|
||||||
|
(object)v
|
||||||
|
}
|
||||||
|
), null, new DelegatePairing(null, new List<object>(){
|
||||||
|
(object)v
|
||||||
|
}
|
||||||
|
)), false));
|
||||||
|
}
|
||||||
|
|
||||||
numOfButtons++;
|
numOfButtons++;
|
||||||
if (numOfButtons > 8)
|
if (numOfButtons > 8)
|
||||||
{
|
{
|
||||||
|
@ -61,9 +76,13 @@ namespace StardewSymphonyRemastered.Framework.Menus
|
||||||
if (v.containsPoint(x, y))
|
if (v.containsPoint(x, y))
|
||||||
{
|
{
|
||||||
var pair = (KeyValuePair<string, MusicPack>)v.buttonFunctionality.hover.paramaters[0];
|
var pair = (KeyValuePair<string, MusicPack>)v.buttonFunctionality.hover.paramaters[0];
|
||||||
v.hoverText = pair.Key;
|
v.hoverText = (string)pair.Key;
|
||||||
v.onHover();
|
v.onHover();
|
||||||
StardewSymphony.ModMonitor.Log(pair.Key);
|
//StardewSymphony.ModMonitor.Log(pair.Key);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
v.hoverText = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using StardustCore.UIUtilities;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -18,7 +19,7 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
public string description;
|
public string description;
|
||||||
public string versionInfo;
|
public string versionInfo;
|
||||||
public string pathToMusicPackIcon;
|
public string pathToMusicPackIcon;
|
||||||
public Texture2D Icon;
|
public Texture2DExtended Icon;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constrctor
|
/// Constrctor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -35,7 +36,7 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
this.pathToMusicPackIcon = PathToMusicPackIcon;
|
this.pathToMusicPackIcon = PathToMusicPackIcon;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.Icon = StardewSymphony.ModHelper.Content.Load<Texture2D>(this.pathToMusicPackIcon);
|
this.Icon = new Texture2DExtended(StardewSymphony.ModHelper, this.pathToMusicPackIcon);
|
||||||
}
|
}
|
||||||
catch(Exception err)
|
catch(Exception err)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Audio;
|
using Microsoft.Xna.Framework.Audio;
|
||||||
|
using StardewValley;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -174,6 +175,14 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
dynamicSound.Play();
|
dynamicSound.Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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>
|
/// <summary>
|
||||||
/// Used to resume the currently playing song.
|
/// Used to resume the currently playing song.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -131,7 +131,10 @@ namespace StardewSymphonyRemastered
|
||||||
string path = Path.Combine(ModHelper.DirectoryPath, "Content", "Graphics", "MusicMenu");
|
string path = Path.Combine(ModHelper.DirectoryPath, "Content", "Graphics", "MusicMenu");
|
||||||
if (!Directory.Exists(path)) Directory.CreateDirectory(path);
|
if (!Directory.Exists(path)) Directory.CreateDirectory(path);
|
||||||
string musicNote = Path.Combine(path, "MusicNote.png");
|
string musicNote = Path.Combine(path, "MusicNote.png");
|
||||||
|
string musicCD = Path.Combine(path, "MusicDisk.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("MusicCD", new Texture2DExtended(ModHelper, StardustCore.Utilities.getRelativeDirectory("StardewSymphonyRemastered", musicCD)));
|
||||||
|
|
||||||
if (!Directory.Exists(MusicPath)) Directory.CreateDirectory(MusicPath);
|
if (!Directory.Exists(MusicPath)) Directory.CreateDirectory(MusicPath);
|
||||||
if (!Directory.Exists(WavMusicDirectory)) Directory.CreateDirectory(WavMusicDirectory);
|
if (!Directory.Exists(WavMusicDirectory)) Directory.CreateDirectory(WavMusicDirectory);
|
||||||
|
|
|
@ -313,6 +313,8 @@ namespace StardustCore.IlluminateFramework
|
||||||
{
|
{
|
||||||
public static Dictionary<string, Color> ColorDictionary;
|
public static Dictionary<string, Color> ColorDictionary;
|
||||||
|
|
||||||
|
public static Random colorRandomizer;
|
||||||
|
|
||||||
public static void initializeColors()
|
public static void initializeColors()
|
||||||
{
|
{
|
||||||
ColorDictionary = new Dictionary<string, Color>();
|
ColorDictionary = new Dictionary<string, Color>();
|
||||||
|
@ -609,12 +611,19 @@ namespace StardustCore.IlluminateFramework
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generate a random color! Does not need to be inverted to be properly used.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
public static Color randomColor()
|
public static Color randomColor()
|
||||||
{
|
{
|
||||||
Random r = new Random(Game1.player.money + Game1.tileSize + Game1.dayOfMonth+(int)Game1.stats.stepsTaken);
|
if (colorRandomizer == null)
|
||||||
int R = r.Next(0, 255);
|
{
|
||||||
int G = r.Next(0, 255);
|
colorRandomizer = new Random(Game1.player.money + Game1.tileSize + Game1.dayOfMonth + (int)Game1.stats.stepsTaken);
|
||||||
int B = r.Next(0, 255);
|
}
|
||||||
|
int R = colorRandomizer.Next(0, 255);
|
||||||
|
int G = colorRandomizer.Next(0, 255);
|
||||||
|
int B = colorRandomizer.Next(0, 255);
|
||||||
int A = 255;
|
int A = 255;
|
||||||
return new Color(R, G, B, A);
|
return new Color(R, G, B, A);
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ namespace StardustCore.UIUtilities.MenuComponents
|
||||||
/// <param name="b"></param>
|
/// <param name="b"></param>
|
||||||
/// <param name="c"></param>
|
/// <param name="c"></param>
|
||||||
/// <param name="layerDepth"></param>
|
/// <param name="layerDepth"></param>
|
||||||
public void draw(SpriteBatch b, float layerDepth)
|
public void draw(SpriteBatch b,Color color ,float layerDepth)
|
||||||
{
|
{
|
||||||
|
|
||||||
this.animationManager.tickAnimation();
|
this.animationManager.tickAnimation();
|
||||||
|
@ -108,12 +108,20 @@ namespace StardustCore.UIUtilities.MenuComponents
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StardustCore.ModCore.ModMonitor.Log("HOVER???");
|
//Game1.drawDialogueBox(Game1.getMousePosition().X, Game1.getMousePosition().Y, false, false, this.hoverText);
|
||||||
b.DrawString(Game1.smallFont, this.hoverText, new Vector2((float)(this.bounds.X + this.bounds.Width), (float)this.bounds.Y + ((float)(this.bounds.Height / 2) - Game1.smallFont.MeasureString(this.label).Y / 2f)), this.textColor);
|
//StardustCore.ModCore.ModMonitor.Log("HOVER???");
|
||||||
|
b.DrawString(Game1.smallFont, this.hoverText, new Vector2((float)(this.bounds.X + this.bounds.Width), (float)this.bounds.Y + ((float)(this.bounds.Height) - Game1.smallFont.MeasureString(this.label).Y / 2f)), this.textColor,0f,Vector2.Zero,1f,SpriteEffects.None,layerDepth-0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public new void draw(SpriteBatch b)
|
||||||
|
{
|
||||||
|
if (!this.visible)
|
||||||
|
return;
|
||||||
|
this.draw(b, Color.White, (float)(0.860000014305115 + (double)this.bounds.Y / 20000.0));
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Swaps if the button is visible or not. Also toggles the animation manager appropriately.
|
/// Swaps if the button is visible or not. Also toggles the animation manager appropriately.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue