Exemplo n.º 1
0
        private void Export()
        {
                        #if UNITY_WEBPLAYER
            ACDebug.LogWarning("Game text cannot be exported in WebPlayer mode - please switch platform and try again.");
                        #else
            if (inventoryManager == null || exportColumns == null || exportColumns.Count == 0 || inventoryManager.items == null || inventoryManager.items.Count == 0)
            {
                return;
            }

            string suggestedFilename = "";
            if (AdvGame.GetReferences().settingsManager)
            {
                suggestedFilename = AdvGame.GetReferences().settingsManager.saveFileName + " - ";
            }
            suggestedFilename += "Inventory.csv";

            string fileName = EditorUtility.SaveFilePanel("Export inventory items", "Assets", suggestedFilename, "csv");
            if (fileName.Length == 0)
            {
                return;
            }

            List <InvItem> exportItems = new List <InvItem>();
            foreach (InvItem item in inventoryManager.items)
            {
                exportItems.Add(new InvItem(item));
            }

            List <string[]> output = new List <string[]>();

            List <string> headerList = new List <string>();
            headerList.Add("ID");
            foreach (ExportColumn exportColumn in exportColumns)
            {
                headerList.Add(exportColumn.GetHeader());
            }
            output.Add(headerList.ToArray());

            foreach (InvItem exportItem in exportItems)
            {
                List <string> rowList = new List <string>();
                rowList.Add(exportItem.id.ToString());
                foreach (ExportColumn exportColumn in exportColumns)
                {
                    string cellText = exportColumn.GetCellText(exportItem, inventoryManager);
                    rowList.Add(cellText);
                }
                output.Add(rowList.ToArray());
            }

            string fileContents = CSVReader.CreateCSVGrid(output);
            if (!string.IsNullOrEmpty(fileContents) && Serializer.SaveFile(fileName, fileContents))
            {
                ACDebug.Log((exportItems.Count - 1).ToString() + " items exported.");
            }

            //this.Close ();
                        #endif
        }
        private void CreateScript()
        {
                        #if UNITY_WEBPLAYER
            ACDebug.LogWarning("Game text cannot be exported in WebPlayer mode - please switch platform and try again.");
                        #else
            if (AdvGame.GetReferences() == null || AdvGame.GetReferences().speechManager == null)
            {
                ACDebug.LogError("Cannot create script sheet - no Speech Manager is assigned!");
                return;
            }

            SpeechManager speechManager = AdvGame.GetReferences().speechManager;
            languageIndex = Mathf.Max(languageIndex, 0);

            string suggestedFilename = "Adventure Creator";
            if (AdvGame.GetReferences().settingsManager)
            {
                suggestedFilename = AdvGame.GetReferences().settingsManager.saveFileName;
            }
            if (limitToCharacter && characterName != "")
            {
                suggestedFilename += " (" + characterName + ")";
            }
            if (limitToTag && tagID >= 0)
            {
                SpeechTag speechTag = speechManager.GetSpeechTag(tagID);
                if (speechTag != null && speechTag.label.Length > 0)
                {
                    suggestedFilename += " (" + speechTag.label + ")";
                }
            }
            suggestedFilename += " - ";
            if (languageIndex > 0)
            {
                suggestedFilename += speechManager.languages[languageIndex] + " ";
            }
            suggestedFilename += "script.html";

            string fileName = EditorUtility.SaveFilePanel("Save script file", "Assets", suggestedFilename, "html");
            if (fileName.Length == 0)
            {
                return;
            }

            string gameName = "Adventure Creator";
            if (AdvGame.GetReferences().settingsManager&& AdvGame.GetReferences().settingsManager.saveFileName.Length > 0)
            {
                gameName = AdvGame.GetReferences().settingsManager.saveFileName;
                if (languageIndex > 0)
                {
                    gameName += " (" + speechManager.languages[languageIndex] + ")";
                }
            }

            System.Text.StringBuilder script = new System.Text.StringBuilder();
            script.Append("<html>\n<head>\n");
            script.Append("<meta http-equiv='Content-Type' content='text/html;charset=ISO-8859-1' charset='UTF-8'>\n");
            script.Append("<title>" + gameName + "</title>\n");
            script.Append("<style> body, table, div, p, dl { font: 400 14px/22px Roboto,sans-serif; } footer { text-align: center; padding-top: 20px; font-size: 12px;} footer a { color: blue; text-decoration: none} </style>\n</head>\n");
            script.Append("<body>\n");

            script.Append("<h1>" + gameName + " - script sheet");
            if (limitToCharacter && characterName != "")
            {
                script.Append(" (" + characterName + ")");
            }
            script.Append("</h1>\n");
            script.Append("<h2>Created: " + DateTime.UtcNow.ToString("HH:mm dd MMMM, yyyy") + "</h2>\n");

            // By scene
            foreach (string sceneFile in speechManager.sceneFiles)
            {
                List <SpeechLine> sceneSpeechLines = new List <SpeechLine>();

                int    slashPoint = sceneFile.LastIndexOf("/") + 1;
                string sceneName  = sceneFile.Substring(slashPoint);

                foreach (SpeechLine line in speechManager.lines)
                {
                    if (line.textType == AC_TextType.Speech &&
                        (line.scene == sceneFile || sceneName == (line.scene + ".unity")) &&
                        (!limitToCharacter || characterName == "" || line.owner == characterName || (line.isPlayer && characterName == "Player")) &&
                        (!limitToTag || line.tagID == tagID))
                    {
                        if (!speechManager.autoNameSpeechFiles && limitToMissingAudio)
                        {
                            if (languageIndex == 0 && line.customAudioClip != null)
                            {
                                continue;
                            }
                            if (speechManager.translateAudio && languageIndex > 0 && line.customTranslationAudioClips.Count > (languageIndex - 1) && line.customTranslationAudioClips[languageIndex - 1] != null)
                            {
                                continue;
                            }
                            if (!speechManager.translateAudio && line.customAudioClip != null)
                            {
                                continue;
                            }
                        }

                        sceneSpeechLines.Add(line);
                    }
                }

                if (sceneSpeechLines != null && sceneSpeechLines.Count > 0)
                {
                    sceneSpeechLines.Sort(delegate(SpeechLine a, SpeechLine b) { return(a.OrderIdentifier.CompareTo(b.OrderIdentifier)); });

                    script.Append("<hr/>\n<h3><b>Scene:</b> " + sceneName + "</h3>\n");
                    foreach (SpeechLine sceneSpeechLine in sceneSpeechLines)
                    {
                        script.Append(sceneSpeechLine.Print(languageIndex, includeDescriptions, removeTokens));
                    }
                }
            }

            // No scene
            List <SpeechLine> assetSpeechLines = new List <SpeechLine>();

            foreach (SpeechLine line in speechManager.lines)
            {
                if (line.scene == "" &&
                    line.textType == AC_TextType.Speech &&
                    (!limitToCharacter || characterName == "" || line.owner == characterName || (line.isPlayer && characterName == "Player")) &&
                    (!limitToTag || line.tagID == tagID))
                {
                    assetSpeechLines.Add(line);
                }
            }

            if (assetSpeechLines != null && assetSpeechLines.Count > 0)
            {
                assetSpeechLines.Sort(delegate(SpeechLine a, SpeechLine b) { return(a.OrderIdentifier.CompareTo(b.OrderIdentifier)); });

                script.Append("<hr/>\n<h3>Scene-independent lines:</h3>\n");
                foreach (SpeechLine assetSpeechLine in assetSpeechLines)
                {
                    script.Append(assetSpeechLine.Print(languageIndex, includeDescriptions, removeTokens));
                }
            }

            script.Append("<footer>Generated by <a href='http://adventurecreator.org' target=blank>Adventure Creator</a>, by Chris Burton</footer>\n");
            script.Append("</body>\n</html>");

            Serializer.SaveFile(fileName, script.ToString());
                        #endif

            this.Close();
        }
        private void Export()
        {
                        #if UNITY_WEBPLAYER
            ACDebug.LogWarning("Game text cannot be exported in WebPlayer mode - please switch platform and try again.");
                        #else
            if (variablesManager == null || exportColumns == null || exportColumns.Count == 0)
            {
                return;
            }

            if (variableLocation == VariableLocation.Local && allScenes)
            {
                bool canProceed = EditorUtility.DisplayDialog("Export variables", "AC will now go through your game, and collect all variables to be exported.\n\nIt is recommended to back up your project beforehand.", "OK", "Cancel");
                if (!canProceed)
                {
                    return;
                }

                if (!UnityEditor.SceneManagement.EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
                {
                    return;
                }
            }

            string suggestedFilename = "";
            if (AdvGame.GetReferences().settingsManager)
            {
                suggestedFilename = AdvGame.GetReferences().settingsManager.saveFileName + " - ";
            }
            if (variableLocation == VariableLocation.Local && allScenes)
            {
                suggestedFilename += " All ";
            }
            suggestedFilename += variableLocation.ToString() + " Variables.csv";

            string fileName = EditorUtility.SaveFilePanel("Export variables", "Assets", suggestedFilename, "csv");
            if (fileName.Length == 0)
            {
                return;
            }

            List <string[]> output = new List <string[]>();

            List <string> headerList = new List <string>();
            headerList.Add("ID");
            foreach (ExportColumn exportColumn in exportColumns)
            {
                headerList.Add(exportColumn.GetHeader());
            }
            output.Add(headerList.ToArray());

            // Global
            if (variableLocation == VariableLocation.Global)
            {
                List <GVar> exportVars = new List <GVar>();
                foreach (GVar globalVariable in variablesManager.vars)
                {
                    exportVars.Add(new GVar(globalVariable));
                }

                foreach (GVar exportVar in exportVars)
                {
                    List <string> rowList = new List <string>();
                    rowList.Add(exportVar.id.ToString());
                    foreach (ExportColumn exportColumn in exportColumns)
                    {
                        string cellText = exportColumn.GetCellText(exportVar, VariableLocation.Global, replaceForwardSlashes);
                        rowList.Add(cellText);
                    }
                    output.Add(rowList.ToArray());
                }
            }

            // Local
            else if (variableLocation == VariableLocation.Local)
            {
                if (allScenes)
                {
                    string   originalScene = UnityVersionHandler.GetCurrentSceneFilepath();
                    string[] sceneFiles    = AdvGame.GetSceneFiles();
                    foreach (string sceneFile in sceneFiles)
                    {
                        UnityVersionHandler.OpenScene(sceneFile);

                        if (FindObjectOfType <LocalVariables>())
                        {
                            LocalVariables localVariables = FindObjectOfType <LocalVariables>();
                            if (localVariables != null)
                            {
                                string sceneName = UnityVersionHandler.GetCurrentSceneName();
                                output = GatherOutput(output, localVariables.localVars, sceneName);
                            }
                        }
                    }

                    if (string.IsNullOrEmpty(originalScene))
                    {
                        UnityVersionHandler.NewScene();
                    }
                    else
                    {
                        UnityVersionHandler.OpenScene(originalScene);
                    }
                }
                else
                {
                    string sceneName = UnityVersionHandler.GetCurrentSceneName();
                    output = GatherOutput(output, KickStarter.localVariables.localVars, sceneName);
                }
            }

            // Component
            else if (variableLocation == VariableLocation.Component)
            {
                string sceneName = UnityVersionHandler.GetCurrentSceneName();
                if (variables != null)
                {
                    output = GatherOutput(output, variables.vars, sceneName);
                }
            }

            string fileContents = CSVReader.CreateCSVGrid(output);
            if (!string.IsNullOrEmpty(fileContents) && Serializer.SaveFile(fileName, fileContents))
            {
                int numExported = output.Count - 1;
                if (numExported == 1)
                {
                    ACDebug.Log("1 " + variableLocation + " variable exported.");
                }
                else
                {
                    ACDebug.Log(numExported.ToString() + " " + variableLocation + " variables exported.");
                }
            }
                        #endif
        }
Exemplo n.º 4
0
        private void Export()
        {
                        #if UNITY_WEBPLAYER
            ACDebug.LogWarning("Game text cannot be exported in WebPlayer mode - please switch platform and try again.");
                        #else
            if (variablesManager == null || exportColumns == null || exportColumns.Count == 0)
            {
                return;
            }

            if (variableLocation == VariableLocation.Local && allScenes)
            {
                bool canProceed = EditorUtility.DisplayDialog("Export variables", "AC will now go through your game, and collect all variables to be exported.\n\nIt is recommended to back up your project beforehand.", "OK", "Cancel");
                if (!canProceed)
                {
                    return;
                }

                if (!UnityVersionHandler.SaveSceneIfUserWants())
                {
                    return;
                }
            }

            string suggestedFilename = "";
            if (AdvGame.GetReferences().settingsManager)
            {
                suggestedFilename = AdvGame.GetReferences().settingsManager.saveFileName + " - ";
            }
            if (variableLocation == VariableLocation.Local && allScenes)
            {
                suggestedFilename += " All ";
            }
            suggestedFilename += variableLocation.ToString() + " Variables.csv";

            string fileName = EditorUtility.SaveFilePanel("Export variables", "Assets", suggestedFilename, "csv");
            if (fileName.Length == 0)
            {
                return;
            }

            bool            fail   = false;
            List <string[]> output = new List <string[]>();

            List <string> headerList = new List <string>();
            headerList.Add("ID");
            foreach (ExportColumn exportColumn in exportColumns)
            {
                headerList.Add(exportColumn.GetHeader());
            }
            output.Add(headerList.ToArray());

            // Global
            if (variableLocation == VariableLocation.Global)
            {
                List <GVar> exportVars = new List <GVar>();
                foreach (GVar globalVariable in variablesManager.vars)
                {
                    exportVars.Add(new GVar(globalVariable));
                }

                foreach (GVar exportVar in exportVars)
                {
                    List <string> rowList = new List <string>();
                    rowList.Add(exportVar.id.ToString());
                    foreach (ExportColumn exportColumn in exportColumns)
                    {
                        string cellText = exportColumn.GetCellText(exportVar, VariableLocation.Global, replaceForwardSlashes);
                        rowList.Add(cellText);

                        if (cellText.Contains(CSVReader.csvDelimiter))
                        {
                            fail = true;
                            ACDebug.LogError("Cannot export variables since global variable " + exportVar.id.ToString() + " (" + exportVar.label + ") contains the character '" + CSVReader.csvDelimiter + "'.");
                        }
                    }
                    output.Add(rowList.ToArray());
                }
            }

            // Local
            else if (variableLocation == VariableLocation.Local)
            {
                if (allScenes)
                {
                    string   originalScene = UnityVersionHandler.GetCurrentSceneFilepath();
                    string[] sceneFiles    = AdvGame.GetSceneFiles();
                    foreach (string sceneFile in sceneFiles)
                    {
                        UnityVersionHandler.OpenScene(sceneFile);

                        if (FindObjectOfType <LocalVariables>())
                        {
                            LocalVariables localVariables = FindObjectOfType <LocalVariables>();
                            if (localVariables != null)
                            {
                                string sceneName = UnityVersionHandler.GetCurrentSceneName();
                                output = GatherOutput(output, localVariables.localVars, sceneName);
                            }
                        }
                    }

                    if (originalScene == "")
                    {
                        UnityVersionHandler.NewScene();
                    }
                    else
                    {
                        UnityVersionHandler.OpenScene(originalScene);
                    }
                }
                else
                {
                    string sceneName = UnityVersionHandler.GetCurrentSceneName();
                    output = GatherOutput(output, KickStarter.localVariables.localVars, sceneName);
                }
            }

            // Component
            else if (variableLocation == VariableLocation.Component)
            {
                string sceneName = UnityVersionHandler.GetCurrentSceneName();
                if (variables != null)
                {
                    output = GatherOutput(output, variables.vars, sceneName);
                }
            }

            if (!fail)
            {
                int length = output.Count;

                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                for (int j = 0; j < length; j++)
                {
                    sb.AppendLine(string.Join(CSVReader.csvDelimiter, output[j]));
                }

                if (Serializer.SaveFile(fileName, sb.ToString()))
                {
                    int numExported = output.Count - 1;
                    if (numExported == 1)
                    {
                        ACDebug.Log("1 " + variableLocation + " variable exported.");
                    }
                    else
                    {
                        ACDebug.Log(numExported.ToString() + " " + variableLocation + " variables exported.");
                    }
                }
            }
                        #endif
        }
        private void Export()
        {
                        #if UNITY_WEBPLAYER
            ACDebug.LogWarning("Game text cannot be exported in WebPlayer mode - please switch platform and try again.");
                        #else
            if (inventoryManager == null || exportColumns == null || exportColumns.Count == 0 || inventoryManager.items == null || inventoryManager.items.Count == 0)
            {
                return;
            }

            string suggestedFilename = "";
            if (AdvGame.GetReferences().settingsManager)
            {
                suggestedFilename = AdvGame.GetReferences().settingsManager.saveFileName + " - ";
            }
            suggestedFilename += "Inventory.csv";

            string fileName = EditorUtility.SaveFilePanel("Export inventory items", "Assets", suggestedFilename, "csv");
            if (fileName.Length == 0)
            {
                return;
            }

            List <InvItem> exportItems = new List <InvItem>();
            foreach (InvItem item in inventoryManager.items)
            {
                exportItems.Add(new InvItem(item));
            }

            bool            fail   = false;
            List <string[]> output = new List <string[]>();

            List <string> headerList = new List <string>();
            headerList.Add("ID");
            foreach (ExportColumn exportColumn in exportColumns)
            {
                headerList.Add(exportColumn.GetHeader());
            }
            output.Add(headerList.ToArray());

            foreach (InvItem exportItem in exportItems)
            {
                List <string> rowList = new List <string>();
                rowList.Add(exportItem.id.ToString());
                foreach (ExportColumn exportColumn in exportColumns)
                {
                    string cellText = exportColumn.GetCellText(exportItem, inventoryManager);
                    rowList.Add(cellText);

                    if (cellText.Contains(CSVReader.csvDelimiter))
                    {
                        fail = true;
                        ACDebug.LogError("Cannot export inventory since item " + exportItem.id.ToString() + " (" + exportItem.label + ") contains the character '" + CSVReader.csvDelimiter + "'.");
                    }
                }
                output.Add(rowList.ToArray());
            }

            if (!fail)
            {
                int length = output.Count;

                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                for (int j = 0; j < length; j++)
                {
                    sb.AppendLine(string.Join(CSVReader.csvDelimiter, output[j]));
                }

                if (Serializer.SaveFile(fileName, sb.ToString()))
                {
                    ACDebug.Log((exportItems.Count - 1).ToString() + " items exported.");
                }
            }

            //this.Close ();
                        #endif
        }
Exemplo n.º 6
0
        private void Export()
        {
                        #if UNITY_WEBPLAYER
            ACDebug.LogWarning("Game text cannot be exported in WebPlayer mode - please switch platform and try again.");
                        #else
            if (speechManager == null || exportColumns == null || exportColumns.Count == 0 || speechManager.lines == null || speechManager.lines.Count == 0)
            {
                return;
            }

            string suggestedFilename = "";
            if (AdvGame.GetReferences().settingsManager)
            {
                suggestedFilename = AdvGame.GetReferences().settingsManager.saveFileName + " - ";
            }
            suggestedFilename += "GameText.csv";

            string fileName = EditorUtility.SaveFilePanel("Export game text", "Assets", suggestedFilename, "csv");
            if (fileName.Length == 0)
            {
                return;
            }

            string[]          sceneNames  = speechManager.GetSceneNames();
            List <SpeechLine> exportLines = new List <SpeechLine>();
            foreach (SpeechLine line in speechManager.lines)
            {
                if (filterByType)
                {
                    if (line.textType != typeFilter)
                    {
                        continue;
                    }
                }
                if (filterByScene)
                {
                    if (sceneNames != null && sceneNames.Length > sceneFilter)
                    {
                        string selectedScene      = sceneNames[sceneFilter] + ".unity";
                        string scenePlusExtension = (line.scene != "") ? (line.scene + ".unity") : "";

                        if ((line.scene == "" && sceneFilter == 0) ||
                            sceneFilter == 1 ||
                            (line.scene != "" && sceneFilter > 1 && line.scene.EndsWith(selectedScene)) ||
                            (line.scene != "" && sceneFilter > 1 && scenePlusExtension.EndsWith(selectedScene)))
                        {
                        }
                        else
                        {
                            continue;
                        }
                    }
                }
                if (filterByText)
                {
                    if (!line.Matches(textFilter, filterSpeechLine))
                    {
                        continue;
                    }
                }
                if (filterByTag)
                {
                    if (tagFilter == -1 ||
                        (tagFilter < speechManager.speechTags.Count && line.tagID == speechManager.speechTags[tagFilter].ID))
                    {
                    }
                    else
                    {
                        continue;
                    }
                }

                exportLines.Add(new SpeechLine(line));
            }

            if (doRowSorting)
            {
                if (rowSorting == RowSorting.ByID)
                {
                    exportLines.Sort(delegate(SpeechLine a, SpeechLine b) { return(a.lineID.CompareTo(b.lineID)); });
                }
                else if (rowSorting == RowSorting.ByDescription)
                {
                    exportLines.Sort(delegate(SpeechLine a, SpeechLine b) { return(a.description.CompareTo(b.description)); });
                }
                else if (rowSorting == RowSorting.ByType)
                {
                    exportLines.Sort(delegate(SpeechLine a, SpeechLine b) { return(a.textType.ToString().CompareTo(b.textType.ToString())); });
                }
                else if (rowSorting == RowSorting.ByAssociatedObject)
                {
                    exportLines.Sort(delegate(SpeechLine a, SpeechLine b) { return(a.owner.CompareTo(b.owner)); });
                }
                else if (rowSorting == RowSorting.ByScene)
                {
                    exportLines.Sort(delegate(SpeechLine a, SpeechLine b) { return(a.scene.CompareTo(b.owner)); });
                }
            }

            bool            fail   = false;
            List <string[]> output = new List <string[]>();

            string[]      languagesArray = speechManager.languages.ToArray();
            List <string> headerList     = new List <string>();
            headerList.Add("ID");
            foreach (ExportColumn exportColumn in exportColumns)
            {
                headerList.Add(exportColumn.GetHeader(languagesArray));
            }
            output.Add(headerList.ToArray());

            foreach (SpeechLine line in exportLines)
            {
                List <string> rowList = new List <string>();
                rowList.Add(line.lineID.ToString());
                foreach (ExportColumn exportColumn in exportColumns)
                {
                    string cellText = exportColumn.GetCellText(line);
                    rowList.Add(cellText);

                    if (cellText.Contains(CSVReader.csvDelimiter))
                    {
                        fail = true;
                        ACDebug.LogError("Cannot export translation since line " + line.lineID.ToString() + " (" + line.text + ") contains the character '" + CSVReader.csvDelimiter + "'.");
                    }
                }
                output.Add(rowList.ToArray());
            }

            if (!fail)
            {
                int length = output.Count;

                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                for (int j = 0; j < length; j++)
                {
                    sb.AppendLine(string.Join(CSVReader.csvDelimiter, output[j]));
                }

                if (Serializer.SaveFile(fileName, sb.ToString()))
                {
                    ACDebug.Log((exportLines.Count - 1).ToString() + " lines exported.");
                }
            }

            //this.Close ();
                        #endif
        }
Exemplo n.º 7
0
        private void Export()
        {
                        #if UNITY_WEBPLAYER
            ACDebug.LogWarning("Game text cannot be exported in WebPlayer mode - please switch platform and try again.");
                        #else
            if (speechManager == null || exportColumns == null || exportColumns.Count == 0 || speechManager.lines == null || speechManager.lines.Count == 0)
            {
                return;
            }

            string suggestedFilename = string.Empty;
            if (AdvGame.GetReferences().settingsManager)
            {
                suggestedFilename = AdvGame.GetReferences().settingsManager.saveFileName + " - ";
            }
            suggestedFilename += "GameText.csv";

            string fileName = EditorUtility.SaveFilePanel("Export game text", "Assets", suggestedFilename, "csv");
            if (fileName.Length == 0)
            {
                return;
            }

            List <SpeechLine> exportLines = new List <SpeechLine>();
            foreach (SpeechLine line in speechManager.lines)
            {
                if (filterByType)
                {
                    if (line.textType != typeFilter)
                    {
                        continue;
                    }
                }
                if (filterByScene)
                {
                    if (sceneNames != null && sceneNames.Length > sceneFilter)
                    {
                        string selectedScene      = sceneNames[sceneFilter] + ".unity";
                        string scenePlusExtension = (string.IsNullOrEmpty(line.scene)) ? string.Empty : (line.scene + ".unity");

                        if ((string.IsNullOrEmpty(line.scene) && sceneFilter == 0) ||
                            sceneFilter == 1 ||
                            (!string.IsNullOrEmpty(line.scene) && sceneFilter > 1 && line.scene.EndsWith(selectedScene)) ||
                            (!string.IsNullOrEmpty(line.scene) && sceneFilter > 1 && scenePlusExtension.EndsWith(selectedScene)))
                        {
                        }
                        else
                        {
                            continue;
                        }
                    }
                }
                if (filterByText)
                {
                    if (!line.Matches(textFilter, filterSpeechLine))
                    {
                        continue;
                    }
                }
                if (filterByTag)
                {
                    if (tagFilter == -1 ||
                        (tagFilter < speechManager.speechTags.Count && line.tagID == speechManager.speechTags[tagFilter].ID))
                    {
                    }
                    else
                    {
                        continue;
                    }
                }

                exportLines.Add(new SpeechLine(line));
            }

            if (doRowSorting)
            {
                switch (rowSorting)
                {
                case RowSorting.ByID:
                    exportLines.Sort((a, b) => a.lineID.CompareTo(b.lineID));
                    break;

                case RowSorting.ByDescription:
                    exportLines.Sort((a, b) => string.Compare(a.description, b.description, System.StringComparison.Ordinal));
                    break;

                case RowSorting.ByType:
                    exportLines.Sort((a, b) => string.Compare(a.textType.ToString(), b.textType.ToString(), System.StringComparison.Ordinal));
                    break;

                case RowSorting.ByAssociatedObject:
                    exportLines.Sort((a, b) => string.Compare(a.owner, b.owner, System.StringComparison.Ordinal));
                    break;

                case RowSorting.ByScene:
                    exportLines.Sort((a, b) => string.Compare(a.scene, b.scene, System.StringComparison.Ordinal));
                    break;

                default:
                    break;
                }
            }

            List <string[]> output = new List <string[]>();

            string[]      languagesArray = speechManager.languages.ToArray();
            List <string> headerList     = new List <string>();
            headerList.Add("ID");
            foreach (ExportColumn exportColumn in exportColumns)
            {
                headerList.Add(exportColumn.GetHeader(languagesArray));
            }
            output.Add(headerList.ToArray());

            foreach (SpeechLine line in exportLines)
            {
                List <string> rowList = new List <string>();
                rowList.Add(line.lineID.ToString());
                foreach (ExportColumn exportColumn in exportColumns)
                {
                    string cellText = exportColumn.GetCellText(line);
                    rowList.Add(cellText);
                }
                output.Add(rowList.ToArray());
            }

            string fileContents = CSVReader.CreateCSVGrid(output);
            if (!string.IsNullOrEmpty(fileContents) && Serializer.SaveFile(fileName, fileContents))
            {
                int numLines = exportLines.Count;
                ACDebug.Log(numLines.ToString() + " line" + ((numLines != 1) ? "s" : string.Empty) + " exported.");
            }
                        #endif
        }