Ejemplo n.º 1
0
        public Room LeftRoom(List<Room> rooms, Room current, Level level)
        {
            int x = current.roomX;
            int y = current.roomY;
            int z = current.roomZ;

            if (x != level.rows[y].columns.Count() - 1)
            {
            x = System.Threading.Interlocked.Decrement(ref x);
            }

            foreach (Room r in rooms)
            {
            if (r.roomX == x & r.roomY == y & r.roomZ == z)
            {
                return r;
            }
            }
            return current;
        }
Ejemplo n.º 2
0
        public Room DownRoom(List<Room> rooms, Room current, Level level)
        {
            int x = current.roomX;
            int y = current.roomY;
            int z = current.roomZ;

            if (y != level.rows.Count() - 1)
            {
            y = System.Threading.Interlocked.Increment(ref y);
            }

            foreach (Room r in rooms)
            {
            if (r.roomX == x & r.roomY == y & r.roomZ == z)
            {
                return r;
            }
            }
            return current;
        }
Ejemplo n.º 3
0
        private void LoadLevel(string path)
        {
            rowcount = 0;
            columncount = 0;
            roomcount = 0;

            rooms = new List<Room>();

            System.Xml.Serialization.XmlSerializer ax = default(System.Xml.Serialization.XmlSerializer);

            Stream txtReader = File.Open(path, FileMode.Open);

            //TextReader txtReader = File.OpenText(filePath);

            ax = new System.Xml.Serialization.XmlSerializer(typeof(Level));
            level = (Level)ax.Deserialize(txtReader);

            for (int r = 0; r <= level.rows.Count() - 1; r++)
            {
                if (level.rows[r] != null)
                    rowcount += 1;

                for (int i = 0; i <= level.rows[r].columns.Length - 1; i++)
                {
                    if (level.rows[r].columns[i] != null)
                        columncount += 1;

                    if (level.rows[r].columns[i].RoomIndex != 0)
                         {

                        roomcount += 1;
                        rooms.Add(new Room(level.rows[r].columns[i].RoomIndex, level.rows[r].columns[i].FilePath,
                            level.rows[r].columns[i].RoomStart));
                        rooms[roomcount - 1].AssignRoomPosition(i, r, 0);
                        if (level.rows[r].columns[i].RoomStart == true)
                            currentRoom = rooms[roomcount - 1];
                         }
                    //Row 1st

                    this.TextBox4.Text = level.rows[0].columns[0].RoomIndex.ToString();
                    this.TextBox5.Text = level.rows[0].columns[1].RoomIndex.ToString();
                    this.TextBox6.Text = level.rows[0].columns[2].RoomIndex.ToString();
                    this.TextBox7.Text = level.rows[0].columns[3].RoomIndex.ToString();
                    this.TextBox8.Text = level.rows[0].columns[4].RoomIndex.ToString();
                    this.TextBox9.Text = level.rows[0].columns[5].RoomIndex.ToString();
                    this.TextBox10.Text = level.rows[0].columns[6].RoomIndex.ToString();
                    this.TextBox11.Text = level.rows[0].columns[7].RoomIndex.ToString();

                    //Row 2nd

                    this.TextBox12.Text = level.rows[1].columns[0].RoomIndex.ToString();
                    this.TextBox13.Text = level.rows[1].columns[1].RoomIndex.ToString();
                    this.TextBox14.Text = level.rows[1].columns[2].RoomIndex.ToString();
                    this.TextBox15.Text = level.rows[1].columns[3].RoomIndex.ToString();
                    this.TextBox16.Text = level.rows[1].columns[4].RoomIndex.ToString();
                    this.TextBox17.Text = level.rows[1].columns[5].RoomIndex.ToString();
                    this.TextBox18.Text = level.rows[1].columns[6].RoomIndex.ToString();
                    this.TextBox19.Text = level.rows[1].columns[7].RoomIndex.ToString();

                    //Row 3rd

                    this.TextBox20.Text = level.rows[2].columns[0].RoomIndex.ToString();
                    this.TextBox21.Text = level.rows[2].columns[1].RoomIndex.ToString();
                    this.TextBox22.Text = level.rows[2].columns[2].RoomIndex.ToString();
                    this.TextBox23.Text = level.rows[2].columns[3].RoomIndex.ToString();
                    this.TextBox24.Text = level.rows[2].columns[4].RoomIndex.ToString();
                    this.TextBox25.Text = level.rows[2].columns[5].RoomIndex.ToString();
                    this.TextBox26.Text = level.rows[2].columns[6].RoomIndex.ToString();
                    this.TextBox27.Text = level.rows[2].columns[7].RoomIndex.ToString();

                }

            }

            txtReader.Close();

            TextBox32.Text = rowcount.ToString();
            TextBox33.Text = columncount.ToString();
            Label16.Text = roomcount.ToString();
        }
Ejemplo n.º 4
0
        private void ClearLevel()
        {
            level = null;

            this.TextBox4.Text = "";
            this.TextBox5.Text = "";
            this.TextBox6.Text = "";
            this.TextBox7.Text = "";
            this.TextBox8.Text = "";
            this.TextBox9.Text = "";
            this.TextBox10.Text = "";
            this.TextBox11.Text = "";

            //Row 2nd

            this.TextBox12.Text = "";
            this.TextBox13.Text = "";
            this.TextBox14.Text = "";
            this.TextBox15.Text = "";
            this.TextBox16.Text = "";
            this.TextBox17.Text = "";
            this.TextBox18.Text = "";
            this.TextBox19.Text = "";

            //Row 3rd

            this.TextBox20.Text = "";
            this.TextBox21.Text = "";
            this.TextBox22.Text = "";
            this.TextBox23.Text = "";
            this.TextBox24.Text = "";
            this.TextBox25.Text = "";
            this.TextBox26.Text = "";
            this.TextBox27.Text = "";
        }