Designer:
- Door Linking implementation started. - Duplicate directions are not allowed within a Room - If a User enters the name of a non-existing Room for linking to a Doorway, the Designer generates that Room for the User. - Room Editor now refreshes it's list of Rooms after the Doorway Manager closes so that auto generated Rooms are displayed. - Added new Doorway Manager UI Engine: - Added Door.DoorwayExist() method to the Door class.
This commit is contained in:
parent
0811af95b1
commit
f919539a89
12 changed files with 512 additions and 25 deletions
|
@ -542,7 +542,6 @@ namespace MudDesigner
|
|||
}
|
||||
SaveObject();
|
||||
IsSaved = true;
|
||||
RefreshProjectExplorer();
|
||||
if (_Widget != null)
|
||||
_Widget.Refresh();
|
||||
}
|
||||
|
|
|
@ -93,6 +93,13 @@
|
|||
<Compile Include="MudEngine\GameManagement\ProjectInformation.cs" />
|
||||
<Compile Include="MudEngine\FileSystem\FileManager.cs" />
|
||||
<Compile Include="MudEngine\GameManagement\QuestSetup.cs" />
|
||||
<Compile Include="MudEngine\UITypeEditors\UIDoorwayEditor.cs" />
|
||||
<Compile Include="MudEngine\UITypeEditors\UIDoorwayControl.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MudEngine\UITypeEditors\UIDoorwayControl.Designer.cs">
|
||||
<DependentUpon>UIDoorwayControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MudEngine\UITypeEditors\UIRealmControl.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
@ -119,6 +126,10 @@
|
|||
<DependentUpon>Designer.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="MudEngine\UITypeEditors\UIDoorwayControl.resx">
|
||||
<DependentUpon>UIDoorwayControl.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="MudEngine\UITypeEditors\UIRealmControl.resx">
|
||||
<DependentUpon>UIRealmControl.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
|
|
|
@ -56,10 +56,5 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
|
|||
ConnectedRoom = connectedRoom;
|
||||
TravelDirection = travelDirection;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return this.TravelDirection.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,9 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using System.Drawing.Design;
|
||||
|
||||
using MudDesigner.MudEngine.UITypeEditors;
|
||||
|
||||
namespace MudDesigner.MudEngine.GameObjects.Environment
|
||||
{
|
||||
|
@ -36,14 +39,10 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
|
|||
}
|
||||
}
|
||||
|
||||
public AvailableTravelDirections Directions
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Category("Environment Information")]
|
||||
[Description("Allows for linking of Rooms together via Doorways")]
|
||||
[EditorAttribute(typeof(UIDoorwayEditor), typeof(UITypeEditor))]
|
||||
[RefreshProperties(RefreshProperties.All)]
|
||||
public List<Door> Doorways
|
||||
{
|
||||
get;
|
||||
|
@ -77,12 +76,22 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
|
|||
set;
|
||||
}
|
||||
|
||||
public Room TestRoom { get; set; }
|
||||
public Room()
|
||||
{
|
||||
Doorways = new List<Door>();
|
||||
|
||||
IsSafe = false;
|
||||
}
|
||||
|
||||
public bool DoorwayExist(string travelDirection)
|
||||
{
|
||||
foreach (Door door in Doorways)
|
||||
{
|
||||
if (door.TravelDirection.ToString().ToLower() == travelDirection.ToLower())
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
140
Mud Designer/MudEngine/UITypeEditors/UIDoorwayControl.Designer.cs
generated
Normal file
140
Mud Designer/MudEngine/UITypeEditors/UIDoorwayControl.Designer.cs
generated
Normal file
|
@ -0,0 +1,140 @@
|
|||
namespace MudDesigner.MudEngine.UITypeEditors
|
||||
{
|
||||
partial class UIDoorwayControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.lstInstalledDoors = new System.Windows.Forms.ListBox();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.btnAddDoorway = new System.Windows.Forms.Button();
|
||||
this.btnRemoveDoorway = new System.Windows.Forms.Button();
|
||||
this.propertyDoorway = new System.Windows.Forms.PropertyGrid();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.lstInstalledDoors);
|
||||
this.groupBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.groupBox1.ForeColor = System.Drawing.Color.Gray;
|
||||
this.groupBox1.Location = new System.Drawing.Point(12, 12);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(256, 220);
|
||||
this.groupBox1.TabIndex = 0;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Installed Doorways";
|
||||
//
|
||||
// lstInstalledDoors
|
||||
//
|
||||
this.lstInstalledDoors.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lstInstalledDoors.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lstInstalledDoors.FormattingEnabled = true;
|
||||
this.lstInstalledDoors.Location = new System.Drawing.Point(3, 16);
|
||||
this.lstInstalledDoors.Name = "lstInstalledDoors";
|
||||
this.lstInstalledDoors.Size = new System.Drawing.Size(250, 199);
|
||||
this.lstInstalledDoors.TabIndex = 0;
|
||||
this.lstInstalledDoors.SelectedIndexChanged += new System.EventHandler(this.lstInstalledDoors_SelectedIndexChanged);
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.propertyDoorway);
|
||||
this.groupBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.groupBox2.ForeColor = System.Drawing.Color.Gray;
|
||||
this.groupBox2.Location = new System.Drawing.Point(306, 12);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(270, 249);
|
||||
this.groupBox2.TabIndex = 1;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Installed Doorways";
|
||||
//
|
||||
// btnAddDoorway
|
||||
//
|
||||
this.btnAddDoorway.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnAddDoorway.Location = new System.Drawing.Point(15, 238);
|
||||
this.btnAddDoorway.Name = "btnAddDoorway";
|
||||
this.btnAddDoorway.Size = new System.Drawing.Size(106, 23);
|
||||
this.btnAddDoorway.TabIndex = 2;
|
||||
this.btnAddDoorway.Text = "Add Doorway";
|
||||
this.btnAddDoorway.UseVisualStyleBackColor = true;
|
||||
this.btnAddDoorway.Click += new System.EventHandler(this.btnAddDoorway_Click);
|
||||
//
|
||||
// btnRemoveDoorway
|
||||
//
|
||||
this.btnRemoveDoorway.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnRemoveDoorway.Location = new System.Drawing.Point(159, 238);
|
||||
this.btnRemoveDoorway.Name = "btnRemoveDoorway";
|
||||
this.btnRemoveDoorway.Size = new System.Drawing.Size(106, 23);
|
||||
this.btnRemoveDoorway.TabIndex = 3;
|
||||
this.btnRemoveDoorway.Text = "Remove Doorway";
|
||||
this.btnRemoveDoorway.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// propertyDoorway
|
||||
//
|
||||
this.propertyDoorway.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.propertyDoorway.Location = new System.Drawing.Point(3, 16);
|
||||
this.propertyDoorway.Name = "propertyDoorway";
|
||||
this.propertyDoorway.Size = new System.Drawing.Size(264, 230);
|
||||
this.propertyDoorway.TabIndex = 0;
|
||||
this.propertyDoorway.ToolbarVisible = false;
|
||||
this.propertyDoorway.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyDoorway_PropertyValueChanged);
|
||||
//
|
||||
// UIDoorwayManager
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.ClientSize = new System.Drawing.Size(591, 270);
|
||||
this.Controls.Add(this.btnRemoveDoorway);
|
||||
this.Controls.Add(this.btnAddDoorway);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "UIDoorwayManager";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "UIDoorwayManager";
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.ListBox lstInstalledDoors;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.Button btnAddDoorway;
|
||||
private System.Windows.Forms.Button btnRemoveDoorway;
|
||||
private System.Windows.Forms.PropertyGrid propertyDoorway;
|
||||
}
|
||||
}
|
149
Mud Designer/MudEngine/UITypeEditors/UIDoorwayControl.cs
Normal file
149
Mud Designer/MudEngine/UITypeEditors/UIDoorwayControl.cs
Normal file
|
@ -0,0 +1,149 @@
|
|||
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 MudDesigner.MudEngine.GameObjects;
|
||||
using MudDesigner.MudEngine.GameObjects.Environment;
|
||||
using MudDesigner.MudEngine.GameManagement;
|
||||
using MudDesigner.MudEngine.FileSystem;
|
||||
|
||||
namespace MudDesigner.MudEngine.UITypeEditors
|
||||
{
|
||||
public partial class UIDoorwayControl : Form
|
||||
{
|
||||
Room _Room;
|
||||
Door _Door;
|
||||
|
||||
public UIDoorwayControl(Room room)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_Room = new Room();
|
||||
_Room = room;
|
||||
|
||||
foreach (Door d in _Room.Doorways)
|
||||
{
|
||||
lstInstalledDoors.Items.Add(d.TravelDirection.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private void btnAddDoorway_Click(object sender, EventArgs e)
|
||||
{
|
||||
_Door = new Door();
|
||||
Array directions = Enum.GetValues(typeof(AvailableTravelDirections));
|
||||
bool IsAvailableDirection = true;
|
||||
|
||||
foreach (int direction in directions)
|
||||
{
|
||||
//None value; Don't use the None value when linking rooms.
|
||||
if (direction == 0)
|
||||
continue;
|
||||
|
||||
string availableDirection = Enum.GetName(typeof(AvailableTravelDirections), direction);
|
||||
|
||||
if (_Room.DoorwayExist(availableDirection))
|
||||
IsAvailableDirection = false;
|
||||
else
|
||||
{
|
||||
IsAvailableDirection = true;
|
||||
|
||||
_Door.TravelDirection = (AvailableTravelDirections)Enum.Parse(typeof(AvailableTravelDirections), availableDirection);
|
||||
lstInstalledDoors.Items.Add(_Door.TravelDirection.ToString());
|
||||
_Room.Doorways.Add(_Door);
|
||||
propertyDoorway.SelectedObject = _Door;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!IsAvailableDirection)
|
||||
{
|
||||
MessageBox.Show("There are no available doorways remaining to add.", "Mud Designer");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void propertyDoorway_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
|
||||
{
|
||||
if (e.ChangedItem.Label == "TravelDirection")
|
||||
{
|
||||
if (e.ChangedItem.Value.ToString() == "None")
|
||||
{
|
||||
MessageBox.Show("This is not a valid Direction.", "Mud Designer");
|
||||
_Door = (Door)propertyDoorway.SelectedObject;
|
||||
_Door.TravelDirection = (AvailableTravelDirections)e.OldValue;
|
||||
propertyDoorway.Refresh();
|
||||
return;
|
||||
}
|
||||
else if (_Room.DoorwayExist(e.ChangedItem.Value.ToString()))
|
||||
{
|
||||
MessageBox.Show("This direction has already been installed into the room. Please select another direction.", "Mud Designer");
|
||||
_Door = (Door)propertyDoorway.SelectedObject;
|
||||
_Door.TravelDirection = (AvailableTravelDirections)e.OldValue;
|
||||
propertyDoorway.Refresh();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (e.ChangedItem.Label == "ConnectedRoom")
|
||||
{
|
||||
string zonePath = "";
|
||||
|
||||
if (_Room.Realm == "No Realm Associated.")
|
||||
{
|
||||
zonePath = FileManager.GetDataPath(SaveDataTypes.Zones);
|
||||
}
|
||||
else
|
||||
zonePath = FileManager.GetDataPath(_Room.Realm, _Room.Zone);
|
||||
|
||||
zonePath = Path.Combine(zonePath, _Room.Zone);
|
||||
string roomPath = Path.Combine(zonePath, "Rooms");
|
||||
string roomFile = e.ChangedItem.Value.ToString() + ".Room";
|
||||
string filePath = Path.Combine(roomPath, roomFile);
|
||||
|
||||
if (!File.Exists(filePath))
|
||||
{
|
||||
DialogResult result =
|
||||
MessageBox.Show("Warning! The supplied Room does not exists, would you like the Designer to automatically generate it for you?", "Mud Designer", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
|
||||
if (result == DialogResult.No)
|
||||
{
|
||||
_Door = (Door)propertyDoorway.SelectedObject;
|
||||
_Door.ConnectedRoom = (string)e.OldValue;
|
||||
propertyDoorway.Refresh();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Room r = new Room();
|
||||
r.Name = e.ChangedItem.Value.ToString();
|
||||
r.Realm = _Room.Realm;
|
||||
r.Zone = _Room.Zone;
|
||||
r.Save(Path.Combine(roomPath, r.Filename));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void lstInstalledDoors_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (lstInstalledDoors.SelectedIndex == -1)
|
||||
return;
|
||||
|
||||
foreach (Door door in _Room.Doorways)
|
||||
{
|
||||
if (door.TravelDirection.ToString() == lstInstalledDoors.SelectedItem.ToString())
|
||||
{
|
||||
_Door = door;
|
||||
propertyDoorway.SelectedObject = _Door;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
Mud Designer/MudEngine/UITypeEditors/UIDoorwayControl.resx
Normal file
120
Mud Designer/MudEngine/UITypeEditors/UIDoorwayControl.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
54
Mud Designer/MudEngine/UITypeEditors/UIDoorwayEditor.cs
Normal file
54
Mud Designer/MudEngine/UITypeEditors/UIDoorwayEditor.cs
Normal file
|
@ -0,0 +1,54 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Drawing.Design;
|
||||
using System.IO;
|
||||
|
||||
using MudDesigner.MudEngine.GameObjects.Environment;
|
||||
using MudDesigner.MudEngine.FileSystem;
|
||||
|
||||
namespace MudDesigner.MudEngine.UITypeEditors
|
||||
{
|
||||
public class UIDoorwayEditor : UITypeEditor
|
||||
{
|
||||
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
|
||||
{
|
||||
Room room = new Room();
|
||||
room = (Room)context.Instance;
|
||||
|
||||
UIDoorwayControl ctl = new UIDoorwayControl(room);
|
||||
ctl.ShowDialog();
|
||||
|
||||
//Load the Zone that this room belongs to.
|
||||
string zonePath = "";
|
||||
|
||||
if (room.Realm == "No Realm Associated.")
|
||||
{
|
||||
zonePath = FileManager.GetDataPath(SaveDataTypes.Zones);
|
||||
}
|
||||
else
|
||||
{
|
||||
zonePath = FileManager.GetDataPath(room.Realm, room.Zone);
|
||||
}
|
||||
|
||||
zonePath = Path.Combine(zonePath, room.Zone);
|
||||
string zoneFile = Path.Combine(zonePath, room.Zone + ".zone");
|
||||
Zone z = new Zone();
|
||||
z = (Zone)z.Load(zoneFile);
|
||||
|
||||
//Get an instance of the current Room Editor so we can refresh it.
|
||||
//it requires the zone it belongs to, to be passed into the constructor
|
||||
UIRoomControl roomEd =(UIRoomControl)Program.CurrentEditor;
|
||||
|
||||
roomEd.RefreshRoomList();
|
||||
|
||||
return room.Doorways;
|
||||
}
|
||||
|
||||
public override System.Drawing.Design.UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context)
|
||||
{
|
||||
return System.Drawing.Design.UITypeEditorEditStyle.Modal;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -157,8 +157,8 @@
|
|||
private System.Windows.Forms.ToolStripButton btnNewRoom;
|
||||
private System.Windows.Forms.ToolStripLabel toolStripLabel1;
|
||||
private System.Windows.Forms.ToolStripTextBox txtFindRoom;
|
||||
private System.Windows.Forms.ListBox lstRooms;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.PropertyGrid propertyRoom;
|
||||
public System.Windows.Forms.ListBox lstRooms;
|
||||
}
|
||||
}
|
|
@ -53,6 +53,8 @@ namespace MudDesigner.MudEngine.UITypeEditors
|
|||
//Project/Realms/RealmName/Zones/ZoneName/Rooms
|
||||
savePath = Path.Combine(savePath, "Rooms");
|
||||
}
|
||||
|
||||
Program.CurrentEditor = this;
|
||||
}
|
||||
|
||||
private bool CheckSavedState()
|
||||
|
@ -89,6 +91,20 @@ namespace MudDesigner.MudEngine.UITypeEditors
|
|||
IsSaved = true;
|
||||
}
|
||||
|
||||
internal void RefreshRoomList()
|
||||
{
|
||||
if (Directory.Exists(savePath))
|
||||
{
|
||||
lstRooms.Items.Clear();
|
||||
string[] files = Directory.GetFiles(savePath);
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
lstRooms.Items.Add(Path.GetFileName(file));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void propertyRoom_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
|
||||
{
|
||||
IsSaved = false;
|
||||
|
@ -143,15 +159,7 @@ namespace MudDesigner.MudEngine.UITypeEditors
|
|||
|
||||
private void UIRoomControl_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (Directory.Exists(savePath))
|
||||
{
|
||||
string[] files = Directory.GetFiles(savePath);
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
lstRooms.Items.Add(Path.GetFileName(file));
|
||||
}
|
||||
}
|
||||
RefreshRoomList();
|
||||
}
|
||||
|
||||
private void lstRooms_MouseDoubleClick(object sender, MouseEventArgs e)
|
||||
|
|
|
@ -16,7 +16,6 @@ namespace MudDesigner.MudEngine.UITypeEditors
|
|||
{
|
||||
Zone obj = (Zone)context.Instance;
|
||||
UIRoomControl ctl;
|
||||
|
||||
ctl = new UIRoomControl(obj);
|
||||
|
||||
ctl.ShowDialog();
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing.Design;
|
||||
|
||||
//MudEngine
|
||||
using MudDesigner.MudEngine;
|
||||
using MudDesigner.MudEngine.FileSystem;
|
||||
|
@ -17,7 +19,8 @@ namespace MudDesigner
|
|||
static class Program
|
||||
{
|
||||
public static Designer Designer{ get; set; }
|
||||
|
||||
internal static Form CurrentEditor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue