- Migrated additional content from MudDesigner solution to MudEngine.

- Updated MudDesigner to reference the new MudEngine solution.
- MudDesigner currently references engine classes within it's own solution and the MudEngine solution. This will be addressed soon. All classes related to the engine will be moved to the MudEngine project.
- Began prepping for the removal of all UITypeEditor classes and the namespace from the MudDesigner project.

Please note that while this version will compile, it is currently broken. Projects do not get created correctly due to the migration I'm performing. The designer is given less priority at the moment as the engine is the primary focus. Projects will need to be hard-coded using the MudEngine library until the designer is fixed.
This commit is contained in:
Scionwest_cp 2010-07-15 20:21:56 -07:00
parent dc311f5aa5
commit d40b8690d5
59 changed files with 217 additions and 1538 deletions

View file

@ -1,122 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using System.Windows.Forms;
using MudDesigner.MudEngine.Interfaces;
using MudDesigner.MudEngine.Characters;
using MudDesigner.MudEngine.GameManagement;
using MudDesigner.MudEngine.GameObjects.Environment;
namespace MudDesigner.MudEngine.GameCommands
{
public class CommandEngine
{
#region ====== Public Enumerators, Structures & Properties ======
/// <summary>
/// Gets or Sets a Dictionary list of available commands to use.
/// </summary>
static internal Dictionary<string, IGameCommand> Commands { get; set; }
public List<string> GetCommands
{
get
{
List<string> temp = new List<string>();
foreach (string name in Commands.Keys)
{
temp.Add(name);
}
return temp;
}
}
#endregion
#region ====== Public Methods ======
public bool GetCommand(string Name)
{
if (Commands.ContainsKey(Name.ToLower()))
return true;
else
return false;
}
/// <summary>
/// Executes the specified command name if it exists in the Commands Dictionary.
/// </summary>
/// <param name="Name"></param>
/// <param name="Parameter"></param>
/// <returns></returns>
public static CommandResults ExecuteCommand(string Name, BaseCharacter player, ProjectInformation project, Room room, string command)
{
Name = Name.Insert(0, "Command");
foreach (string key in Commands.Keys)
{
if (Name.ToLower().Contains(key.ToLower()))
{
return Commands[key.ToLower()].Execute(player, project, room, command);
}
}
return new CommandResults();
}
/// <summary>
/// Dynamically loads the specified library into memory and stores all of the
/// classess inheriting from MudCreator.InputCommands.ICommand into the CommandEngines
/// commands dictionary for use with the project
/// </summary>
/// <param name="CommandLibrary"></param>
public static void LoadAllCommands()
{
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
Commands = new Dictionary<string, IGameCommand>();
foreach (Type t in assembly.GetTypes())
{
if (t.GetInterface(typeof(IGameCommand).FullName) != null)
{
//Use activator to create an instance
IGameCommand command = (IGameCommand)Activator.CreateInstance(t);
if (command != null)
{
if (command.Name == null)
command.Name = t.Name.ToLower();
else //Make sure the command is always in lower case.
command.Name = command.Name.ToLower();
//Add the command to the commands list if it does not already exist
if (Commands.ContainsKey(command.Name))
{
//Command exists, check if the command is set to override existing commands or not
if (command.Override)
{
Commands[command.Name] = command;
}
}
//Command does not exist, add it to the commands list
else
Commands.Add(command.Name, command);
}
}
}
}
public static string GetCommand(object Parameter)
{
List<object> objectList = (List<object>)Parameter;
foreach (object obj in objectList)
{
if (obj is string)
return (string)obj;
}
return null;
}
#endregion
}
}

View file

@ -4,19 +4,20 @@ using System.Linq;
using System.Text;
using System.Windows.Forms;
using MudDesigner.MudEngine.Interfaces;
using MudDesigner.MudEngine.Characters;
using MudDesigner.MudEngine.GameManagement;
using MudDesigner.MudEngine.GameObjects.Environment;
using MudDesigner.Engine.Interfaces;
using MudEngine.GameObjects.Characters;
using MudEngine.GameManagement;
using MudEngine.Commands;
using MudEngine.GameObjects.Environment;
namespace MudDesigner.MudEngine.GameCommands
namespace MudEngine.Commands
{
public class CommandExit : IGameCommand
{
public bool Override { get; set; }
public string Name { get; set; }
public CommandResults Execute(BaseCharacter player, ProjectInformation project, Room room, string command)
public CommandResults Execute(BaseCharacter player, GameSetup project, Room room, string command)
{
Application.Exit();

View file

@ -3,13 +3,13 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using MudDesigner.MudEngine.Interfaces;
using MudDesigner.MudEngine.Characters;
using MudDesigner.MudEngine.Characters.Controlled;
using MudDesigner.MudEngine.GameManagement;
using MudDesigner.MudEngine.GameObjects.Environment;
using MudDesigner.Engine.Interfaces;
using MudEngine.GameObjects.Characters;
using MudEngine.GameObjects.Characters.Controlled;
using MudEngine.GameManagement;
using MudEngine.GameObjects.Environment;
namespace MudDesigner.MudEngine.GameCommands
namespace MudEngine.Commands
{
public class CommandGMTeleport : IGameCommand
{
@ -21,8 +21,9 @@ namespace MudDesigner.MudEngine.GameCommands
Override = true;
}
public CommandResults Execute(BaseCharacter player, ProjectInformation project, Room room, string command)
public CommandResults Execute(BaseCharacter player, GameSetup project, Room room, string command)
{
/* TODO: Re-implement this.
PlayerGM playerGM = new PlayerGM();
if (player is PlayerGM)
@ -31,7 +32,7 @@ namespace MudDesigner.MudEngine.GameCommands
}
else
return null;
*/
//TODO: Find the Realm/Zone/Room that the GM specified to teleport to.
return null;
}

View file

@ -3,23 +3,23 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using MudDesigner.MudEngine.Characters;
using MudDesigner.MudEngine.Characters.Controlled;
using MudDesigner.MudEngine.FileSystem;
using MudDesigner.MudEngine.GameCommands;
using MudDesigner.MudEngine.GameManagement;
using MudDesigner.MudEngine.GameObjects.Environment;
using MudDesigner.MudEngine.GameObjects.Items;
using MudDesigner.MudEngine.Interfaces;
using MudEngine.GameObjects.Characters;
using MudEngine.GameObjects.Characters.Controlled;
using MudEngine.FileSystem;
using MudEngine.Commands;
using MudEngine.GameManagement;
using MudEngine.GameObjects.Environment;
using MudEngine.GameObjects.Items;
using MudDesigner.Engine.Interfaces;
namespace MudDesigner.MudEngine.GameCommands
namespace MudEngine.Commands
{
public class CommandLook : IGameCommand
{
public string Name { get; set; }
public bool Override { get; set; }
public CommandResults Execute(BaseCharacter player, ProjectInformation project, Room room, string command)
public CommandResults Execute(BaseCharacter player, GameSetup project, Room room, string command)
{
StringBuilder desc = new StringBuilder();
@ -31,7 +31,7 @@ namespace MudDesigner.MudEngine.GameCommands
desc.AppendLine(room.Description);
foreach (Door door in room.Doorways)
{
if (door.TravelDirection != MudDesigner.MudEngine.GameObjects.AvailableTravelDirections.Down && door.TravelDirection != MudDesigner.MudEngine.GameObjects.AvailableTravelDirections.Up)
if (door.TravelDirection != MudEngine.GameObjects.AvailableTravelDirections.Down && door.TravelDirection != MudEngine.GameObjects.AvailableTravelDirections.Up)
{
desc.AppendLine(door.Description);
}

View file

@ -1,32 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
namespace MudDesigner.MudEngine.GameCommands
{
public class CommandResults
{
/// <summary>
/// Result of the command.
/// </summary>
public object[] Result { get; set; }
public CommandResults()
{
}
public CommandResults(object[] Result)
{
this.Result = Result;
}
public CommandResults(string message)
{
this.Result = new object[] { message };
}
}
}

View file

@ -4,21 +4,21 @@ using System.Linq;
using System.Text;
using System.IO;
using MudDesigner.MudEngine.Interfaces;
using MudDesigner.MudEngine.Characters;
using MudDesigner.MudEngine.GameManagement;
using MudDesigner.MudEngine.GameObjects.Environment;
using MudDesigner.MudEngine.GameObjects;
using MudDesigner.MudEngine.FileSystem;
using MudDesigner.Engine.Interfaces;
using MudEngine.GameObjects.Characters;
using MudEngine.GameManagement;
using MudEngine.GameObjects.Environment;
using MudEngine.GameObjects;
using MudEngine.FileSystem;
namespace MudDesigner.MudEngine.GameCommands
namespace MudEngine.Commands
{
public class CommandWalk : IGameCommand
{
public string Name { get; set; }
public bool Override { get; set; }
public CommandResults Execute(BaseCharacter player, ProjectInformation project, Room room, string command)
public CommandResults Execute(BaseCharacter player, GameSetup project, Room room, string command)
{
string[] words = command.Split(' ');
List<string> directions = new List<string>();