Mud Designer:
- Removed code for pathing. MudEngine handles it now. - Removed _InstallLocation and placed it as a private Field within the MudEngine.Engine class. - Mud Designer now Validates paths during startup Mud Engine: - Added Debug code to ValidateDataPaths and GetDataPath Methods. if DEBUG constant is defined it returns the paths or creates the directory structure based off the _InstallLocation field. - Zones now contain a copy of the Realms Name Realm Explorer: - Renamed _Realm to _CurrentRealm to be more consistant with other editor naming conventions. - Zones can now be added to Realms - Realms can now be saved and loaded - Zones not within any Realms are listed in the Realm Explorer as being Available For Use - Realm Explorer Launchs the Zone Builder
This commit is contained in:
parent
d949c17471
commit
3ba3c4107b
15 changed files with 102 additions and 90 deletions
|
@ -40,7 +40,7 @@
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
<OutputPath>..\Example\</OutputPath>
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
|
|
|
@ -12,4 +12,10 @@
|
||||||
<FallbackCulture>en-US</FallbackCulture>
|
<FallbackCulture>en-US</FallbackCulture>
|
||||||
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<StartWorkingDirectory>C:\Codeplex\MudDesigner\Example\</StartWorkingDirectory>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<StartWorkingDirectory>C:\Codeplex\MudDesigner\Example\</StartWorkingDirectory>
|
||||||
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -7,6 +7,8 @@ namespace MUDEngine
|
||||||
{
|
{
|
||||||
public class Engine
|
public class Engine
|
||||||
{
|
{
|
||||||
|
private const string _InstallLocation = @"C:\Codeplex\MudDesigner\Example\";
|
||||||
|
|
||||||
public enum SaveDataTypes
|
public enum SaveDataTypes
|
||||||
{
|
{
|
||||||
Root,
|
Root,
|
||||||
|
@ -23,11 +25,15 @@ namespace MUDEngine
|
||||||
/// <param name="validatedPath"></param>
|
/// <param name="validatedPath"></param>
|
||||||
public static void ValidateDataPaths()
|
public static void ValidateDataPaths()
|
||||||
{
|
{
|
||||||
|
#if DEBUG
|
||||||
|
ValidateDataPaths(_InstallLocation);
|
||||||
|
#else
|
||||||
string assemblyPath = System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.FullyQualifiedName;
|
string assemblyPath = System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.FullyQualifiedName;
|
||||||
string assemblyName = System.IO.Path.GetFileName(assemblyPath);
|
string assemblyName = System.IO.Path.GetFileName(assemblyPath);
|
||||||
string installBase = assemblyPath.Substring(0, assemblyPath.Length - assemblyName.Length);
|
string installBase = assemblyPath.Substring(0, assemblyPath.Length - assemblyName.Length);
|
||||||
string rootPath = System.IO.Path.Combine(installBase, "Data");
|
string rootPath = System.IO.Path.Combine(installBase, "Data");
|
||||||
ValidateDataPaths(rootPath);
|
ValidateDataPaths(rootPath);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -37,6 +43,9 @@ namespace MUDEngine
|
||||||
/// <param name="InstallPath"></param>
|
/// <param name="InstallPath"></param>
|
||||||
public static void ValidateDataPaths(string InstallPath)
|
public static void ValidateDataPaths(string InstallPath)
|
||||||
{
|
{
|
||||||
|
if (!InstallPath.EndsWith("data", true, null))
|
||||||
|
InstallPath = System.IO.Path.Combine(InstallPath, "Data");
|
||||||
|
|
||||||
if (!System.IO.Directory.Exists(InstallPath))
|
if (!System.IO.Directory.Exists(InstallPath))
|
||||||
System.IO.Directory.CreateDirectory(InstallPath);
|
System.IO.Directory.CreateDirectory(InstallPath);
|
||||||
|
|
||||||
|
@ -58,12 +67,23 @@ namespace MUDEngine
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string GetDataPath(SaveDataTypes DataType)
|
public static string GetDataPath(SaveDataTypes DataType)
|
||||||
{
|
{
|
||||||
|
#if DEBUG
|
||||||
|
string path = System.IO.Path.Combine(_InstallLocation, "Data");
|
||||||
|
if (DataType == SaveDataTypes.Root)
|
||||||
|
return _InstallLocation;
|
||||||
|
else
|
||||||
|
return System.IO.Path.Combine(path, DataType.ToString());
|
||||||
|
#else
|
||||||
string assemblyPath = System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.FullyQualifiedName;
|
string assemblyPath = System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.FullyQualifiedName;
|
||||||
string assemblyName = System.IO.Path.GetFileName(assemblyPath);
|
string assemblyName = System.IO.Path.GetFileName(assemblyPath);
|
||||||
string installBase = assemblyPath.Substring(0, assemblyPath.Length - assemblyName.Length);
|
string installBase = assemblyPath.Substring(0, assemblyPath.Length - assemblyName.Length);
|
||||||
string rootPath = System.IO.Path.Combine(installBase, "Data");
|
string rootPath = System.IO.Path.Combine(installBase, "Data");
|
||||||
|
|
||||||
return System.IO.Path.Combine(rootPath, DataType.ToString());
|
if (DataType == SaveDataTypes.Root)
|
||||||
|
return installBase;
|
||||||
|
else
|
||||||
|
return System.IO.Path.Combine(rootPath, DataType.ToString());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,12 +23,13 @@
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
<OutputPath>..\Example\</OutputPath>
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="ManagedScriptingWIN, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="ManagedScriptingWIN, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
|
|
@ -7,5 +7,11 @@ namespace MUDEngine.Objects.Environment
|
||||||
{
|
{
|
||||||
public class Zone : BaseObject
|
public class Zone : BaseObject
|
||||||
{
|
{
|
||||||
|
[System.ComponentModel.Browsable(false)]
|
||||||
|
public string Realm
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,8 +42,8 @@
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
<OutputPath>..\Example\</OutputPath>
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<StartWorkingDirectory>
|
<StartWorkingDirectory>C:\Codeplex\MudDesigner\Example\</StartWorkingDirectory>
|
||||||
</StartWorkingDirectory>
|
|
||||||
<StartArguments>
|
<StartArguments>
|
||||||
</StartArguments>
|
</StartArguments>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<StartWorkingDirectory>
|
<StartWorkingDirectory>C:\Codeplex\MudDesigner\Example\</StartWorkingDirectory>
|
||||||
</StartWorkingDirectory>
|
|
||||||
<StartArguments>
|
<StartArguments>
|
||||||
</StartArguments>
|
</StartArguments>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
|
@ -9,14 +9,13 @@ namespace MudDesigner
|
||||||
{
|
{
|
||||||
static frmMain MudHUB;
|
static frmMain MudHUB;
|
||||||
|
|
||||||
internal static string _InstallLocation = @"E:\Codeplex\MudDesigner";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The main entry point for the application.
|
/// The main entry point for the application.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
|
MUDEngine.Engine.ValidateDataPaths();
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
bool bExit = false;
|
bool bExit = false;
|
||||||
|
@ -46,53 +45,7 @@ namespace MudDesigner
|
||||||
System.Diagnostics.Process process = new System.Diagnostics.Process();
|
System.Diagnostics.Process process = new System.Diagnostics.Process();
|
||||||
System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo();
|
System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo();
|
||||||
|
|
||||||
//If running in debug mode we need to hard-code the paths as during normal running of the apps
|
info.FileName = System.IO.Path.Combine(MUDEngine.Engine.GetDataPath(MUDEngine.Engine.SaveDataTypes.Root), appName);
|
||||||
//all of the apps are running within the Apps directory.
|
|
||||||
#if DEBUG
|
|
||||||
string[] apps = new string[] { };
|
|
||||||
try
|
|
||||||
{
|
|
||||||
apps = System.IO.Directory.GetFiles(_InstallLocation, "*.exe", System.IO.SearchOption.AllDirectories);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
MessageBox.Show("Error: The directory '" + _InstallLocation + "' does not exist!\n\n"
|
|
||||||
+ "The engine has a #DEBUG constant defined in the project properties."
|
|
||||||
+ "\nIf you are wanting to run the Designer from within Visual Studio, please change the\n"
|
|
||||||
+ "MudDesigner.Program._InstallLocation Field to the current ROOT directory of your source code."
|
|
||||||
+ "\n\nIf you are running a Release build of the engine, with all of the editors contained within the"
|
|
||||||
+ " same directory, then edit the MudDesigner project properties to remove the #DEBUG constant."
|
|
||||||
+ "\n" + appName + " will not load.",
|
|
||||||
"Mud Designer", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
List<string> legalApps = new List<string>();
|
|
||||||
|
|
||||||
foreach (string app in apps)
|
|
||||||
{
|
|
||||||
if ((!app.EndsWith(".vshost.exe"))
|
|
||||||
&& (!app.EndsWith(".vshost.exe.manifest"))
|
|
||||||
&& System.IO.Directory.GetParent(app).Name == "Debug"
|
|
||||||
&& System.IO.Directory.GetParent(app).Parent.Name == "bin")
|
|
||||||
{
|
|
||||||
legalApps.Add(app);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
string filename = "";
|
|
||||||
foreach (string app in legalApps)
|
|
||||||
{
|
|
||||||
if (System.IO.Path.GetFileName(app).ToLower() == appName.ToLower())
|
|
||||||
{
|
|
||||||
filename = app;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
info.FileName = filename;
|
|
||||||
#else
|
|
||||||
info.FileName = appName;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
info.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
|
info.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
|
||||||
info.WorkingDirectory = Application.StartupPath;
|
info.WorkingDirectory = Application.StartupPath;
|
||||||
|
@ -108,7 +61,7 @@ namespace MudDesigner
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show("ERROR:\n" + ex.Message, "Editor HUB", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show("ERROR:\n" + ex.Message + "\nPlease change MUDEngine.Engine._InstallLocation to the Examples directory found inside of your downloaded source code folder.", "Editor HUB", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
<OutputPath>..\Example\</OutputPath>
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<StartWorkingDirectory>
|
<StartWorkingDirectory>C:\Codeplex\MudDesigner\Example\</StartWorkingDirectory>
|
||||||
</StartWorkingDirectory>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<StartWorkingDirectory>
|
<StartWorkingDirectory>C:\Codeplex\MudDesigner\Example\</StartWorkingDirectory>
|
||||||
</StartWorkingDirectory>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -25,7 +25,7 @@
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
<OutputPath>C:\Codeplex\MudDesigner\Example\</OutputPath>
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
|
|
1
RealmExplorer/frmMain.Designer.cs
generated
1
RealmExplorer/frmMain.Designer.cs
generated
|
@ -154,6 +154,7 @@
|
||||||
this.btnPlaceZone.TabIndex = 2;
|
this.btnPlaceZone.TabIndex = 2;
|
||||||
this.btnPlaceZone.Text = "Place Zone In Realm";
|
this.btnPlaceZone.Text = "Place Zone In Realm";
|
||||||
this.btnPlaceZone.UseVisualStyleBackColor = true;
|
this.btnPlaceZone.UseVisualStyleBackColor = true;
|
||||||
|
this.btnPlaceZone.Click += new System.EventHandler(this.btnPlaceZone_Click);
|
||||||
//
|
//
|
||||||
// btnBuildZone
|
// btnBuildZone
|
||||||
//
|
//
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace RealmExplorer
|
||||||
public partial class frmMain : Form
|
public partial class frmMain : Form
|
||||||
{
|
{
|
||||||
Zone _Zone;
|
Zone _Zone;
|
||||||
Realm _Realm;
|
Realm _CurrentRealm;
|
||||||
List<Zone> _AvailableZones;
|
List<Zone> _AvailableZones;
|
||||||
ScriptingEngine _ScriptEngine;
|
ScriptingEngine _ScriptEngine;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ namespace RealmExplorer
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_Zone = new Zone();
|
_Zone = new Zone();
|
||||||
_Realm = new Realm();
|
_CurrentRealm = new Realm();
|
||||||
_AvailableZones = new List<Zone>();
|
_AvailableZones = new List<Zone>();
|
||||||
_ScriptEngine = new ScriptingEngine();
|
_ScriptEngine = new ScriptingEngine();
|
||||||
_ScriptEngine.CompileStyle = ManagedScripting.Compilers.BaseCompiler.ScriptCompileStyle.CompileToMemory;
|
_ScriptEngine.CompileStyle = ManagedScripting.Compilers.BaseCompiler.ScriptCompileStyle.CompileToMemory;
|
||||||
|
@ -33,7 +33,7 @@ namespace RealmExplorer
|
||||||
|
|
||||||
SetupScript();
|
SetupScript();
|
||||||
|
|
||||||
propertyRealm.SelectedObject = _Realm;
|
propertyRealm.SelectedObject = _CurrentRealm;
|
||||||
|
|
||||||
string[] existingRealms = System.IO.Directory.GetFiles(Engine.GetDataPath(Engine.SaveDataTypes.Realms));
|
string[] existingRealms = System.IO.Directory.GetFiles(Engine.GetDataPath(Engine.SaveDataTypes.Realms));
|
||||||
foreach (string realm in existingRealms)
|
foreach (string realm in existingRealms)
|
||||||
|
@ -80,7 +80,7 @@ namespace RealmExplorer
|
||||||
private void SetupScript()
|
private void SetupScript()
|
||||||
{
|
{
|
||||||
//Check if the realm script is empty. If so then generate a standard script for it.
|
//Check if the realm script is empty. If so then generate a standard script for it.
|
||||||
if (String.IsNullOrEmpty(_Realm.Script))
|
if (String.IsNullOrEmpty(_CurrentRealm.Script))
|
||||||
{
|
{
|
||||||
//Instance a new method helper class
|
//Instance a new method helper class
|
||||||
ManagedScripting.CodeBuilding.MethodSetup method = new ManagedScripting.CodeBuilding.MethodSetup();
|
ManagedScripting.CodeBuilding.MethodSetup method = new ManagedScripting.CodeBuilding.MethodSetup();
|
||||||
|
@ -96,26 +96,26 @@ namespace RealmExplorer
|
||||||
method.IsOverride = true;
|
method.IsOverride = true;
|
||||||
method.Modifier = ManagedScripting.CodeBuilding.ClassGenerator.Modifiers.Public;
|
method.Modifier = ManagedScripting.CodeBuilding.ClassGenerator.Modifiers.Public;
|
||||||
method.Code = new string[] { "base." + method.Name + "();" };
|
method.Code = new string[] { "base." + method.Name + "();" };
|
||||||
script = script.Insert(_Realm.Script.Length, method.Create() + "\n");
|
script = script.Insert(_CurrentRealm.Script.Length, method.Create() + "\n");
|
||||||
}
|
}
|
||||||
_Realm.Script = script;
|
_CurrentRealm.Script = script;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnNewRealm_Click(object sender, EventArgs e)
|
private void btnNewRealm_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_Zone = new Zone();
|
_Zone = new Zone();
|
||||||
_Realm = new Realm();
|
_CurrentRealm = new Realm();
|
||||||
SetupScript();
|
SetupScript();
|
||||||
|
|
||||||
propertyRealm.SelectedObject = _Realm;
|
propertyRealm.SelectedObject = _CurrentRealm;
|
||||||
lstZonesInRealm.Items.Clear();
|
lstZonesInRealm.Items.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnSaveRealm_Click(object sender, EventArgs e)
|
private void btnSaveRealm_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
string path = Engine.GetDataPath(Engine.SaveDataTypes.Realms);
|
string path = Engine.GetDataPath(Engine.SaveDataTypes.Realms);
|
||||||
string filename = System.IO.Path.Combine(path, _Realm.Name + ".realm");
|
string filename = System.IO.Path.Combine(path, _CurrentRealm.Name + ".realm");
|
||||||
if (System.IO.File.Exists(filename))
|
if (System.IO.File.Exists(filename))
|
||||||
{
|
{
|
||||||
DialogResult result = MessageBox.Show("File exists!\nOverwrite?", "Realm Explorer", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
DialogResult result = MessageBox.Show("File exists!\nOverwrite?", "Realm Explorer", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||||
|
@ -124,10 +124,10 @@ namespace RealmExplorer
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MUDEngine.FileSystem.FileSystem.Save(filename, _Realm);
|
MUDEngine.FileSystem.FileSystem.Save(filename, _CurrentRealm);
|
||||||
|
|
||||||
if (!lstRealms.Items.Contains(_Realm.Name))
|
if (!lstRealms.Items.Contains(_CurrentRealm.Name))
|
||||||
lstRealms.Items.Add(_Realm.Name);
|
lstRealms.Items.Add(_CurrentRealm.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void lstRealms_SelectedIndexChanged(object sender, EventArgs e)
|
private void lstRealms_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
@ -137,9 +137,23 @@ namespace RealmExplorer
|
||||||
|
|
||||||
string path = Engine.GetDataPath(Engine.SaveDataTypes.Realms);
|
string path = Engine.GetDataPath(Engine.SaveDataTypes.Realms);
|
||||||
string filename = System.IO.Path.Combine(path, lstRealms.SelectedItem.ToString() + ".realm");
|
string filename = System.IO.Path.Combine(path, lstRealms.SelectedItem.ToString() + ".realm");
|
||||||
_Realm = (Realm)MUDEngine.FileSystem.FileSystem.Load(filename, _Realm);
|
_CurrentRealm = (Realm)MUDEngine.FileSystem.FileSystem.Load(filename, _CurrentRealm);
|
||||||
|
|
||||||
propertyRealm.SelectedObject = _Realm;
|
propertyRealm.SelectedObject = _CurrentRealm;
|
||||||
|
lstZonesInRealm.Items.Clear();
|
||||||
|
|
||||||
|
foreach (string file in System.IO.Directory.GetFiles(Engine.GetDataPath(Engine.SaveDataTypes.Zones), "*.zone"))
|
||||||
|
{
|
||||||
|
Zone zone = new Zone();
|
||||||
|
zone = (Zone)MUDEngine.FileSystem.FileSystem.Load(file, zone);
|
||||||
|
|
||||||
|
if (zone.Realm == _CurrentRealm.Name)
|
||||||
|
lstZonesInRealm.Items.Add(zone.Name);
|
||||||
|
else if (String.IsNullOrEmpty(zone.Realm))
|
||||||
|
{
|
||||||
|
lstAvailableZones.Items.Add(zone.Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnDeleteRealm_Click(object sender, EventArgs e)
|
private void btnDeleteRealm_Click(object sender, EventArgs e)
|
||||||
|
@ -171,7 +185,7 @@ namespace RealmExplorer
|
||||||
{
|
{
|
||||||
if (tabControl1.SelectedTab.Text == "Script")
|
if (tabControl1.SelectedTab.Text == "Script")
|
||||||
{
|
{
|
||||||
txtScript.Text = _Realm.Script;
|
txtScript.Text = _CurrentRealm.Script;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,7 +195,7 @@ namespace RealmExplorer
|
||||||
_ScriptEngine.AddReference(Application.StartupPath + "/MUDEngine.dll");
|
_ScriptEngine.AddReference(Application.StartupPath + "/MUDEngine.dll");
|
||||||
string code = "namespace MUDEngine.Objects.Environment\n"
|
string code = "namespace MUDEngine.Objects.Environment\n"
|
||||||
+ "{\n"
|
+ "{\n"
|
||||||
+ " public class " + _Realm.Name.Replace(" ", "") + " : Realm\n"
|
+ " public class " + _CurrentRealm.Name.Replace(" ", "") + " : Realm\n"
|
||||||
+ " {\n"
|
+ " {\n"
|
||||||
+ " " + txtScript.Text + "\n"
|
+ " " + txtScript.Text + "\n"
|
||||||
+ " }\n"
|
+ " }\n"
|
||||||
|
@ -196,11 +210,7 @@ namespace RealmExplorer
|
||||||
|
|
||||||
info.Arguments = "\"Run=Zone Builder.exe\"";
|
info.Arguments = "\"Run=Zone Builder.exe\"";
|
||||||
info.Domain = "Zone Builder";
|
info.Domain = "Zone Builder";
|
||||||
#if DEBUG
|
info.FileName = "Zone Builder.exe";
|
||||||
info.FileName = @"E:\Codeplex\MudDesigner\MudDesigner\bin\Debug\Mud Designer.exe";
|
|
||||||
#else
|
|
||||||
info.FileName = "Mud Designer.exe";
|
|
||||||
#endif
|
|
||||||
info.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
|
info.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
|
||||||
|
|
||||||
process.StartInfo = info;
|
process.StartInfo = info;
|
||||||
|
@ -210,5 +220,24 @@ namespace RealmExplorer
|
||||||
this.Show();
|
this.Show();
|
||||||
process = null;
|
process = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void btnPlaceZone_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (lstAvailableZones.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Please select a Zone to add!", "Realm Explorer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string path = Engine.GetDataPath(Engine.SaveDataTypes.Zones);
|
||||||
|
string filename = System.IO.Path.Combine(path, lstAvailableZones.SelectedItem.ToString() + ".zone");
|
||||||
|
Zone zone = new Zone();
|
||||||
|
zone = (Zone)MUDEngine.FileSystem.FileSystem.Load(filename, zone);
|
||||||
|
zone.Realm = _CurrentRealm.Name;
|
||||||
|
MUDEngine.FileSystem.FileSystem.Save(filename, zone);
|
||||||
|
|
||||||
|
_CurrentRealm.Zones.Add(zone);
|
||||||
|
lstZonesInRealm.Items.Add(zone.Name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
<OutputPath>C:\Codeplex\MudDesigner\Example\</OutputPath>
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
<OutputPath>..\Example\</OutputPath>
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue