- Added a new designer that I will begin working on and testing UITypeEditors with. Future plan is to migrate all editors into a single editor relying heavily on UITypeEditors to flesh it out. - Selecting the Script property within the Designer.cs form executes the UIScriptEditor class and installs the UIScriptControl into the Designers control collection. - Clicking close on the Designer.cs GUI showcases clearing the controls of custom UITypeEditors and how the results of the editing is saved into the object that the PropertyGrid is editing. Mud Engine: - Added a UIScriptControl User Control that the UIScriptEditor TypeEditor uses to install directly into the new Test Designer.
179 lines
5 KiB
C#
179 lines
5 KiB
C#
using System.IO;
|
|
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 MudDesigner.MudEngine.GameObjects.Environment;
|
|
using MudDesigner.MudEngine.FileSystem;
|
|
|
|
namespace MudDesigner.Editors
|
|
{
|
|
public partial class ToolkitLauncher : Form
|
|
{
|
|
bool IsStartup = true;
|
|
|
|
public ToolkitLauncher()
|
|
{
|
|
InitializeComponent();
|
|
this.Text = "Mud Designer Toolkit " + Program.Settings.GetVersion();
|
|
|
|
if (Program.Settings.DefaultRealm != null)
|
|
{
|
|
lblCurrentRealm.Text = "Current Realm: " + Program.Settings.DefaultRealm.Name;
|
|
chkDefaultRealm.Checked = true;
|
|
}
|
|
|
|
//done starting up. This prevents checkbox change events from firing during startup
|
|
IsStartup = false;
|
|
}
|
|
|
|
private void btnProjectSettings_Click(object sender, EventArgs e)
|
|
{
|
|
ProjectSettings form = new ProjectSettings();
|
|
Program.CurrentEditor = form;
|
|
|
|
form.Show();
|
|
this.Hide();
|
|
while (form.Created)
|
|
Application.DoEvents();
|
|
|
|
form = null;
|
|
|
|
this.Show();
|
|
}
|
|
|
|
private void btnCurrencyEditor_Click(object sender, EventArgs e)
|
|
{
|
|
CurrencyEditor form = new CurrencyEditor();
|
|
Program.CurrentEditor = form;
|
|
|
|
form.Show();
|
|
this.Hide();
|
|
while (form.Created)
|
|
Application.DoEvents();
|
|
|
|
form = null;
|
|
|
|
this.Show();
|
|
}
|
|
|
|
private void btnRealmExplorer_Click(object sender, EventArgs e)
|
|
{
|
|
RealmExplorer form = new RealmExplorer();
|
|
Program.CurrentEditor = form;
|
|
|
|
form.Show();
|
|
this.Hide();
|
|
while (form.Created)
|
|
Application.DoEvents();
|
|
|
|
form = null;
|
|
|
|
this.Show();
|
|
}
|
|
|
|
private void btnZoneBuilder_Click(object sender, EventArgs e)
|
|
{
|
|
ZoneBuilder form = new ZoneBuilder();
|
|
Program.CurrentEditor = form;
|
|
|
|
form.Show();
|
|
this.Hide();
|
|
while (form.Created)
|
|
Application.DoEvents();
|
|
|
|
form = null;
|
|
|
|
this.Show();
|
|
}
|
|
|
|
private void chkDefaultRealm_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (IsStartup)
|
|
return;
|
|
|
|
if (!chkDefaultRealm.Checked)
|
|
{
|
|
Program.Settings.DefaultRealm = null;
|
|
lblCurrentRealm.Text = "Current Realm: None";
|
|
SaveSettings();
|
|
}
|
|
else
|
|
{
|
|
Realm realm = GetRealm();
|
|
if (realm != null)
|
|
{
|
|
Program.Settings.DefaultRealm = realm;
|
|
SaveSettings();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void btnChangeRealm_Click(object sender, EventArgs e)
|
|
{
|
|
Realm realm = GetRealm();
|
|
if (realm != null)
|
|
{
|
|
Program.Settings.DefaultRealm = realm;
|
|
SaveSettings();
|
|
}
|
|
}
|
|
|
|
public Realm GetRealm()
|
|
{
|
|
ExistingRealms form = new ExistingRealms();
|
|
form.Show();
|
|
this.Hide();
|
|
|
|
while (form.Created)
|
|
Application.DoEvents();
|
|
|
|
this.Show();
|
|
|
|
Realm realm = new Realm();
|
|
string[] files = Directory.GetFiles(FileManager.GetDataPath(SaveDataTypes.Realms), "*.realm", SearchOption.AllDirectories);
|
|
foreach (string file in files)
|
|
{
|
|
realm = (Realm)FileManager.Load(file, realm);
|
|
if (realm.Name == form.lstRealms.SelectedItem.ToString())
|
|
{
|
|
Program.Settings.DefaultRealm = realm;
|
|
lblCurrentRealm.Text = "Current Realm: " + realm.Name;
|
|
return realm;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
public void SaveSettings()
|
|
{
|
|
string savePath = Path.Combine(Application.StartupPath, "Toolkit.xml");
|
|
FileManager.Save(savePath, Program.Settings);
|
|
}
|
|
|
|
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|
{
|
|
System.Diagnostics.Process.Start("http://muddesigner.dailyforum.net");
|
|
}
|
|
|
|
private void btnTest_Click(object sender, EventArgs e)
|
|
{
|
|
Designer form = new Designer();
|
|
Program.CurrentEditor = form;
|
|
|
|
form.Show();
|
|
this.Hide();
|
|
while (form.Created)
|
|
Application.DoEvents();
|
|
|
|
form = null;
|
|
|
|
this.Show();
|
|
}
|
|
}
|
|
}
|