private void DrawJrlFile(JrlFile jrlFile, ref JrlFile jrlFileToDelete) { EditorGUILayout.BeginHorizontal(); jrlFile.filename = EditorGUILayout.TextField(jrlFile.filename); if (GUILayout.Button("...", EditorStyles.miniButtonMid, GUILayout.Width(22))) { jrlFile.filename = EditorUtility.OpenFilePanel("Select Jrl.Xml File", lastXmlPath, "xml"); lastXmlPath = EditorWindowTools.GetDirectoryName(jrlFile.filename); GUIUtility.keyboardControl = 0; } if (GUILayout.Button("-", EditorStyles.miniButtonRight, GUILayout.Width(22))) jrlFileToDelete = jrlFile; EditorGUILayout.EndHorizontal(); }
private void ConvertJrl(JrlFile jrlFile, int itemID, DialogueDatabase database) { Jrl jrl = null; try { jrl = Jrl.Load(jrlFile.filename, prefs.Encoding); } catch (System.Exception e) { Debug.LogError(string.Format("{0}: Failed to load {1}. Make sure the file is a valid journal, and check the encoding type. Error: {2}", DialogueDebug.Prefix, jrlFile.filename, e.Message)); } try { if (jrl == null) return; foreach (var jrlStruct in jrl.Categories) { Item item = JrlStructToItem(jrlStruct, itemID++); database.items.Add(item); } } catch (System.Exception e) { Debug.LogError(string.Format("{0}: Failed to convert {1}. Error: {2}", DialogueDebug.Prefix, jrlFile.filename, e.Message)); } }