/// <summary> /// Loads the prefs from XML. /// </summary> /// <returns> /// The prefs. /// </returns> /// <param name='xml'> /// XML. /// </param> public static AuroraConverterPrefs FromXml(string xml) { AuroraConverterPrefs prefs = null; if (!string.IsNullOrEmpty(xml)) { XmlSerializer xmlSerializer = new XmlSerializer(typeof(AuroraConverterPrefs)); prefs = xmlSerializer.Deserialize(new StringReader(xml)) as AuroraConverterPrefs; } if (prefs == null) { prefs = new AuroraConverterPrefs(); prefs.OutputFolder = "Assets"; prefs.DatabaseFilename = "Dialogue Database"; prefs.Overwrite = false; prefs.EncodingType = EncodingType.Default; } prefs.CheckLists(); return(prefs); }
private void LoadConverterProfile() { string filename = EditorUtility.OpenFilePanel("Load Profile XML File", "", "xml"); if (!string.IsNullOrEmpty(filename)) { try { StreamReader xmlFile = new StreamReader(filename, prefs.Encoding); string xmlContents = xmlFile.ReadToEnd(); xmlFile.Close(); AuroraConverterPrefs newPrefs = AuroraConverterPrefs.FromXml(xmlContents); if (newPrefs != null) prefs = newPrefs; } catch (System.Exception) { EditorUtility.DisplayDialog("Invalid Converter Profile", string.Format("{0} is not a valid converter profile.", filename), "OK"); } } }
public void LoadPrefs() { if (prefs == null) prefs = AuroraConverterPrefs.Load(); }
/// <summary> /// Draws the converter window. /// </summary> void OnGUI() { EditorGUIUtility.LookLikeControls(); if (prefs == null) prefs = AuroraConverterPrefs.Load(); scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition); try { EditorStyles.textField.wordWrap = true; DrawActorsSection(); DrawDlgFileSection(); DrawJrlFileSection(); DrawLanguagesSection(); DrawVariablesSection(); DrawProfilesSection(); DrawSaveToSection(); } finally { EditorGUILayout.EndScrollView(); } }
/// <summary> /// Loads the prefs from XML. /// </summary> /// <returns> /// The prefs. /// </returns> /// <param name='xml'> /// XML. /// </param> public static AuroraConverterPrefs FromXml(string xml) { AuroraConverterPrefs prefs = null; if (!string.IsNullOrEmpty(xml)) { XmlSerializer xmlSerializer = new XmlSerializer(typeof(AuroraConverterPrefs)); prefs = xmlSerializer.Deserialize(new StringReader(xml)) as AuroraConverterPrefs; } if (prefs == null) { prefs = new AuroraConverterPrefs(); prefs.OutputFolder = "Assets"; prefs.DatabaseFilename = "Dialogue Database"; prefs.Overwrite = false; //--- Unused: prefs.EnforceUniqueIDs = true; prefs.EncodingType = EncodingType.Default; } prefs.CheckLists(); return prefs; }