| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- /*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<RhythmGameDataExcelItem>
- {
- }
- #if UNITY_EDITOR
- public class RhythmGameDataAssetAssignment
- {
- public static bool CreateAsset(List<Dictionary<string, string>> 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<RhythmGameDataExcelData>();
- 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
|