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