1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- using Blue;
- using Newtonsoft.Json;
- using Newtonsoft.Json.Linq;
- using UnityEngine;
- using UnityEngine.UI;
- namespace GHZLangChao
- {
- public class DeviceInfo_Item : AbstractController
- {
- private DeviceParameters DeviceParameter;
- public Transform currentPos;
- public DataItem item;
- [SerializeField] private Button DetailsBtn;
- private IQueueSystem mQueueSystem;
- private void Start()
- {
- DetailsBtn.onClick.AddListener(ClickDetails);
- }
- int i;
- public void Init(DeviceParameters DeviceParameter, int i, DataItem item)
- {
- this.DeviceParameter = DeviceParameter;
- this.i = i;
- this.item = item;
- }
- private void ClickDetails()
- {
- DeviceParameter.deviceModel = "NetView400" + i;
-
-
- HttpLangChaoTool.Instance.Post(HttpLangChaoAction.bladeServer, "", BladeServerCallBack);
-
- item.gameObject.SetActive(false);
- }
- private void BladeServerCallBack(string msg)
- {
- Debug.Log(msg);
- JObject json = JObject.Parse(msg);
- if (json["code"].ToString() == "200")
- {
- string data = json["data"].ToString();
- this.DeviceParameter = JsonConvert.DeserializeObject<DeviceParameters>(data);
- this.SendCommand(new DeviceDetailsUpdataDataCommand(DeviceParameter, currentPos, item));
- }
- else
- {
- Debug.LogError(" 请求刀片机详情参数出错 !!! " + HttpLangChaoAction.bladeServer);
- }
- }
- private void OnEnable()
- {
- if (mQueueSystem == null)
- mQueueSystem = this.GetService<IQueueSystem>();
- mQueueSystem.Add(gameObject);
- }
- private void OnDestroy()
- {
- mQueueSystem.Remove(gameObject);
- }
- }
- }
|