2018-03-06 12:46:45 +08:00
|
|
|
|
using EventSystem.Framework.FunctionEvents;
|
|
|
|
|
using EventSystem.Framework.Information;
|
|
|
|
|
using Microsoft.Xna.Framework;
|
|
|
|
|
using StardewValley;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace EventSystem.Framework.Events
|
|
|
|
|
{
|
|
|
|
|
public class DialogueDisplayEvent :MapEvent
|
|
|
|
|
{
|
|
|
|
|
string dialogue;
|
2018-03-06 15:46:24 +08:00
|
|
|
|
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:06:39 +08:00
|
|
|
|
|
2018-03-06 15:46:24 +08:00
|
|
|
|
public override bool OnLeftClick()
|
2018-03-06 15:06:39 +08:00
|
|
|
|
{
|
2018-03-06 15:46:24 +08:00
|
|
|
|
if (base.OnLeftClick() == false) 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-03-06 12:46:45 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Used to update the event and check for interaction.
|
|
|
|
|
/// </summary>
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|