internal static void AddEntityToolStripClick()
{
// search: addentity, add entity
if (ProjectManager.GlueProjectSave == null)
{
System.Windows.Forms.MessageBox.Show("You need to load a project first.");
}
else
{
if (ProjectManager.StatusCheck() == ProjectManager.CheckResult.Passed)
{
TextInputWindow tiw = new TextInputWindow();
tiw.DisplayText = "Enter a name for the new Entity";
tiw.Text = "New Entity";
CheckBox is2DCheckBox = new CheckBox();
is2DCheckBox.Text = "Is 2D";
is2DCheckBox.Checked = true;
is2DCheckBox.Margin = new Padding(2, 0, 0, 0);
tiw.AddControl(is2DCheckBox);
if (tiw.ShowDialog(MainGlueWindow.Self) == DialogResult.OK)
{
string entityName = tiw.Result;
string whyIsntValid;
string directory = "";
if (EditorLogic.CurrentTreeNode.IsDirectoryNode())
{
directory = EditorLogic.CurrentTreeNode.GetRelativePath();
directory = directory.Replace('/', '\\');
}
if (!NameVerifier.IsEntityNameValid(tiw.Result, null, out whyIsntValid))
{
MessageBox.Show(whyIsntValid);
}
else
{
var newElement =
GlueCommands.Self.GluxCommands.EntityCommands.AddEntity(directory + tiw.Result, is2DCheckBox.Checked);
GlueState.Self.CurrentElement = newElement;
}
}
}
}
}