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