示例#1
0
        private void OpenChestEditor()
        {
            if (chestEditorStripMenuItem.Checked)
            {
                return;     // dont open a second one
            }
            chestEditor = new ChestEditorWindow();

            if (currentRoom != null)
            {
                var chestData = currentRoom.GetChestData();
                chestEditor.SetData(chestData);
            }
            chestEditor.FormClosed          += new FormClosedEventHandler(OnChestEditorClose);
            chestEditorStripMenuItem.Checked = true;
            chestEditor.Show();
        }
示例#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 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;
                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);
                }
            }
        }
示例#3
0
        public void ChangeRoom(int areaId, int roomId)
        {
            statusRoomIdText.Text = "Room Id:" + roomId.Hex().PadLeft(2, '0');
            statusAreaIdText.Text = "Area Id:" + areaId.Hex().PadLeft(2, '0');

            var isDifferentArea = currentArea != areaId;
            var room            = FindRoom(areaId, roomId);


            try
            {
                mapLayers = room.DrawRoom(areaId, true, true);
            }
            catch (PaletteException exception)
            {
                Notify(exception.Message, "Invalid Room");
                statusText.Text = "Room load aborted.";
                return;
            }

            currentArea = areaId;
            currentRoom = room;

            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 && isDifferentArea)//still in the same area? dont reload
            {
                areaEditor.LoadArea(areaId);
            }

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

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

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