diff --git a/GeneralMods/MapEvents/Framework/Events/DialogueDisplayEvent.cs b/GeneralMods/MapEvents/Framework/Events/DialogueDisplayEvent.cs
index 0d0dec7c..809a7a35 100644
--- a/GeneralMods/MapEvents/Framework/Events/DialogueDisplayEvent.cs
+++ b/GeneralMods/MapEvents/Framework/Events/DialogueDisplayEvent.cs
@@ -13,17 +13,21 @@ namespace EventSystem.Framework.Events
public class DialogueDisplayEvent :MapEvent
{
string dialogue;
- public DialogueDisplayEvent(string Name, GameLocation Location, Vector2 Position, PlayerEvents playerEvents, string Dialogue) : base(Name, Location, Position, playerEvents)
+ public DialogueDisplayEvent(string Name, GameLocation Location, Vector2 Position, PlayerEvents playerEvents, MouseButtonEvents MouseEvents,MouseEntryLeaveEvent EntryLeave, string Dialogue) : base(Name, Location, Position, playerEvents)
{
this.name = Name;
this.location = Location;
this.tilePosition = Position;
this.playerEvents = playerEvents;
+ this.mouseButtonEvents = MouseEvents;
this.doesInteractionNeedToRun = true;
this.dialogue = Dialogue;
+
+ this.mouseEntryLeaveEvents = EntryLeave;
}
+
///
/// Occurs when the player enters the warp tile event position.
/// s
@@ -33,7 +37,10 @@ namespace EventSystem.Framework.Events
{
this.doesInteractionNeedToRun = false;
this.playerOnTile = true;
- if (this.playerEvents.onPlayerEnter != null) this.playerEvents.onPlayerEnter.run(); //used to run a function before the warp.
+ if (this.playerEvents != null)
+ {
+ if (this.playerEvents.onPlayerEnter != null) this.playerEvents.onPlayerEnter.run(); //used to run a function before the warp.
+ }
Game1.activeClickableMenu =new StardewValley.Menus.DialogueBox(this.dialogue);
//Game1.drawDialogueBox(this.dialogue);
}
@@ -48,15 +55,31 @@ namespace EventSystem.Framework.Events
{
this.playerOnTile = false;
this.doesInteractionNeedToRun = true;
- if (this.playerEvents.onPlayerLeave != null) this.playerEvents.onPlayerLeave.run();
+ if (this.playerEvents != null)
+ {
+ if (this.playerEvents.onPlayerLeave != null) this.playerEvents.onPlayerLeave.run();
+ }
}
}
+ public override void OnLeftClick()
+ {
+ if (Game1.activeClickableMenu != null) return;
+ if (this.mouseButtonEvents == null) return;
+ if (this.mouseOnTile == false) return;
+ if (this.location.isObjectAt((int)this.tilePosition.X*Game1.tileSize, (int)this.tilePosition.Y*Game1.tileSize)) return;
+ if (this.mouseButtonEvents.onLeftClick != null) this.mouseButtonEvents.onLeftClick.run();
+ Game1.activeClickableMenu = new StardewValley.Menus.DialogueBox(this.dialogue);
+ }
+
///
/// Used to update the event and check for interaction.
///
public override void update()
{
+ this.clickEvent();
+ this.OnMouseEnter();
+ this.OnMouseLeave();
this.OnPlayerEnter();
this.OnPlayerLeave();
}
diff --git a/GeneralMods/MapEvents/Framework/MapEvent.cs b/GeneralMods/MapEvents/Framework/MapEvent.cs
index d07d213e..7156763b 100644
--- a/GeneralMods/MapEvents/Framework/MapEvent.cs
+++ b/GeneralMods/MapEvents/Framework/MapEvent.cs
@@ -177,6 +177,7 @@ namespace EventSystem.Framework
///
public virtual void OnLeftClick()
{
+ if (Game1.activeClickableMenu != null) return;
if (this.mouseOnTile==false) return;
if (this.mouseButtonEvents.onLeftClick != null) this.mouseButtonEvents.onLeftClick.run();
}
@@ -230,7 +231,7 @@ namespace EventSystem.Framework
///
public virtual bool isMouseOnTile()
{
- Vector2 mousePosition = new Vector2(Game1.getMouseX(), Game1.getMouseY());
+ Vector2 mousePosition = Game1.currentCursorTile;
if (mousePosition.X == this.tilePosition.X && mousePosition.Y == this.tilePosition.Y) return true;
return false;
}
@@ -238,7 +239,7 @@ namespace EventSystem.Framework
///
/// Occurs when the tile is clicked. Runs the appropriate event.
///
- public virtual void eventClickEvent()
+ public virtual void clickEvent()
{
if (this.mouseOnTile == false) return;
var mouseState=Mouse.GetState();
@@ -253,7 +254,7 @@ namespace EventSystem.Framework
///
public virtual void update()
{
- eventClickEvent(); //click events
+ clickEvent(); //click events
OnPlayerEnter(); //player enter events
OnPlayerLeave(); //player leave events
OnMouseEnter(); //on mouse enter events
diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Menus/MusicManagerMenu.cs b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Menus/MusicManagerMenu.cs
index 8e97d10d..cf3255a0 100644
--- a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Menus/MusicManagerMenu.cs
+++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Menus/MusicManagerMenu.cs
@@ -8,30 +8,46 @@ using Microsoft.Xna.Framework.Graphics;
using StardewValley;
using StardustCore.UIUtilities;
using StardustCore.UIUtilities.MenuComponents;
+using StardustCore.UIUtilities.MenuComponents.Delegates;
+using StardustCore.UIUtilities.MenuComponents.Delegates.Functionality;
namespace StardewSymphonyRemastered.Framework.Menus
{
public class MusicManagerMenu : IClickableMenuExtended
{
- private string musicNotePath;
public MusicManagerMenu(float width, float height)
{
-
-
-
this.width = (int)width;
this.height = (int)height;
this.texturedStrings = new List();
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, 200, 100), 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, false));
-
+ 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.
}
public override void receiveRightClick(int x, int y, bool playSound = true)
{
+ foreach (var v in this.buttons)
+ {
+ if (v.containsPoint(x, y)) v.onRightClick();
+ }
+ }
+ public override void performHoverAction(int x, int y)
+ {
+ foreach(var v in this.buttons)
+ {
+ if (v.containsPoint(x, y)) v.onHover();
+ }
+ }
+
+ public override void receiveLeftClick(int x, int y, bool playSound = true)
+ {
+ foreach (var v in this.buttons)
+ {
+ if (v.containsPoint(x, y)) v.onLeftClick();
+ }
}
public override void drawBackground(SpriteBatch b)
@@ -54,5 +70,13 @@ namespace StardewSymphonyRemastered.Framework.Menus
}
this.drawMouse(b);
}
+
+ //Button Functionality
+ #region
+ private void hello(List