using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Drawing.Text;
using System.IO;

namespace Art_of_War
{
    public partial class Form1 : Form
    {
        LevelEinstellungen level;




        PrivateFontCollection pfc = new PrivateFontCollection();
        public Form1()
        {

            InitializeComponent();

            level = new LevelEinstellungen();

            

            level.spielfeldgroesse = new koordinaten { x = 850f, y = 850f };
            level.AddBasis(new Basis(0, 5, "panzer", 10.0f, zugehoerigkeit.rot, new int[] { 2, 4 }, new koordinaten { x = 0.047f, y = 0.047f }));
            level.AddBasis(new Basis(1, 5, "panzer", 10.0f, zugehoerigkeit.blau, new int[] { 2, 5 }, new koordinaten { x = 0.93f, y = 0.047f }));
            level.AddBasis(new Basis(2, 1, "panzer", 0f, zugehoerigkeit.neutral, new int[] { 0, 1 }, new koordinaten { x = 0.4705f, y = 0.047f }));
            level.AddBasis(new Basis(3, 3, "panzer", 0f, zugehoerigkeit.neutral, new int[] { 4, 5 }, new koordinaten { x = 0.4705f, y = 0.4705f }));
            level.AddBasis(new Basis(4, 2, "panzer", 0f, zugehoerigkeit.neutral, new int[] { 0, 3, 6 }, new koordinaten { x = 0.1411f, y = 0.5647f }));
            level.AddBasis(new Basis(5, 2, "panzer", 0f, zugehoerigkeit.neutral, new int[] { 1, 3, 6 }, new koordinaten { x = 0.8470f, y = 0.5647f }));
            level.AddBasis(new Basis(6, 4, "panzer", 0f, zugehoerigkeit.neutral, new int[] { 4, 5 }, new koordinaten { x = 0.4705f, y = 0.93f }));

            //Font einbinden
            //****************
            //Stream fontStream = this.GetType().Assembly.GetManifestResourceStream("embedfont.Alphd___.ttf");



            //byte[] fontdata = new byte[fontStream.Length];

            //fontStream.Read(fontdata, 0, (int)fontStream.Length);

            //fontStream.Close();

            //unsafe
            //{

            //    fixed (byte* pFontData = fontdata)
            //    {

            //        pfc.AddMemoryFont((System.IntPtr)pFontData, fontdata.Length);

            //    }

            //}


        }

        private void button1_Click(object sender, EventArgs e)
        {
            //if ( levelsettingschanged != null)
            this.level.levelsettingschanged += new EventHandler<LevelEventArgs>(levelsettings_changed);




            GameForm gameform = new GameForm(level);
            gameform.ShowDialog();

            //newgamebutton.Enabled = false;
            //newgamebutton.Visible = false;
           

            //Input input = new Input(this);        

            //LevelEinstellungen level = new LevelEinstellungen(spielfeldgroesse);



            //PermanenteEinstellungen permanentsettings = new PermanenteEinstellungen();
            //Spiel spiel = new Spiel(permanentsettings, level1, input);
            //GrafikInformationen graficInfo = new GrafikInformationen(level1, spiel, picbox);
           
        }

        private void levelsettings_changed(object sender, LevelEventArgs e)
        {
            this.level = e.level;
        }

        public Control FocusedThingy
        {
            get { return newgamebutton; }
        }

        private void LevelSettingButton_Click(object sender, EventArgs e)
        {
            SettingsForm settingsform = new SettingsForm(level);
            settingsform.ShowDialog();
        }

        private void quitButton_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
    }

    
}
