Mud Designer UI:

- Began support work on the networking side of the designer UI. Attempts to connect to the server or run stand-alone.
 - Began implementing object creation.

Mud Engine:
 - Added the [Browsable(false)]  attribute to several Game properties so they are not visible within the new Designer.
This commit is contained in:
Scionwest_cp 2010-11-07 09:05:54 -08:00
parent a347607337
commit f446c754fb
9 changed files with 556 additions and 56 deletions

View file

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?><ItemProperties xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><Properties><Property><Name>svn:ignore</Name><Value>bin
obj
</Value></Property></Properties></ItemProperties>

96
MudDesigner/Client.cs Normal file
View file

@ -0,0 +1,96 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.Sockets;
namespace MudDesigner
{
public class Client
{
public Client()
{
}
~Client()
{
}
public Boolean Initialize(string i, int p)
{
try
{
if (i.Length <= 0)
return false;
ip = i;
if (p <= 0)
return false;
port = p;
sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
}
catch (Exception)
{
return false;
}
return true;
}
public Boolean Connect()
{
try
{
sock.Connect(ip, port);
}
catch (Exception)
{
return false;
}
return true;
}
public Boolean Send(string data,Boolean newLine)
{
try
{
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
if(newLine)
data += "\n";
sock.Send(encoding.GetBytes(data));
}
catch (Exception)
{
return false;
}
return true;
}
public Boolean Receive(out string rs,int size)
{
try
{
byte[] data = new byte[size];
sock.Receive(data);
System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
rs = enc.GetString(data.ToArray());
}
catch (Exception)
{
rs = "";
return false;
}
return true;
}
public Boolean End()
{
try
{
sock.Close();
}
catch (Exception)
{
return false;
}
return true;
}
private string ip;
private int port;
private Socket sock;
}
}

View file

@ -46,6 +46,7 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Client.cs" />
<Compile Include="frmDesigner.cs"> <Compile Include="frmDesigner.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>

View file

@ -28,38 +28,293 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveProjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
this.closeProjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.cutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.pasteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
this.preferencesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.createObjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.environmentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.realmToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.zoneToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.roomToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.txtCommand = new System.Windows.Forms.TextBox();
this.txtConsole = new System.Windows.Forms.RichTextBox();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.propertyGrid1 = new System.Windows.Forms.PropertyGrid(); this.propertyGrid1 = new System.Windows.Forms.PropertyGrid();
this.menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// statusStrip1
//
this.statusStrip1.Location = new System.Drawing.Point(0, 695);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(993, 22);
this.statusStrip1.TabIndex = 1;
this.statusStrip1.Text = "statusStrip1";
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem,
this.editToolStripMenuItem,
this.createObjectToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(993, 24);
this.menuStrip1.TabIndex = 2;
this.menuStrip1.Text = "menuStrip1";
//
// fileToolStripMenuItem
//
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.saveProjectToolStripMenuItem,
this.toolStripMenuItem1,
this.closeProjectToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
this.fileToolStripMenuItem.Text = "File";
//
// saveProjectToolStripMenuItem
//
this.saveProjectToolStripMenuItem.Name = "saveProjectToolStripMenuItem";
this.saveProjectToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this.saveProjectToolStripMenuItem.Text = "Save Project";
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(140, 6);
//
// closeProjectToolStripMenuItem
//
this.closeProjectToolStripMenuItem.Name = "closeProjectToolStripMenuItem";
this.closeProjectToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this.closeProjectToolStripMenuItem.Text = "Close Project";
//
// editToolStripMenuItem
//
this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.cutToolStripMenuItem,
this.copyToolStripMenuItem,
this.pasteToolStripMenuItem,
this.toolStripMenuItem2,
this.preferencesToolStripMenuItem});
this.editToolStripMenuItem.Name = "editToolStripMenuItem";
this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20);
this.editToolStripMenuItem.Text = "Edit";
//
// cutToolStripMenuItem
//
this.cutToolStripMenuItem.Name = "cutToolStripMenuItem";
this.cutToolStripMenuItem.Size = new System.Drawing.Size(135, 22);
this.cutToolStripMenuItem.Text = "Cut";
//
// copyToolStripMenuItem
//
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
this.copyToolStripMenuItem.Size = new System.Drawing.Size(135, 22);
this.copyToolStripMenuItem.Text = "Copy";
//
// pasteToolStripMenuItem
//
this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem";
this.pasteToolStripMenuItem.Size = new System.Drawing.Size(135, 22);
this.pasteToolStripMenuItem.Text = "Paste";
//
// toolStripMenuItem2
//
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(132, 6);
//
// preferencesToolStripMenuItem
//
this.preferencesToolStripMenuItem.Name = "preferencesToolStripMenuItem";
this.preferencesToolStripMenuItem.Size = new System.Drawing.Size(135, 22);
this.preferencesToolStripMenuItem.Text = "Preferences";
//
// createObjectToolStripMenuItem
//
this.createObjectToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.environmentToolStripMenuItem});
this.createObjectToolStripMenuItem.Name = "createObjectToolStripMenuItem";
this.createObjectToolStripMenuItem.Size = new System.Drawing.Size(91, 20);
this.createObjectToolStripMenuItem.Text = "Create Object";
//
// environmentToolStripMenuItem
//
this.environmentToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.realmToolStripMenuItem,
this.zoneToolStripMenuItem,
this.roomToolStripMenuItem});
this.environmentToolStripMenuItem.Name = "environmentToolStripMenuItem";
this.environmentToolStripMenuItem.Size = new System.Drawing.Size(142, 22);
this.environmentToolStripMenuItem.Text = "Environment";
//
// realmToolStripMenuItem
//
this.realmToolStripMenuItem.Name = "realmToolStripMenuItem";
this.realmToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
this.realmToolStripMenuItem.Text = "Realm";
//
// zoneToolStripMenuItem
//
this.zoneToolStripMenuItem.Name = "zoneToolStripMenuItem";
this.zoneToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
this.zoneToolStripMenuItem.Text = "Zone";
//
// roomToolStripMenuItem
//
this.roomToolStripMenuItem.Name = "roomToolStripMenuItem";
this.roomToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
this.roomToolStripMenuItem.Text = "Room";
//
// splitContainer1
//
this.splitContainer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 24);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.txtCommand);
this.splitContainer1.Panel1.Controls.Add(this.txtConsole);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
this.splitContainer1.Size = new System.Drawing.Size(993, 671);
this.splitContainer1.SplitterDistance = 714;
this.splitContainer1.TabIndex = 3;
//
// txtCommand
//
this.txtCommand.Location = new System.Drawing.Point(0, 324);
this.txtCommand.Name = "txtCommand";
this.txtCommand.Size = new System.Drawing.Size(698, 20);
this.txtCommand.TabIndex = 1;
this.txtCommand.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtCommand_KeyDown);
//
// txtConsole
//
this.txtConsole.Location = new System.Drawing.Point(0, 0);
this.txtConsole.Name = "txtConsole";
this.txtConsole.Size = new System.Drawing.Size(698, 318);
this.txtConsole.TabIndex = 0;
this.txtConsole.Text = "";
//
// splitContainer2
//
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
this.splitContainer2.Name = "splitContainer2";
this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.Controls.Add(this.groupBox1);
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add(this.propertyGrid1);
this.splitContainer2.Size = new System.Drawing.Size(273, 669);
this.splitContainer2.SplitterDistance = 213;
this.splitContainer2.TabIndex = 0;
//
// groupBox1
//
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(273, 213);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Project Settings";
//
// propertyGrid1 // propertyGrid1
// //
this.propertyGrid1.Dock = System.Windows.Forms.DockStyle.Right; this.propertyGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
this.propertyGrid1.Location = new System.Drawing.Point(525, 0); this.propertyGrid1.Location = new System.Drawing.Point(0, 0);
this.propertyGrid1.Name = "propertyGrid1"; this.propertyGrid1.Name = "propertyGrid1";
this.propertyGrid1.Size = new System.Drawing.Size(259, 564); this.propertyGrid1.Size = new System.Drawing.Size(273, 452);
this.propertyGrid1.TabIndex = 0; this.propertyGrid1.TabIndex = 4;
this.propertyGrid1.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyGrid1_PropertyValueChanged);
// //
// frmDesigner // frmDesigner
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.ClientSize = new System.Drawing.Size(784, 564); this.ClientSize = new System.Drawing.Size(993, 717);
this.Controls.Add(this.propertyGrid1); this.Controls.Add(this.splitContainer1);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.menuStrip1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MainMenuStrip = this.menuStrip1;
this.MaximizeBox = false; this.MaximizeBox = false;
this.MinimizeBox = false; this.MinimizeBox = false;
this.Name = "frmDesigner"; this.Name = "frmDesigner";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Mud Designer"; this.Text = "Mud Designer";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmDesigner_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmDesigner_FormClosing);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout();
} }
#endregion #endregion
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveProjectToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem closeProjectToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem cutToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem pasteToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2;
private System.Windows.Forms.ToolStripMenuItem preferencesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem createObjectToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem environmentToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem realmToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem zoneToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem roomToolStripMenuItem;
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.SplitContainer splitContainer2;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.PropertyGrid propertyGrid1; private System.Windows.Forms.PropertyGrid propertyGrid1;
private System.Windows.Forms.TextBox txtCommand;
private System.Windows.Forms.RichTextBox txtConsole;
} }
} }

View file

@ -7,6 +7,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.IO; using System.IO;
using System.Threading;
using MudEngine.GameManagement; using MudEngine.GameManagement;
using MudEngine.FileSystem; using MudEngine.FileSystem;
@ -16,18 +17,27 @@ namespace MudDesigner
public partial class frmDesigner : Form public partial class frmDesigner : Form
{ {
private Game _Game; private Game _Game;
private Client _Client;
private Thread _ClientThread;
private Boolean _IsRenaming; private Boolean _IsRenaming;
private String _OldName; private String _OldName;
public frmDesigner(Game game) private Boolean _TimeOut;
private Object _SelectedObject;
public frmDesigner(Game game, Client client)
{ {
InitializeComponent(); InitializeComponent();
_Game = game; _Game = game;
_Client = client;
MudEngine.GameObjects.Environment.Room r = new MudEngine.GameObjects.Environment.Room(_Game); MudEngine.GameObjects.Environment.Room r = new MudEngine.GameObjects.Environment.Room(_Game);
this.propertyGrid1.SelectedObject = _Game; this.propertyGrid1.SelectedObject = _Game;
_TimeOut = false;
_Client.Send("Hello world", false);
} }
/// <summary> /// <summary>
@ -73,5 +83,58 @@ namespace MudDesigner
_OldName = e.OldValue.ToString(); _OldName = e.OldValue.ToString();
} }
} }
private void ChangeObject(Object obj)
{
_SelectedObject = obj;
propertyGrid1.SelectedObject = obj;
}
private void btnNewRealm_Click(object sender, EventArgs e)
{
ChangeObject(new MudEngine.GameObjects.Environment.Realm(_Game));
}
private void button1_Click(object sender, EventArgs e)
{
ChangeObject(new MudEngine.GameObjects.Environment.Zone(_Game));
}
private void txtCommand_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
_Client.Send(txtCommand.Text, true);
System.Windows.Forms.Timer t = new System.Windows.Forms.Timer();
t.Interval = 10000;
t.Tick += new EventHandler(timerTick);
_TimeOut = false;
String result;
while (!_TimeOut)
{
if (_Client.Receive(out result, 1))
{
txtConsole.Text += result;
}
else
_TimeOut = true;
}
txtConsole.Text += "\n";
}
}
void timerTick(object sender, EventArgs e)
{
_TimeOut = true;
}
void UpdateConsole(String message)
{
txtConsole.Text += message;
}
} }
} }

View file

@ -117,4 +117,10 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>133, 17</value>
</metadata>
</root> </root>

View file

@ -34,9 +34,6 @@
this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.lstProjects = new System.Windows.Forms.ListBox(); this.lstProjects = new System.Windows.Forms.ListBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.btnClose = new System.Windows.Forms.Button();
this.btnNewProject = new System.Windows.Forms.Button();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.launchServerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.launchServerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
@ -44,6 +41,11 @@
this.renameProjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.renameProjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
this.deleteProjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.deleteProjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.btnClose = new System.Windows.Forms.Button();
this.btnNewProject = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.comServerType = new System.Windows.Forms.ComboBox();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout();
@ -53,8 +55,9 @@
this.splitContainer2.Panel2.SuspendLayout(); this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout(); this.splitContainer2.SuspendLayout();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.contextMenuStrip1.SuspendLayout(); this.contextMenuStrip1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// splitContainer1 // splitContainer1
@ -71,8 +74,8 @@
// splitContainer1.Panel2 // splitContainer1.Panel2
// //
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2); this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
this.splitContainer1.Size = new System.Drawing.Size(624, 444); this.splitContainer1.Size = new System.Drawing.Size(624, 461);
this.splitContainer1.SplitterDistance = 169; this.splitContainer1.SplitterDistance = 175;
this.splitContainer1.TabIndex = 0; this.splitContainer1.TabIndex = 0;
// //
// button1 // button1
@ -88,7 +91,7 @@
this.button1.ForeColor = System.Drawing.Color.White; this.button1.ForeColor = System.Drawing.Color.White;
this.button1.Location = new System.Drawing.Point(0, 0); this.button1.Location = new System.Drawing.Point(0, 0);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(624, 169); this.button1.Size = new System.Drawing.Size(624, 175);
this.button1.TabIndex = 0; this.button1.TabIndex = 0;
this.button1.Text = "Mud Designer\r\nAlpha 1"; this.button1.Text = "Mud Designer\r\nAlpha 1";
this.button1.UseVisualStyleBackColor = false; this.button1.UseVisualStyleBackColor = false;
@ -107,8 +110,8 @@
// splitContainer2.Panel2 // splitContainer2.Panel2
// //
this.splitContainer2.Panel2.Controls.Add(this.groupBox2); this.splitContainer2.Panel2.Controls.Add(this.groupBox2);
this.splitContainer2.Size = new System.Drawing.Size(624, 271); this.splitContainer2.Size = new System.Drawing.Size(624, 282);
this.splitContainer2.SplitterDistance = 216; this.splitContainer2.SplitterDistance = 224;
this.splitContainer2.TabIndex = 0; this.splitContainer2.TabIndex = 0;
// //
// groupBox1 // groupBox1
@ -117,7 +120,7 @@
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill; this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox1.Location = new System.Drawing.Point(0, 0); this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(624, 216); this.groupBox1.Size = new System.Drawing.Size(624, 224);
this.groupBox1.TabIndex = 1; this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "Available Projects"; this.groupBox1.Text = "Available Projects";
@ -130,43 +133,9 @@
this.lstProjects.FormattingEnabled = true; this.lstProjects.FormattingEnabled = true;
this.lstProjects.Location = new System.Drawing.Point(3, 16); this.lstProjects.Location = new System.Drawing.Point(3, 16);
this.lstProjects.Name = "lstProjects"; this.lstProjects.Name = "lstProjects";
this.lstProjects.Size = new System.Drawing.Size(618, 197); this.lstProjects.Size = new System.Drawing.Size(618, 205);
this.lstProjects.TabIndex = 0; this.lstProjects.TabIndex = 0;
// //
// groupBox2
//
this.groupBox2.Controls.Add(this.btnClose);
this.groupBox2.Controls.Add(this.btnNewProject);
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox2.Location = new System.Drawing.Point(0, 0);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(624, 51);
this.groupBox2.TabIndex = 0;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Options";
//
// btnClose
//
this.btnClose.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnClose.Location = new System.Drawing.Point(509, 16);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(109, 32);
this.btnClose.TabIndex = 2;
this.btnClose.Text = "Close";
this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// btnNewProject
//
this.btnNewProject.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnNewProject.Location = new System.Drawing.Point(6, 16);
this.btnNewProject.Name = "btnNewProject";
this.btnNewProject.Size = new System.Drawing.Size(109, 32);
this.btnNewProject.TabIndex = 0;
this.btnNewProject.Text = "New Project";
this.btnNewProject.UseVisualStyleBackColor = true;
this.btnNewProject.Click += new System.EventHandler(this.btnNewProject_Click);
//
// contextMenuStrip1 // contextMenuStrip1
// //
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -214,12 +183,68 @@
this.deleteProjectToolStripMenuItem.Size = new System.Drawing.Size(157, 22); this.deleteProjectToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
this.deleteProjectToolStripMenuItem.Text = "Delete Project"; this.deleteProjectToolStripMenuItem.Text = "Delete Project";
// //
// groupBox2
//
this.groupBox2.Controls.Add(this.groupBox3);
this.groupBox2.Controls.Add(this.btnClose);
this.groupBox2.Controls.Add(this.btnNewProject);
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox2.Location = new System.Drawing.Point(0, 0);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(624, 54);
this.groupBox2.TabIndex = 0;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Options";
//
// btnClose
//
this.btnClose.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnClose.Location = new System.Drawing.Point(509, 16);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(109, 32);
this.btnClose.TabIndex = 2;
this.btnClose.Text = "Close";
this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// btnNewProject
//
this.btnNewProject.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnNewProject.Location = new System.Drawing.Point(6, 16);
this.btnNewProject.Name = "btnNewProject";
this.btnNewProject.Size = new System.Drawing.Size(109, 32);
this.btnNewProject.TabIndex = 0;
this.btnNewProject.Text = "New Project";
this.btnNewProject.UseVisualStyleBackColor = true;
this.btnNewProject.Click += new System.EventHandler(this.btnNewProject_Click);
//
// groupBox3
//
this.groupBox3.Controls.Add(this.comServerType);
this.groupBox3.Location = new System.Drawing.Point(121, 10);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(195, 41);
this.groupBox3.TabIndex = 3;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Server Type";
//
// comServerType
//
this.comServerType.Dock = System.Windows.Forms.DockStyle.Fill;
this.comServerType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comServerType.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.comServerType.FormattingEnabled = true;
this.comServerType.Location = new System.Drawing.Point(3, 16);
this.comServerType.Name = "comServerType";
this.comServerType.Size = new System.Drawing.Size(189, 21);
this.comServerType.TabIndex = 0;
//
// frmProjectManager // frmProjectManager
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.ClientSize = new System.Drawing.Size(624, 444); this.ClientSize = new System.Drawing.Size(624, 461);
this.Controls.Add(this.splitContainer1); this.Controls.Add(this.splitContainer1);
this.ForeColor = System.Drawing.Color.Silver; this.ForeColor = System.Drawing.Color.Silver;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
@ -237,8 +262,9 @@
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false); this.splitContainer2.ResumeLayout(false);
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.contextMenuStrip1.ResumeLayout(false); this.contextMenuStrip1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -260,6 +286,8 @@
private System.Windows.Forms.ToolStripMenuItem renameProjectToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem renameProjectToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2; private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2;
private System.Windows.Forms.ToolStripMenuItem deleteProjectToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem deleteProjectToolStripMenuItem;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.ComboBox comServerType;
} }
} }

View file

@ -7,6 +7,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.IO; using System.IO;
using System.Threading;
using MudEngine.FileSystem; using MudEngine.FileSystem;
using MudEngine.GameManagement; using MudEngine.GameManagement;
@ -23,6 +24,8 @@ namespace MudDesigner
dynamic _Game; dynamic _Game;
ScriptEngine _ScriptEngine; ScriptEngine _ScriptEngine;
Client client;
Thread r;
public frmProjectManager() public frmProjectManager()
{ {
@ -64,6 +67,18 @@ namespace MudDesigner
//TODO: Do I need to Re-initialize _ScriptEngine? //TODO: Do I need to Re-initialize _ScriptEngine?
RefreshProjects();
client = new Client();
client.Initialize("localhost", 555);
comServerType.Items.Add("Local Server");
comServerType.Items.Add("Test Server");
comServerType.SelectedIndex = 0;
}
private void RefreshProjects()
{
_ProjectFiles = Directory.GetFiles(Environment.CurrentDirectory, "*.ini"); _ProjectFiles = Directory.GetFiles(Environment.CurrentDirectory, "*.ini");
foreach (String filename in _ProjectFiles) foreach (String filename in _ProjectFiles)
@ -102,15 +117,42 @@ namespace MudDesigner
private void ShowDesigner() private void ShowDesigner()
{ {
frmDesigner form = new frmDesigner(_Game); frmDesigner form = new frmDesigner(_Game, client);
form.Show(); form.Show();
this.Hide(); this.Hide();
if (comServerType.SelectedItem.ToString() == "Test Server")
{
}
else
{
frmInputBox input = new frmInputBox("Enter the Port that your local server is currently running on.");
input.ShowDialog();
if (input.IsCancel)
return;
client.Initialize("localhost", Convert.ToInt32(input.Input));
if (!client.Connect() || !client.Send("hello", false)) // test send + client data
{
MessageBox.Show("Failed to connect to a local server. Is the server running?", "Mud Designer");
return;
}
}
while (form.Visible) while (form.Visible)
{ {
Application.DoEvents(); Application.DoEvents();
} }
//Refresh the project list incase the project was renamed.
lstProjects.Items.Clear();
RefreshProjects();
this.Show(); this.Show();
form = null; form = null;
} }

View file

@ -50,11 +50,13 @@ namespace MudEngine.GameManagement
/// <summary> /// <summary>
/// Gets or Sets the paths to various project related objects. /// Gets or Sets the paths to various project related objects.
/// </summary> /// </summary>
[Browsable(false)]
public SaveDataPaths DataPaths { get; set; } public SaveDataPaths DataPaths { get; set; }
/// <summary> /// <summary>
/// Gets the scripting engine used by the game. /// Gets the scripting engine used by the game.
/// </summary> /// </summary>
[Browsable(false)]
public ScriptEngine scriptEngine { get; internal set; } public ScriptEngine scriptEngine { get; internal set; }
/// <summary> /// <summary>
@ -68,6 +70,7 @@ namespace MudEngine.GameManagement
/// </summary> /// </summary>
[Category("Project Settings")] [Category("Project Settings")]
[Description("If enabled, all objects will be loaded during server startup resulting in a slower server start time, but faster load time during gameplay")] [Description("If enabled, all objects will be loaded during server startup resulting in a slower server start time, but faster load time during gameplay")]
[Browsable(false)]
public Boolean PreCacheObjects { get; set; } public Boolean PreCacheObjects { get; set; }
/// <summary> /// <summary>
@ -154,8 +157,10 @@ namespace MudEngine.GameManagement
[DefaultValue("Copper")] [DefaultValue("Copper")]
public String BaseCurrencyName { get; set; } public String BaseCurrencyName { get; set; }
[Browsable(false)]
public GameTime WorldTime { get; set; } public GameTime WorldTime { get; set; }
[Browsable(false)]
public GameWorld World { get; set; } public GameWorld World { get; set; }
#endregion #endregion
@ -168,6 +173,7 @@ namespace MudEngine.GameManagement
/// <summary> /// <summary>
/// Gets the current running Server object. /// Gets the current running Server object.
/// </summary> /// </summary>
[Browsable(false)]
public Server Server { get; internal set; } public Server Server { get; internal set; }
/// <summary> /// <summary>