//---------------------------------------------------------------------------------------------------------------------------------------------------
//
// 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 System.Text;
using System.Xml;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using DarkWynter.Engine.Globals;
using DarkWynter.Engine.Utilities;
using DarkWynter.Engine.GameObjects;
using DarkWynter.Stream;
///
/// Instance of a HUDMapEvent
/// Extends GameEvent
/// Used to update the mini gameworld map on the HUD
///
public class HUDMapEvent : GameEvent
{
///
/// The texture to use for the event
///
public string texPath { get { return _texPath; } set { _texPath = value; } }
private string _texPath;
///
/// The position on the HUD
///
public Vector2 position { get { return _position; } set { _position = value; } }
private Vector2 _position;
///
/// The texture's width
///
public int texX { get { return _texX; } set { _texX = value; } }
private int _texX;
///
/// The texture's height
///
public int texY { get { return _texY; } set { _texY = value; } }
private int _texY;
///
/// A boolean which returns true if image is being drawn
///
public bool drawMap { get { return _drawMap; } set { _drawMap = value; } }
private bool _drawMap;
Vector2 mapLocation;
Texture2D mapTexture;
int mapIndex;
///
/// Creates the HUDMapEvent from XML
///
/// XML Node
public HUDMapEvent(XmlNode node)
: base(node)
{
this.texPath = node.Attributes["texture"].Value;
this.texX = int.Parse(node.Attributes["texX"].Value);
this.texY = int.Parse(node.Attributes["texY"].Value);
string value = node.Attributes["draw"].Value;
if (value == "Yes")
{
this.drawMap = true;
}
else
{
this.drawMap = false;
}
eventLimitMilli = 2000;
mapIndex = -1;
string filename = texPath;
mapTexture = Engine.Globals.Statics_Engine.SystemSettings.content.Load(filename);;
mapLocation = new Vector2(Statics_Stream.RenderSettings.cameraList[0].viewport.Width - this.texX, this.texY);
IHuman human = DarkWynterEngine.engine.objectLibrary.humans[0] as IHuman;
mapIndex = human.mapIndex;
}
///
/// Adds/changes the HUD mini map
///
public override void FireEvent()
{
DarkWynterEngine._HUD.UpdateImageDisplay(mapIndex, mapTexture, mapLocation, mapTexture.Width, mapTexture.Height, Color.White, drawMap);
isFinished = true;
}
}
}