コード例 #1
0
        private static void DownloadComplete(string text, LocalizationDocument doc)
        {
            if (string.IsNullOrEmpty(text))
            {
                Debug.LogError("Could not download google sheet");
                return;
            }

            var path = doc.TextAsset != null?AssetDatabase.GetAssetPath(doc.TextAsset) : null;

            if (string.IsNullOrEmpty(path))
            {
                path = EditorUtility.SaveFilePanelInProject("Save Localization", "", "txt", "Please enter a file name to save the csv to", path);
            }
            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            File.WriteAllText(path, text);

            AssetDatabase.ImportAsset(path);

            doc.TextAsset = AssetDatabase.LoadAssetAtPath <TextAsset>(path);
            EditorUtility.SetDirty(doc.TextAsset);
            AssetDatabase.SaveAssets();
        }
コード例 #2
0
        private static void DownloadGoogleSheet(LocalizationDocument doc)
        {
            EditorUtility.DisplayCancelableProgressBar("Download", "Downloading...", 0);

            var iterator = GoogleDownload.DownloadSheet(doc.DocsId, doc.SheetId, t => DownloadComplete(t, doc), doc.Format, DisplayDownloadProgressbar);

            while (iterator.MoveNext())
            {
            }
        }
コード例 #3
0
        public bool InputFilesContains(LocalizationDocument doc)
        {
            foreach (var inputFile in inputFiles)
            {
                if (inputFile != null && inputFile.TextAsset == doc.TextAsset && inputFile.Format == doc.Format)
                {
                    return(true);
                }
            }

            return(false);
        }
コード例 #4
0
 private static IEnumerator Download(LocalizationDocument document, Action <string> done, Func <float, bool> progressbar = null)
 {
     return(GoogleDownload.DownloadSheet(document.DocsId, document.SheetId, done, document.Format, progressbar));
 }