- Zones now adjusted to delete rooms matching the new collection method being used.

Designer:
 - Room Designer now supports the new Zones.Room collection
This commit is contained in:
Scionwest_cp 2010-02-19 16:04:17 -08:00
parent f79a5d482b
commit 1d302413d2
3 changed files with 29 additions and 45 deletions

View file

@ -55,14 +55,14 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
[Category("Environment Information")] [Category("Environment Information")]
[EditorAttribute(typeof(UIRoomEditor), typeof(UITypeEditor))] [EditorAttribute(typeof(UIRoomEditor), typeof(UITypeEditor))]
[Description("Collection of Rooms that have been created. Editing the Rooms Collection lets you manage the Zones rooms.")] [Description("Collection of Rooms that have been created. Editing the Rooms Collection lets you manage the Zones rooms.")]
public List<Room> Rooms { get; set; } public List<string> Rooms { get; set; }
[Category("Environment Information")] [Category("Environment Information")]
public string EntranceRoom { get; set; } public string EntranceRoom { get; set; }
public Zone() public Zone()
{ {
Rooms = new List<Room>(); Rooms = new List<string>();
IsSafe = false; IsSafe = false;
Realm = "No Realm Associated."; Realm = "No Realm Associated.";
} }
@ -76,30 +76,14 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
{ {
var filterQuery = var filterQuery =
from room in Rooms from room in Rooms
where room.Name == name where room == name
select room; select room;
foreach (var room in filterQuery) foreach (string room in filterQuery)
return room; {
Room r = new Room();
return null; return (Room)r.Load(room, this.Name);
} }
/// <summary>
///
/// </summary>
/// <param name="RoomName"></param>
/// <returns></returns>
public Room GetRoomByFilename(string filename)
{
var filterQuery =
from room in Rooms
where room.Filename == filename
select room;
foreach (var room in filterQuery)
return room;
return null; return null;
} }
@ -110,7 +94,7 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
/// </summary> /// </summary>
public void RebuildRoomCollection() public void RebuildRoomCollection()
{ {
Rooms = new List<Room>(); Rooms = new List<string>();
//Create our collection of Rooms. //Create our collection of Rooms.
string realmPath = Path.Combine(FileManager.GetDataPath(SaveDataTypes.Realms), this.Realm); string realmPath = Path.Combine(FileManager.GetDataPath(SaveDataTypes.Realms), this.Realm);
string zonePath = Path.Combine(realmPath, this.Name); string zonePath = Path.Combine(realmPath, this.Name);
@ -130,7 +114,7 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
Room r = new Room(); Room r = new Room();
r = (Room)r.Load(Path.GetFileNameWithoutExtension(file)); r = (Room)r.Load(Path.GetFileNameWithoutExtension(file));
//r = (Room)FileManager.Load(file, r); //r = (Room)FileManager.Load(file, r);
this.Rooms.Add(r); this.Rooms.Add(r.Name);
} }
//Save the re-built Room collection //Save the re-built Room collection

View file

@ -32,18 +32,18 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UIRoomControl)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UIRoomControl));
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.lstRooms = new System.Windows.Forms.ListBox(); this.lstRooms = new System.Windows.Forms.ListBox();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.mnuDeleteRoom = new System.Windows.Forms.ToolStripMenuItem();
this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.btnNewRoom = new System.Windows.Forms.ToolStripButton(); this.btnNewRoom = new System.Windows.Forms.ToolStripButton();
this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel(); this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
this.txtFindRoom = new System.Windows.Forms.ToolStripTextBox(); this.txtFindRoom = new System.Windows.Forms.ToolStripTextBox();
this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox();
this.propertyRoom = new System.Windows.Forms.PropertyGrid(); this.propertyRoom = new System.Windows.Forms.PropertyGrid();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.mnuDeleteRoom = new System.Windows.Forms.ToolStripMenuItem();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
this.toolStrip1.SuspendLayout(); this.toolStrip1.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// groupBox1 // groupBox1
@ -71,6 +71,20 @@
this.lstRooms.TabIndex = 1; this.lstRooms.TabIndex = 1;
this.lstRooms.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.lstRooms_MouseDoubleClick); this.lstRooms.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.lstRooms_MouseDoubleClick);
// //
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuDeleteRoom});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(143, 26);
//
// mnuDeleteRoom
//
this.mnuDeleteRoom.Name = "mnuDeleteRoom";
this.mnuDeleteRoom.Size = new System.Drawing.Size(142, 22);
this.mnuDeleteRoom.Text = "Delete Room";
this.mnuDeleteRoom.Click += new System.EventHandler(this.mnuDeleteRoom_Click);
//
// toolStrip1 // toolStrip1
// //
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -129,20 +143,6 @@
this.propertyRoom.ToolbarVisible = false; this.propertyRoom.ToolbarVisible = false;
this.propertyRoom.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyRoom_PropertyValueChanged); this.propertyRoom.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyRoom_PropertyValueChanged);
// //
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuDeleteRoom});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(143, 26);
//
// mnuDeleteRoom
//
this.mnuDeleteRoom.Name = "mnuDeleteRoom";
this.mnuDeleteRoom.Size = new System.Drawing.Size(152, 22);
this.mnuDeleteRoom.Text = "Delete Room";
this.mnuDeleteRoom.Click += new System.EventHandler(this.mnuDeleteRoom_Click);
//
// UIRoomControl // UIRoomControl
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -163,10 +163,10 @@
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.UIRoomControl_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.UIRoomControl_FormClosing);
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout(); this.groupBox1.PerformLayout();
this.contextMenuStrip1.ResumeLayout(false);
this.toolStrip1.ResumeLayout(false); this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout(); this.toolStrip1.PerformLayout();
this.groupBox2.ResumeLayout(false); this.groupBox2.ResumeLayout(false);
this.contextMenuStrip1.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }

View file

@ -232,7 +232,7 @@ namespace MudDesigner.MudEngine.UITypeEditors
r = (Room)r.Load(lstRooms.SelectedItem.ToString(), _Zone.Name); r = (Room)r.Load(lstRooms.SelectedItem.ToString(), _Zone.Name);
File.Delete(r.InstallPath); File.Delete(r.InstallPath);
lstRooms.Items.Remove(lstRooms.SelectedItem); lstRooms.Items.Remove(lstRooms.SelectedItem);
_Zone.Rooms.Remove(r); _Zone.Rooms.Remove(r.Name);
} }
} }
} }