//シートの読み込み
		static StringGrid ReadSheet(ISheet sheet, string path)
		{
			int lastRowNum = sheet.LastRowNum;

			StringGrid grid = new StringGrid(path + ":" + sheet.SheetName, CsvType.Tsv);
			for (int rowIndex = sheet.FirstRowNum; rowIndex <= lastRowNum; ++rowIndex)
			{
				IRow row = sheet.GetRow(rowIndex);

				List<string> stringList = new List<string>();
				if (row != null)
				{
					foreach (var cell in row.Cells)
					{
						for (int i = stringList.Count; i < cell.ColumnIndex; ++i)
						{
							stringList.Add("");
						}
						stringList.Add(cell.ToString());
					}
				}
				grid.AddRow(stringList);
			}
			grid.ParseHeader();
			return grid;
		}
        StringGridDictionary ConvertToLocalized(StringGridDictionary gridTbl)
        {
            List <string> languageNameList = LanguageNameList();

            StringGridDictionary localizedGirdTbl = new StringGridDictionary();

            foreach (var keyValue in gridTbl.List)
            {
                int        index;
                StringGrid grid = keyValue.Grid;
                if (grid.TryGetColumnIndex(TextKey, out index))
                {
                    StringGrid localizedGird = new StringGrid(grid.Name, grid.SheetName, CsvType.Tsv);
                    localizedGird.AddRow(languageNameList);
                    for (int i = 0; i < grid.Rows.Count; ++i)
                    {
                        if (i == 0)
                        {
                            continue;
                        }
                        string text = grid.Rows[i].ParseCellOptional <string>(TextKey, "");
                        localizedGird.AddRow(new List <string>(new string[] { text }));
                    }
                    localizedGirdTbl.Add(new StringGridDictionaryKeyValue(grid.SheetName, localizedGird));
                }
            }
            return(localizedGirdTbl);
        }
        //起動用CSVをコンバート
        CsvInfo ConvertBootSetting(List <AdvExcelSheets> excelSheets, string chapterName, int version)
        {
            if (string.IsNullOrEmpty(chapterName))
            {
                chapterName = AdvSheetParser.SheetNameBoot;
            }
            StringGrid grid = new StringGrid(chapterName, chapterName, CsvType.Tsv);

            grid.AddRow(new List <string> {
                AdvParser.Localize(AdvColumnName.Tag), AdvParser.Localize(AdvColumnName.Param1), AdvParser.Localize(AdvColumnName.Version)
            });
            ///起動用データをコンバート
            foreach (var excel in excelSheets)
            {
                string excelName = System.IO.Path.GetFileNameWithoutExtension(excel.Path);
                //シナリオ設定シートは個別にコンバート
                AddFileDataToTsv(grid, version, excelName, AdvSheetParser.SheetNameScenario);
                foreach (var sheet in excel.SettingsSheets)
                {
                    AddFileDataToTsv(grid, version, excelName, sheet.SheetName);
                }
            }

            string path = chapterName;

            return(new CsvInfo(grid, path));
        }
Example #4
0
        //シートの読み込み
        static StringGrid ReadSheet(ISheet sheet, string path)
        {
            int lastRowNum = sheet.LastRowNum;

            StringGrid grid = new StringGrid(path + ":" + sheet.SheetName, sheet.SheetName, CsvType.Tsv);

            for (int rowIndex = sheet.FirstRowNum; rowIndex <= lastRowNum; ++rowIndex)
            {
                IRow row = sheet.GetRow(rowIndex);

                List <string> stringList = new List <string>();
                if (row != null)
                {
                    foreach (var cell in row.Cells)
                    {
                        for (int i = stringList.Count; i < cell.ColumnIndex; ++i)
                        {
                            stringList.Add("");
                        }
                        stringList.Add(cell.ToString());
                    }
                }
                grid.AddRow(stringList);
            }
            grid.ParseHeader();
            return(grid);
        }
            StringGrid MakeScenarioSettingGrid(int version)
            {
                StringGrid grid = new StringGrid(AdvSheetParser.SheetNameScenario, AdvSheetParser.SheetNameScenario, CsvType.Tsv);

                grid.AddRow(new List <string> {
                    AdvParser.Localize(AdvColumnName.FileName), AdvParser.Localize(AdvColumnName.Version)
                });
                grid.ParseHeader();

                foreach (var sheet in ScenarioSheets)
                {
                    grid.AddRow(new List <string> {
                        this.Name + "/Scenario/" + sheet.SheetName, "" + version
                    });
                }
                return(grid);
            }
Example #6
0
        /// <summary>
        /// CSVにコンバートする際に、デフォルトで使用するsettings系のURLリストを追加する
        /// </summary>
        /// <param name="grid"></param>
        static void AddDefaultUrlSettingsOnCsvOnvert(StringGrid grid, int version)
        {
            const string format = "Settings/{0}.tsv";

            grid.AddRow(new List <string> {
                TagScenarioSetting, string.Format(format, AdvSettingDataManager.SheetNameScenario), "" + version
            });
            grid.AddRow(new List <string> {
                TagCharacterSetting, string.Format(format, AdvSettingDataManager.SheetNameCharacter), "" + version
            });
            grid.AddRow(new List <string> {
                TagTextureSetting, string.Format(format, AdvSettingDataManager.SheetNameTexture), "" + version
            });
            grid.AddRow(new List <string> {
                TagSoundSetting, string.Format(format, AdvSettingDataManager.SheetNameSound), "" + version
            });
            grid.AddRow(new List <string> {
                TagParamSetting, string.Format(format, AdvSettingDataManager.SheetNameParam), "" + version
            });
            grid.AddRow(new List <string> {
                TagLayerSetting, string.Format(format, AdvSettingDataManager.SheetNameLayer), "" + version
            });
            grid.AddRow(new List <string> {
                TagSceneGallerySetting, string.Format(format, AdvSettingDataManager.SheetNameSceneGallery), "" + version
            });
        }
        void AddFileDataToTsv(StringGrid grid, int version, string excelFileName, string sheetName)
        {
            const string format = "{0}/Settings/{1}.tsv";
            string       tag    = AdvSheetParser.ToBootTsvTagName(sheetName);

            grid.AddRow(new List <string> {
                tag, string.Format(format, excelFileName, sheetName), "" + version
            });
        }
Example #8
0
        //シートの読み込み
        static StringGrid ReadSheet(ISheet sheet, string path, char ignoreSheetMark, bool parseFormula)
        {
            int lastRowNum = sheet.LastRowNum;

            StringGrid grid = new StringGrid(path + ":" + sheet.SheetName, sheet.SheetName, CsvType.Tsv);

            if (sheet.SheetName.Length > 0 && sheet.SheetName[0] == ignoreSheetMark)
            {
                return(grid);
            }

            for (int rowIndex = sheet.FirstRowNum; rowIndex <= lastRowNum; ++rowIndex)
            {
                IRow row = sheet.GetRow(rowIndex);

                List <string> stringList = new List <string>();
                if (row != null)
                {
                    foreach (var cell in row.Cells)
                    {
                        for (int i = stringList.Count; i < cell.ColumnIndex; ++i)
                        {
                            stringList.Add("");
                        }
                        if (parseFormula)
                        {
                            try
                            {
                                switch (cell.CellType)
                                {
                                case CellType.Formula:
                                case CellType.String:
                                    stringList.Add(cell.StringCellValue);
                                    break;

                                default:
                                    stringList.Add(cell.ToString());
                                    break;
                                }
                            }
                            catch (System.Exception e)
                            {
                                Debug.LogError(e.Message);
                                stringList.Add(cell.ToString());
                            }
                        }
                        else
                        {
                            stringList.Add(cell.ToString());
                        }
                    }
                }
                grid.AddRow(stringList);
            }
            grid.ParseHeader();
            return(grid);
        }
Example #9
0
 /// <summary>
 /// CSVにコンバートする際起動用のBootファイルを作成
 /// </summary>
 /// <param name="grid">エクセル側のデータ</param>
 public static StringGrid CreateOnCsvOnvert(StringGrid grid, int version)
 {
     if (grid == null)
     {
         grid = new StringGrid(AdvSettingDataManager.SheetNameBoot, CsvType.Tsv);
         grid.AddRow(new List <string> {
             AdvParser.Localize(AdvColumnName.Tag), AdvParser.Localize(AdvColumnName.Param1), AdvParser.Localize(AdvColumnName.Version)
         });
     }
     ///起動用データをコンバート
     AdvBootSetting.AddDefaultUrlSettingsOnCsvOnvert(grid, version);
     return(grid);
 }
Example #10
0
//#if UNITY_EDITOR

        /// <summary>
        /// エクセルからCSVファイルにコンバートする際に、シナリオ設定データをマージして作成する
        /// </summary>
        /// <param name="grid">シナリオ設定データ</param>
        /// <param name="scenarioSheetDictionary">シナリオデータ</param>
        /// <returns>マージしたシナリオ設定データ</returns>
        public static StringGrid MargeScenarioData(StringGrid grid, StringGridDictionary scenarioSheetDictionary, int version)
        {
            if (grid == null)
            {
                grid = new StringGrid(AdvSettingDataManager.SheetNameScenario, CsvType.Tsv);
                grid.AddRow(new List <string> {
                    AdvParser.Localize(AdvColumnName.FileName), AdvParser.Localize(AdvColumnName.Version)
                });
                grid.ParseHeader();
            }

            List <string> addScnenarioList = new List <string>();

            foreach (string sheetName in scenarioSheetDictionary.Keys)
            {
                bool isFind = false;
                foreach (StringGridRow row in grid.Rows)
                {
                    if (AdvParser.ParseCell <string>(row, AdvColumnName.FileName) == sheetName)
                    {
                        isFind = true;
                    }
                }
                if (!isFind)
                {
                    addScnenarioList.Add(sheetName);
                }
            }
            foreach (string sheetName in addScnenarioList)
            {
                grid.AddRow(new List <string> {
                    sheetName, "" + version
                });
            }
            return(grid);
        }
		/// <summary>
		/// CSVにコンバートする際に、デフォルトで使用するsettings系のURLリストを追加する
		/// </summary>
		/// <param name="grid"></param>
		static void AddDefaultUrlSettingsOnCsvOnvert( StringGrid grid, int version ){

			const string format = "Settings/{0}.tsv";
			grid.AddRow(new List<string> { TagScenarioSetting, string.Format(format, AdvSettingDataManager.SheetNameScenario), ""+version });
			grid.AddRow(new List<string> { TagCharacterSetting, string.Format(format, AdvSettingDataManager.SheetNameCharacter), "" + version });
			grid.AddRow(new List<string> { TagTextureSetting, string.Format(format, AdvSettingDataManager.SheetNameTexture), "" + version });
			grid.AddRow(new List<string> { TagSoundSetting, string.Format(format, AdvSettingDataManager.SheetNameSound), "" + version });
			grid.AddRow(new List<string> { TagParamSetting, string.Format(format, AdvSettingDataManager.SheetNameParam), "" + version });
			grid.AddRow(new List<string> { TagLayerSetting, string.Format(format, AdvSettingDataManager.SheetNameLayer), "" + version });
			grid.AddRow(new List<string> { TagSceneGallerySetting, string.Format(format, AdvSettingDataManager.SheetNameSceneGallery), "" + version });
		}
		/// <summary>
		/// CSVにコンバートする際起動用のBootファイルを作成
		/// </summary>
		/// <param name="grid">エクセル側のデータ</param>
		public static StringGrid CreateOnCsvOnvert(StringGrid grid, int version)
		{
			if( grid == null )
			{
				grid = new StringGrid(AdvSettingDataManager.SheetNameBoot, CsvType.Tsv);
				grid.AddRow(new List<string> { AdvParser.Localize(AdvColumnName.Tag), AdvParser.Localize(AdvColumnName.Param1), AdvParser.Localize(AdvColumnName.Version) });
			}
			///起動用データをコンバート
			AdvBootSetting.AddDefaultUrlSettingsOnCsvOnvert(grid, version);
			return grid;
		}