/// <summary> /// 读取表数据,生成对应的数组 /// </summary> /// <param name="filePath">excel文件全路径</param> /// <returns>ItemDescribe数组</returns> public static ItemDescribe[] CreateItemDescribeArrayWithExcel(string filePath) { //获得表数据 int columnNum = 0, rowNum = 0; DataRowCollection collect = ReadExcel(filePath, ref columnNum, ref rowNum); //根据excel的定义,第二行开始才是数据 ItemDescribe[] array = new ItemDescribe[rowNum - 1]; for (int i = 1; i < rowNum; i++) { ItemDescribe ItemDescribe = new ItemDescribe(); //解析每列的数据 ItemDescribe.ItemName = collect[i][0].ToString(); ItemDescribe.Describe = collect[i][1].ToString(); array[i - 1] = ItemDescribe; } return(array); }
void Awake() { instance = this; label = GetComponentInChildren <UILabel>(); gameObject.SetActive(false); }