Engine:
- Changed the IGameCommand Interface constructor for the Execute method. - Updated all of the game commands to make use of the new Execute Method Constructor requirements set by the updated interface. - Look command now returns a description of the players current Room. - Walk command now supports moving players from one Room to another. Use 'Walk Direction' where Direction equals the direction you want to travel (Example: 'Walk North") - TravelDirections.GetTravelDirectionValue now checks the supplied direction value in a case-insensitive manor. - Add a new CommandEngine that handles the commands inputed from the user. - Modified CommandResult to return an array of objects rather than a single object. Runtime: - Now scans the supplied collection of objects returned to the runtime after executing a game command, and adjusts the runtime components as needed, including printing information to the console. - Now displays various warnings during startup to let the user know if certain content hasn't been set within the ProjectInformation yet. - Now executes the 'Look' command on startup to display the users current location. - Fully supports the 'Look' and 'Walk' commands.
This commit is contained in:
parent
efc49e35ce
commit
79f6d36083
10 changed files with 334 additions and 24 deletions
|
@ -3,6 +3,8 @@ 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;
|
||||
|
@ -17,20 +19,16 @@ namespace MudDesigner.MudEngine.GameCommands
|
|||
public string Name { get; set; }
|
||||
public bool Override { get; set; }
|
||||
|
||||
public object Execute(params object[] parameters)
|
||||
public CommandResults Execute(BaseCharacter player, ProjectInformation project, Room room, string command)
|
||||
{
|
||||
Room room = new Room() ;
|
||||
StringBuilder desc = new StringBuilder();
|
||||
|
||||
foreach (object obj in parameters)
|
||||
if (room == null)
|
||||
{
|
||||
if (obj is Room)
|
||||
room = (Room)obj;
|
||||
return new CommandResults("Not within a created Room.");
|
||||
}
|
||||
|
||||
if (room == null)
|
||||
return null;
|
||||
|
||||
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)
|
||||
|
@ -39,7 +37,7 @@ namespace MudDesigner.MudEngine.GameCommands
|
|||
}
|
||||
}
|
||||
|
||||
return desc.ToString();
|
||||
return new CommandResults(desc.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue