Exemplo n.º 1
0
        private void OpenAreaEditor()
        {
            if (areaEditorToolStripMenuItem.Checked)
            {
                return;
            }

            areaEditor = new AreaEditor();

            if (currentRoom != null)
            {
                areaEditor.LoadArea(currentArea);
            }

            areaEditor.FormClosed += new FormClosedEventHandler(OnAreaEditorClose);
            areaEditorToolStripMenuItem.Checked = true;
            areaEditor.Show();
        }
Exemplo n.º 2
0
        private void roomTreeView_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (e.Node.Parent != null)
            {
                Console.WriteLine(e.Node.Parent.Text.Split(' ')[1] + " " + e.Node.Text.Split(' ')[1]);
                int areaIndex = Convert.ToInt32(e.Node.Parent.Text.Split(' ')[1], 16);
                int roomIndex = Convert.ToInt32(e.Node.Text.Split(' ')[1], 16);
                var prevArea  = currentArea;                //changed in next line so hold temporarily
                var room      = FindRoom(areaIndex, roomIndex);

                currentRoom = room;

                mapLayers = room.DrawRoom(areaIndex, true, true);

                selectedTileData             = -1;
                tileTabControl.SelectedIndex = 1;             // Reset to bg2

                //0= bg1 (treetops and such)
                //1= bg2 (flooring)
                mapGridBox.Image        = OverlayImage(mapLayers[1], mapLayers[0]);
                tileMaps                = room.DrawTilesetImages(16, currentArea);
                bottomTileGridBox.Image = tileMaps[1];
                topTileGridBox.Image    = tileMaps[0];

                mapGridBox.Selectable        = true;
                mapGridBox.SelectedIndex     = -1;
                bottomTileGridBox.Selectable = true;
                topTileGridBox.Selectable    = true;

                if (chestEditor != null)
                {
                    var chestData = currentRoom.GetChestData();
                    chestEditor.SetData(chestData);
                }

                if (metatileEditor != null)
                {
                    metatileEditor.currentArea = currentArea;
                    room = MapManager.Instance.MapAreas.Single(a => a.Index == currentArea).Rooms.First();
                    if (!room.Loaded)
                    {
                        room.LoadRoom(currentArea);
                    }
                    metatileEditor.RedrawTiles(currentRoom);
                }

                if (areaEditor != null && currentArea != prevArea)              //still in the same area? dont reload
                {
                    areaEditor.LoadArea(areaIndex);
                }

                /*if(enemyPlacementEditor != null)
                 * {
                 *      enemyPlacementEditor.LoadData();
                 * }*/

                if (warpEditor != null)
                {
                    warpEditor.LoadData();
                }

                if (objectPlacementEditor != null)
                {
                    objectPlacementEditor.LoadData();
                }
            }
        }