public static EditRootLanguageFileWindow ShowWindow()
    {
        EditRootLanguageFileWindow thisWindow = (EditRootLanguageFileWindow)EditorWindow.GetWindow <EditRootLanguageFileWindow>
                                                    ("Edit Root Language File", true, typeof(SmartLocalizationWindow));

        return(thisWindow);
    }
    void TestCreateNewRootKeys()
    {
        // Show root language editor window and get root values
        EditRootLanguageFileWindow           window = EditRootLanguageFileWindow.ShowWindow();
        Dictionary <string, LocalizedObject> dict   = LanguageHandlerEditor.LoadParsedLanguageFile(string.Empty, true);

        // Add any missing TEXT.RSC records
        DaggerfallUnity dfUnity = DaggerfallUnity.Instance;

        if (dfUnity.IsReady)
        {
            TextResourceFile rscFile = new TextResourceFile(dfUnity.Arena2Path, "TEXT.RSC");
            for (int i = 0; i < rscFile.RecordCount; i++)
            {
                TextResourceFile.TextRecord record = rscFile.GetTextRecordByIndex(i);
                string key = RSCNamespacePrefix + record.id.ToString();
                if (!dict.ContainsKey(key))
                {
                    LocalizedObject obj = new LocalizedObject();
                    obj.ObjectType = LocalizedObjectType.STRING;
                    obj.TextValue  = record.text;
                    LanguageDictionaryHelper.AddNewKeyPersistent(dict, key, obj);
                }
            }
        }

        //// Add new root keys and values
        //LocalizedObject obj = new LocalizedObject();
        //obj.ObjectType = LocalizedObjectType.STRING;
        //obj.TextValue = "This is a new text key.";
        //LanguageDictionaryHelper.AddNewKeyPersistent(dict, "NewKey.Test", obj);

        // Set new root values
        window.SetRootValues(dict);
    }
Example #3
0
 private void ShowRootEditWindow(Dictionary <string, LocalizedObject> rootValues)
 {
     if (editRootWindow == null)
     {
         editRootWindow = EditRootLanguageFileWindow.ShowWindow();
         editRootWindow.ShowTab();
     }
     else
     {
         editRootWindow.SetRootValues(rootValues);
         editRootWindow.ShowTab();
     }
 }
	private void ShowRootEditWindow(Dictionary<string,LocalizedObject> rootValues)
	{
		if(editRootWindow == null)
		{
			editRootWindow = EditRootLanguageFileWindow.ShowWindow();
			editRootWindow.ShowTab();
		}
		else
		{
			editRootWindow.SetRootValues(rootValues);
			editRootWindow.ShowTab();
		}
	}