//--------------------------------------------------------------------------------------------------------------------------------------------------- // // Copyright (C)2007 DarkWynter Studios. All rights reserved. // //--------------------------------------------------------------------------------------------------------------------------------------------------- // {Contact : darkwynter.com for licensing information //--------------------------------------------------------------------------------------------------------------------------------------------------- namespace DarkWynter.Engine.EventControl.EventTypes { using System; using System.Collections.Generic; using System.Diagnostics; using DarkWynter.Engine.Globals; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using DarkWynter.Engine.GameObjects; using DarkWynter.Engine.UserInterface; using System.Text; using System.Xml; /// /// Instance of a DialogueEvent /// Extends GameEvent /// Used to update the Dialogue graphics and text on the HUD /// public class DialogueEvent : GameEvent { /// /// Who is speaking /// public string speaker { get { return _speaker; } set { _speaker = value; } } private string _speaker; /// /// What the speaker is saying /// public string message { get { return _message; } set { _message = value; } } private string _message; /// /// The amount of time the message is to be shown /// public int time { get { return _time; } set { _time = value; } } private int _time; /// /// Path holding the texture we want to use /// public string texturePath { get { return _texturePath; } set { _texturePath = value; } } private string _texturePath; /// /// Create for the dialogue event /// /// Speaker of the message /// Message contents /// Time to run public DialogueEvent(XmlNode node ) :base(node) { this.speaker = node.Attributes["speaker"].Value; this.message = node.Attributes["message"].Value; this.time = int.Parse(node.Attributes["time"].Value); this.texturePath = node.Attributes["texturePath"].Value; Texture2D dialogueTexture = Statics_Engine.SystemSettings.content.Load(texturePath); eventLimitMilli = 10000; eventSpeaker = speaker; eventMessage = message; eventLimitMilli = time; eventTexture = dialogueTexture; } /// /// Runs the dialogue on the HUD for the specified time /// public override void FireEvent() { DarkWynterEngine._HUD.DisplayDialog(eventTexture, eventSpeaker, eventMessage, Color.DarkOrange, eventLimitMilli); if (GameEventHandler.CurrentGameConditions._triggerSanity != -1) { GameEventHandler.CurrentGameConditions._triggerSanity = -1; } isFinished = true; } } }