コード例 #1
0
        /// <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);
        }
コード例 #2
0
 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");
         }
     }
 }
コード例 #3
0
 public void LoadPrefs()
 {
     if (prefs == null) prefs = AuroraConverterPrefs.Load();
 }
コード例 #4
0
 /// <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();
     }
 }
コード例 #5
0
 /// <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;
 }