Beispiel #1
0
        List <ConvertFileList.CusomFileVersionUpInfo> VersionUpScenrioSub(AdvFileListConverter converter)
        {
            List <ConvertFileList.CusomFileVersionUpInfo> list = new List <ConvertFileList.CusomFileVersionUpInfo>();

            AdvExcelCsvConverter excelConverter             = new AdvExcelCsvConverter();
            List <AdvExcelCsvConverter.CsvInfo> csvInfoList = new List <AdvExcelCsvConverter.CsvInfo>();

            foreach (AdvScenarioDataProject.ChapterData item in ProjectSetting.ChapterDataList)
            {
                if (!excelConverter.TryConvertToCsvList(item.ExcelPathList, item.chapterName, 0, ref csvInfoList))
                {
                    throw new System.Exception("Convert is failed");
                }
            }

            int count = 0;

            foreach (AdvExcelCsvConverter.CsvInfo csvInfo in csvInfoList)
            {
                ConvertFileList.CusomFileVersionUpInfo versionUpInfo;
                if (converter.TryVersionUpFileFromMem(csvInfo.Path + ExtensionUtil.TSV, System.Text.Encoding.UTF8.GetBytes(csvInfo.Grid.ToText()), out versionUpInfo))
                {
                    ++count;
                }
                list.Add(versionUpInfo);
            }
            Debug.Log(string.Format("Scenairo {0}/{1} files updateted", count, csvInfoList.Count));
            return(list);
        }
Beispiel #2
0
        /// <summary>
        /// エクセルをコンバート
        /// </summary>
        public static void Convert()
        {
            if (ProjectData == null)
            {
                Debug.LogWarning("Scenario Data Excel project is no found");
                return;
            }
            if (string.IsNullOrEmpty(ProjectData.ConvertPath))
            {
                Debug.LogWarning("Convert Path is not defined");
                return;
            }
            AdvExcelCsvConverter converter = new AdvExcelCsvConverter();

            foreach (var item in ProjectData.ChapterDataList)
            {
                if (!converter.Convert(ProjectData.ConvertPath, item.ExcelPathList, item.chapterName, ProjectData.ConvertVersion))
                {
                    Debug.LogWarning("Convert is failed");
                    return;
                }
            }
            if (ProjectData.IsAutoUpdateVersionAfterConvert)
            {
                ProjectData.ConvertVersion = ProjectData.ConvertVersion + 1;
                EditorUtility.SetDirty(ProjectData);
            }
        }
		/// <summary>
		/// エクセルをコンバート
		/// </summary>
		public static void Convert()
		{
			if (ProjectData == null)
			{
				Debug.LogWarning("Scenario Data Excel project is no found");
				return;
			}
			if (string.IsNullOrEmpty(ProjectData.ConvertPath))
			{
				Debug.LogWarning("Convert Path is not defined");
				return;
			}
			AdvExcelCsvConverter converter = new AdvExcelCsvConverter();
			if ( !converter.Convert(ProjectData.ConvertPath, ProjectData.ExcelPathList, ProjectData.ConvertVersion ) )
			{
				Debug.LogWarning("Convert is failed");
				return;
			}
			if (ProjectData.IsAutoUpdateVersionAfterConvert)
			{
				ProjectData.ConvertVersion = ProjectData.ConvertVersion + 1;
				EditorUtility.SetDirty(ProjectData);
			}
		}