diff --git a/GQ_URP/GQ/Assets/script/GameManager.cs b/GQ_URP/GQ/Assets/script/GameManager.cs
index 5b07fe26c..36f2cd5af 100644
--- a/GQ_URP/GQ/Assets/script/GameManager.cs
+++ b/GQ_URP/GQ/Assets/script/GameManager.cs
@@ -62,7 +62,7 @@ public class GameManager : MonoBehaviour
///
/// 场景所有机框
///
- [Header("场景所有机框信息")] public List Racks_go;
+ [Header("场景所有机框信息")] public List Racks_go = new List();
///
/// 场景所有机框信息
///
@@ -71,7 +71,7 @@ public class GameManager : MonoBehaviour
///
/// 场景所有机槽
///
- [Header("场景所有机槽信息")] public List MachineSlots_go;
+ [Header("场景所有机槽信息")] public List MachineSlots_go = new List();
///
/// 场景所有机槽信息
///
@@ -80,7 +80,7 @@ public class GameManager : MonoBehaviour
///
/// 场景所有板卡
///
- [Header("场景所有板卡信息")] public List TmsCards_go;
+ [Header("场景所有板卡信息")] public List TmsCards_go = new List();
///
/// 场景所有板卡信息
///
@@ -91,7 +91,7 @@ public class GameManager : MonoBehaviour
///
/// 场景所有端口
///
- [Header("场景所有端口信息")] public List TmsPorts_go;
+ [Header("场景所有端口信息")] public List TmsPorts_go = new List();
///
/// 场景所有端口信息
///
@@ -99,10 +99,10 @@ public class GameManager : MonoBehaviour
[HideInInspector] public int nowLayerMask = 6;
- [Header("环境------------------------查询接口")] public ENVQuery.Root root_AllENV;
+ [Header("环境------------------------查询接口")] public ENVQuery.Root root_AllENV = new ENVQuery.Root();
public List ENVs;
- [Header("告警------------------------查询接口")] public TmsAlarmQuery.Root root_AllAlarm;
+ [Header("告警------------------------查询接口")] public TmsAlarmQuery.Root root_AllAlarm = new TmsAlarmQuery.Root();
public List tmsAlarms;
/////
@@ -156,7 +156,10 @@ public class GameManager : MonoBehaviour
{
if (Menu.M_数字孪生_场景管理 == CabinetUIManager.Instance.current_menu && nowDevice != null)
{
- if (nowDevice.GetComponent() == null) return;
+ if (nowDevice.GetComponent() == null)
+ return;
+ if (nowDevice.GetComponent().deviceList.deviceType == "3")
+ return;
if (string.IsNullOrEmpty(nowDeviceID))
{
PatternChoose.Inst.sb_xz_page.SetActive(true);//√
@@ -184,12 +187,16 @@ public class GameManager : MonoBehaviour
});
PatternChoose.Inst.sb_xz_page.transform.Find("删除").GetComponent
public ByCode xianlan;
+ public GameObject xianlan_popup;
public UIToCabinet uiToCabinet;
@@ -81,22 +82,58 @@ public class PatternChoose : MonoBehaviour
{
if (CabinetUIManager.Instance.current_menu == Menu.M_数字孪生_智能巡检)
return;
- ExtendedFlycam.Inst.QieHuan(CabinetUIManager.Instance.current_menu, 2);
+ roomCut_fuc();
});
quanJing.onValueChanged.AddListener((x) =>
{
- GameManager.Inst.editorMenu.gameObject.SetActive(false);
- ExtendedFlycam.Inst.QieHuan(CabinetUIManager.Instance.current_menu);
+ if (!x)
+ return;
+ quanJing_fuc();
});
niaoKan.onValueChanged.AddListener((x) =>
{
- GameManager.Inst.editorMenu.gameObject.SetActive(false);
- ExtendedFlycam.Inst.QieHuan(CabinetUIManager.Instance.current_menu,3);
+ if (!x)
+ return;
+ niaoKan_fuc();
});
}
+ ///
+ /// 点击切换房间
+ ///
+ public void roomCut_fuc()
+ {
+ ExtendedFlycam.Inst.QieHuan(CabinetUIManager.Instance.current_menu, 2);
+ for (int i = 0; i < xianlan.transform.childCount; i++)
+ {
+ xianlan.transform.GetChild(i).gameObject.SetActive(false);
+ }
+ }
+
+ ///
+ /// 点击全景
+ ///
+ public void quanJing_fuc()
+ {
+ GameManager.Inst.editorMenu.gameObject.SetActive(false);
+ ExtendedFlycam.Inst.QieHuan(CabinetUIManager.Instance.current_menu);
+ for (int i = 0; i < xianlan.transform.childCount; i++)
+ {
+ xianlan.transform.GetChild(i).gameObject.SetActive(false);
+ }
+ }
+
+ ///
+ /// 点击鸟瞰
+ ///
+ public void niaoKan_fuc()
+ {
+ GameManager.Inst.editorMenu.gameObject.SetActive(false);
+ ExtendedFlycam.Inst.QieHuan(CabinetUIManager.Instance.current_menu, 3);
+ }
+
// Update is called once per frame
void Update()
{
diff --git a/GQ_URP/GQ/Assets/script/UI/ToggleController.cs b/GQ_URP/GQ/Assets/script/UI/ToggleController.cs
new file mode 100644
index 000000000..60b31f3c8
--- /dev/null
+++ b/GQ_URP/GQ/Assets/script/UI/ToggleController.cs
@@ -0,0 +1,62 @@
+using UnityEngine;
+using UnityEngine.UI;
+
+
+///
+/// Toggle
+///
+[AddComponentMenu("ToggleController/Toggle")]
+public class ToggleController : MonoBehaviour
+{
+ private Toggle toggle;
+ public bool canEnterToggleValueChanged = true; // Ƿܽ Toggle ֵı䷽
+ public bool toggleWasOn; // һ Toggle ״̬
+
+ public UIToCabinet uIToCabinet;
+
+ private void Start()
+ {
+ toggle = GetComponent();
+ toggleWasOn = toggle.isOn; // ʼ toggleWasOn
+ }
+
+ public void OnToggleClicked()
+ {
+ // ֶǷԽ Toggle ֵı䷽
+ if (CanEnterToggleValueChanged())
+ {
+ canEnterToggleValueChanged = true;
+ // Toggle ֵ
+ toggle.isOn = !toggle.isOn;
+ }
+ else
+ {
+ canEnterToggleValueChanged = false;
+ }
+ }
+
+ private void Update()
+ {
+ // Update м Toggle ֵı
+ if (canEnterToggleValueChanged && toggle.isOn != toggleWasOn)
+ {
+ //Debug.Log(gameObject.name + " ֵı: " + toggle.isOn);
+
+ toggleWasOn = toggle.isOn;
+ }
+ }
+
+ private bool CanEnterToggleValueChanged()
+ {
+ // жϣ true false
+ // true ʾԽ Toggle ֵı䷽
+ // false ʾִ Toggle ֵı䷽
+
+ return SomeConditionIsTrue();
+ }
+
+ private bool SomeConditionIsTrue()
+ {
+ return uIToCabinet.isContinue_menu;
+ }
+}
diff --git a/GQ_URP/GQ/Assets/script/UI/ToggleController.cs.meta b/GQ_URP/GQ/Assets/script/UI/ToggleController.cs.meta
new file mode 100644
index 000000000..ba354cd08
--- /dev/null
+++ b/GQ_URP/GQ/Assets/script/UI/ToggleController.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: ef35a4d1fe2185a43ac237b8bfeecad0
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/GQ_URP/GQ/Assets/script/前端交互/WebInteraction.cs b/GQ_URP/GQ/Assets/script/前端交互/WebInteraction.cs
index abae339a6..0694415c3 100644
--- a/GQ_URP/GQ/Assets/script/前端交互/WebInteraction.cs
+++ b/GQ_URP/GQ/Assets/script/前端交互/WebInteraction.cs
@@ -11,6 +11,7 @@ using Newtonsoft.Json;
public class WebInteraction : MonoBehaviour
{
+ public string s;
public static WebInteraction Inst;
public string current_videoNumber = null;
@@ -67,7 +68,7 @@ public class WebInteraction : MonoBehaviour
///
/// ¼ȨŵIJ˵
///
- List menu_name = new List();
+ public List menu_name = new List();
private void Awake()
{
@@ -81,6 +82,7 @@ public class WebInteraction : MonoBehaviour
{
//gameManager.token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2OTI2NDMyODksInVzZXJuYW1lIjoiMTgzMTIzNDU2NzgifQ.uMoC7I4SytLEgYTKHxyvOv7Lygeb9zDCmhLDYv1cJrA";
//gameManager.enabled = true;
+ unity_power_value(s);
});
}
@@ -93,7 +95,7 @@ public class WebInteraction : MonoBehaviour
/// ǰ˵ô˷Token
///
///
- public void unity_token_value(string jsonData, string roleId)
+ public void unity_token_value(string jsonData)
{
try
{
@@ -117,48 +119,6 @@ public class WebInteraction : MonoBehaviour
StartCoroutine(GameManager.Inst.LoadAddress((ct) =>
{
- #region Ȩ
- //Ȩ
- bool isgo = false;
- try
- {
- init_menu();
-
- closeMenu();
-
- root = JsonConvert.DeserializeObject(roleId);
-
- if (root.message == "ɹ")
- {
- menu_name.Clear();
- if (root.data != null && root.data.Count > 0)
- {
- for (int i = 0; i < root.data.Count; i++)
- {
- menu_name.Add(root.data[i].menuName);
- foreach (var item in root.data[i].children)
- menu_name.Add(item.menuName);
- }
- openMenu();
- setMenuIsOn_2();
- setMenuIsOn_1();
- Debug.Log("Ȩ");
- }
- else
- SecondConfirmPanel.DeleteConform(null, "Ȩ");
- }
- else
- SecondConfirmPanel.DeleteConform(null, "ȡȨʧ");
- }
- catch (Exception e)
- {
- SecondConfirmPanel.DeleteConform(null, "Ȩʧ");
- Debug.Log("Ȩش" + e.Message + "\n" + e.StackTrace);
- }
- if (!isgo)
- return;
- #endregion
-
//س
if (ct != null)
{
@@ -235,12 +195,78 @@ public class WebInteraction : MonoBehaviour
else
{
SecondConfirmPanel.DeleteConform(null, "ӿڵַ");
- Debug.Log("ȡ!");
+ Debug.Log("ȡַ!");
}
}));
}
+ public void unity_power_value(string roleId)
+ {
+ Debug.Log("@@QX1");
+ #region Ȩ
+ //Ȩ
+ bool isgo = false;
+ try
+ {
+ Debug.Log("@@QX2");
+ init_menu();
+ Debug.Log("@@QX3");
+ closeMenu();
+ Debug.Log("@@QX4");
+ root = JsonConvert.DeserializeObject(roleId);
+ Debug.Log("@@QX5");
+ if (root.message == "ɹ")
+ {
+ Debug.Log("@@QX6");
+ menu_name.Clear();
+ if (root.data != null && root.data.Count > 0)
+ {
+ for (int i = 0; i < root.data.Count; i++)
+ {
+ menu_name.Add(root.data[i].menuName);
+ foreach (var item in root.data[i].children)
+ menu_name.Add(item.menuName);
+ }
+ Debug.Log("@@QX7");
+ openMenu();
+ Debug.Log("@@QX8");
+ setMenuIsOn_2();
+ Debug.Log("@@QX9");
+ setMenuIsOn_1();
+ Debug.Log("Ȩ");
+ }
+ else
+ {
+ SecondConfirmPanel.DeleteConform(null, "Ȩ");
+ Debug.Log("@@QX10");
+ }
+ }
+ else
+ {
+ SecondConfirmPanel.DeleteConform(null, "ȡȨʧ");
+ Debug.Log("@@QX11");
+ }
+ }
+ catch (Exception e)
+ {
+ SecondConfirmPanel.DeleteConform(null, "Ȩʧ");
+ Debug.Log("Ȩش" + e.Message + "\n" + e.StackTrace);
+ }
+ Debug.Log("@@QX13");
+ //if (!isgo)
+ // return;
+ for (int i = 0; i < menu_struct.Count; i++)
+ {
+ Debug.Log(menu_struct[i].toggle.name
+ + "\n: " + menu_struct[i].toggle.gameObject.activeSelf
+ + "\nʼ: " + menu_struct[i].isState
+ + "\nIsOn: " + menu_struct[i].toggle.isOn
+ + "\nʼIsOn:" + menu_struct[i]._ison);
+ }
+ #endregion
+ }
+
///
/// ʼ˵Ϣ
///
@@ -266,11 +292,11 @@ public class WebInteraction : MonoBehaviour
bool isFind_ison = false;
for (int i = 0; i < ms.Count; i++)
{
- if (!isFind_ison && ms[i].toggle.gameObject.activeInHierarchy)
+ if (!isFind_ison && ms[i].toggle.gameObject.activeSelf)
{
ms[i]._ison = true;
- ms[i].toggle.isOn= true;
- isFind_ison = true;
+ ms[i].toggle.isOn = true;
+ isFind_ison = true;
}
else
ms[i]._ison = false;
@@ -290,7 +316,7 @@ public class WebInteraction : MonoBehaviour
bool isFind_ison = false;
for (int j = 0; j < secondary_menu[i].childCount; j++)
{
- if (!isFind_ison && secondary_menu[i].GetChild(j).gameObject.activeInHierarchy)
+ if (!isFind_ison && secondary_menu[i].GetChild(j).gameObject.activeSelf)
{
secondary_menu[i].GetChild(j).GetComponent().isOn = true;
@@ -354,11 +380,11 @@ public class WebInteraction : MonoBehaviour
{
for (int j = 0; j < menu_name.Count; j++)
{
- if (menu_struct[i].toggle.gameObject.name.Split('_')[1] == menu_name[j])
+ //if (menu_struct[i].toggle.gameObject.name.Split('_')[1] == menu_name[j])
+ if (menu_struct[i].toggle.gameObject.name.Contains(menu_name[j]))
{
menu_struct[i].toggle.gameObject.SetActive(true);
menu_struct[i].isState = true;
- i++;
break;
}
}
@@ -595,17 +621,17 @@ public class WebInteraction : MonoBehaviour
///
///
///
- public int roleFlag;
+ public string roleFlag;
///
///
///
public string parentId;
///
- /// ˵
+ ///
///
public string parentName;
///
- /// ˵
+ ///
///
public string menuName;
///
@@ -674,11 +700,11 @@ public class WebInteraction : MonoBehaviour
///
public string parentId;
///
- /// ˵
+ ///
///
public string parentName;
///
- /// ˵
+ ///
///
public string menuName;
///
@@ -739,7 +765,7 @@ public class WebInteraction : MonoBehaviour
///
public string code;
///
- /// Ϣ
+ /// ɹ
///
public string message;
///
diff --git a/GQ_URP/GQ/Assets/script/接口/修改/AddDevice.cs b/GQ_URP/GQ/Assets/script/接口/修改/AddDevice.cs
index 01d42c865..5e2640b84 100644
--- a/GQ_URP/GQ/Assets/script/接口/修改/AddDevice.cs
+++ b/GQ_URP/GQ/Assets/script/接口/修改/AddDevice.cs
@@ -52,6 +52,8 @@ public class AddDevice : MonoBehaviour
DeviceQuery.DeviceList device;
private void OnEnable()
{
+ mybody = new Body();
+ GameManager.Inst.editorMenu.gameObject.SetActive(false);
init();
//config = new MapperConfiguration(cfg =>
//{
@@ -100,6 +102,11 @@ public class AddDevice : MonoBehaviour
mybody.devicePosition = GameManager.Inst.nowDevice.transform.parent.name;
mybody.modelNum = GameManager.Inst.objectToShow_add.GetComponent().dragController.oriObjectPrefab.gameObject.name;
}
+ else if (GameManager.Inst.nowDevice.GetComponent().deviceList.deviceType == "3")
+ {
+ var cabinet = GameManager.Inst.FindParent(GameManager.Inst.nowDevice, GameManager.Inst.IsDesiredParent);
+ mybody.shelfId = cabinet.GetComponent().deviceList.id;
+ }
}
public void init()
@@ -177,6 +184,7 @@ public class AddDevice : MonoBehaviour
}
else
{
+ Debug.Log("添加设备失败原因:" + URlreturn.message);
SecondConfirmPanel.DeleteConform(null, " 添加设备失败");
refurbish();
}
@@ -280,10 +288,20 @@ public class AddDevice : MonoBehaviour
DragTest1 d = new DragTest1();
if (GameManager.Inst.nowDevice.GetComponent())
{
- d = GameManager.Inst.nowDevice.GetComponent();
- mybody.occupyNum = d.volume.ToString();
- mybody.modelNum = d.name.Replace("(Clone)", "");
- mybody.devicePosition = d.transform.parent.name;
+ DeviceQuery dq = GameManager.Inst.nowDevice.GetComponent();
+ if (dq.deviceList.deviceType == "1")
+ {
+ d = GameManager.Inst.nowDevice.GetComponent();
+ mybody.occupyNum = d.volume.ToString();
+ mybody.modelNum = d.name.Replace("(Clone)", "");
+ mybody.devicePosition = d.transform.parent.name;
+ }
+ else if (dq.deviceList.deviceType == "3")
+ {
+ var cabinet = GameManager.Inst.nowDevice.transform.parent;
+ mybody.shelfId = cabinet.GetComponent().deviceList.id;
+ mybody.devicePosition = dq.deviceList.devicePosition;
+ }
}
diff --git a/GQ_URP/GQ/Assets/script/接口/修改/AddPort.cs b/GQ_URP/GQ/Assets/script/接口/修改/AddPort.cs
index f1e183b16..4b635ccb0 100644
--- a/GQ_URP/GQ/Assets/script/接口/修改/AddPort.cs
+++ b/GQ_URP/GQ/Assets/script/接口/修改/AddPort.cs
@@ -4,9 +4,11 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
+using System.Reflection;
using System.Threading.Tasks;
using Unity.VisualScripting;
using UnityEngine;
+using UnityEngine.EventSystems;
using UnityEngine.UI;
using static GameManager;
///
@@ -17,6 +19,7 @@ public class AddPort : MonoBehaviour
public Root URlreturn;
public Body mybody = new Body();
public Button save_bt;
+ public Image save_bt_img;
///
/// 端口
@@ -67,8 +70,14 @@ public class AddPort : MonoBehaviour
//IMapper mapper;
PortQuery.PortList portlist;
+ ///
+ /// 对联设备ID和名字关联字典
+ ///
+ public Dictionary conDevice_dic = new Dictionary();
+ public string conDevice_dic_id;
private void Awake()
{
+ save_bt_img = save_bt.GetComponent();
addconCabinet();
conCabinet.captionText.text = null;
gameObject.SetActive(false);
@@ -83,14 +92,16 @@ public class AddPort : MonoBehaviour
conCabinet.AddOptions(conCabinetname);
}
-
+
private void OnEnable()
{
+ mybody = new Body();
+ conDevice_dic.Clear();
if (conCabinet.options.Count == 0)
{
addconCabinet();
conCabinet.captionText.text = null;
-
+
}
init();
port.text = null;
@@ -143,6 +154,33 @@ public class AddPort : MonoBehaviour
//{
// Debug.Log(e.StackTrace + "**********" + e.Message);
//}
+
+ tbinfo();
+ }
+
+ public void tbinfo()
+ {
+ var p = GameManager.Inst.nowDevice.GetComponent();
+ if (p)
+ {
+ mybody.port = p.portList.port;
+ mybody.portCode = p.portList.portCode;
+ mybody.portName = p.portList.portName;
+ mybody.portType = p.portList.portType;
+ mybody.portPosition = p.portList.portPosition;
+ mybody.deviceId = p.portList.deviceId;
+ //mybody.deviceName = p.portList.deviceName;
+ mybody.portModel = p.portList.portModel;
+ mybody.status = p.portList.status;
+ mybody.conDevice = p.portList.conDevice;
+ mybody.conPort = p.portList.conPort;
+ // mybody.conDeviceName = p.portList.conDeviceName;
+ mybody.cableName = p.portList.cableName;
+ mybody.cableGroupName = p.portList.cableGroupName;
+ mybody.remark = p.portList.remark;
+ //mybody.createName = p.portList.createName;
+ //mybody.createTime = p.portList.createTime;
+ }
}
private void init()
@@ -194,6 +232,7 @@ public class AddPort : MonoBehaviour
portType_list.Add(item);
}
portType_list.Add("");
+ portType.options.Clear();
portType.AddOptions(portType_list);
portType.captionText.text = "";
}
@@ -202,6 +241,7 @@ public class AddPort : MonoBehaviour
{
//deviceId.onValueChanged.AddListener(deviceId_fuc);//所属设备
conDevice.onValueChanged.AddListener(conDevice_fuc);//对联设备
+ conCabinet.onValueChanged.AddListener(OnDropdownValueChanged_conCabinet);//对联机柜
save_bt.onClick.AddListener(() =>
{
GameManager.Inst.editorMenu.gameObject.SetActive(false);
@@ -210,6 +250,41 @@ public class AddPort : MonoBehaviour
});
}
+ public void OnDropdownValueChanged_conCabinet(int index)
+ {
+ List conDevice_list = new List();//对联设备
+ Dictionary conDevice_list_dict = new Dictionary();
+
+ if (index != conCabinet.options.Count - 1)
+ {
+ var _s = GameManager.Inst.Cabinets_go[index].GetComponentsInChildren();
+
+ Array.ForEach(_s, (item) =>
+ {
+ if (!conDevice_list_dict.ContainsKey(item.deviceList.id) && !string.IsNullOrEmpty(item.deviceList.id))
+ {
+ //conDevice_list_dict.Add(item.deviceList.id, "");
+ //conDevice_list.Add(item.deviceList.id);
+ conDevice_list_dict.Add(item.deviceList.id, item.deviceList.deviceName);
+ conDevice_list.Add(item.deviceList.deviceName);
+ }
+ });
+ conDevice_list.Add("");
+ conDevice.options.Clear();
+ conDevice.AddOptions(conDevice_list);
+
+ conDevice_dic.Clear();
+ conDevice_dic = conDevice_list_dict;
+ }
+ else
+ {
+ conDevice_dic.Clear();
+ conDevice.options.Clear();
+ conDevice.captionText.text = "";
+ }
+ }
+
+
private IEnumerator SaveJsonCoroutine()
{
yield return StartCoroutine(saveJson((y) =>
@@ -219,8 +294,9 @@ public class AddPort : MonoBehaviour
SecondConfirmPanel.DeleteConform(null, "添加端口失败");
refurbish();
}
- else if (y == "2")
+ else if (y == "2")
{
+ Debug.Log("添加端口失败:该端口未配置所属设备,端口:" + mybody.port);
SecondConfirmPanel.DeleteConform(null, "该端口未配置所属设备");
refurbish();
}
@@ -246,11 +322,12 @@ public class AddPort : MonoBehaviour
}
else
{
+ Debug.Log("添加端口失败:" + URlreturn.message);
SecondConfirmPanel.DeleteConform(null, "添加端口失败");
refurbish();
}
}
- }));
+ }));
}
///
@@ -293,6 +370,18 @@ public class AddPort : MonoBehaviour
private void conDevice_fuc(int arg0)
{
+ List> orderedList = conDevice_dic.ToList();
+ try
+ {
+ KeyValuePair element = orderedList.ElementAt(arg0);
+ conDevice_dic_id = element.Key;
+ }
+ catch (Exception)
+ {
+ conDevice_dic_id = null;
+ }
+
+
List conPort_ops = new List();
//对联设备下所有端口
//conDevice.options[arg0].text//对联设备id
@@ -305,12 +394,25 @@ public class AddPort : MonoBehaviour
for (int i = 0; i < GameManager.Inst.TmsPorts_go.Count; i++)
{
var n = GameManager.Inst.TmsPorts_go[i].GetComponent().portList;
- if (n.deviceId == conDevice.options[arg0].text)
- conPort_ops.Add(n.port);
+ if (string.IsNullOrEmpty(conDevice_dic_id))
+ {
+ if (n.deviceName == conDevice.options[arg0].text)
+ //if (n.deviceId == conDevice.options[arg0].text)
+ {
+ conPort_ops.Add(n.port);
+ }
+ }
+ else
+ {
+ if (n.deviceId == conDevice_dic_id)
+ {
+ conPort_ops.Add(n.port);
+ }
+ }
}
-
conPort.options.Clear();
+ conPort_ops.Add("");
conPort.AddOptions(conPort_ops);
}
@@ -322,9 +424,28 @@ public class AddPort : MonoBehaviour
private void Update()
{
+ if ((cableGroupName.transform.Find("Dropdown List") && cableGroupName.transform.Find("Dropdown List").gameObject.activeSelf) ||
+ (portType.transform.Find("Dropdown List") && portType.transform.Find("Dropdown List").gameObject.activeSelf))
+ {
+ // 下拉菜单处于展开状态。
+ //Color color = save_bt_img.color;
+ //color.a = 0;
+ //save_bt_img.color = color;
+ save_bt.gameObject.SetActive(false);
+ }
+
+ else
+ {
+ // 下拉菜单未展开。
+ //Color color = save_bt_img.color;
+ //color.a = 1;
+ //save_bt_img.color = color;
+ save_bt.gameObject.SetActive(true);
+ }
}
+
public IEnumerator saveJson(Action callback = null)
{
if (string.IsNullOrEmpty(mybody.deviceId))
@@ -348,7 +469,9 @@ public class AddPort : MonoBehaviour
//mybody.status = status.value.ToString();
- mybody.conDevice = conDevice.captionText.text;
+ //mybody.conDevice = conDevice.captionText.text;
+
+ mybody.conDevice = conDevice_dic_id;
mybody.conPort = conPort.captionText.text;
diff --git a/GQ_URP/GQ/Assets/script/接口/修改/DeleteDevice.cs b/GQ_URP/GQ/Assets/script/接口/修改/DeleteDevice.cs
index 074355e86..4d6856648 100644
--- a/GQ_URP/GQ/Assets/script/接口/修改/DeleteDevice.cs
+++ b/GQ_URP/GQ/Assets/script/接口/修改/DeleteDevice.cs
@@ -36,7 +36,8 @@ public class DeleteDevice : MonoBehaviour
}
else
{
- SecondConfirmPanel.DeleteConform(null, "删除设备失败");
+ Debug.Log("删除设备失败:" + URlreturn.message);
+ SecondConfirmPanel.DeleteConform(null, "删除设备失败:" + URlreturn.message);
refurbish();
}
}));
diff --git a/GQ_URP/GQ/Assets/script/接口/修改/DeletePort.cs b/GQ_URP/GQ/Assets/script/接口/修改/DeletePort.cs
index dd1f4b2c4..f909285dc 100644
--- a/GQ_URP/GQ/Assets/script/接口/修改/DeletePort.cs
+++ b/GQ_URP/GQ/Assets/script/接口/修改/DeletePort.cs
@@ -36,6 +36,7 @@ public class DeletePort : MonoBehaviour
}
else
{
+ Debug.Log("删除端口失败: " + URlreturn.message);
SecondConfirmPanel.DeleteConform(null, "删除端口失败");
refurbish();
}
@@ -90,23 +91,31 @@ public class DeletePort : MonoBehaviour
}));
}
- public IEnumerator saveJson(Action callback = null)
+ public IEnumerator saveJson(Action callback)
{
var newData = JsonConvert.SerializeObject(mybody);
yield return StartCoroutine(
CombineJSON.UpdateJson_POST(GameManager.Inst.Jk_URL.dk_sc, GameManager.Inst.arguments.token, newData, (jsonResult) =>
{
- try
+ if (string.IsNullOrEmpty(jsonResult))
{
- URlreturn = JsonConvert.DeserializeObject(jsonResult);
- callback?.Invoke(jsonResult);
- }
- catch (System.Exception e)
- {
- Debug.Log("删除端口错误:" + e.Message);
callback.Invoke(null);
}
+ else
+ {
+ try
+ {
+ URlreturn = JsonConvert.DeserializeObject(jsonResult);
+ callback?.Invoke(jsonResult);
+ }
+ catch (System.Exception e)
+ {
+ Debug.Log("删除端口错误:" + e.Message);
+ callback.Invoke(null);
+ }
+
+ }
})
);
}
diff --git a/GQ_URP/GQ/Assets/script/接口/修改/RedactDevice.cs b/GQ_URP/GQ/Assets/script/接口/修改/RedactDevice.cs
index 1d201820f..83962cba8 100644
--- a/GQ_URP/GQ/Assets/script/接口/修改/RedactDevice.cs
+++ b/GQ_URP/GQ/Assets/script/接口/修改/RedactDevice.cs
@@ -40,7 +40,7 @@ public class RedactDevice : MonoBehaviour
#endregion
public Button save_bt;
-
+ public Text modelNum;
//MapperConfiguration config;
//IMapper mapper;
@@ -135,6 +135,16 @@ public class RedactDevice : MonoBehaviour
mybody.devicePosition = GameManager.Inst.nowDevice.transform.parent.name;
if (devicePosition) devicePosition.text = mybody.devicePosition;
}
+ else if (GameManager.Inst.nowDevice.GetComponent().deviceList.deviceType == "3")
+ {
+ //var cabinet = GameManager.Inst.FindParent(GameManager.Inst.nowDevice, GameManager.Inst.IsDesiredParent);
+ mybody.shelfId = GameManager.Inst.nowDevice.transform.parent.GetComponent().deviceList.id;
+ }
+
+ if (!string.IsNullOrEmpty(mybody.modelNum))
+ modelNum.text = mybody.modelNum;
+ else
+ modelNum.text = null;
}
private void Start()
@@ -152,6 +162,7 @@ public class RedactDevice : MonoBehaviour
{
if (string.IsNullOrEmpty(y))
{
+ Debug.Log("编辑设备失败");
SecondConfirmPanel.DeleteConform(null, "编辑设备失败");
refurbish();
}
@@ -176,6 +187,7 @@ public class RedactDevice : MonoBehaviour
}
else
{
+ Debug.Log("编辑设备失败: " + URlreturn.message);
SecondConfirmPanel.DeleteConform(null, "编辑设备失败");
refurbish();
}
@@ -234,7 +246,7 @@ public class RedactDevice : MonoBehaviour
public IEnumerator saveJson(Action callback)
{
- if (type.value == 0 || deviceType.value == 0 || status.value == 2) yield break;
+ if (type.value == 0 || deviceType.value == 0 || status.value > 1) yield break;
if (string.IsNullOrEmpty(mybody.id)) yield break;
try
diff --git a/GQ_URP/GQ/Assets/script/接口/修改/RedactPort.cs b/GQ_URP/GQ/Assets/script/接口/修改/RedactPort.cs
index 0002f6a03..09189eceb 100644
--- a/GQ_URP/GQ/Assets/script/接口/修改/RedactPort.cs
+++ b/GQ_URP/GQ/Assets/script/接口/修改/RedactPort.cs
@@ -3,11 +3,14 @@ using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
+using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
+using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
+using UnityEngine.EventSystems;
using UnityEngine.Networking;
using UnityEngine.UI;
using static GameManager;
@@ -20,6 +23,7 @@ public class RedactPort : MonoBehaviour
public Root URlreturn;
//public PortQuery.Root root;
public Button save_bt;
+ public Image save_bt_img;
PortQuery.PortList portlist;
///
@@ -70,8 +74,17 @@ public class RedactPort : MonoBehaviour
public InputField cableName;
+ public Text deviceName;
+
+ ///
+ /// 对联设备ID和名字关联字典
+ ///
+ public Dictionary conDevice_dic = new Dictionary();
+ public string conDevice_dic_id;
+
private void Awake()
{
+ save_bt_img = save_bt.GetComponent();
addconCabinet();
conCabinet.captionText.text = null;
gameObject.SetActive(false);
@@ -91,6 +104,8 @@ public class RedactPort : MonoBehaviour
//IMapper mapper;
private void OnEnable()
{
+ mybody = new Body();
+ conDevice_dic.Clear();
//config = new MapperConfiguration(cfg =>
//{
// cfg.CreateMap();
@@ -121,40 +136,61 @@ public class RedactPort : MonoBehaviour
addconCabinet();
}
syncInfo();
- #region 正式
- init();
+
+ string conCabinet_name = findconCabinet();
+ if (string.IsNullOrEmpty(conCabinet_name))
+ init();
+ else
+ init(conCabinet_name);
port.text = mybody.port;
portCode.text = mybody.portCode;
portName.text = mybody.portName;
- cableGroupName.captionText.text = mybody.cableGroupName;
+ //cableGroupName.captionText.text = mybody.cableGroupName;
+ int _cableGroupName = cableGroupName.options.FindIndex(option => option.text == mybody.cableGroupName);
+ if (_cableGroupName != -1)
+ {
+ cableGroupName.captionText.text = mybody.cableGroupName;
+ cableGroupName.value = _cableGroupName;
+ }
cableName.text = mybody.cableName;
//deviceId.text = mybody.deviceId;
//portModel.text = mybody.portModel;
portType.captionText.text = mybody.portType;
//portType.value = portType.options.FindIndex(option => option.text == portType.captionText.text);
- int index = portType.options.FindIndex(option => option.text == mybody.portType);
- if (index != -1)
+ int _portType = portType.options.FindIndex(option => option.text == mybody.portType);
+ if (_portType != -1)
{
portType.captionText.text = mybody.portType;
- portType.value = index;
+ portType.value = _portType;
}
else
{
Debug.LogError("端口类型不存在于下拉菜单选项中!");
}
- findconCabinet();
- conDevice.captionText.text = mybody.conDevice;
+
+ //conDevice.captionText.text = mybody.conDevice;
+ conDevice.captionText.text = mybody.conDeviceName;
//status.value = string.IsNullOrEmpty(mybody.status) ? 2 : Convert.ToInt32(mybody.status);
- if (!string.IsNullOrEmpty(mybody.conDevice))
+ if (!string.IsNullOrEmpty(mybody.conDevice) && !string.IsNullOrEmpty(conCabinet_name))
+ //if (!string.IsNullOrEmpty(mybody.conDevice))
{
//自动识别对联设备
for (int i = 0; i < conDevice.options.Count; i++)
{
- if (conDevice.options[i].text == mybody.conDevice)
+ //if (conDevice.options[i].text == mybody.conDevice)
+ if (conDevice.options[i].text == mybody.conDeviceName && !string.IsNullOrEmpty(mybody.conDeviceName))
{
- conDevice.value = 0;
+ conDevice.value = conDevice.options.Count;
conDevice.value = i;
+ conDevice.captionText.text = mybody.conDeviceName;
+
+ var _conPort = conPort.options.FindIndex(option => option.text == mybody.conPort);
+ if (_conPort != -1)
+ {
+ conPort.captionText.text = mybody.conPort;
+ conPort.value = _conPort;
+ }
break;
}
}
@@ -167,13 +203,24 @@ public class RedactPort : MonoBehaviour
cableName.text = null;
cableGroupName.captionText.text = null;
}
- #endregion
+
+ if (!string.IsNullOrEmpty(mybody.deviceName))
+ deviceName.text = mybody.deviceName;
+ else
+ deviceName.text = null;
+
+ int _conDevice = conDevice.options.FindIndex(option => option.text == mybody.conDevice);
+ if (_conDevice != -1)
+ {
+ conDevice.captionText.text = mybody.cableGroupName;
+ conDevice.value = _conDevice;
+ }
}
///
/// 寻找对联机柜
///
- public void findconCabinet()
+ public string findconCabinet()
{
GameObject _go = null;
List gos = new List();
@@ -181,7 +228,7 @@ public class RedactPort : MonoBehaviour
gos.AddRange(GameManager.Inst.TmsCards_go);
for (int i = 0; i < gos.Count; i++)
{
- if (gos[i].GetComponent().deviceList.id == mybody.conDevice)
+ if (gos[i].GetComponent().deviceList.id == mybody.conDevice && !string.IsNullOrEmpty(mybody.conDevice))
{
_go = gos[i];
break;
@@ -199,18 +246,24 @@ public class RedactPort : MonoBehaviour
{
conCabinet.value = i;
conCabinet.captionText.text = go.name;
- break;
+ return go.name;
+ //break;
}
}
//conCabinet.captionText.text = go.name;
}
+ else
+ {
+ conCabinet.captionText.text = "";
+ conCabinet.value = int.MaxValue;
+ }
}
else
{
- conCabinet.captionText.text = null;
- conCabinet.value = 99;
+ conCabinet.captionText.text = "";
+ conCabinet.value = int.MaxValue;
}
-
+ return "";
}
@@ -252,7 +305,7 @@ public class RedactPort : MonoBehaviour
mybody.portModel = portlist.portModel;
mybody.status = portlist.status;
mybody.conDevice = portlist.conDevice;
- mybody.conDevice = portlist.conDeviceName;
+ //mybody.conDevice = portlist.conDeviceName;
mybody.conPort = portlist.conPort;
mybody.cableName = portlist.cableName;
mybody.cableGroupName = portlist.cableGroupName;
@@ -324,8 +377,6 @@ public class RedactPort : MonoBehaviour
///
/// 获取端口的对联设备和对联端口选项
///
- ///
- ///
public void init()
{
//var jsonResult = await CombineJSON.GetJson_POST(GameManager.Inst.Jk_URL.dk_cx, GameManager.Inst.token);
@@ -335,7 +386,7 @@ public class RedactPort : MonoBehaviour
List conDevice_list = new List();//对联设备
List conPort_list = new List();// 对联端口
conPort_list.Add("");
- conDevice_list.Add("");
+
//加载所有对联设备和对联端口选项
Dictionary conDevice_list_dict = new Dictionary();
Dictionary conPort_list_dict = new Dictionary();
@@ -344,10 +395,11 @@ public class RedactPort : MonoBehaviour
return;
foreach (var item in GameManager.Inst.TmsPorts)
{
- if (!conDevice_list_dict.ContainsKey(item.deviceId))
+ if (!conDevice_list_dict.ContainsKey(item.deviceId) && !string.IsNullOrEmpty(item.deviceId))
{
- conDevice_list_dict.Add(item.deviceId, "");
- conDevice_list.Add(item.deviceId);
+ conDevice_list_dict.Add(item.deviceId, item.deviceName);
+ //conDevice_list.Add(item.deviceId);
+ conDevice_list.Add(item.deviceName);
}
if (!conPort_list_dict.ContainsKey(item.port))
{
@@ -356,7 +408,10 @@ public class RedactPort : MonoBehaviour
}
}
conDevice.options.Clear();
+ conDevice_list.Add("");
conDevice.AddOptions(conDevice_list);
+ conDevice_dic.Clear();
+ conDevice_dic = conDevice_list_dict;
conPort.options.Clear();
conPort.AddOptions(conPort_list);
@@ -377,10 +432,78 @@ public class RedactPort : MonoBehaviour
portType_list.Add(item);
}
portType_list.Add("");
+ portType.options.Clear();
portType.AddOptions(portType_list);
portType.captionText.text = "";
}
+ ///
+ /// 获取端口的对联设备和对联端口选项
+ ///
+ /// 对联机柜
+ public void init(string conCabinet_name)
+ {
+ List conDevice_list = new List();//对联设备
+ List conPort_list = new List();// 对联端口
+ conPort_list.Add("");
+
+ //加载所有对联设备和对联端口选项
+ Dictionary conDevice_list_dict = new Dictionary();
+ Dictionary conPort_list_dict = new Dictionary();
+
+ DeviceQuery d = null;
+ for (int i = 0; i < GameManager.Inst.Cabinets_go.Count; i++)
+ {
+ if (GameManager.Inst.Cabinets_go[i].name == conCabinet_name)
+ {
+ d = GameManager.Inst.Cabinets_go[i].GetComponent();
+ break;
+ }
+ }
+
+ foreach (var item in d.gameObject.GetComponentsInChildren())
+ {
+ if (!conDevice_list_dict.ContainsKey(item.portList.deviceId) && !string.IsNullOrEmpty(item.portList.deviceId))
+ {
+ conDevice_list_dict.Add(item.portList.deviceId, item.portList.deviceName);
+ //conDevice_list.Add(item.deviceId);
+ conDevice_list.Add(item.portList.deviceName);
+ }
+ if (!conPort_list_dict.ContainsKey(item.portList.port))
+ {
+ conPort_list_dict.Add(item.portList.port, "");
+ conPort_list.Add(item.portList.port);
+ }
+ }
+ conDevice.options.Clear();
+ conDevice_list.Add("");
+ conDevice.AddOptions(conDevice_list);
+ conDevice_dic.Clear();
+ conDevice_dic = conDevice_list_dict;
+
+ conPort.options.Clear();
+ conPort.AddOptions(conPort_list);
+
+ cableGroupName.options.Clear();
+ foreach (var item in LineQuery.Inst.keyValues.Keys)
+ {
+ Dropdown.OptionData optionData = new Dropdown.OptionData(item);
+ cableGroupName.options.Add(optionData);
+ }
+ Dropdown.OptionData optionData1 = new Dropdown.OptionData("");
+ cableGroupName.options.Add(optionData1);
+ cableGroupName.captionText.text = "";
+
+ List portType_list = new List();
+ foreach (var item in PatternChoose.Inst.xianlan.lineCode_dic.Keys)
+ {
+ portType_list.Add(item);
+ }
+ portType_list.Add("");
+ portType.options.Clear();
+ portType.AddOptions(portType_list);
+ portType.captionText.text = "";
+ }
private void Start()
{
@@ -393,6 +516,7 @@ public class RedactPort : MonoBehaviour
conDevice.onValueChanged.AddListener(OnDropdownValueChanged_conDevice);
//port.onValueChanged.AddListener(OnDropdownValueChanged_port);
conCabinet.onValueChanged.AddListener(OnDropdownValueChanged_conCabinet);
+
}
private IEnumerator SaveJsonCoroutine()
@@ -418,7 +542,8 @@ public class RedactPort : MonoBehaviour
}
else
{
- SecondConfirmPanel.DeleteConform(null, "编辑端口失败");
+ Debug.Log("编辑端口失败: " + URlreturn.message);
+ SecondConfirmPanel.DeleteConform(null, (x != null && URlreturn != null) ? URlreturn.message : "编辑端口失败");
refurbish();
}
}));
@@ -485,15 +610,37 @@ public class RedactPort : MonoBehaviour
///
public void OnDropdownValueChanged_conDevice(int index)
{
- if (index == 0) return;
+ List> orderedList = conDevice_dic.ToList();
+ try
+ {
+ KeyValuePair element = orderedList.ElementAt(index);
+ conDevice_dic_id = element.Key;
+ }
+ catch (Exception)
+ {
+ conDevice_dic_id = null;
+ }
+
+ //if (index == 0) return;
List conPort_list = new List();//对联端口
conPort_list.Add("");
- //conDevice.options[index]//对联设备ID
+
foreach (var item in GameManager.Inst.root_AllPort.data)
{
- if (item.deviceId == conDevice.options[index].text)
+ if (string.IsNullOrEmpty(conDevice_dic_id))
{
- conPort_list.Add(item.port);
+ if (item.deviceName == conDevice.options[index].text && !string.IsNullOrEmpty(item.deviceName))//conDevice.options[index]//对联设备名
+ //if (item.deviceId == conDevice.options[index].text)//conDevice.options[index]//对联设备ID
+ {
+ conPort_list.Add(item.port);
+ }
+ }
+ else
+ {
+ if (item.deviceId == conDevice_dic_id)
+ {
+ conPort_list.Add(item.port);
+ }
}
}
conPort.options.Clear();
@@ -507,6 +654,7 @@ public class RedactPort : MonoBehaviour
if (conPort.options[i].text == mybody.conPort)
{
conPort.value = i;
+ conPort.captionText.text = conPort.options[i].text;
break;
}
}
@@ -515,24 +663,59 @@ public class RedactPort : MonoBehaviour
public void OnDropdownValueChanged_conCabinet(int index)
{
List conDevice_list = new List();//对联设备
+ conDevice_list.Add("");
Dictionary conDevice_list_dict = new Dictionary();
+ conDevice_list_dict.Add("", "");
+ if (index != conCabinet.options.Count - 1)
+ {
+ var _s = GameManager.Inst.Cabinets_go[index].GetComponentsInChildren();
- var _s = GameManager.Inst.Cabinets_go[index].GetComponentsInChildren();
-
- Array.ForEach(_s, (item) =>
- {
- if (!conDevice_list_dict.ContainsKey(item.deviceList.id))
+ Array.ForEach(_s, (item) =>
{
- conDevice_list_dict.Add(item.deviceList.id, "");
- conDevice_list.Add(item.deviceList.id);
- }
- });
+ if (!conDevice_list_dict.ContainsKey(item.deviceList.id) && !string.IsNullOrEmpty(item.deviceList.id))
+ {
+ conDevice_list_dict.Add(item.deviceList.id, item.deviceList.deviceName);
+ // conDevice_list.Add(item.deviceList.id);
+ conDevice_list.Add(item.deviceList.deviceName);
+ }
+ });
+ //conDevice_list.Add("");
+ conDevice.options.Clear();
+ conDevice.AddOptions(conDevice_list);
- conDevice.options.Clear();
- conDevice.AddOptions(conDevice_list);
+ conDevice_dic.Clear();
+ conDevice_dic = conDevice_list_dict;
+ }
+ else
+ {
+ conDevice_dic.Clear();
+ conDevice.options.Clear();
+ conDevice.captionText.text = "";
+ }
}
+
+
+
private void Update()
{
+ if ((cableGroupName.transform.Find("Dropdown List") && cableGroupName.transform.Find("Dropdown List").gameObject.activeSelf) ||
+ (portType.transform.Find("Dropdown List") && portType.transform.Find("Dropdown List").gameObject.activeSelf))
+ {
+ // 下拉菜单处于展开状态。
+ //Color color = save_bt_img.color;
+ //color.a = 0;
+ //save_bt_img.color = color;
+ save_bt.gameObject.SetActive(false);
+ }
+
+ else
+ {
+ // 下拉菜单未展开。
+ //Color color = save_bt_img.color;
+ //color.a = 1;
+ //save_bt_img.color = color;
+ save_bt.gameObject.SetActive(true);
+ }
}
@@ -556,7 +739,8 @@ public class RedactPort : MonoBehaviour
//mybody.deviceId = deviceId.text;
//mybody.portModel = portModel.text;
//mybody.status = status.value.ToString();
- mybody.conDevice = conDevice.captionText.text;
+ //mybody.conDevice = conDevice.captionText.text;
+ mybody.conDevice = conDevice_dic_id;
mybody.conPort = conPort.captionText.text;
mybody.cableName = cableName.text;
diff --git a/GQ_URP/GQ/Assets/script/接口/查询/ByCode.cs b/GQ_URP/GQ/Assets/script/接口/查询/ByCode.cs
index 8b4fa82d7..9418be5a5 100644
--- a/GQ_URP/GQ/Assets/script/接口/查询/ByCode.cs
+++ b/GQ_URP/GQ/Assets/script/接口/查询/ByCode.cs
@@ -41,7 +41,10 @@ public class ByCode : MonoBehaviour
callback.Invoke("1");
}
else
+ {
+ Debug.Log("·Ͳѯʧܣ" + myroot.message);
callback.Invoke(null);
+ }
}
catch (Exception e)
{
@@ -50,7 +53,9 @@ public class ByCode : MonoBehaviour
}
}
else
+ {
callback.Invoke(null);
+ }
}));
}
diff --git a/GQ_URP/GQ/Assets/script/接口/查询/ENVQuery.cs b/GQ_URP/GQ/Assets/script/接口/查询/ENVQuery.cs
index 894b6979b..a88a7bc9e 100644
--- a/GQ_URP/GQ/Assets/script/接口/查询/ENVQuery.cs
+++ b/GQ_URP/GQ/Assets/script/接口/查询/ENVQuery.cs
@@ -19,21 +19,6 @@ public class ENVQuery : MonoBehaviour
//await initAsync("");
}
- public async Task initAsync()
- {
- //var jsonResult = await CombineJSON.GetJson_POST(GameManager.Inst.Jk_URL.hj_cx, GameManager.Inst.token);
-
- //Root root = JsonConvert.DeserializeObject(jsonResult);
-
- //foreach (var item in root.data)
- //{
- // if (item.pointId == eNVList.pointId)
- // {
- // eNVList = item;
- // break;
- // }
- //}
- }
void Update()
{
diff --git a/GQ_URP/GQ/Assets/script/接口/查询/LineQuery.cs b/GQ_URP/GQ/Assets/script/接口/查询/LineQuery.cs
index d4eafa430..75f3f634f 100644
--- a/GQ_URP/GQ/Assets/script/接口/查询/LineQuery.cs
+++ b/GQ_URP/GQ/Assets/script/接口/查询/LineQuery.cs
@@ -50,7 +50,8 @@ public class LineQuery : MonoBehaviour
///
/// ѯ
///
- public IEnumerator getJsonCoroutine(Action> callback = null)
+ //public IEnumerator getJsonCoroutine(Action> callback = null)
+ public IEnumerator getJsonCoroutine(Action callback = null)
{
Root root = new Root();
yield return StartCoroutine(getJson(root, (x) =>
@@ -59,6 +60,7 @@ public class LineQuery : MonoBehaviour
if (root != null && root.message == "ɹ")
{
keyValues.Clear();
+ dic.Clear();
if (root.data != null && root.data.Count > 0)
{
for (int i = 0; i < root.data.Count; i++)
@@ -73,16 +75,19 @@ public class LineQuery : MonoBehaviour
LineGroupManager.Instance.AddLineGroup(d.lineContentJson);
}
}
- callback?.Invoke(keyValues);
+ callback?.Invoke("1");
}
else
{
keyValues.Clear();
+ callback?.Invoke("1");
}
}
else
{
+ Debug.Log("ѯʧ: " + root.message);
SecondConfirmPanel.DeleteConform(null, "ѯʧ");
+ callback.Invoke(null);
}
}));
@@ -99,7 +104,7 @@ public class LineQuery : MonoBehaviour
root = x;
if (root != null && root.message == "ɹ")
{
- StartCoroutine(getJsonCoroutine((x) =>
+ //StartCoroutine(getJsonCoroutine((x) =>
{
foreach (var item in keyValues.Keys)
{
@@ -115,12 +120,14 @@ public class LineQuery : MonoBehaviour
}
}
callback?.Invoke("1");
- }));
+ }
+ //));
}
else
{
+ Debug.Log("ɾʧ: " + root.message);
SecondConfirmPanel.DeleteConform(null, "ɾʧ");
callback.Invoke(null);
}
@@ -146,6 +153,7 @@ public class LineQuery : MonoBehaviour
}
else
{
+ Debug.Log("ʧ: " + root.message);
SecondConfirmPanel.DeleteConform(null, "ʧ");
//LineGroupManager.Instance.AddLineGroup("", false);
}
@@ -296,7 +304,7 @@ public class LineQuery : MonoBehaviour
public IEnumerator Succeed(Action callback)
{
GameManager.Inst.isLoading = false;
-
+
yield return null;
StartCoroutine(GameManager.Inst.Initialize((x) =>
{
diff --git a/GQ_URP/GQ/Assets/script/接口/查询/PortQuery.cs b/GQ_URP/GQ/Assets/script/接口/查询/PortQuery.cs
index a8bb02f8e..713d7cfd9 100644
--- a/GQ_URP/GQ/Assets/script/接口/查询/PortQuery.cs
+++ b/GQ_URP/GQ/Assets/script/接口/查询/PortQuery.cs
@@ -28,7 +28,7 @@ public class PortQuery : MonoBehaviour
}
private void Start()
- {
+ {
portList.deviceId = transform.parent.GetComponent().deviceList.id;
//await initAsync("");
diff --git a/GQ_URP/GQ/Assets/script/点击/ClickEvent.cs b/GQ_URP/GQ/Assets/script/点击/ClickEvent.cs
index 8f9988803..034f94d1d 100644
--- a/GQ_URP/GQ/Assets/script/点击/ClickEvent.cs
+++ b/GQ_URP/GQ/Assets/script/点击/ClickEvent.cs
@@ -142,7 +142,17 @@ public class ClickEvent : MonoBehaviour
//PatternChoose.Inst.sb_bj_page.SetActive(false);.gameObject.SetActive(true);//
}
- if (drag && GameManager.Inst.nowCabine == cabinet)
+ if (string.IsNullOrEmpty(d.deviceList.id) && d.deviceList.deviceType == "3")
+ {
+ PatternChoose.Inst.sb_xz_page.SetActive(true);
+ GameManager.Inst.objectToShow_add.SetActive(false);
+ }
+ else if (!string.IsNullOrEmpty(d.deviceList.id) && d.deviceList.deviceType == "3")
+ {
+ PatternChoose.Inst.sb_bj_page.SetActive(true);
+ GameManager.Inst.objectToShow_add.SetActive(false);
+ }
+ else if (drag && GameManager.Inst.nowCabine == cabinet)
{
drag.uPosManger = GameManager.Inst.FindParent(gameObject, GameManager.Inst.IsFindParent_UPosManger).GetComponent();
GameManager.Inst.gameObject.GetComponent().uposManger = drag.uPosManger;
@@ -159,7 +169,7 @@ public class ClickEvent : MonoBehaviour
else if (Menu.M___ == CabinetUIManager.Instance.current_menu && GameManager.Inst.magnifyState)
{
- if (Physics.Raycast(ray, out hit, 100, 1 << 11 | 1 << 14))
+ if (Physics.Raycast(ray, out hit, 100, 1 << 11 /*| 1 << 14*/))
{
if (hit.collider.gameObject.layer == 14) return;
if (hit.collider.gameObject == gameObject)
@@ -251,23 +261,28 @@ public class ClickEvent : MonoBehaviour
//p.hight.GetComponent().materials[0] = Resources.Load("Materials/1Tou");
PatternChoose.Inst.transform.Find("˿/˿").gameObject.SetActive(true);//
}
- }
- }
- }
- else if (Physics.Raycast(ray, out hit, 100, 1 << 6 | 1 << 14))
- {
- if (hit.collider.gameObject.layer == 14) return;
- if (hit.collider.gameObject.GetComponent().deviceList.type == "1" &&
- hit.collider.gameObject.GetComponent().isTransparentGlow)
- {
- //Ŵ
- if (hit.collider.gameObject == gameObject && !My_magnifyState)
- {
- Change_hide(gameObject, true, true);
+
}
}
}
+
+ if (gameObject != GameManager.Inst.nowCabine)
+ {
+ if (Physics.Raycast(ray, out hit, 100, 1 << 6 | 1 << 14))
+ {
+ if (hit.collider.gameObject.layer == 14) return;
+ if (hit.collider.gameObject.GetComponent().deviceList.type == "1" &&
+ hit.collider.gameObject.GetComponent().isTransparentGlow)
+ {
+ //Ŵ
+ if (hit.collider.gameObject == gameObject && !My_magnifyState)
+ {
+ Change_hide(gameObject, true, true);
+ }
+ }
+ }
+ }
}
#region MyRegion
@@ -831,6 +846,8 @@ public class ClickEvent : MonoBehaviour
///
public void Zoomin(GameObject cabine)
{
+ ExtendedFlycam.Inst.CameraRtDisable();
+
ExtendedFlycam.Inst.QieHuan(CabinetUIManager.Instance.current_menu);
GameManager.Inst.magnifyState = true;
TransparentGlowManage.Inst.is_magnify = true;
@@ -874,7 +891,17 @@ public class ClickEvent : MonoBehaviour
FindVideo(cabine);
}
- ExtendedFlycam.Inst.CameraRtDisable();
+ if (Menu.M_ȫ_ͷ == CabinetUIManager.Instance.current_menu)
+ {
+ if (cabine.name.Contains(""))
+ {
+ for (int i = 0; i < ExtendedFlycam.Inst.peiDianShi.Count; i++)
+ {
+ ExtendedFlycam.Inst.peiDianShi[i].SetActive(true);
+ }
+ }
+ }
+
if (selected_cabient != null)
{
CameraMgr.Instance.camera_Rt.KillCameraDotween();
@@ -941,6 +968,8 @@ public class ClickEvent : MonoBehaviour
///
public void Zoomout(GameObject cabine)
{
+ ExtendedFlycam.Inst.CameraRtDisable();
+
GameManager.Inst.magnifyState = false;
TransparentGlowManage.Inst.is_magnify = false;
@@ -950,23 +979,32 @@ public class ClickEvent : MonoBehaviour
});
- ExtendedFlycam.Inst.CameraRtDisable();
GameManager.Inst.nowDeviceID = null;
My_magnifyState = false;
//ExtendedFlycam.Inst.init_mainCamera_rot();
// 屻
Debug.Log("С" + gameObject.name);
- Camera.main.transform.DOMove(TransparentGlowManage.Inst.MainCamera_pos, 1f);
- Camera.main.transform.DORotateQuaternion(Quaternion.Euler(TransparentGlowManage.Inst.MainCamera_rot), 1f).OnComplete(() =>
- {
- //ʼתǶ
- //ExtendedFlycam.Inst.initialRotationEulerAngles = Camera.main.transform.localEulerAngles;
- CameraMgr.Instance.ResumeView();
- selected_cabient = null;
- ExtendedFlycam.Inst.CameraRtEnable();
- });
+ //Camera.main.transform.DOMove(TransparentGlowManage.Inst.MainCamera_pos, 1f);
+ //Camera.main.transform.DORotateQuaternion(Quaternion.Euler(TransparentGlowManage.Inst.MainCamera_rot), 1f).OnComplete(() =>
+ //{
+ // //ʼתǶ
+ // //ExtendedFlycam.Inst.initialRotationEulerAngles = Camera.main.transform.localEulerAngles;
+ // CameraMgr.Instance.ResumeView();
+ // selected_cabient = null;
+ // ExtendedFlycam.Inst.CameraRtEnable();
+ //});
+
+ GameManager.Inst.editorMenu.gameObject.SetActive(false);
+ ExtendedFlycam.Inst.QieHuan(CabinetUIManager.Instance.current_menu);
+ CameraMgr.Instance.ResumeView();
+ selected_cabient = null;
+ ExtendedFlycam.Inst.CameraRtEnable();
+ for (int i = 0; i < PatternChoose.Inst.xianlan.transform.childCount; i++)
+ {
+ PatternChoose.Inst.xianlan.transform.GetChild(i).gameObject.SetActive(false);
+ }
}
///
diff --git a/GQ_URP/GQ/Assets/script/画线/CreateLine.cs b/GQ_URP/GQ/Assets/script/画线/CreateLine.cs
index 3f34dcd76..0da1e0a74 100644
--- a/GQ_URP/GQ/Assets/script/画线/CreateLine.cs
+++ b/GQ_URP/GQ/Assets/script/画线/CreateLine.cs
@@ -208,16 +208,16 @@ public class CreateLine : CabinetUIBase
///
//public void setPoss(ACC_Trail _prefab, List vector3s)
//{
- //_prefab.transform.parent.gameObject.SetActive(true);
- //_prefab.controlPoints.Clear();
- ////var acc = _prefab.GetComponent();
- //for (int i = 0; i < vector3s.Count; i++)
- //{
- // poss[i].position = vector3s[i];
- // _prefab.controlPoints.Add(poss[i]);
- //}
- //_prefab.SetControlPoints();
- //_prefab.UpdateSequencesPositions();
+ //_prefab.transform.parent.gameObject.SetActive(true);
+ //_prefab.controlPoints.Clear();
+ ////var acc = _prefab.GetComponent();
+ //for (int i = 0; i < vector3s.Count; i++)
+ //{
+ // poss[i].position = vector3s[i];
+ // _prefab.controlPoints.Add(poss[i]);
+ //}
+ //_prefab.SetControlPoints();
+ //_prefab.UpdateSequencesPositions();
//}
// 设置基本信息
@@ -228,13 +228,61 @@ public class CreateLine : CabinetUIBase
//prefab_xianlan.verticalCurvature = 0;
//prefab_xianlan.thickness = new Vector2(0.05f, 0.05f);
- var l = xian.AddComponent();
- l.newColor = x;
- l.lines.Add(A);
- l.lines.Add(B);
- l.cableGroupName = p.cableGroupName;
- l.cableName = p.cableName;
- l.portType = p.portType;
+ var lineInfor = xian.AddComponent();
+ lineInfor.newColor = x;
+ lineInfor.lines.Add(A);
+ lineInfor.lines.Add(B);
+ lineInfor.cableGroupName = p.cableGroupName;
+ lineInfor.cableName = p.cableName;
+ lineInfor.portType = p.portType;
+
+ LineRendererInteraction interaction = xian.AddComponent();
+ interaction.lineInfor = lineInfor;
+ interaction.lineRenderer = xian.GetComponent();
+
+ PortQuery p_a = A.GetComponent();
+ PortQuery p_b = B.GetComponent();
+ GameObject cab_a = GameManager.Inst.FindParent(A.gameObject, GameManager.Inst.IsDesiredParent);
+ GameObject cab_b = GameManager.Inst.FindParent(B.gameObject, GameManager.Inst.IsDesiredParent);
+
+ interaction.popupUI = PatternChoose.Inst.xianlan_popup;
+ interaction.cableUI = interaction.popupUI.GetComponent();
+ interaction.port_A = p_a.portList.port;
+ interaction.port_A_cabinet = cab_a != null ? cab_a.name : null;
+ interaction.port_A_deviceName = p_a.portList.deviceName;
+ interaction.port_B = p_b.portList.port;
+ interaction.port_B_cabinet = cab_b != null ? cab_b.name : null;
+ interaction.port_B_deviceName = p_b.portList.deviceName;
+ CreateCableBox(interaction, lineInfor);
+ }
+
+ public void CreateCableBox(LineRendererInteraction interaction, LineInfor lineInfor)
+ {
+ lineRenderer = interaction.lineRenderer;
+ //// 计算折线的边界框
+ //Bounds bounds = new Bounds(lineRenderer.GetPosition(0), Vector3.zero);
+ //for (int i = 1; i < lineRenderer.positionCount; i++)
+ //{
+ // bounds.Encapsulate(lineRenderer.GetPosition(i));
+ //}
+
+ Bounds bounds = new Bounds(lineRenderer.GetPosition(0), Vector3.zero);
+ bounds.Encapsulate(lineRenderer.GetPosition(1));
+
+ Bounds bounds2 = new Bounds(lineRenderer.GetPosition(lineRenderer.positionCount - 1), Vector3.zero);
+ bounds2.Encapsulate(lineRenderer.GetPosition(lineRenderer.positionCount - 2));
+
+ // 添加BoxCollider组件并设置大小和位置
+ BoxCollider boxCollider = lineRenderer.gameObject.AddComponent();
+ boxCollider.center = bounds.center;
+ //boxCollider.size = bounds.size;
+ boxCollider.size = new Vector3(0.5F, lineInfor.lineWidth_min, lineInfor.lineWidth_min);
+
+
+ BoxCollider boxCollider2 = lineRenderer.gameObject.AddComponent();
+ boxCollider2.center = bounds2.center;
+ //boxCollider2.size = bounds2.size;
+ boxCollider2.size = new Vector3(0.5F, lineInfor.lineWidth_min, lineInfor.lineWidth_min);
}
// 生成线缆预制体
diff --git a/GQ_URP/GQ/Assets/script/画线/LineRendererInteraction.cs b/GQ_URP/GQ/Assets/script/画线/LineRendererInteraction.cs
new file mode 100644
index 000000000..a14a76fb9
--- /dev/null
+++ b/GQ_URP/GQ/Assets/script/画线/LineRendererInteraction.cs
@@ -0,0 +1,65 @@
+using UnityEngine;
+using UnityEngine.UI;
+
+public class LineRendererInteraction : MonoBehaviour
+{
+ public LineRenderer lineRenderer;
+ public GameObject popupUI;
+ private bool isMouseHovering = false;
+
+ public LineInfor lineInfor;
+ public BoxCollider boxCollider;
+
+ public string port_A;
+ public string port_A_cabinet;
+ public string port_A_deviceName;
+ public string port_B;
+ public string port_B_cabinet;
+ public string port_B_deviceName;
+
+ public CableUI cableUI;
+
+ private void Awake()
+ {
+
+ }
+
+ private void OnEnable()
+ {
+ cableUI.port_A.text = this.port_A;
+ cableUI.port_A_cabinet.text = this.port_A_cabinet;
+ cableUI.port_A_deviceName.text = this.port_A_deviceName;
+ cableUI.port_B.text = this.port_B;
+ cableUI.port_B_cabinet.text = this.port_B_cabinet;
+ cableUI.port_B_deviceName.text = this.port_B_deviceName;
+ }
+
+ private void Update()
+ {
+ if (!gameObject.activeInHierarchy || !popupUI || !GameManager.Inst.magnifyState)
+ return;
+ // Ƿͣ LineRenderer
+ if (isMouseHovering)
+ {
+ // ʾ UI
+ popupUI.SetActive(true);
+ }
+ else
+ {
+ // ص UI
+ popupUI.SetActive(false);
+ }
+ }
+
+ private void OnMouseEnter()
+ {
+ // LineRenderer ʱ
+ isMouseHovering = true;
+ }
+
+ private void OnMouseExit()
+ {
+ // 뿪 LineRenderer ʱ
+ isMouseHovering = false;
+ }
+}
diff --git a/GQ_URP/GQ/Assets/script/画线/LineRendererInteraction.cs.meta b/GQ_URP/GQ/Assets/script/画线/LineRendererInteraction.cs.meta
new file mode 100644
index 000000000..7e1432aa7
--- /dev/null
+++ b/GQ_URP/GQ/Assets/script/画线/LineRendererInteraction.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 24cd771d07949474fac8bd302c73b048
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/GQ_URP/GQ/Assets/script/相机/ExtendedFlycam.cs b/GQ_URP/GQ/Assets/script/相机/ExtendedFlycam.cs
index 48e8e2258..e69956f9f 100644
--- a/GQ_URP/GQ/Assets/script/相机/ExtendedFlycam.cs
+++ b/GQ_URP/GQ/Assets/script/相机/ExtendedFlycam.cs
@@ -390,17 +390,37 @@ public class ExtendedFlycam : MonoBehaviour
xunJian_img.gameObject.SetActive(false);
}
GameObject createLine = PatternChoose.Inst.xianlan.gameObject;
- //if (CabinetUIManager.Instance.current_menu != Menu.M_数字孪生_线缆连接_展示)
- //{
- // for (int i = 0; i < createLine.transform.childCount; i++)
- // {
- // createLine.transform.GetChild(i).gameObject.SetActive(false);
- // }
- //}
- for (int i = 0; i < createLine.transform.childCount; i++)
+
+ if (CabinetUIManager.Instance.jieDiWang.activeSelf)
{
- createLine.transform.GetChild(i).gameObject.SetActive(false);
+ if (!jiFang[1].activeInHierarchy)
+ {
+ CabinetUIManager.Instance.jieDiWang.SetActive(false);
+ }
+ else
+ {
+ jiFang[4].SetActive(false);
+ }
}
+ else if (CabinetUIManager.Instance.current_menu == Menu.M_数字孪生_接地网)
+ {
+ jiFang[4].SetActive(false);
+ if (jiFang[1].activeInHierarchy)
+ {
+ CabinetUIManager.Instance.jieDiWang.SetActive(true);
+ }
+ }
+ if (CabinetUIManager.Instance.current_menu != Menu.M_数字孪生_线缆连接_展示 || room == Room.配电室)
+ {
+ for (int i = 0; i < createLine.transform.childCount; i++)
+ {
+ createLine.transform.GetChild(i).gameObject.SetActive(false);
+ }
+ }
+ //for (int i = 0; i < createLine.transform.childCount; i++)
+ //{
+ // createLine.transform.GetChild(i).gameObject.SetActive(false);
+ //}
bool isgo = true;
reminder((x) =>
{
@@ -409,6 +429,8 @@ public class ExtendedFlycam : MonoBehaviour
if (!isgo || SecondConfirmPanel.Instance.transform.GetChild(0).gameObject.activeInHierarchy)
return;
+ //if (Vector3.Distance(Camera.main.transform.position, new Vector3(5.47000027f, 19.2399025f, -4.70852375f)) <= 1f)
+ // return;
if (index == 0)
{
QuanJing();
@@ -434,8 +456,8 @@ public class ExtendedFlycam : MonoBehaviour
room = Room.机房;
else if (CabinetUIManager.Instance.current_menu == Menu.M_全景监控_现场作业)
room = Room.机房;
- else if (CabinetUIManager.Instance.current_menu == Menu.M_全景监控_摄像头)
- room = Room.机房;
+ //else if (CabinetUIManager.Instance.current_menu == Menu.M_全景监控_摄像头)
+ // room = Room.机房;
else
room = Room.None;
@@ -490,7 +512,7 @@ public class ExtendedFlycam : MonoBehaviour
// 房间状态显示(无转换)
else
{
- showRoom();
+ showRoom(state);
}
if (room == Room.机房)
@@ -513,7 +535,7 @@ public class ExtendedFlycam : MonoBehaviour
///
/// 展示房间
///
- void showRoom()
+ void showRoom(int _none = 1)
{
if (Room.None == room)
{
@@ -551,7 +573,14 @@ public class ExtendedFlycam : MonoBehaviour
jiFang[i].SetActive(false);
}
}
- JingTou(((int)cameraTypes));
+ if (_none == 1)
+ JingTou(((int)cameraTypes));
+ else
+ {
+ cameraTypes = CameraTypes.鸟瞰;
+ JingTou(((int)cameraTypes));
+ }
+
}
///
diff --git a/GQ_URP/GQ/Assets/script/透明/TransparentGlow.cs b/GQ_URP/GQ/Assets/script/透明/TransparentGlow.cs
index 2e20468b7..57f972abe 100644
--- a/GQ_URP/GQ/Assets/script/透明/TransparentGlow.cs
+++ b/GQ_URP/GQ/Assets/script/透明/TransparentGlow.cs
@@ -62,15 +62,15 @@ public class TransparentGlow : MonoBehaviour
///
/// 原始机柜模型
///
- private List original_jigui = new List();
+ [SerializeField] private List original_jigui = new List();
///
/// 原始设备模型
///
- private List original_shebei = new List();
+ [SerializeField] private List original_shebei = new List();
private List _jigui;
private List _shebei;
- private bool search_u_wei, is_jigui;
+ [SerializeField] private bool search_u_wei, is_jigui;
///
/// 若脚本在机柜上,则该字段为机柜材质
@@ -88,7 +88,7 @@ public class TransparentGlow : MonoBehaviour
{
Array.ForEach(GetComponent().materials, m =>
{
- if (!_jigui.Contains(m))
+ if (!_jigui.Contains(m) && !m.name.Contains("Tou"))
{
_jigui.Add(m);
original_jigui.Add(new Material(m));
@@ -101,7 +101,7 @@ public class TransparentGlow : MonoBehaviour
if (transform.GetChild(i).GetComponent())
Array.ForEach(transform.GetChild(i).GetComponent().materials, m =>
{
- if (!_jigui.Contains(m))
+ if (!_jigui.Contains(m) && !m.name.Contains("Tou"))
{
_jigui.Add(m);
original_jigui.Add(new Material(m));
@@ -145,12 +145,13 @@ public class TransparentGlow : MonoBehaviour
search_u_wei = true;
if (transform.Find("U位"))
{
+ original_shebei.Clear();
is_jigui = true;
Array.ForEach(transform.Find("U位").GetComponentsInChildren(), mr =>
{
Array.ForEach(mr.materials, m =>
{
- if (!_shebei.Contains(m))
+ if (!_shebei.Contains(m) && !m.name.Contains("Tou"))
{
_shebei.Add(m);
original_shebei.Add(new Material(m));
@@ -167,6 +168,11 @@ public class TransparentGlow : MonoBehaviour
}
}
+ public void Awake()
+ {
+ List mats = jigui_mats;
+ List mats1 = shebei_mats;
+ }
// Start is called before the first frame update
void Start()
@@ -205,7 +211,7 @@ public class TransparentGlow : MonoBehaviour
// Materials[i].renderQueue = 3000;
// Materials[i].SetFloat("_Transparecy", a);
//}
-
+ GameObject g = gameObject;
for (int i = 0; i < jigui_mats.Count; i++)
{
jigui_mats[i].shader = TransparentGlow_Shader;
@@ -232,7 +238,7 @@ public class TransparentGlow : MonoBehaviour
//{
// Materials[i].shader = empty[i].shader;
//}
-
+ GameObject g = gameObject;
for (int i = 0; i < jigui_mats.Count; i++)
{
jigui_mats[i].shader = original_jigui[i].shader;