示例#1
0
        //言語用ファイルをマージする
        void MargeLanguage(string textKey, string pathBase, string pathLocalized)
        {
            IWorkbook book          = ExcelParser.ReadBook(pathBase);
            IWorkbook bookLocalized = ExcelParser.ReadBook(pathLocalized);

            for (int i = 0; i < bookLocalized.NumberOfSheets; ++i)
            {
                ISheet sheetLocalized = bookLocalized.GetSheetAt(i);
                ISheet sheet          = book.GetSheet(sheetLocalized.SheetName);
                if (sheet == null)
                {
                    Debug.LogError(sheet.SheetName + " is not found in " + pathBase);
                    continue;
                }

                List <int> textColumnIndexList = new List <int>();
                IRow       rowLocalized        = sheetLocalized.GetRow(sheetLocalized.FirstRowNum);
                for (int cellIndex = 0; cellIndex < rowLocalized.Cells.Count; ++cellIndex)
                {
                    ICell  cell  = rowLocalized.Cells[cellIndex];
                    string key   = (cellIndex == 0) ? textKey : cell.StringCellValue.Replace("[[[", "").Replace("]]]", "");
                    int    index = 0;
                    if (!ExcelParser.TryGetColumneIndex(sheet, key, out index))
                    {
                        IRow row = sheet.GetRow(sheet.FirstRowNum);
                        index = row.Cells.Count;
                        row.CreateCell(index).SetCellValue(key);
                    }
                    textColumnIndexList.Add(index);
                }
                MargeLanguage(sheet, sheetLocalized, textColumnIndexList);
            }
            ExcelParser.WriteBook(book, pathBase);
        }
示例#2
0
        //対象のエクセルファイルを全て読み込み
        StringGridDictionary ReadExcel(string path)
        {
            StringGridDictionary book = ExcelParser.Read(path, '#', Project.ParseFormula, Project.ParseNumreic);

            book.RemoveSheets(@"^#");
            return(book);
        }
 void Convert(string outputDirectiory, List <string> assetPathList)
 {
     foreach (string path in assetPathList)
     {
         StringGridDictionary gridTbl = ExcelParser.Read(path);
         gridTbl.RemoveSheets(@"^#");
         string outputPath = FilePathUtil.Combine(outputDirectiory, FilePathUtil.GetFileName(path));
         ExcelParser.Write(outputPath, ConvertToLocalized(gridTbl));
     }
 }
 internal AdvExcelSheets(string path)
 {
     this.SettingsSheets = new List <StringGrid>();
     this.ScenarioSheets = new List <StringGrid>();
     this.CsvList        = new List <CsvInfo>();
     this.Path           = path;
     this.Name           = System.IO.Path.GetFileNameWithoutExtension(Path);
     this.sheets         = ExcelParser.Read(path, '#', false);
     this.sheets.RemoveSheets(@"^#");
 }
示例#5
0
 void Convert(string outputDirectiory, List <string> assetPathList)
 {
     foreach (string path in assetPathList)
     {
         StringGridDictionary gridTbl = ExcelParser.Read(path, '#', AdvScenarioDataBuilderWindow.ProjectData.ParseFormula, AdvScenarioDataBuilderWindow.ProjectData.ParseNumreic);
         gridTbl.RemoveSheets(@"^#");
         string outputPath = FilePathUtil.Combine(outputDirectiory, FilePathUtil.GetFileName(path));
         ExcelParser.Write(outputPath, ConvertToLocalized(gridTbl));
     }
 }
示例#6
0
        //ファイルの読み込み
        public bool Import(List <string> pathList)
        {
            //対象のエクセルファイルを全て読み込み
            Dictionary <string, StringGridDictionary> bookDictionary = new Dictionary <string, StringGridDictionary>();

            foreach (string path in pathList)
            {
                if (!string.IsNullOrEmpty(path))
                {
                    StringGridDictionary book = ExcelParser.Read(path);
                    if (book.List.Count > 0)
                    {
                        bookDictionary.Add(path, book);
                    }
                }
            }

            if (bookDictionary.Count <= 0)
            {
                return(false);
            }

            assetSetting = null;
            //設定データをインポート
            foreach (string path in bookDictionary.Keys)
            {
                ImportSettingBook(bookDictionary[path], path);
                if (assetSetting != null)
                {
                    break;
                }
            }
            if (assetSetting == null)
            {
                return(false);
            }

            AssetFileManager.IsEditorErrorCheck = true;
            AdvCommand.IsEditorErrorCheck       = true;
            TextData.CallbackCalcExpression     = assetSetting.DefaultParam.CalcExpressionNotSetParam;
            //シナリオデータをインポート
            foreach (string path in bookDictionary.Keys)
            {
                ImportScenarioBook(bookDictionary[path], path);
            }
            TextData.CallbackCalcExpression = null;

            //シナリオラベルのリンクチェック
            ErroeCheckScenarioLabel();

            AdvCommand.IsEditorErrorCheck       = false;
            AssetFileManager.IsEditorErrorCheck = false;
            return(true);
        }
示例#7
0
        //対象のエクセルファイルを全て読み込み
        StringGridDictionary ReadExcel(string path)
        {
            StringGridDictionary book = ExcelParser.Read(path, '#', Project.ParseFormula, Project.ParseNumreic);

            book.RemoveSheets(@"^#");
            if (Project.EnableCommentOutOnImport)
            {
                book.EraseCommentOutStrings(@"//");
            }
            return(book);
        }
示例#8
0
        //対象のエクセルファイルを全て読み込み
        StringGridDictionary ReadAllExcelFiles(List <string> excelPathList)
        {
            StringGridDictionary readSheets = new StringGridDictionary();

            foreach (string assetPath in excelPathList)
            {
                if (!string.IsNullOrEmpty(assetPath))
                {
                    StringGridDictionary dictionary = ExcelParser.Read(assetPath);
                    foreach (var sheet in dictionary.List)
                    {
                        readSheets.Add(sheet);
                    }
                }
            }
            return(readSheets);
        }
示例#9
0
        //対象のエクセルファイルを全て読み込み
        Dictionary <string, StringGridDictionary> ReadExcels(List <string> pathList)
        {
            Dictionary <string, StringGridDictionary> bookDictionary = new Dictionary <string, StringGridDictionary>();

            foreach (string path in pathList)
            {
                if (!string.IsNullOrEmpty(path))
                {
                    StringGridDictionary book = ExcelParser.Read(path);
                    book.RemoveSheets(@"^#");
                    if (book.List.Count > 0)
                    {
                        bookDictionary.Add(path, book);
                    }
                }
            }
            return(bookDictionary);
        }
        /// <summary>
        /// コンバートする
        /// </summary>
        /// <param name="folderPath">出力先パス</param>
        /// <param name="assetPathList">読み込むエクセルファイルのリスト</param>
        /// <returns>コンバートしたらtrue。失敗したらfalse</returns>
        public bool Convert(string folderPath, List <string> assetPathList, int version)
        {
            scenarioSheetDictionary.Clear();
            if (!string.IsNullOrEmpty(folderPath) && assetPathList.Count > 0)
            {
                //対象のエクセルファイルを全て読み込み
                StringGridDictionary readSheet = new StringGridDictionary();
                foreach (string assetPath in assetPathList)
                {
                    if (!string.IsNullOrEmpty(assetPath))
                    {
                        StringGridDictionary dictionary = ExcelParser.Read(assetPath);
                        foreach (var sheet in dictionary.List)
                        {
                            readSheet.Add(sheet);
                        }
                    }
                }

                if (readSheet.List.Count <= 0)
                {
                    return(false);
                }

                //各シートをコンバート
                foreach (var sheet in readSheet.List)
                {
                    ConvertSheet(sheet, folderPath);
                }
                //シナリオ設定シートは個別にコンバート
                WriteScenarioSetting(folderPath, version);

                ///起動用CSVをコンバート
                WriteBootSetting(folderPath, version);

                return(true);
            }
            return(false);
        }
        //ファイルの読み込み
        public bool Import(List <string> pathList)
        {
            //対象のエクセルファイルを全て読み込み
            Dictionary <string, StringGridDictionary> bookDictionary = new Dictionary <string, StringGridDictionary>();

            foreach (string path in pathList)
            {
                if (!string.IsNullOrEmpty(path))
                {
                    StringGridDictionary book = ExcelParser.Read(path);
                    if (book.List.Count > 0)
                    {
                        bookDictionary.Add(path, book);
                    }
                }
            }

            if (bookDictionary.Count <= 0)
            {
                return(false);
            }

            AdvEngine engine = UtageEditorToolKit.FindComponentAllInTheScene <AdvEngine>();

            if (engine != null)
            {
                engine.BootInitCustomCommand();
            }
            assetSetting = null;
            //設定データをインポート
            foreach (string path in bookDictionary.Keys)
            {
                ImportSettingBook(bookDictionary[path], path);
                if (assetSetting != null)
                {
                    break;
                }
            }
            if (assetSetting == null)
            {
                return(false);
            }

            AssetFileManager.IsEditorErrorCheck = true;
            AdvCommand.IsEditorErrorCheck       = true;
            GraphicInfo.CallbackExpression      = assetSetting.DefaultParam.CalcExpressionBoolean;
            TextParser.CallbackCalcExpression   = assetSetting.DefaultParam.CalcExpressionNotSetParam;
            iTweenData.CallbackGetValue         = assetSetting.DefaultParam.GetParameter;

            //シナリオデータをインポート
            foreach (string path in bookDictionary.Keys)
            {
                ImportScenarioBook(bookDictionary[path], path);
            }
            GraphicInfo.CallbackExpression    = null;
            TextParser.CallbackCalcExpression = null;
            iTweenData.CallbackGetValue       = null;

            //シナリオラベルのリンクチェック
            ErroeCheckScenarioLabel();

            AdvCommand.IsEditorErrorCheck       = false;
            AssetFileManager.IsEditorErrorCheck = false;
            return(true);
        }