symphony menu is coming along.

This commit is contained in:
2018-03-20 16:45:07 -07:00
parent 67c110f282
commit ed899b49d9
13 changed files with 106 additions and 12 deletions

View File

@ -17,7 +17,7 @@ namespace FarmersMarketStall.Framework.Menus
public static IClickableMenu openMenu(MarketStall marketStall) public static IClickableMenu openMenu(MarketStall marketStall)
{ {
return null; throw new NotImplementedException("This menu isn't implemented because the author is busy/lazy. Please encorage Omegasis to finish it!",null);
//return new StardewValley.Menus.InventoryMenu((int)(Game1.viewport.Width*.25f),(int)(Game1.viewport.Height*.25f),true,marketStall.stock); //return new StardewValley.Menus.InventoryMenu((int)(Game1.viewport.Width*.25f),(int)(Game1.viewport.Height*.25f),true,marketStall.stock);
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 B

View File

@ -0,0 +1,8 @@
{
"name": "Omegas's Music Data Example",
"author": "Omegasis",
"description": "Just a simple example of how metadata is formated for music packs. Feel free to copy and edit this one!",
"versionInfo": "1.0.0 CoolExample",
"pathToMusicPackIcon": "Icon",
"Icon": null
}

View File

@ -0,0 +1 @@
Place the .wav song files in the Songs folder, modify the MusicPackInformation.json as desired, and then run!

View File

@ -0,0 +1,8 @@
{
"name": "Omegas's Music Data Example",
"author": "Omegasis",
"description": "Just a simple example of how metadata is formated for music packs. Feel free to copy and edit this one!",
"versionInfo": "1.0.0 CoolExample",
"pathToMusicPackIcon": "Icon.png",
"Icon": null
}

View File

@ -0,0 +1,3 @@
Place the Wave Bank.xwb file and Sound Bank.xsb file you created in XACT in a similar directory in Content/Music/XACT/SoundPackName.
Modify MusicPackInformation.json as desire!
Run the mod!

View File

@ -23,7 +23,27 @@ namespace StardewSymphonyRemastered.Framework.Menus
this.texturedStrings = new List<StardustCore.UIUtilities.SpriteFonts.Components.TexturedString>(); this.texturedStrings = new List<StardustCore.UIUtilities.SpriteFonts.Components.TexturedString>();
this.texturedStrings.Add(StardustCore.UIUtilities.SpriteFonts.SpriteFont.vanillaFont.ParseString("Hello", new Microsoft.Xna.Framework.Vector2(100, 100),StardustCore.IlluminateFramework.Colors.invertColor(StardustCore.IlluminateFramework.LightColorsList.Blue))); this.texturedStrings.Add(StardustCore.UIUtilities.SpriteFonts.SpriteFont.vanillaFont.ParseString("Hello", new Microsoft.Xna.Framework.Vector2(100, 100),StardustCore.IlluminateFramework.Colors.invertColor(StardustCore.IlluminateFramework.LightColorsList.Blue)));
this.buttons = new List<StardustCore.UIUtilities.MenuComponents.Button>(); this.buttons = new List<StardustCore.UIUtilities.MenuComponents.Button>();
this.buttons.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.buttons.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.
int numOfButtons = 0;
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>
{
(object)v
}
),null, new DelegatePairing(null,new List<object>(){
(object)v
}
)), false));
numOfButtons++;
if (numOfButtons > 8)
{
numOfButtons = 0;
rows++;
}
}
} }
public override void receiveRightClick(int x, int y, bool playSound = true) public override void receiveRightClick(int x, int y, bool playSound = true)
@ -38,7 +58,13 @@ namespace StardewSymphonyRemastered.Framework.Menus
{ {
foreach(var v in this.buttons) foreach(var v in this.buttons)
{ {
if (v.containsPoint(x, y)) v.onHover(); if (v.containsPoint(x, y))
{
var pair = (KeyValuePair<string, MusicPack>)v.buttonFunctionality.hover.paramaters[0];
v.hoverText = pair.Key;
v.onHover();
StardewSymphony.ModMonitor.Log(pair.Key);
}
} }
} }
@ -77,6 +103,15 @@ namespace StardewSymphonyRemastered.Framework.Menus
{ {
StardewSymphony.ModMonitor.Log("Hello"); StardewSymphony.ModMonitor.Log("Hello");
} }
public void displayMusicPack(List<object> param)
{
var info=(KeyValuePair<string, MusicPack>)param[0];
StardewSymphony.ModMonitor.Log(info.ToString());
StardewSymphony.musicManager.playRandomSongFromPack(info.Key);
//info.Value.playRandomSong();
}
#endregion #endregion
} }
} }

View File

@ -354,5 +354,13 @@ namespace StardewSymphonyRemastered.Framework
pack.Value.songInformation.initializeSeasonalMusic(); pack.Value.songInformation.initializeSeasonalMusic();
} }
} }
public void playRandomSongFromPack(string musicPackName)
{
this.musicPacks.TryGetValue(musicPackName, out MusicPack musicPack);
if (this.currentMusicPack != null) this.currentMusicPack.stopSong();
musicPack.playRandomSong();
this.currentMusicPack = musicPack;
}
} }
} }

View File

@ -59,6 +59,11 @@ namespace StardewSymphonyRemastered.Framework
} }
public virtual void playRandomSong()
{
}
public virtual void writeToJson() public virtual void writeToJson()
{ {

View File

@ -66,9 +66,14 @@ namespace StardewSymphonyRemastered.Framework
this.songInformation.listOfSongsWithoutTriggers = listofSongs; 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> /// <summary>
@ -143,6 +148,7 @@ namespace StardewSymphonyRemastered.Framework
/// </summary> /// </summary>
public override void stopSong() public override void stopSong()
{ {
if(Game1.currentSong!=null) Game1.currentSong.Stop(AudioStopOptions.Immediate);
if (this.currentCue == null) return; if (this.currentCue == null) return;
else else
{ {

View File

@ -67,6 +67,8 @@ namespace StardewSymphonyRemastered
WavMusicDirectory = Path.Combine(MusicPath, "Wav"); WavMusicDirectory = Path.Combine(MusicPath, "Wav");
XACTMusicDirectory = Path.Combine(MusicPath, "XACT"); XACTMusicDirectory = Path.Combine(MusicPath, "XACT");
TemplateMusicDirectory = Path.Combine(MusicPath, "Templates"); TemplateMusicDirectory = Path.Combine(MusicPath, "Templates");
textureManager = new TextureManager(); textureManager = new TextureManager();
this.createDirectories(); this.createDirectories();
this.createBlankXACTTemplate(); this.createBlankXACTTemplate();

View File

@ -95,11 +95,25 @@ namespace StardustCore.UIUtilities.MenuComponents
Utility.drawWithShadow(b, this.texture, new Vector2((float)this.bounds.X + (float)(this.sourceRect.Width / 2) * this.baseScale, (float)this.bounds.Y + (float)(this.sourceRect.Height / 2) * this.baseScale), this.sourceRect, this.textureColor, 0.0f, new Vector2((float)(this.sourceRect.Width / 2), (float)(this.sourceRect.Height / 2)), this.scale, false, layerDepth, -1, -1, 0.35f); Utility.drawWithShadow(b, this.texture, new Vector2((float)this.bounds.X + (float)(this.sourceRect.Width / 2) * this.baseScale, (float)this.bounds.Y + (float)(this.sourceRect.Height / 2) * this.baseScale), this.sourceRect, this.textureColor, 0.0f, new Vector2((float)(this.sourceRect.Width / 2), (float)(this.sourceRect.Height / 2)), this.scale, false, layerDepth, -1, -1, 0.35f);
else else
b.Draw(this.texture, new Vector2((float)this.bounds.X + (float)(this.sourceRect.Width / 2) * this.baseScale, (float)this.bounds.Y + (float)(this.sourceRect.Height / 2) * this.baseScale), new Rectangle?(this.sourceRect), this.textureColor, 0.0f, new Vector2((float)(this.sourceRect.Width / 2), (float)(this.sourceRect.Height / 2)), this.scale, SpriteEffects.None, layerDepth); b.Draw(this.texture, new Vector2((float)this.bounds.X + (float)(this.sourceRect.Width / 2) * this.baseScale, (float)this.bounds.Y + (float)(this.sourceRect.Height / 2) * this.baseScale), new Rectangle?(this.sourceRect), this.textureColor, 0.0f, new Vector2((float)(this.sourceRect.Width / 2), (float)(this.sourceRect.Height / 2)), this.scale, SpriteEffects.None, layerDepth);
if (string.IsNullOrEmpty(this.label)) if (string.IsNullOrEmpty(this.label)) {
return;
}
else {
b.DrawString(Game1.smallFont, this.label, 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); b.DrawString(Game1.smallFont, this.label, 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);
} }
if (this.hoverText=="")
{
}
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);
}
}
/// <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>

View File

@ -14,7 +14,7 @@ namespace StardustCore.UIUtilities.MenuComponents.Delegates
public DelegatePairing(Delegates.paramaterDelegate buttonDelegate,List<object> Paramaters) public DelegatePairing(Delegates.paramaterDelegate buttonDelegate,List<object> Paramaters)
{ {
this.click = buttonDelegate; this.click = buttonDelegate;
if (this.paramaters == null) if (Paramaters == null)
{ {
this.paramaters = new List<object>(); this.paramaters = new List<object>();
} }
@ -25,8 +25,12 @@ namespace StardustCore.UIUtilities.MenuComponents.Delegates
} }
public void run() public void run()
{
if (this.click != null)
{ {
this.click.Invoke(this.paramaters); this.click.Invoke(this.paramaters);
} }
else return;
}
} }
} }