using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Projekt
{
    /// <summary>
    /// Diese Klasse merkt sich, was der Held schon alles erledigt hat
    /// </summary>
    [Serializable]
    public class Memory
    {

        public Memory()
        {

        }
        
        List<List<int>> actionmem = new List<List<int>>();

        public List<List<int>> Actionmem
        {
            get { return actionmem; }
            set { actionmem = value; }
        }
        

        /// <summary>
        /// hier kann man der Memory mem(level, room, xcoord*10+ycoord) einen Integerwert zuweisen
        /// </summary>
        /// <param name="level"></param>
        /// <param name="room"></param>
        /// <param name="xcoord"></param>
        /// <param name="ycoord"></param>
        /// <param name="value"></param>
        public void SetActionMem(int xcoord, int ycoord, int value)
        {
            
            actionmem[xcoord][ycoord] = value;
        }

        /// <summary>
        /// hier kann man die Memory von mem(level, room, xcoord*10+ycoord) ablesen
        /// </summary>
        /// <param name="level"></param>
        /// <param name="room"></param>
        /// <param name="xcoord"></param>
        /// <param name="ycoord"></param>
        /// <param name="value"></param>
        public int GetActionMem(int xcoord, int ycoord)
        {
            
            return actionmem[xcoord][ycoord];
        }

        
        List<List<int>> stringmem = new List<List<int>>();

        public List<List<int>> Stringmem
        {
            get { return stringmem; }
            set { stringmem = value; }
        }


        /// <summary>
        /// hier kann man der Memory stringmem(level, room, xcoord*10+ycoord) einen Integerwert zuweisen
        /// </summary>
        /// <param name="level"></param>
        /// <param name="room"></param>
        /// <param name="xcoord"></param>
        /// <param name="ycoord"></param>
        /// <param name="value"></param>
        public void SetStringMem(int xcoord, int ycoord, int value)
        {
            
            stringmem[xcoord][ycoord] = value;
        }

        /// <summary>
        /// hier kann man die Memory von stringmem(level, room, xcoord*10+ycoord) ablesen
        /// </summary>
        /// <param name="level"></param>
        /// <param name="room"></param>
        /// <param name="xcoord"></param>
        /// <param name="ycoord"></param>
        /// <param name="value"></param>
        public int GetStringMem(int xcoord, int ycoord)
        {
            return stringmem[xcoord][ycoord];
        }

        //gibt an, ob ein Schlüssel für eine Tür im Raum vorhanden ist.
        List<List<bool>> door_key = new List<List<bool>>();

        public List<List<bool>> Door_key
        {
            get { return door_key; }
            set { door_key = value; }
        }

        /// <summary>
        /// setzen ob der TürSchlüssel vorhanden ist
        /// </summary>
        /// <param name="level"></param>
        /// <param name="room"></param>
        /// <param name="xcoord"></param>
        /// <param name="ycoord"></param>
        /// <param name="value"></param>
        public void SetDoorKey(int xcoord, int ycoord, bool value)
        {
           
            door_key[xcoord][ycoord] = value;
        }

        public bool GetDoorKey(int xcoord, int ycoord)
        {
            
            return door_key[xcoord][ycoord];
        }

        //gibt an, ob ein Schlüssel für eine Truhe im Raum vorhanden ist.
        List<List<bool>> box_key = new List<List<bool>>();

        public List<List<bool>> Box_key
        {
            get { return box_key; }
            set { box_key = value; }
        }

        /// <summary>
        /// setzen ob der TruhenSchlüssel vorhanden ist
        /// </summary>
        /// <param name="level"></param>
        /// <param name="room"></param>
        /// <param name="xcoord"></param>
        /// <param name="ycoord"></param>
        /// <param name="value"></param>
        public void SetBoxKey(int xcoord, int ycoord, bool value)
        {
            
            box_key[xcoord][ycoord] = value;
        }

        /// <summary>
        /// findet heraus, ob der TruhenSchlüssel vorhanden ist
        /// </summary>
        /// <param name="level"></param>
        /// <param name="room"></param>
        /// <param name="xcoord"></param>
        /// <param name="ycoord"></param>
        /// <returns></returns>
        public bool GetboxKey(int xcoord, int ycoord)
        {
           
            return box_key[xcoord][ycoord];
        }

        public void SetFirstMem()
        {
            string[] str = FileTransfer.GetAllFileNames(Application.StartupPath + "\\XmLFiles\\Rooms\\");
            List<int> xcoord = new List<int>();
            List<int> ycoord = new List<int>();
            List<int> intlist = new List<int>();
            List<bool> boollist = new List<bool>();
            
            
            foreach (string st in str)
            {
                
                xcoord.Add((int) st[5]);
                ycoord.Add( (int) st[7]); 
            }

            for (int y=0; y<ycoord.Count;y++)
            {
                intlist.Add(0);
                boollist.Add(false);
            }
           
         
            for(int x=0; x<xcoord.Count;x++)
            {
                actionmem.Add(intlist);
                stringmem.Add(intlist);
                box_key.Add(boollist);
                door_key.Add(boollist);
            }
            
           
        }



    }
}
