示例#1
0
        public void LoadMapTiles(string mapName, Graphics device)
        {
            MapTiles.Clear();
            Reader = new StreamReader(@"..\..\Assets\Maps\" + mapName + ".map");
            Bitmap walkableAreas = new Bitmap(@"..\..\Assets\Maps\" + mapName + ".walkable");

            int y = 0;

            while (!Reader.EndOfStream)
            {
                string line = Reader.ReadLine();

                for (int x = 0; x < line.Length; x++)
                {
                    Tile t = new Tile();
                    t.loc      = new Point(x * 10, y * 10);
                    PixelColor = walkableAreas.GetPixel(x * 10, y * 10);

                    if (PixelColor == WalkableColor) //if (line[x].ToString() == "1")
                    {
                        t.color    = Color.Green;
                        t.walkable = true;
                    }
                    if (PixelColor == NonWalkableColor) //if (line[x].ToString() == "0")
                    {
                        t.color    = Color.Cyan;
                        t.walkable = false;
                    }

                    MapTiles.Add(t);
                }

                y++;
            }

            // Once the tilelist is full, preform an initial drawing of the grid
            GridCalculatedImage = new Bitmap(this.MapImageWidth, this.MapImageHeight);
            GridGraphicsDevice  = Graphics.FromImage(this.GridCalculatedImage);

            foreach (Tile tile in MapTiles)
            {
                pen.Color = tile.color;
                GridGraphicsDevice.DrawRectangle(pen, 0 + tile.loc.X, 0 + tile.loc.Y, 10, 10);
            }
        }
示例#2
0
        public void Close()
        {
            if (!ProjectLoaded)
            {
                return;
            }

            Rooms.Clear();
            DoorSets.Clear();
            Doors.Clear();
            ScrollSets.Clear();
            PlmSets.Clear();
            ScrollPlmDatas.Clear();
            Backgrounds.Clear();
            Fxs.Clear();
            SaveStations.Clear();
            LevelDatas.Clear();
            EnemySets.Clear();
            EnemyGfxs.Clear();
            ScrollAsms.Clear();
            DoorAsms.Clear();
            SetupAsms.Clear();
            MainAsms.Clear();
            TileSets.Clear();
            TileTables.Clear();
            TileSheets.Clear();
            Palettes.Clear();
            AreaMaps.Clear();
            PlmTypes.Clear();
            EnemyTypes.Clear();

            CurrentRom      = null;
            ProjectPath     = String.Empty;
            RomFileName     = String.Empty;
            ProjectFileName = String.Empty;

            RoomTiles.Clear();
            MapTiles.Clear();
            BackgroundImage = null;

            ChangesMade   = false;
            ProjectLoaded = false;
            ProjectClosed?.Invoke(this, null);
        }