Exemplo n.º 1
0
        public static ConverterPrefs Load()
        {
            var converterPrefs = new ConverterPrefs();

            converterPrefs.ProjectFilename             = EditorPrefs.GetString(ArticyProjectFilenameKey);
            converterPrefs.PortraitFolder              = EditorPrefs.GetString(ArticyPortraitFolderKey);
            converterPrefs.StageDirectionsAreSequences = EditorPrefs.HasKey(ArticyStageDirectionsAreSequencesKey) ? EditorPrefs.GetBool(ArticyStageDirectionsAreSequencesKey) : true;
            converterPrefs.FlowFragmentMode            = (ConverterPrefs.FlowFragmentModes)(EditorPrefs.HasKey(ArticyFlowFragmentModeKey) ? EditorPrefs.GetInt(ArticyFlowFragmentModeKey) : 0);
            converterPrefs.DocumentsSubmenu            = EditorPrefs.GetString(ArticyDocumentsSubmenuKey);
            converterPrefs.TextTableDocument           = EditorPrefs.GetString(ArticyTextTableDocumentKey);
            converterPrefs.OutputFolder       = EditorPrefs.GetString(ArticyOutputFolderKey, "Assets");
            converterPrefs.Overwrite          = EditorPrefs.GetBool(ArticyOverwriteKey, false);
            converterPrefs.ConversionSettings = ConversionSettings.FromXml(EditorPrefs.GetString(ArticyConversionSettingsKey));
            converterPrefs.EncodingType       = EditorPrefs.HasKey(ArticyEncodingKey) ? (EncodingType)EditorPrefs.GetInt(ArticyEncodingKey) : EncodingType.Default;
            converterPrefs.RecursionMode      = EditorPrefs.HasKey(ArticyRecursionKey) ? (ConverterPrefs.RecursionModes)EditorPrefs.GetInt(ArticyRecursionKey) : ConverterPrefs.RecursionModes.On;
            converterPrefs.ConvertDropdownsAs = EditorPrefs.HasKey(ArticyDropdownsKey) ? (ConverterPrefs.ConvertDropdownsModes)EditorPrefs.GetInt(ArticyDropdownsKey) : ConverterPrefs.ConvertDropdownsModes.Ints;
            converterPrefs.ConvertSlotsAs     = EditorPrefs.HasKey(ArticySlotsKey) ? (ConverterPrefs.ConvertSlotsModes)EditorPrefs.GetInt(ArticySlotsKey) : ConverterPrefs.ConvertSlotsModes.DisplayName;
            converterPrefs.UseTechnicalNames  = EditorPrefs.GetBool(ArticyUseTechnicalNamesKey, false);
            converterPrefs.DirectConversationLinksToEntry1 = EditorPrefs.GetBool(ArticyDirectConversationLinksToEntry1Key, false);
            converterPrefs.ConvertMarkupToRichText         = EditorPrefs.GetBool(ArticyConvertMarkupToRichTextKey, false);
            converterPrefs.FlowFragmentScript = EditorPrefs.GetString(ArticyFlowFragmentScriptKey, ConverterPrefs.DefaultFlowFragmentScript);
            converterPrefs.VoiceOverProperty  = EditorPrefs.GetString(ArticyVoiceOverPropertyKey, ConverterPrefs.DefaultVoiceOverProperty);
            converterPrefs.LocalizationXlsx   = EditorPrefs.GetString(ArticyLocalizationXlsKey);
            converterPrefs.emVarSet           = ArticyEmVarSetFromXML(EditorPrefs.GetString(ArticyEmVarsKey));
            return(converterPrefs);
        }
 void OnEnable()
 {
     instance = this;
     minSize  = new Vector2(320, 128);
     template = TemplateTools.LoadFromEditorPrefs();
     prefs    = ConverterPrefsTools.Load();
 }
 public static void Save(ConverterPrefs converterPrefs)
 {
     EditorPrefs.SetString(ArticyProjectFilenameKey, converterPrefs.ProjectFilename);
     EditorPrefs.SetString(ArticyPortraitFolderKey, converterPrefs.PortraitFolder);
     EditorPrefs.SetBool(ArticyStageDirectionsAreSequencesKey, converterPrefs.StageDirectionsAreSequences);
     EditorPrefs.SetBool(ArticyUseDefaultActorsIfNoneKey, converterPrefs.UseDefaultActorsIfNoneAssignedToDialogue);
     EditorPrefs.SetInt(ArticyFlowFragmentModeKey, (int)converterPrefs.FlowFragmentMode);
     EditorPrefs.SetString(ArticyOtherScriptFieldsKey, converterPrefs.OtherScriptFields);
     EditorPrefs.SetString(ArticyDocumentsSubmenuKey, converterPrefs.DocumentsSubmenu);
     EditorPrefs.SetString(ArticyTextTableDocumentKey, converterPrefs.TextTableDocument);
     EditorPrefs.SetString(ArticyOutputFolderKey, converterPrefs.OutputFolder);
     EditorPrefs.SetBool(ArticyOverwriteKey, converterPrefs.Overwrite);
     EditorPrefs.SetString(ArticyConversionSettingsKey, converterPrefs.ConversionSettings.ToXml());
     EditorPrefs.SetInt(ArticyEncodingKey, (int)converterPrefs.EncodingType);
     EditorPrefs.SetInt(ArticyRecursionKey, (int)converterPrefs.RecursionMode);
     EditorPrefs.SetInt(ArticyDropdownsKey, (int)converterPrefs.ConvertDropdownsAs);
     EditorPrefs.SetInt(ArticySlotsKey, (int)converterPrefs.ConvertSlotsAs);
     EditorPrefs.SetBool(ArticyUseTechnicalNamesKey, converterPrefs.UseTechnicalNames);
     EditorPrefs.SetBool(ArticyDirectConversationLinksToEntry1Key, converterPrefs.DirectConversationLinksToEntry1);
     EditorPrefs.SetBool(ArticyConvertMarkupToRichTextKey, converterPrefs.ConvertMarkupToRichText);
     EditorPrefs.SetBool(ArticySplitTextOnPipesKey, converterPrefs.SplitTextOnPipes);
     EditorPrefs.SetString(ArticyFlowFragmentScriptKey, converterPrefs.FlowFragmentScript);
     EditorPrefs.SetString(ArticyVoiceOverPropertyKey, converterPrefs.VoiceOverProperty);
     EditorPrefs.SetString(ArticyLocalizationXlsKey, converterPrefs.LocalizationXlsx);
     EditorPrefs.SetString(ArticyEmVarsKey, ArticyEmVarSetToXML(converterPrefs.emVarSet));
 }
Exemplo n.º 4
0
 private void ClearArticyProject()
 {
     articyData = null;
     prefs.ConversionSettings.Clear();
     ConverterPrefsTools.DeleteEditorPrefs();
     prefs = new ConverterPrefs();
 }
Exemplo n.º 5
0
 /// <summary>
 /// Convert the ArticyData, using the preferences in Prefs, into a dialogue database.
 /// </summary>
 /// <param name='articyData'>
 /// Articy data.
 /// </param>
 /// <param name='prefs'>
 /// Prefs.
 /// </param>
 /// <param name='database'>
 /// Dialogue database.
 /// </param>
 public void Convert(ArticyData articyData, ConverterPrefs prefs, DialogueDatabase database)
 {
     if (articyData != null)
     {
         Setup(articyData, prefs, database);
         ConvertProjectAttributes();
         ConvertEntities();
         ConvertLocations();
         ConvertFlowFragments();
         ConvertVariables();
         ConvertDialogues();
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// Convert the ArticyData, using the preferences in Prefs, into a dialogue database.
 /// </summary>
 /// <param name='articyData'>
 /// Articy data.
 /// </param>
 /// <param name='prefs'>
 /// Prefs.
 /// </param>
 /// <param name='database'>
 /// Dialogue database.
 /// </param>
 public void Convert(ArticyData articyData, ConverterPrefs prefs, DialogueDatabase database)
 {
     if (articyData != null) {
         Setup(articyData, prefs, database);
         ConvertProjectAttributes();
         ConvertEntities();
         ConvertLocations();
         if (prefs.FlowFragmentMode == ConverterPrefs.FlowFragmentModes.Quests) {
             ConvertFlowFragmentsToQuests();
         }
         ConvertVariables();
         ConvertDialogues();
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// Sets up the conversion process.
 /// </summary>
 /// <param name='articyData'>
 /// Articy data.
 /// </param>
 /// <param name='prefs'>
 /// Prefs.
 /// </param>
 /// <param name='database'>
 /// Dialogue database.
 /// </param>
 private void Setup(ArticyData articyData, ConverterPrefs prefs, DialogueDatabase database)
 {
     this.articyData        = articyData;
     this.prefs             = prefs;
     this.database          = database;
     database.actors        = new List <Actor>();
     database.items         = new List <Item>();
     database.locations     = new List <Location>();
     database.variables     = new List <Variable>();
     database.conversations = new List <Conversation>();
     conversationID         = 0;
     actorID    = 0;
     itemID     = 0;
     locationID = 0;
     fullVariableNames.Clear();
     template = Template.FromEditorPrefs();
 }
Exemplo n.º 8
0
 public static void Save(ConverterPrefs converterPrefs)
 {
     EditorPrefs.SetString(ArticyProjectFilenameKey, converterPrefs.ProjectFilename);
     EditorPrefs.SetString(ArticyPortraitFolderKey, converterPrefs.PortraitFolder);
     EditorPrefs.SetBool(ArticyStageDirectionsAreSequencesKey, converterPrefs.StageDirectionsAreSequences);
     EditorPrefs.SetInt(ArticyFlowFragmentModeKey, (int)converterPrefs.FlowFragmentMode);
     EditorPrefs.SetString(ArticyOutputFolderKey, converterPrefs.OutputFolder);
     EditorPrefs.SetBool(ArticyOverwriteKey, converterPrefs.Overwrite);
     EditorPrefs.SetString(ArticyConversionSettingsKey, converterPrefs.ConversionSettings.ToXml());
     EditorPrefs.SetInt(ArticyEncodingKey, (int)converterPrefs.EncodingType);
     EditorPrefs.SetInt(ArticyRecursionKey, (int)converterPrefs.RecursionMode);
     EditorPrefs.SetInt(ArticyDropdownsKey, (int)converterPrefs.ConvertDropdownsAs);
     EditorPrefs.SetInt(ArticySlotsKey, (int)converterPrefs.ConvertSlotsAs);
     EditorPrefs.SetBool(ArticyDirectConversationLinksToEntry1, converterPrefs.DirectConversationLinksToEntry1);
     EditorPrefs.SetBool(ArticyConvertMarkupToRichText, converterPrefs.ConvertMarkupToRichText);
     EditorPrefs.SetString(ArticyFlowFragmentScriptKey, converterPrefs.FlowFragmentScript);
     EditorPrefs.SetString(ArticyVoiceOverPropertyKey, converterPrefs.VoiceOverProperty);
     EditorPrefs.SetString(ArticyLocalizationXlsKey, converterPrefs.LocalizationXlsx);
     EditorPrefs.SetString(ArticyEmVarsKey, ArticyEmVarSetToXML(converterPrefs.emVarSet));
 }
Exemplo n.º 9
0
 public static ArticyData LoadArticyDataFromXmlData(string xmlData, ConverterPrefs prefs)
 {
     if (Articy_3_1.Articy_3_1_Tools.IsSchema(xmlData))
     {
         return(Articy_3_1.Articy_3_1_Tools.LoadArticyDataFromXmlData(xmlData, prefs.Encoding, prefs.ConvertDropdownsAsString, prefs));
     }
     else if (Articy_2_4.Articy_2_4_Tools.IsSchema(xmlData))
     {
         return(Articy_2_4.Articy_2_4_Tools.LoadArticyDataFromXmlData(xmlData, prefs.Encoding, prefs.ConvertDropdownsAsString, prefs));
     }
     else if (Articy_2_2.Articy_2_2_Tools.IsSchema(xmlData))
     {
         return(Articy_2_2.Articy_2_2_Tools.LoadArticyDataFromXmlData(xmlData, prefs.Encoding));
     }
     else if (Articy_1_4.Articy_1_4_Tools.IsSchema(xmlData))
     {
         return(Articy_1_4.Articy_1_4_Tools.LoadArticyDataFromXmlData(xmlData, prefs.Encoding));
     }
     else
     {
         return(null);
     }
 }
Exemplo n.º 10
0
 /// <summary>
 /// Sets up the conversion process.
 /// </summary>
 /// <param name='articyData'>
 /// Articy data.
 /// </param>
 /// <param name='prefs'>
 /// Prefs.
 /// </param>
 /// <param name='database'>
 /// Dialogue database.
 /// </param>
 private void Setup(ArticyData articyData, ConverterPrefs prefs, DialogueDatabase database)
 {
     this.articyData = articyData;
     this.prefs = prefs;
     this.database = database;
     database.actors = new List<Actor>();
     database.items = new List<Item>();
     database.locations = new List<Location>();
     database.variables = new List<Variable>();
     database.conversations = new List<Conversation>();
     conversationID = 0;
     actorID = 0;
     itemID = 0;
     locationID = 0;
     fullVariableNames.Clear();
     template = Template.FromEditorPrefs();
 }
Exemplo n.º 11
0
 /// <summary>
 /// This static utility method creates a converter and uses it run the conversion.
 /// </summary>
 /// <param name='articyData'>
 /// Articy data.
 /// </param>
 /// <param name='prefs'>
 /// Prefs.
 /// </param>
 /// <param name='database'>
 /// Dialogue database.
 /// </param>
 public static void ConvertArticyDataToDatabase(ArticyData articyData, ConverterPrefs prefs, DialogueDatabase database)
 {
     ArticyConverter converter = new ArticyConverter();
     converter.Convert(articyData, prefs, database);
 }
 public static ArticyData LoadArticyDataFromXmlFile(string xmlFilename, Encoding encoding, bool convertDropdownAsString = false, ConverterPrefs prefs = null)
 {
     if (Articy_3_1.Articy_3_1_EditorTools.IsSchema(xmlFilename))
     {
         return(Articy_3_1.Articy_3_1_EditorTools.LoadArticyDataFromXmlFile(xmlFilename, encoding, convertDropdownAsString, prefs));
     }
     else if (Articy_2_4.Articy_2_4_EditorTools.IsSchema(xmlFilename))
     {
         return(Articy_2_4.Articy_2_4_EditorTools.LoadArticyDataFromXmlFile(xmlFilename, encoding, convertDropdownAsString, prefs));
     }
     else if (Articy_2_2.Articy_2_2_EditorTools.IsSchema(xmlFilename))
     {
         return(Articy_2_2.Articy_2_2_EditorTools.LoadArticyDataFromXmlFile(xmlFilename, encoding));
     }
     else if (Articy_1_4.Articy_1_4_EditorTools.IsSchema(xmlFilename))
     {
         return(Articy_1_4.Articy_1_4_EditorTools.LoadArticyDataFromXmlFile(xmlFilename, encoding));
     }
     else
     {
         return(null);
     }
 }
Exemplo n.º 13
0
        /// <summary>
        /// This static utility method creates a converter and uses it run the conversion.
        /// </summary>
        /// <param name='articyData'>
        /// Articy data.
        /// </param>
        /// <param name='prefs'>
        /// Prefs.
        /// </param>
        /// <param name='database'>
        /// Dialogue database.
        /// </param>
        public static void ConvertArticyDataToDatabase(ArticyData articyData, ConverterPrefs prefs, DialogueDatabase database)
        {
            ArticyConverter converter = new ArticyConverter();

            converter.Convert(articyData, prefs, database);
        }