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