From ed899b49d905c651a9898f64a9c3d441fecb8696 Mon Sep 17 00:00:00 2001 From: Date: Tue, 20 Mar 2018 16:45:07 -0700 Subject: [PATCH] symphony menu is coming along. --- .../Framework/Menus/MarketStallMenu.cs | 2 +- .../Content/Graphics/MusicMenu/MusicNote.png | Bin 0 -> 242 bytes .../Templates/WAV/MusicPackInformation.json | 8 ++++ .../Content/Music/Templates/WAV/readme.txt | 1 + .../Templates/XACT/MusicPackInformation.json | 8 ++++ .../Content/Music/Templates/XACT/readme.txt | 3 ++ .../Framework/Menus/MusicManagerMenu.cs | 39 +++++++++++++++++- .../Framework/Music/MusicManager.cs | 8 ++++ .../Framework/Music/MusicPack.cs | 5 +++ .../Framework/Music/XACTMusicPack.cs | 14 +++++-- .../StardewSymphony.cs | 2 + .../UIUtilities/MenuComponents/Button.cs | 20 +++++++-- .../Delegates/DelegatePairing.cs | 8 +++- 13 files changed, 106 insertions(+), 12 deletions(-) create mode 100644 GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Content/Graphics/MusicMenu/MusicNote.png create mode 100644 GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Content/Music/Templates/WAV/MusicPackInformation.json create mode 100644 GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Content/Music/Templates/WAV/readme.txt create mode 100644 GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Content/Music/Templates/XACT/MusicPackInformation.json create mode 100644 GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Content/Music/Templates/XACT/readme.txt diff --git a/GeneralMods/FarmersMarketStall/Framework/Menus/MarketStallMenu.cs b/GeneralMods/FarmersMarketStall/Framework/Menus/MarketStallMenu.cs index 104bd0de..466833db 100644 --- a/GeneralMods/FarmersMarketStall/Framework/Menus/MarketStallMenu.cs +++ b/GeneralMods/FarmersMarketStall/Framework/Menus/MarketStallMenu.cs @@ -17,7 +17,7 @@ namespace FarmersMarketStall.Framework.Menus 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); } diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Content/Graphics/MusicMenu/MusicNote.png b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Content/Graphics/MusicMenu/MusicNote.png new file mode 100644 index 0000000000000000000000000000000000000000..98ac852f083fa9a58f015ad026fbb5bd7c42e523 GIT binary patch literal 242 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucLCF%=h?3y^w370~qEv>0#LT=By}Z;C1rt33 zJtM=93Yk-Zijq8C978Pp@Ae!NJfOhAqTBm#wvy0MhPX7BdONYiR_!x2EK?*GocUn7 zRkS2->D0O%!k4-%Z*dhYTIItr?K{hf?2GlMRpM^)cbsT+x?`YX5tei!L#bZzG-H#F g`?9$jMFo`%-)?W%{_`pGHK1(_p00i_>zopr086b<(); 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(); - 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)v + } + ),null, new DelegatePairing(null,new List(){ + (object)v + } + )), false)); + numOfButtons++; + if (numOfButtons > 8) + { + numOfButtons = 0; + rows++; + } + } } 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) { - if (v.containsPoint(x, y)) v.onHover(); + if (v.containsPoint(x, y)) + { + var pair = (KeyValuePair)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"); } + + public void displayMusicPack(List param) + { + var info=(KeyValuePair)param[0]; + StardewSymphony.ModMonitor.Log(info.ToString()); + StardewSymphony.musicManager.playRandomSongFromPack(info.Key); + //info.Value.playRandomSong(); + } + #endregion } } diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/MusicManager.cs b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/MusicManager.cs index 88897ea4..4d57673f 100644 --- a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/MusicManager.cs +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/MusicManager.cs @@ -354,5 +354,13 @@ namespace StardewSymphonyRemastered.Framework 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; + } } } diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/MusicPack.cs b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/MusicPack.cs index b4f954da..aa2934f5 100644 --- a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/MusicPack.cs +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/MusicPack.cs @@ -59,6 +59,11 @@ namespace StardewSymphonyRemastered.Framework } + public virtual void playRandomSong() + { + + } + public virtual void writeToJson() { diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/XACTMusicPack.cs b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/XACTMusicPack.cs index de56a22e..4060a873 100644 --- a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/XACTMusicPack.cs +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/XACTMusicPack.cs @@ -64,13 +64,18 @@ namespace StardewSymphonyRemastered.Framework listofSongs.Add(song); } - 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); + } + /// /// Get the cue from the list of songs. /// @@ -143,6 +148,7 @@ namespace StardewSymphonyRemastered.Framework /// public override void stopSong() { + if(Game1.currentSong!=null) Game1.currentSong.Stop(AudioStopOptions.Immediate); if (this.currentCue == null) return; else { diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/StardewSymphony.cs b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/StardewSymphony.cs index edbd4fa8..d8e22620 100644 --- a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/StardewSymphony.cs +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/StardewSymphony.cs @@ -67,6 +67,8 @@ namespace StardewSymphonyRemastered WavMusicDirectory = Path.Combine(MusicPath, "Wav"); XACTMusicDirectory = Path.Combine(MusicPath, "XACT"); TemplateMusicDirectory = Path.Combine(MusicPath, "Templates"); + + textureManager = new TextureManager(); this.createDirectories(); this.createBlankXACTTemplate(); diff --git a/GeneralMods/StardustCore/UIUtilities/MenuComponents/Button.cs b/GeneralMods/StardustCore/UIUtilities/MenuComponents/Button.cs index 064022bc..29e2aa14 100644 --- a/GeneralMods/StardustCore/UIUtilities/MenuComponents/Button.cs +++ b/GeneralMods/StardustCore/UIUtilities/MenuComponents/Button.cs @@ -95,9 +95,23 @@ 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); 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); - if (string.IsNullOrEmpty(this.label)) - return; - 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 (string.IsNullOrEmpty(this.label)) { + + } + 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); + } + + 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); + } + } /// diff --git a/GeneralMods/StardustCore/UIUtilities/MenuComponents/Delegates/DelegatePairing.cs b/GeneralMods/StardustCore/UIUtilities/MenuComponents/Delegates/DelegatePairing.cs index c245d5a6..edb7883f 100644 --- a/GeneralMods/StardustCore/UIUtilities/MenuComponents/Delegates/DelegatePairing.cs +++ b/GeneralMods/StardustCore/UIUtilities/MenuComponents/Delegates/DelegatePairing.cs @@ -14,7 +14,7 @@ namespace StardustCore.UIUtilities.MenuComponents.Delegates public DelegatePairing(Delegates.paramaterDelegate buttonDelegate,List Paramaters) { this.click = buttonDelegate; - if (this.paramaters == null) + if (Paramaters == null) { this.paramaters = new List(); } @@ -26,7 +26,11 @@ namespace StardustCore.UIUtilities.MenuComponents.Delegates public void run() { - this.click.Invoke(this.paramaters); + if (this.click != null) + { + this.click.Invoke(this.paramaters); + } + else return; } } }