diff --git a/Mud Designer/Editors/DoorwayManager.Designer.cs b/Mud Designer/Editors/DoorwayManager.Designer.cs new file mode 100644 index 0000000..f9ee0a6 --- /dev/null +++ b/Mud Designer/Editors/DoorwayManager.Designer.cs @@ -0,0 +1,321 @@ +namespace MudDesigner.Editors +{ + partial class DoorwayManager + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.lstRealms = new System.Windows.Forms.ListBox(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.lstZones = new System.Windows.Forms.ListBox(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.lstRooms = new System.Windows.Forms.ListBox(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.propertyRoom = new System.Windows.Forms.PropertyGrid(); + this.groupBox5 = new System.Windows.Forms.GroupBox(); + this.btnSelectDoorway = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.btnEast = new System.Windows.Forms.Button(); + this.btnWest = new System.Windows.Forms.Button(); + this.btnDown = new System.Windows.Forms.Button(); + this.btnSouth = new System.Windows.Forms.Button(); + this.btnNorth = new System.Windows.Forms.Button(); + this.btnUp = new System.Windows.Forms.Button(); + this.progressBar1 = new System.Windows.Forms.ProgressBar(); + this.groupBox1.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.groupBox3.SuspendLayout(); + this.groupBox4.SuspendLayout(); + this.groupBox5.SuspendLayout(); + this.SuspendLayout(); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.lstRealms); + this.groupBox1.Location = new System.Drawing.Point(0, 0); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(170, 155); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Available Realms"; + // + // lstRealms + // + this.lstRealms.Dock = System.Windows.Forms.DockStyle.Fill; + this.lstRealms.FormattingEnabled = true; + this.lstRealms.Location = new System.Drawing.Point(3, 16); + this.lstRealms.Name = "lstRealms"; + this.lstRealms.Size = new System.Drawing.Size(164, 134); + this.lstRealms.TabIndex = 0; + this.lstRealms.SelectedIndexChanged += new System.EventHandler(this.lstRealms_SelectedIndexChanged); + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.lstZones); + this.groupBox2.Location = new System.Drawing.Point(0, 161); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(170, 286); + this.groupBox2.TabIndex = 1; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Zones contained within Realm"; + // + // lstZones + // + this.lstZones.Dock = System.Windows.Forms.DockStyle.Fill; + this.lstZones.FormattingEnabled = true; + this.lstZones.Location = new System.Drawing.Point(3, 16); + this.lstZones.Name = "lstZones"; + this.lstZones.Size = new System.Drawing.Size(164, 264); + this.lstZones.TabIndex = 0; + this.lstZones.SelectedIndexChanged += new System.EventHandler(this.lstZones_SelectedIndexChanged); + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.lstRooms); + this.groupBox3.Location = new System.Drawing.Point(173, 0); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(182, 221); + this.groupBox3.TabIndex = 2; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "Available Rooms"; + // + // lstRooms + // + this.lstRooms.Dock = System.Windows.Forms.DockStyle.Fill; + this.lstRooms.FormattingEnabled = true; + this.lstRooms.Location = new System.Drawing.Point(3, 16); + this.lstRooms.Name = "lstRooms"; + this.lstRooms.Size = new System.Drawing.Size(176, 199); + this.lstRooms.TabIndex = 0; + this.lstRooms.SelectedIndexChanged += new System.EventHandler(this.lstRooms_SelectedIndexChanged); + // + // groupBox4 + // + this.groupBox4.Controls.Add(this.propertyRoom); + this.groupBox4.Location = new System.Drawing.Point(176, 221); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.Size = new System.Drawing.Size(182, 226); + this.groupBox4.TabIndex = 3; + this.groupBox4.TabStop = false; + this.groupBox4.Text = "Room Property Preview"; + // + // propertyRoom + // + this.propertyRoom.Dock = System.Windows.Forms.DockStyle.Fill; + this.propertyRoom.Enabled = false; + this.propertyRoom.HelpVisible = false; + this.propertyRoom.Location = new System.Drawing.Point(3, 16); + this.propertyRoom.Name = "propertyRoom"; + this.propertyRoom.Size = new System.Drawing.Size(176, 207); + this.propertyRoom.TabIndex = 0; + this.propertyRoom.ToolbarVisible = false; + // + // groupBox5 + // + this.groupBox5.Controls.Add(this.btnSelectDoorway); + this.groupBox5.Controls.Add(this.label1); + this.groupBox5.Controls.Add(this.btnEast); + this.groupBox5.Controls.Add(this.btnWest); + this.groupBox5.Controls.Add(this.btnDown); + this.groupBox5.Controls.Add(this.btnSouth); + this.groupBox5.Controls.Add(this.btnNorth); + this.groupBox5.Controls.Add(this.btnUp); + this.groupBox5.Location = new System.Drawing.Point(358, 0); + this.groupBox5.Name = "groupBox5"; + this.groupBox5.Size = new System.Drawing.Size(383, 447); + this.groupBox5.TabIndex = 4; + this.groupBox5.TabStop = false; + this.groupBox5.Text = "Doorway Designer"; + // + // btnSelectDoorway + // + this.btnSelectDoorway.Location = new System.Drawing.Point(256, 421); + this.btnSelectDoorway.Name = "btnSelectDoorway"; + this.btnSelectDoorway.Size = new System.Drawing.Size(118, 23); + this.btnSelectDoorway.TabIndex = 15; + this.btnSelectDoorway.Text = "Select Doorway"; + this.btnSelectDoorway.UseVisualStyleBackColor = true; + this.btnSelectDoorway.Click += new System.EventHandler(this.btnSelectDoorway_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(3, 428); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(114, 13); + this.label1.TabIndex = 14; + this.label1.Text = "Selected Doorway:"; + // + // btnEast + // + this.btnEast.BackColor = System.Drawing.Color.Gray; + this.btnEast.FlatAppearance.BorderSize = 2; + this.btnEast.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + this.btnEast.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnEast.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnEast.Location = new System.Drawing.Point(256, 161); + this.btnEast.Name = "btnEast"; + this.btnEast.Size = new System.Drawing.Size(118, 93); + this.btnEast.TabIndex = 13; + this.btnEast.Text = "East"; + this.btnEast.UseVisualStyleBackColor = false; + this.btnEast.Click += new System.EventHandler(this.button_Click); + // + // btnWest + // + this.btnWest.BackColor = System.Drawing.Color.Gray; + this.btnWest.FlatAppearance.BorderSize = 2; + this.btnWest.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + this.btnWest.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnWest.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnWest.Location = new System.Drawing.Point(6, 161); + this.btnWest.Name = "btnWest"; + this.btnWest.Size = new System.Drawing.Size(118, 93); + this.btnWest.TabIndex = 12; + this.btnWest.Text = "West"; + this.btnWest.UseVisualStyleBackColor = false; + this.btnWest.Click += new System.EventHandler(this.button_Click); + // + // btnDown + // + this.btnDown.BackColor = System.Drawing.Color.Gray; + this.btnDown.FlatAppearance.BorderSize = 2; + this.btnDown.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + this.btnDown.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnDown.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnDown.Location = new System.Drawing.Point(132, 353); + this.btnDown.Name = "btnDown"; + this.btnDown.Size = new System.Drawing.Size(118, 51); + this.btnDown.TabIndex = 11; + this.btnDown.Text = "Down"; + this.btnDown.UseVisualStyleBackColor = false; + this.btnDown.Click += new System.EventHandler(this.button_Click); + // + // btnSouth + // + this.btnSouth.BackColor = System.Drawing.Color.Gray; + this.btnSouth.FlatAppearance.BorderSize = 2; + this.btnSouth.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + this.btnSouth.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnSouth.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnSouth.Location = new System.Drawing.Point(132, 261); + this.btnSouth.Name = "btnSouth"; + this.btnSouth.Size = new System.Drawing.Size(118, 86); + this.btnSouth.TabIndex = 10; + this.btnSouth.Text = "South"; + this.btnSouth.UseVisualStyleBackColor = false; + this.btnSouth.Click += new System.EventHandler(this.button_Click); + // + // btnNorth + // + this.btnNorth.BackColor = System.Drawing.Color.Gray; + this.btnNorth.FlatAppearance.BorderSize = 2; + this.btnNorth.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + this.btnNorth.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnNorth.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnNorth.Location = new System.Drawing.Point(132, 69); + this.btnNorth.Name = "btnNorth"; + this.btnNorth.Size = new System.Drawing.Size(118, 86); + this.btnNorth.TabIndex = 9; + this.btnNorth.Text = "North"; + this.btnNorth.UseVisualStyleBackColor = false; + this.btnNorth.Click += new System.EventHandler(this.button_Click); + // + // btnUp + // + this.btnUp.BackColor = System.Drawing.Color.Gray; + this.btnUp.FlatAppearance.BorderSize = 2; + this.btnUp.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + this.btnUp.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnUp.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnUp.Location = new System.Drawing.Point(132, 12); + this.btnUp.Name = "btnUp"; + this.btnUp.Size = new System.Drawing.Size(118, 51); + this.btnUp.TabIndex = 8; + this.btnUp.Text = "Up"; + this.btnUp.UseVisualStyleBackColor = false; + this.btnUp.Click += new System.EventHandler(this.button_Click); + // + // progressBar1 + // + this.progressBar1.Dock = System.Windows.Forms.DockStyle.Bottom; + this.progressBar1.Location = new System.Drawing.Point(0, 426); + this.progressBar1.Name = "progressBar1"; + this.progressBar1.Size = new System.Drawing.Size(744, 23); + this.progressBar1.TabIndex = 5; + this.progressBar1.Visible = false; + // + // DoorwayManager + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(744, 449); + this.Controls.Add(this.progressBar1); + this.Controls.Add(this.groupBox5); + this.Controls.Add(this.groupBox4); + this.Controls.Add(this.groupBox3); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.groupBox1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "DoorwayManager"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Doorway Manager"; + this.groupBox1.ResumeLayout(false); + this.groupBox2.ResumeLayout(false); + this.groupBox3.ResumeLayout(false); + this.groupBox4.ResumeLayout(false); + this.groupBox5.ResumeLayout(false); + this.groupBox5.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.ListBox lstRealms; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.ListBox lstZones; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.ListBox lstRooms; + private System.Windows.Forms.GroupBox groupBox4; + private System.Windows.Forms.PropertyGrid propertyRoom; + private System.Windows.Forms.GroupBox groupBox5; + private System.Windows.Forms.Button btnEast; + private System.Windows.Forms.Button btnWest; + private System.Windows.Forms.Button btnDown; + private System.Windows.Forms.Button btnSouth; + private System.Windows.Forms.Button btnNorth; + private System.Windows.Forms.Button btnUp; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button btnSelectDoorway; + private System.Windows.Forms.ProgressBar progressBar1; + } +} \ No newline at end of file diff --git a/Mud Designer/Editors/DoorwayManager.cs b/Mud Designer/Editors/DoorwayManager.cs new file mode 100644 index 0000000..c278c16 --- /dev/null +++ b/Mud Designer/Editors/DoorwayManager.cs @@ -0,0 +1,174 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using System.IO; + +using MudDesigner.MudEngine.FileSystem; +using MudDesigner.MudEngine.GameManagement; +using MudDesigner.MudEngine.GameObjects; +using MudDesigner.MudEngine.GameObjects.Environment; + +namespace MudDesigner.Editors +{ + public partial class DoorwayManager : Form + { + internal List rooms; + internal List zones; + internal List realms; + internal Room linkedRoom = new Room(); + internal Zone linkedZone = new Zone(); + internal Realm linkedRealm = new Realm(); + internal AvailableTravelDirections TravelDirection = AvailableTravelDirections.None; + + public DoorwayManager(AvailableTravelDirections TravelDirection) + { + InitializeComponent(); + realms = new List(); + rooms = new List(); + zones = new List(); + + //set the window title to show the room being connected to + //along with the travel direction + this.Text += ": " + Program.Room.Name + "->" + TravelDirection.ToString(); + + //get the realm paths, and find all the realm files + string realmRoot = FileManager.GetDataPath(SaveDataTypes.Realms); + string[] realmFiles = Directory.GetFiles(realmRoot, "*.realm", SearchOption.AllDirectories); + + //loop through each realm file found, load the realm + ///and place it in the realm collection + foreach (string file in realmFiles) + { + Realm r = new Realm(); + r = (Realm)FileManager.Load(file, r); + realms.Add(r); + lstRealms.Items.Add(r.Name); + } + } + + private void lstRealms_SelectedIndexChanged(object sender, EventArgs e) + { + if (lstRealms.SelectedIndex == -1) + return; + + string realmPath = Path.Combine(FileManager.GetDataPath(SaveDataTypes.Realms), lstRealms.SelectedItem.ToString()); + string[] files = Directory.GetFiles(realmPath, "*.zone", SearchOption.AllDirectories); + + //only show the progress bar if there is a large + //number of zones to load. + progressBar1.Value = 0; + if (files.Length > 0) + progressBar1.Visible = true; + + progressBar1.Maximum = files.Length * 2; + + foreach (string file in files) + { + Zone z = new Zone(); + z = (Zone)FileManager.Load(file, z); + zones.Add(z); + lstZones.Items.Add(z.Name); + progressBar1.Increment(1); + } + + foreach (Realm realm in realms) + { + if (realm.Name == lstRealms.SelectedItem.ToString()) + { + linkedRealm = realm; + break; + } + progressBar1.Increment(1); + } + + progressBar1.Visible = false; + } + + private void lstZones_SelectedIndexChanged(object sender, EventArgs e) + { + if (lstZones.SelectedIndex == -1) + return; + + string realmPath = Path.Combine(FileManager.GetDataPath(SaveDataTypes.Realms), lstRealms.SelectedItem.ToString()); + string zonePath = Path.Combine(realmPath, lstZones.SelectedItem.ToString()); + string[] files = Directory.GetFiles(zonePath, "*.room"); + + //only show the progress bar if there is a large number + //of rooms to load + progressBar1.Value = 0; + if (files.Length > 0) + progressBar1.Visible = true; + + progressBar1.Maximum = files.Length * 2; + + foreach (string file in files) + { + Room r = new Room(); + r = (Room)FileManager.Load(file, r); + rooms.Add(r); + lstRooms.Items.Add(r.Name); + progressBar1.Increment(1); + } + + foreach (Zone zone in zones) + { + if (zone.Name == lstZones.SelectedItem.ToString()) + { + linkedZone = zone; + break; + } + progressBar1.Increment(1); + } + progressBar1.Visible = false; + } + + private void lstRooms_SelectedIndexChanged(object sender, EventArgs e) + { + if (lstRooms.SelectedIndex == -1) + return; + + foreach (Room room in rooms) + { + if (room.Name == lstRooms.SelectedItem.ToString()) + { + linkedRoom = room; + break; + } + } + + propertyRoom.SelectedObject = linkedRoom; + } + + private void button_Click(object sender, EventArgs e) + { + Button button = (Button)sender; + TravelDirection = TravelDirections.GetTravelDirectionValue(button.Text); + label1.Text = "Selected Doorway: " + TravelDirection.ToString(); + } + + private void btnSelectDoorway_Click(object sender, EventArgs e) + { + if (TravelDirection == AvailableTravelDirections.None) + { + MessageBox.Show("You must select a doorway to link with.", + "Doorway Manager", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + return; + } + + //Make sure we have all of our environments selected + if (lstRooms.SelectedIndex == -1) + { + MessageBox.Show("You must select a Realm, Zone and Room prior to selecting this doorway.", + "Doorway Manager", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + return; + } + + this.Close(); + } + } +} diff --git a/Mud Designer/Editors/DoorwayManager.resx b/Mud Designer/Editors/DoorwayManager.resx new file mode 100644 index 0000000..ff31a6d --- /dev/null +++ b/Mud Designer/Editors/DoorwayManager.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Mud Designer/Editors/ZoneBuilder.cs b/Mud Designer/Editors/ZoneBuilder.cs index 07c7d0d..00cf6ff 100644 --- a/Mud Designer/Editors/ZoneBuilder.cs +++ b/Mud Designer/Editors/ZoneBuilder.cs @@ -24,6 +24,9 @@ namespace MudDesigner.Editors bool IsRealmLoaded = false; bool IsZoneLoaded = false; bool IsCreatingZone = false; + bool IsRoomLoaded = false; + bool IsCreatingRoom = false; + List _Zones = new List(); public ZoneBuilder() @@ -98,7 +101,6 @@ namespace MudDesigner.Editors //Zone is in 'create' mode, and has not been saved/loaded fully yet. IsZoneLoaded = false; IsCreatingZone = true; - //Reset our room, as we are creating a new zone, there will be no rooms. propertyRoom.SelectedObject = null; lstRooms.Items.Clear(); @@ -174,6 +176,8 @@ namespace MudDesigner.Editors this.Text = "Zone Builder: (" + Program.Realm.Name + ")"; IsRealmLoaded = true; + IsZoneLoaded = false; + IsRoomLoaded = false; //realm is loaded, now clear out the list of zones & rooms and show the zones contained //within the new realm @@ -245,6 +249,7 @@ namespace MudDesigner.Editors propertyZone.SelectedObject = Program.Zone; IsZoneLoaded = true; IsCreatingZone = false; + IsRoomLoaded = false; } private void btnNewRoom_Click(object sender, EventArgs e) @@ -268,10 +273,20 @@ namespace MudDesigner.Editors Program.Room = new Room(); Program.Room.Zone = Program.Zone.Name; propertyRoom.SelectedObject = Program.Room; + IsRoomLoaded = false; + IsCreatingRoom = true; } private void btnSaveRoom_Click(object sender, EventArgs e) { + if (!IsRoomLoaded) + { + if (!IsCreatingRoom) + { + MessageBox.Show("You must create a new Room in order to save.", "Zone Builder", MessageBoxButtons.OK); + return; + } + } //Get the realm, zone & room path setup first string realmPath = System.IO.Path.Combine(FileManager.GetDataPath(SaveDataTypes.Realms), Program.Realm.Name); string zonePath = Path.Combine(realmPath, Program.Zone.Name); @@ -291,6 +306,9 @@ namespace MudDesigner.Editors //add it to the list box if it isn't already there if (!lstRooms.Items.Contains(Program.Room.Name)) lstRooms.Items.Add(Program.Room.Name); + + IsRoomLoaded = true; + IsCreatingRoom = false; } private void btnLoadRoom_Click(object sender, EventArgs e) @@ -334,6 +352,82 @@ namespace MudDesigner.Editors } propertyRoom.SelectedObject = Program.Room; + IsRoomLoaded = true; + IsCreatingRoom = false; + } + + private void doorwayMenuStrip_Opening(object sender, CancelEventArgs e) + { + if (sender is ContextMenuStrip) + { + ContextMenuStrip mnu = (ContextMenuStrip)sender; + Button btn = (Button)mnu.SourceControl; + mnuInstallDoor.Text = "Install " + btn.Text + " doorway."; + + } + } + + private void installDoorwayToAnotherZoneToolStripMenuItem_Click(object sender, EventArgs e) + { + if (!IsRoomLoaded) + { + MessageBox.Show("You must load a Room prior to any doorway installation attempts.", + "Zone Builder", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + return; + } + + //Split the menus text into an array, since the menu + //is dynamically generating it's text, depending on the + //button it is right clicked over. + string[] menuWords = mnuInstallDoor.Text.Split(' '); + + //Create an array of all available travel directions + AvailableTravelDirections travelDirection = new AvailableTravelDirections(); + Array values = Enum.GetValues(typeof(AvailableTravelDirections)); + + //Loop through each word in the menu, until we find a word + //that matches a travel direction. + foreach (string word in menuWords) + { + foreach (int value in values) + { + //get a copy of the current travel direction in the array + string displayName = Enum.GetName(typeof(AvailableTravelDirections), value); + + //check if the current travel direction matches the current word in + //the context menu + if (displayName == word) + { + //If we have a match, store the travel direction so + //we can use it on our Doorway manager + travelDirection = (AvailableTravelDirections)Enum.Parse(typeof(AvailableTravelDirections), displayName); + } + } + } + + //Instance a new Doorway manager + DoorwayManager form = new DoorwayManager(travelDirection); + form.Show(); + this.Hide(); + + while (form.Created) + Application.DoEvents(); + + this.Show(); + + Control[] controls = this.Controls.Find("btn" + travelDirection.ToString(), true); + + controls[0].Text = travelDirection.ToString() + "\nInstalled"; + Help.SetToolTip(controls[0], travelDirection.ToString() + " Doorway Installed.\n\n" + + form.linkedRealm.Name + "->" + form.linkedZone.Name + "->" + form.linkedRoom.Name); + + Door door = new Door(travelDirection); + Door.ConnectedRoom d = new Door.ConnectedRoom(); + d.Realm = form.linkedRealm.Name; + d.Room = form.linkedRoom.Name; + d.Zone = form.linkedZone.Name; + door.TravelRoom = d; + Program.Room.InstalledDoors.Add(door); } } } diff --git a/Mud Designer/Editors/ZoneBuilder.designer.cs b/Mud Designer/Editors/ZoneBuilder.designer.cs index 11e9c33..1e8ae2d 100644 --- a/Mud Designer/Editors/ZoneBuilder.designer.cs +++ b/Mud Designer/Editors/ZoneBuilder.designer.cs @@ -29,6 +29,7 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ZoneBuilder)); this.containerMain = new System.Windows.Forms.SplitContainer(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.lstZones = new System.Windows.Forms.ListBox(); @@ -56,6 +57,20 @@ this.btnDeleteRoom = new System.Windows.Forms.Button(); this.btnNewRoom = new System.Windows.Forms.Button(); this.tabPage2 = new System.Windows.Forms.TabPage(); + this.groupBox8 = new System.Windows.Forms.GroupBox(); + this.btnEast = new System.Windows.Forms.Button(); + this.doorwayMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); + this.mnuInstallDoor = new System.Windows.Forms.ToolStripMenuItem(); + this.installDoorwayToAnotherZoneToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator(); + this.installReverseDoorwayToSelectedRoomToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator(); + this.mnuClearDoorway = new System.Windows.Forms.ToolStripMenuItem(); + this.btnWest = new System.Windows.Forms.Button(); + this.btnDown = new System.Windows.Forms.Button(); + this.btnSouth = new System.Windows.Forms.Button(); + this.btnNorth = new System.Windows.Forms.Button(); + this.btnUp = new System.Windows.Forms.Button(); this.Help = new System.Windows.Forms.ToolTip(this.components); this.containerMain.Panel1.SuspendLayout(); this.containerMain.Panel2.SuspendLayout(); @@ -71,6 +86,9 @@ this.groupBox7.SuspendLayout(); this.groupBox6.SuspendLayout(); this.groupBox5.SuspendLayout(); + this.tabPage2.SuspendLayout(); + this.groupBox8.SuspendLayout(); + this.doorwayMenuStrip.SuspendLayout(); this.SuspendLayout(); // // containerMain @@ -361,6 +379,7 @@ // // tabPage2 // + this.tabPage2.Controls.Add(this.groupBox8); this.tabPage2.Location = new System.Drawing.Point(4, 22); this.tabPage2.Name = "tabPage2"; this.tabPage2.Padding = new System.Windows.Forms.Padding(3); @@ -369,9 +388,167 @@ this.tabPage2.Text = "Room Doorways"; this.tabPage2.UseVisualStyleBackColor = true; // + // groupBox8 + // + this.groupBox8.Controls.Add(this.btnEast); + this.groupBox8.Controls.Add(this.btnWest); + this.groupBox8.Controls.Add(this.btnDown); + this.groupBox8.Controls.Add(this.btnSouth); + this.groupBox8.Controls.Add(this.btnNorth); + this.groupBox8.Controls.Add(this.btnUp); + this.groupBox8.Dock = System.Windows.Forms.DockStyle.Fill; + this.groupBox8.Location = new System.Drawing.Point(3, 3); + this.groupBox8.Name = "groupBox8"; + this.groupBox8.Size = new System.Drawing.Size(458, 407); + this.groupBox8.TabIndex = 0; + this.groupBox8.TabStop = false; + this.groupBox8.Text = "Available Travel Directions"; + // + // btnEast + // + this.btnEast.BackColor = System.Drawing.Color.Gray; + this.btnEast.ContextMenuStrip = this.doorwayMenuStrip; + this.btnEast.FlatAppearance.BorderSize = 2; + this.btnEast.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + this.btnEast.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnEast.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnEast.Location = new System.Drawing.Point(334, 159); + this.btnEast.Name = "btnEast"; + this.btnEast.Size = new System.Drawing.Size(118, 93); + this.btnEast.TabIndex = 7; + this.btnEast.Text = "East"; + this.btnEast.UseVisualStyleBackColor = false; + // + // doorwayMenuStrip + // + this.doorwayMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuInstallDoor, + this.toolStripMenuItem2, + this.mnuClearDoorway}); + this.doorwayMenuStrip.Name = "doorwayMenuStrip"; + this.doorwayMenuStrip.Size = new System.Drawing.Size(162, 76); + this.doorwayMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(this.doorwayMenuStrip_Opening); + // + // mnuInstallDoor + // + this.mnuInstallDoor.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.installDoorwayToAnotherZoneToolStripMenuItem, + this.toolStripMenuItem1, + this.installReverseDoorwayToSelectedRoomToolStripMenuItem}); + this.mnuInstallDoor.Name = "mnuInstallDoor"; + this.mnuInstallDoor.Size = new System.Drawing.Size(161, 22); + this.mnuInstallDoor.Text = "Install New Door"; + // + // installDoorwayToAnotherZoneToolStripMenuItem + // + this.installDoorwayToAnotherZoneToolStripMenuItem.Name = "installDoorwayToAnotherZoneToolStripMenuItem"; + this.installDoorwayToAnotherZoneToolStripMenuItem.Size = new System.Drawing.Size(293, 22); + this.installDoorwayToAnotherZoneToolStripMenuItem.Text = "Install Doorway to another Zone"; + this.installDoorwayToAnotherZoneToolStripMenuItem.ToolTipText = "Opens the Doorway Manager giving you the ability\r\nto link a Room located in a dif" + + "ferent Zone or Realm."; + this.installDoorwayToAnotherZoneToolStripMenuItem.Click += new System.EventHandler(this.installDoorwayToAnotherZoneToolStripMenuItem_Click); + // + // toolStripMenuItem1 + // + this.toolStripMenuItem1.Name = "toolStripMenuItem1"; + this.toolStripMenuItem1.Size = new System.Drawing.Size(290, 6); + // + // installReverseDoorwayToSelectedRoomToolStripMenuItem + // + this.installReverseDoorwayToSelectedRoomToolStripMenuItem.Name = "installReverseDoorwayToSelectedRoomToolStripMenuItem"; + this.installReverseDoorwayToSelectedRoomToolStripMenuItem.Size = new System.Drawing.Size(293, 22); + this.installReverseDoorwayToSelectedRoomToolStripMenuItem.Text = "Install Reverse Doorway to selected Room"; + this.installReverseDoorwayToSelectedRoomToolStripMenuItem.ToolTipText = resources.GetString("installReverseDoorwayToSelectedRoomToolStripMenuItem.ToolTipText"); + // + // toolStripMenuItem2 + // + this.toolStripMenuItem2.Name = "toolStripMenuItem2"; + this.toolStripMenuItem2.Size = new System.Drawing.Size(158, 6); + // + // mnuClearDoorway + // + this.mnuClearDoorway.Name = "mnuClearDoorway"; + this.mnuClearDoorway.Size = new System.Drawing.Size(161, 22); + this.mnuClearDoorway.Text = "Clear Doorway"; + // + // btnWest + // + this.btnWest.BackColor = System.Drawing.Color.Gray; + this.btnWest.ContextMenuStrip = this.doorwayMenuStrip; + this.btnWest.FlatAppearance.BorderSize = 2; + this.btnWest.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + this.btnWest.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnWest.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnWest.Location = new System.Drawing.Point(6, 159); + this.btnWest.Name = "btnWest"; + this.btnWest.Size = new System.Drawing.Size(118, 93); + this.btnWest.TabIndex = 6; + this.btnWest.Text = "West"; + this.btnWest.UseVisualStyleBackColor = false; + // + // btnDown + // + this.btnDown.BackColor = System.Drawing.Color.Gray; + this.btnDown.ContextMenuStrip = this.doorwayMenuStrip; + this.btnDown.FlatAppearance.BorderSize = 2; + this.btnDown.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + this.btnDown.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnDown.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnDown.Location = new System.Drawing.Point(166, 350); + this.btnDown.Name = "btnDown"; + this.btnDown.Size = new System.Drawing.Size(118, 51); + this.btnDown.TabIndex = 5; + this.btnDown.Text = "Down"; + this.btnDown.UseVisualStyleBackColor = false; + // + // btnSouth + // + this.btnSouth.BackColor = System.Drawing.Color.Gray; + this.btnSouth.ContextMenuStrip = this.doorwayMenuStrip; + this.btnSouth.FlatAppearance.BorderSize = 2; + this.btnSouth.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + this.btnSouth.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnSouth.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnSouth.Location = new System.Drawing.Point(166, 258); + this.btnSouth.Name = "btnSouth"; + this.btnSouth.Size = new System.Drawing.Size(118, 86); + this.btnSouth.TabIndex = 4; + this.btnSouth.Text = "South"; + this.btnSouth.UseVisualStyleBackColor = false; + // + // btnNorth + // + this.btnNorth.BackColor = System.Drawing.Color.Gray; + this.btnNorth.ContextMenuStrip = this.doorwayMenuStrip; + this.btnNorth.FlatAppearance.BorderSize = 2; + this.btnNorth.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + this.btnNorth.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnNorth.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnNorth.Location = new System.Drawing.Point(166, 67); + this.btnNorth.Name = "btnNorth"; + this.btnNorth.Size = new System.Drawing.Size(118, 86); + this.btnNorth.TabIndex = 3; + this.btnNorth.Text = "North"; + this.btnNorth.UseVisualStyleBackColor = false; + // + // btnUp + // + this.btnUp.BackColor = System.Drawing.Color.Gray; + this.btnUp.ContextMenuStrip = this.doorwayMenuStrip; + this.btnUp.FlatAppearance.BorderSize = 2; + this.btnUp.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + this.btnUp.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnUp.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnUp.Location = new System.Drawing.Point(166, 10); + this.btnUp.Name = "btnUp"; + this.btnUp.Size = new System.Drawing.Size(118, 51); + this.btnUp.TabIndex = 0; + this.btnUp.Text = "Up"; + this.btnUp.UseVisualStyleBackColor = false; + // // Help // - this.Help.AutoPopDelay = 5000; + this.Help.AutoPopDelay = 12000; this.Help.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(128))))); this.Help.InitialDelay = 1000; this.Help.IsBalloon = true; @@ -404,6 +581,9 @@ this.groupBox7.ResumeLayout(false); this.groupBox6.ResumeLayout(false); this.groupBox5.ResumeLayout(false); + this.tabPage2.ResumeLayout(false); + this.groupBox8.ResumeLayout(false); + this.doorwayMenuStrip.ResumeLayout(false); this.ResumeLayout(false); } @@ -438,6 +618,20 @@ private System.Windows.Forms.ListBox lstRooms; private System.Windows.Forms.GroupBox groupBox7; private System.Windows.Forms.PropertyGrid propertyRoom; + private System.Windows.Forms.GroupBox groupBox8; + private System.Windows.Forms.Button btnUp; + private System.Windows.Forms.Button btnNorth; + private System.Windows.Forms.Button btnDown; + private System.Windows.Forms.Button btnSouth; + private System.Windows.Forms.Button btnWest; + private System.Windows.Forms.Button btnEast; + private System.Windows.Forms.ContextMenuStrip doorwayMenuStrip; + private System.Windows.Forms.ToolStripMenuItem mnuInstallDoor; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2; + private System.Windows.Forms.ToolStripMenuItem mnuClearDoorway; + private System.Windows.Forms.ToolStripMenuItem installDoorwayToAnotherZoneToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1; + private System.Windows.Forms.ToolStripMenuItem installReverseDoorwayToSelectedRoomToolStripMenuItem; } } \ No newline at end of file diff --git a/Mud Designer/Editors/ZoneBuilder.resx b/Mud Designer/Editors/ZoneBuilder.resx index f077234..30b7354 100644 --- a/Mud Designer/Editors/ZoneBuilder.resx +++ b/Mud Designer/Editors/ZoneBuilder.resx @@ -120,4 +120,18 @@ 17, 17 + + 94, 17 + + + Automatically links the currently loaded Room & its Doorway +to the opposite doorway contained within the currently selected +room. This option is only available for Rooms within the same Zone. + +Example: Reverse North doorway would be South doorway. + +Note that the currently selected room is what will be linked to, +it does not need to be loaded in order to be linked. Loading it will +unload the currently loaded room. + \ No newline at end of file diff --git a/Mud Designer/Mud Designer.csproj b/Mud Designer/Mud Designer.csproj index dc26a23..95a7919 100644 --- a/Mud Designer/Mud Designer.csproj +++ b/Mud Designer/Mud Designer.csproj @@ -12,6 +12,21 @@ Mud Designer v3.5 512 + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true true @@ -52,6 +67,12 @@ + + Form + + + DoorwayManager.cs + Form @@ -112,6 +133,10 @@ CurrencyEditor.cs Designer + + DoorwayManager.cs + Designer + ExistingRealms.cs Designer @@ -154,6 +179,28 @@ + + + False + .NET Framework 2.0 %28x86%29 + false + + + False + .NET Framework 3.0 %28x86%29 + false + + + False + .NET Framework 3.5 + true + + + False + Windows Installer 3.1 + true + +