2018-12-30 18:00:05 +08:00
|
|
|
using EventSystem.Framework.FunctionEvents;
|
2018-03-06 12:46:45 +08:00
|
|
|
using Microsoft.Xna.Framework;
|
|
|
|
using StardewValley;
|
|
|
|
|
|
|
|
namespace EventSystem.Framework.Events
|
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
public class DialogueDisplayEvent : MapEvent
|
2018-03-06 12:46:45 +08:00
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
private readonly string dialogue;
|
|
|
|
|
|
|
|
public DialogueDisplayEvent(string Name, GameLocation Location, Vector2 Position, MouseButtonEvents MouseEvents, MouseEntryLeaveEvent EntryLeave, string Dialogue)
|
|
|
|
: base(Name, Location, Position)
|
2018-03-06 12:46:45 +08:00
|
|
|
{
|
|
|
|
this.name = Name;
|
|
|
|
this.location = Location;
|
|
|
|
this.tilePosition = Position;
|
2018-03-06 15:06:39 +08:00
|
|
|
this.mouseButtonEvents = MouseEvents;
|
2018-03-06 12:46:45 +08:00
|
|
|
|
|
|
|
this.doesInteractionNeedToRun = true;
|
|
|
|
this.dialogue = Dialogue;
|
2018-03-06 15:06:39 +08:00
|
|
|
|
|
|
|
this.mouseEntryLeaveEvents = EntryLeave;
|
2018-03-06 12:46:45 +08:00
|
|
|
}
|
|
|
|
|
2018-03-06 15:46:24 +08:00
|
|
|
public override bool OnLeftClick()
|
2018-03-06 15:06:39 +08:00
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
if (!base.OnLeftClick()) return false;
|
|
|
|
if (this.location.isObjectAt((int)this.tilePosition.X * Game1.tileSize, (int)this.tilePosition.Y * Game1.tileSize)) return false;
|
2018-03-06 15:06:39 +08:00
|
|
|
Game1.activeClickableMenu = new StardewValley.Menus.DialogueBox(this.dialogue);
|
2018-03-06 15:46:24 +08:00
|
|
|
return true;
|
2018-03-06 15:06:39 +08:00
|
|
|
}
|
|
|
|
|
2018-12-30 18:00:05 +08:00
|
|
|
/// <summary>Used to update the event and check for interaction.</summary>
|
2018-03-06 12:46:45 +08:00
|
|
|
public override void update()
|
|
|
|
{
|
2018-03-06 15:06:39 +08:00
|
|
|
this.clickEvent();
|
2018-03-06 15:46:24 +08:00
|
|
|
//Needed for updating.
|
2018-03-06 15:06:39 +08:00
|
|
|
this.OnMouseEnter();
|
|
|
|
this.OnMouseLeave();
|
2018-03-06 12:46:45 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|