123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- using System.Collections;
- using System.Collections.Generic;
- using GHZLangChao;
- using SC.XR.Unity.Module_InputSystem;
- using TMPro;
- using UnityEngine;
- using UnityEngine.UI;
- public class DataItem : MonoBehaviour
- {
- public int ID;
- public int tagId;
- public Vector3 offsetPos;
- public int eulerAxle;
- public TextMeshProUGUI idText;
-
- public bool isSelect;
-
-
- public MachineParameters machineParameters;
- public RectTransform bgTransform;
- private BoxCollider boxCollider;
- private MeshRenderer meshRenderer;
- private ManipulationHandler manipulationHandler;
- private void Start()
- {
- boxCollider = this.GetComponent<BoxCollider>();
- boxCollider.enabled = false;
- meshRenderer = this.GetComponent<MeshRenderer>();
- meshRenderer.enabled = false;
- manipulationHandler = this.GetComponent<ManipulationHandler>();
- manipulationHandler.enabled = false;
- }
- public void Init( MachineParameters machineParameters)
- {
- this.ID = machineParameters.deviceId;
- this.offsetPos = machineParameters.offsetPos;
- this.eulerAxle = machineParameters.eulerAxle;
- idText.text = " 当前设备ID为: " + ID;
- this.gameObject.name = "DataItem" + ID;
- BladeServerManager.Instance.listTagTracking.Add(this);
-
- this.machineParameters = machineParameters;
- this.tagId = machineParameters.tagID;
-
-
-
- }
- private List<DeviceParameters> DeviceParameterList;
- public List<DeviceInfo_Item> DeviceInfoList = new List<DeviceInfo_Item>();
- public void SetDeviceParametersData(List<DeviceParameters> DeviceParameterList)
- {
- this.DeviceParameterList = DeviceParameterList;
- for (int i = 0; i < DeviceInfoList.Count;i++)
- {
- DeviceInfoList[i].Init(DeviceParameterList[0],i,this);
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- public void SetSelect(bool state)
- {
- meshRenderer.enabled = state;
- boxCollider.enabled = state;
- manipulationHandler.enabled = state;
- }
- public void SelectObj(Transform selectPanel )
- {
- transform.position = new Vector3(selectPanel.position.x, selectPanel.position.y, 0);
- }
- private void Update()
- {
- if(isSelect)
- {
-
- }
-
- }
- public void SaveEdiotrData( Transform foundTag)
- {
-
-
-
- transform.SetParent(foundTag);
- offsetPos = transform.localPosition;
- transform.SetParent(null);
- SaveData();
- }
- public void SaveData()
- {
-
-
-
-
-
-
-
-
- if (machineParameters != null)
- machineParameters.offsetPos = offsetPos;
- MachineRoomManager.Instance.SaveAllData();
- }
- }
|