using Newtonsoft.Json; using System.Collections.Generic; using System.Threading.Tasks; using UnityEngine; /// /// 端口-查询 /// [AddComponentMenu("端口查询")] public class PortQuery : MonoBehaviour { public PortList portList = new PortList(); private void Awake() { } private void OnEnable() { if (!string.IsNullOrEmpty(portList.id)) { gameObject.name = portList.id; } } private void Start() { portList.deviceId = transform.parent.GetComponent().deviceList.id; //await initAsync(""); } //public async Task initAsync() //{ // var jsonResult = await CombineJSON.GetJson_POST(GameManager.Inst.Jk_URL.dk_cx, GameManager.Inst.token); // Root root = JsonConvert.DeserializeObject(jsonResult); // foreach (var item in root.data) // { // if (item.id == portList.id) // { // portList = item; // break; // } // } //} /// /// 更新端口JSON /// /// string refreshJson() { string json = JsonConvert.SerializeObject(portList); //Debug.Log(json); return json; } #region JSON [System.Serializable] public class PortList { /// /// id /// [Tooltip("")] public string id; /// /// 端口 /// [Tooltip("端口")] public string port; /// /// 编号 /// [Tooltip("编号")] public string portCode; /// /// 名称 /// [Tooltip("名称")] public string portName; /// /// 端口类型 /// [Tooltip("端口类型")] public string portType; /// /// 端口位置 /// [Tooltip("端口位置")] public string portPosition; /// /// 所属设备 /// [Tooltip("所属设备")] public string deviceId; /// /// 所属设备名称 /// [Tooltip("所属设备名称")] public string deviceName; /// /// 端口型号 /// [Tooltip("端口型号")] public string portModel; /// /// 是否启用:1-正常;0-禁用 /// [Tooltip("是否启用:1-正常;0-禁用")] public string status; /// /// 对联设备 /// [Tooltip("对联设备")] public string conDevice; /// /// 对联设备名称 /// [Tooltip("对联设备名称")] public string conDeviceName; /// /// 对联端口 /// [Tooltip("对联端口")] public string conPort; /// /// 线缆名 /// [Tooltip("线缆名")] public string cableName; /// /// 线缆组名 /// [Tooltip("线缆组名")] public string cableGroupName; /// /// 备注 /// [Tooltip("备注")] public string remark; /// /// /// [Tooltip("")] public string createTime; /// /// /// [Tooltip("")] public string createName; } [System.Serializable] public class Root { /// /// /// public string code; /// /// 操作成功 /// public string message; /// /// /// public string totalRows; /// /// /// public int pageSize; /// /// /// public int pageNum; /// /// /// public List data; } #endregion }