diff --git a/Editor/AGS.Editor/AGSEditor.cs b/Editor/AGS.Editor/AGSEditor.cs
index 576a123039c..9f34a34c471 100644
--- a/Editor/AGS.Editor/AGSEditor.cs
+++ b/Editor/AGS.Editor/AGSEditor.cs
@@ -177,6 +177,7 @@ public class AGSEditor : IAGSEditorDirectories
public const int AGS_4_0_0_XML_VERSION_INDEX_PO_TRANSLATIONS = 3999907;
public const int AGS_4_0_0_XML_VERSION_INDEX_COLORS_32BIT = 4000009;
public const int AGS_4_0_0_XML_VERSION_INDEX_FONT_SOURCES = 4000010;
+ public const int AGS_4_0_0_XML_VERSION_INDEX_DIALOG_FILES = 4000027;
/*
* LATEST_XML_VERSION is the X.Y.Z.W string which defines project's user data format.
diff --git a/Editor/AGS.Editor/AGSEditor.csproj b/Editor/AGS.Editor/AGSEditor.csproj
index e544aaecf3d..5f8b71edd56 100644
--- a/Editor/AGS.Editor/AGSEditor.csproj
+++ b/Editor/AGS.Editor/AGSEditor.csproj
@@ -180,6 +180,7 @@
+
diff --git a/Editor/AGS.Editor/Components/DialogsComponent.cs b/Editor/AGS.Editor/Components/DialogsComponent.cs
index 0efdb6843fa..e6a86ae2503 100644
--- a/Editor/AGS.Editor/Components/DialogsComponent.cs
+++ b/Editor/AGS.Editor/Components/DialogsComponent.cs
@@ -1,12 +1,13 @@
+using AGS.Editor.TextProcessing;
+using AGS.Types;
using System;
using System.Collections.Generic;
using System.Drawing;
+using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
-using AGS.Types;
-using AGS.Editor.TextProcessing;
namespace AGS.Editor.Components
{
@@ -32,7 +33,8 @@ public DialogsComponent(GUIController guiController, AGSEditor agsEditor)
_guiController.ProjectTree.AddTreeRoot(this, TOP_LEVEL_COMMAND_ID, "Dialogs", ICON_KEY);
_guiController.OnZoomToFile += GUIController_OnZoomToFile;
_guiController.OnGetScriptEditorControl += _guiController_OnGetScriptEditorControl;
- RePopulateTreeView();
+ Factory.Events.GamePrepareUpgrade += Events_GamePrepareUpgrade;
+ RePopulateTreeView();
}
private void _guiController_OnGetScriptEditorControl(GetScriptEditorControlEventArgs evArgs)
@@ -55,9 +57,9 @@ protected override void ItemCommandClick(string controlID)
{
if (controlID == COMMAND_NEW_ITEM)
{
- Dialog newItem = new Dialog();
+ string name = _agsEditor.GetFirstAvailableScriptName("dDialog");
+ Dialog newItem = new Dialog(name);
newItem.ID = _agsEditor.CurrentGame.RootDialogFolder.GetAllItemsCount();
- newItem.Name = _agsEditor.GetFirstAvailableScriptName("dDialog");
string newNodeID = AddSingleItem(newItem);
_guiController.ProjectTree.SelectNode(this, newNodeID);
ShowPaneForDialog(newItem);
@@ -413,5 +415,74 @@ protected override IList