using System; using System.Collections; using System.Collections.Generic; using UnityEngine; //============================================================ //支持中文,文件使用UTF-8编码 //@author #AUTHOR# //@create #CREATEDATE# //@company #COMPANY# // //@description: //============================================================ [CreateAssetMenu(fileName = "DeviceData", menuName = "DataSheet/DeviceData")] public class SearchData : ScriptableObject { [SerializeField] public List devices = new List(); public string path; public string sheetName; [ContextMenu("set")] public void SetData() { devices.Clear(); devices = ExcelUtil.GetAllDeviceInfo(path, sheetName); } public List FuzzySearch(string name) { List temp = new List(); if (string.IsNullOrEmpty(name)) return null; for (int i = 0; i < devices.Count; i++) { if (devices[i].ID.Contains(name) || devices[i].deviceType.Contains(name) || devices[i].deviceNum.Contains(name)) { temp.Add(devices[i]); } } return temp; } } [Serializable] public class DeviceData { /// /// 设备编号 /// public string ID; /// /// 设备类型 /// public string deviceType; /// /// 生产厂家 /// public string manufacturer; /// /// 设备编号 /// public string deviceNum; /// /// 是否在机柜中 /// public string isInCabinet; /// /// 设备所占U位 /// public string uPos; }