예제 #1
0
        private void goToRoomToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (currentState == State.EDITING_WORLD)
            {
                string title = "Currently Selected Room: " + currentlySelectedRoom.name;
                RoomSelectDialog dialog = new RoomSelectDialog(world, true, title);

                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    switchRooms(dialog.SelectedRoom);
                    pb_Level.Refresh();
                }
            }
        }
예제 #2
0
        //Call back for linking the
        private void linkDoorToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (currentState == State.EDITING_WORLD &&
                currentlySelectedObject != null &&
                currentlySelectedObject is Door)
            {
                Door A = ((Door)currentlySelectedObject);

                //First, pop up the menu and get whichever door the user selects.
                string title = "Currently selected door: " +
                    A.name + " in room " + currentlySelectedRoom.name;

                RoomSelectDialog dialog = new RoomSelectDialog(world, false, title);

                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    Door B = dialog.SelectedDoor;

                    A.Link = null;
                    B.Link = null;

                    A.Link = B;
                    B.Link = A;
                }
            }
        }
예제 #3
0
        //------------End of functions for working with doors-----------------------------------------------
        //------------Functions for creating, switching, renaming, etc  rooms-------------------------------
        private void deleteRoomFromWorldToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if(currentState == State.EDITING_WORLD){
                if(world.Rooms.Count <= 1){
                    showMessage("Room Delete Error", "There is only one room, you cannot delete any more!");

                }else{
                    RoomSelectDialog dialog = new RoomSelectDialog(world, true, "Select room to delete.");

                    if(dialog.ShowDialog() == DialogResult.OK)
                    {
                        Room toDelete = dialog.SelectedRoom;

                        //First, remove the room from the list if rooms.
                        world.Rooms.Remove(toDelete);

                        //Next, clear all the links into this room from other doors.
                        foreach(Door door in toDelete.Doors)
                        {
                            if(door.Link != null)
                            {
                                door.Link.Link = null;
                            }
                        }

                        //Finally, if this was the room with the player, set the world's
                        // starting room to null.
                        if(toDelete == world.CurrentRoom)
                        {
                            world.CurrentRoom = null;
                        }
                    }
                }
            }
        }