Play some randome music and play wav packs.

This commit is contained in:
2018-03-20 23:24:11 -07:00
parent ed899b49d9
commit 1bbf3f2503
7 changed files with 63 additions and 14 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

View File

@ -29,14 +29,29 @@ namespace StardewSymphonyRemastered.Framework.Menus
int rows = 0;
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
}
), null, new DelegatePairing(null, new List<object>(){
(object)v
}
)), false));
}
),null, new DelegatePairing(null,new List<object>(){
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));
}
)), false));
numOfButtons++;
if (numOfButtons > 8)
{
@ -61,9 +76,13 @@ namespace StardewSymphonyRemastered.Framework.Menus
if (v.containsPoint(x, y))
{
var pair = (KeyValuePair<string, MusicPack>)v.buttonFunctionality.hover.paramaters[0];
v.hoverText = pair.Key;
v.hoverText = (string)pair.Key;
v.onHover();
StardewSymphony.ModMonitor.Log(pair.Key);
//StardewSymphony.ModMonitor.Log(pair.Key);
}
else
{
v.hoverText = "";
}
}
}

View File

@ -1,4 +1,5 @@
using Microsoft.Xna.Framework.Graphics;
using StardustCore.UIUtilities;
using System;
using System.Collections.Generic;
using System.Linq;
@ -18,7 +19,7 @@ namespace StardewSymphonyRemastered.Framework
public string description;
public string versionInfo;
public string pathToMusicPackIcon;
public Texture2D Icon;
public Texture2DExtended Icon;
/// <summary>
/// Constrctor
/// </summary>
@ -35,7 +36,7 @@ namespace StardewSymphonyRemastered.Framework
this.pathToMusicPackIcon = PathToMusicPackIcon;
try
{
this.Icon = StardewSymphony.ModHelper.Content.Load<Texture2D>(this.pathToMusicPackIcon);
this.Icon = new Texture2DExtended(StardewSymphony.ModHelper, this.pathToMusicPackIcon);
}
catch(Exception err)
{

View File

@ -1,5 +1,6 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using StardewValley;
using System;
using System.Collections.Generic;
using System.IO;
@ -174,6 +175,14 @@ namespace StardewSymphonyRemastered.Framework
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>
/// Used to resume the currently playing song.
/// </summary>

View File

@ -131,7 +131,10 @@ namespace StardewSymphonyRemastered
string path = Path.Combine(ModHelper.DirectoryPath, "Content", "Graphics", "MusicMenu");
if (!Directory.Exists(path)) Directory.CreateDirectory(path);
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("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(WavMusicDirectory)) Directory.CreateDirectory(WavMusicDirectory);

View File

@ -313,6 +313,8 @@ namespace StardustCore.IlluminateFramework
{
public static Dictionary<string, Color> ColorDictionary;
public static Random colorRandomizer;
public static void initializeColors()
{
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()
{
Random r = new Random(Game1.player.money + Game1.tileSize + Game1.dayOfMonth+(int)Game1.stats.stepsTaken);
int R = r.Next(0, 255);
int G = r.Next(0, 255);
int B = r.Next(0, 255);
if (colorRandomizer == null)
{
colorRandomizer = new Random(Game1.player.money + Game1.tileSize + Game1.dayOfMonth + (int)Game1.stats.stepsTaken);
}
int R = colorRandomizer.Next(0, 255);
int G = colorRandomizer.Next(0, 255);
int B = colorRandomizer.Next(0, 255);
int A = 255;
return new Color(R, G, B, A);
}

View File

@ -85,7 +85,7 @@ namespace StardustCore.UIUtilities.MenuComponents
/// <param name="b"></param>
/// <param name="c"></param>
/// <param name="layerDepth"></param>
public void draw(SpriteBatch b, float layerDepth)
public void draw(SpriteBatch b,Color color ,float layerDepth)
{
this.animationManager.tickAnimation();
@ -108,12 +108,20 @@ namespace StardustCore.UIUtilities.MenuComponents
}
else
{
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 / 2) - Game1.smallFont.MeasureString(this.label).Y / 2f)), this.textColor);
//Game1.drawDialogueBox(Game1.getMousePosition().X, Game1.getMousePosition().Y, false, false, this.hoverText);
//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>
/// Swaps if the button is visible or not. Also toggles the animation manager appropriately.
/// </summary>