Major Changes:

- Rooms are now saved within the selected Zone.
 - Fixed Project Explorer not displaying project directory structure on Designer startup.

Engine:
 - Re-wrote Zone.GetRoom() to use the more efficient LINQ query.
 - Zone.RefreshRoomList now saves itself after re-building the Room collection
 - UIRoomControl now has a public Rooms collection for use by the UIRoomEditor
 - UIRoomEditor now returns the modified UIRoomControl.Rooms collection to the Designers properties pane instead of an empty collection.

Designer:
 - Project Explorer now displays project directory structure on load. This was broken during Designers Constructor re-write.
 - Added additional comments to increase readability of source.
This commit is contained in:
Scionwest_cp 2010-01-18 20:46:43 -08:00
parent afd74530cd
commit 42e6fef109
7 changed files with 86 additions and 11 deletions

View file

@ -1,9 +1,9 @@
using System;
using System.Collections;
using System.ComponentModel;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Xml.Serialization;
namespace MudDesigner.MudEngine.GameObjects.Environment

View file

@ -64,17 +64,29 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
//throw new NotSupportedException("Parameterless constructors of Type " + this.GetType().FullName + " is not supported.");
}
/// <summary>
///
/// </summary>
/// <param name="RoomName"></param>
/// <returns></returns>
public Room GetRoom(string RoomName)
{
foreach (Room r in Rooms)
{
if (r.Name == RoomName)
return r;
}
var filterQuery =
from room in Rooms
where room.Name == RoomName
select room;
foreach (var room in filterQuery)
return room;
return null;
}
/// <summary>
/// Clears out the Zones room collection and re-builds it.
/// This is a time consuming process if there are a large amount of
/// of rooms, use sparingly.
/// </summary>
public void RefreshRoomList()
{
Rooms = new List<Room>();
@ -88,13 +100,19 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
//Zone exists, so it's already been saved.
string[] rooms = Directory.GetFiles(zonePath, "*.room");
//Clear the existing collection of Rooms
this.Rooms.Clear();
//Build a new one based off of the files
foreach (string file in rooms)
{
Room r = new Room();
r = (Room)FileManager.Load(file, r);
this.Rooms.Add(r);
}
//Save the re-built Room collection
this.Save(Path.Combine(zonePath, this.Filename));
}
}
}