muddesigner/MudDesigner/frmDesigner.cs
Scionwest_cp a347607337 Mud Designer:
- Added new Project. Mud Designer project will include the GUI elements needed for graphically building a MUD. Due to Environment creation being finalized, work on a GUI based Environment creation can start.

Mud Engine:
 - Objects no longer require a path to be supplied when calling Object.Save()
 - EditRealm command now edits senses.
 - EditRoom now fully supports creating doorways, however editing existing doorways and linking to existing rooms is not implemented. This command only supports creating new doorways for non-existing Rooms (Rooms are generated as needed)
 - EditZone Now fully supports senses and implemented.
 - Game now supports loading of .ini files when calling Game.Load()
 - All objects now include a SavePath properties. Override this to supply a path for where the object needs to be saved. All Environment and BaseCharacter objects override the BaseObject.SavePath to save into ActiveGame.DataPaths.Environemnts and Players respectively.
 - ObjectCollection now instanced during ScriptEngine initialization to prevent exceptions during runtime.
 - Create command no longer converts all names to lower case.
 - Updated the Walk command to execute the Look command in a safe manor without injecting a command into the player Telnet console.
2010-09-26 08:00:34 -07:00

77 lines
2.4 KiB
C#

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 MudEngine.GameManagement;
using MudEngine.FileSystem;
namespace MudDesigner
{
public partial class frmDesigner : Form
{
private Game _Game;
private Boolean _IsRenaming;
private String _OldName;
public frmDesigner(Game game)
{
InitializeComponent();
_Game = game;
MudEngine.GameObjects.Environment.Room r = new MudEngine.GameObjects.Environment.Room(_Game);
this.propertyGrid1.SelectedObject = _Game;
}
/// <summary>
/// Saves the project.
/// </summary>
public void Save()
{
if ((String.IsNullOrEmpty(_Game.GameTitle)) || (_Game.GameTitle == new Game().GameTitle))
return;
if ((_IsRenaming) && (Directory.Exists(Path.Combine("Projects", _OldName))))
{
Directory.Delete(Path.Combine("Projects", _OldName), true);
File.Delete(Path.Combine(Environment.CurrentDirectory, _OldName + ".ini"));
}
_Game.Save();
}
private void frmDesigner_FormClosing(object sender, FormClosingEventArgs e)
{
DialogResult result = MessageBox.Show("Save Changes?", this.Text, MessageBoxButtons.YesNoCancel);
if (result == System.Windows.Forms.DialogResult.Cancel)
{
e.Cancel = true;
return;
}
else if (result == System.Windows.Forms.DialogResult.Yes)
this.Save();
}
private void propertyGrid1_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
{
if (e.ChangedItem.Label == "GameTitle")
{
String Env = _Game.DataPaths.Environment.Replace(e.OldValue.ToString(), e.ChangedItem.Value.ToString());
String plyr = _Game.DataPaths.Players.Replace(e.OldValue.ToString(), e.ChangedItem.Value.ToString());
_Game.DataPaths = new SaveDataPaths(Env, plyr);
_IsRenaming = true;
_OldName = e.OldValue.ToString();
}
}
}
}