/*Auto Create, Don't Edit !!!*/ using UnityEngine; using System.Collections.Generic; using System; using System.IO; [Serializable] public class ClimbHighExcelItem : ExcelItemBase { public int Level; public int RandomCount; public string Random1; public string Random2; public string Random3; public string Random4; public bool Settlement; public float StlTimeAwards; } [CreateAssetMenu(fileName = "ClimbHighExcelData", menuName = "Excel To ScriptableObject/Create ClimbHighExcelData", order = 1)] public class ClimbHighExcelData : ExcelDataBase { } #if UNITY_EDITOR public class ClimbHighAssetAssignment { public static bool CreateAsset(List> allItemValueRowList, string excelAssetPath) { if (allItemValueRowList == null || allItemValueRowList.Count == 0) return false; int rowCount = allItemValueRowList.Count; ClimbHighExcelItem[] items = new ClimbHighExcelItem[rowCount]; for (int i = 0; i < items.Length; i++) { items[i] = new ClimbHighExcelItem(); items[i].Level = Convert.ToInt32(allItemValueRowList[i]["Level"]); items[i].RandomCount = Convert.ToInt32(allItemValueRowList[i]["RandomCount"]); items[i].Random1 = allItemValueRowList[i]["Random1"]; items[i].Random2 = allItemValueRowList[i]["Random2"]; items[i].Random3 = allItemValueRowList[i]["Random3"]; items[i].Random4 = allItemValueRowList[i]["Random4"]; items[i].Settlement = Convert.ToBoolean(allItemValueRowList[i]["Settlement"]); items[i].StlTimeAwards = Convert.ToSingle(allItemValueRowList[i]["StlTimeAwards"]); } ClimbHighExcelData excelDataAsset = ScriptableObject.CreateInstance(); excelDataAsset.items = items; if (!Directory.Exists(excelAssetPath)) Directory.CreateDirectory(excelAssetPath); string pullPath = excelAssetPath + "/" + typeof(ClimbHighExcelData).Name + ".asset"; UnityEditor.AssetDatabase.DeleteAsset(pullPath); UnityEditor.AssetDatabase.CreateAsset(excelDataAsset, pullPath); UnityEditor.AssetDatabase.Refresh(); return true; } } #endif