using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Graphics;

namespace Slayter
{
    public class MessageScreen:ScreenOrigin
    {
        public MessageScreen(Screen screen,string title,string text)
            :base(screen.parent)
        {
            drawables = new List<IDrawable>(screen.Drawables);
            parent.setMessageScreen(this);

            commingFrom = screen;

            Texture2D messageTex = parent.Content.Load<Texture2D>("message");
            Rectangle messageBox=new Rectangle((640 - (messageTex.Width + 100))/2, (480-(messageTex.Height + 75))/2,
                messageTex.Width + 100, messageTex.Height + 75);
            ClickableObject message = new ClickableObject(messageTex,messageBox , delegate(MouseState state, ClickableObject o) { });
            drawables.Add(message);

            SpriteFont f = parent.Content.Load<SpriteFont>("font2");
            Vector2 v = f.MeasureString(title);
            Text Title = new Text(f,title,new Vector2(messageBox.X+(messageBox.Width-v.X)/2,messageBox.Y+5));
            drawables.Add(Title);
                
            SpriteFont f2 = parent.Content.Load<SpriteFont>("font3");
            TextArea teXt = new TextArea(f2, text, new Rectangle(messageBox.X+10, messageBox.Y + 45, 300, 90),parent);
            drawables.Add(teXt);
            ClickableObject ground = new ClickableObject(screen.BGROUND.Picture, new Rectangle(0, 0, 640, 480), delegate(MouseState state, ClickableObject o) { parent.removeMessageScreen(this); });
            clickables.Add(teXt);
            clickables.Add(message);            
            clickables.Add(ground);           
        }
    }
}
