9.25-3
This commit is contained in:
parent
27b5f84e4c
commit
08618f6849
|
@ -62,7 +62,7 @@ public class GameManager : MonoBehaviour
|
|||
/// <summary>
|
||||
/// 场景所有机框
|
||||
/// </summary>
|
||||
[Header("场景所有机框信息")] public List<GameObject> Racks_go;
|
||||
[Header("场景所有机框信息")] public List<GameObject> Racks_go = new List<GameObject>();
|
||||
/// <summary>
|
||||
/// 场景所有机框信息
|
||||
/// </summary>
|
||||
|
@ -71,7 +71,7 @@ public class GameManager : MonoBehaviour
|
|||
/// <summary>
|
||||
/// 场景所有机槽
|
||||
/// </summary>
|
||||
[Header("场景所有机槽信息")] public List<GameObject> MachineSlots_go;
|
||||
[Header("场景所有机槽信息")] public List<GameObject> MachineSlots_go = new List<GameObject>();
|
||||
/// <summary>
|
||||
/// 场景所有机槽信息
|
||||
/// </summary>
|
||||
|
@ -80,7 +80,7 @@ public class GameManager : MonoBehaviour
|
|||
/// <summary>
|
||||
/// 场景所有板卡
|
||||
/// </summary>
|
||||
[Header("场景所有板卡信息")] public List<GameObject> TmsCards_go;
|
||||
[Header("场景所有板卡信息")] public List<GameObject> TmsCards_go = new List<GameObject>();
|
||||
/// <summary>
|
||||
/// 场景所有板卡信息
|
||||
/// </summary>
|
||||
|
@ -91,7 +91,7 @@ public class GameManager : MonoBehaviour
|
|||
/// <summary>
|
||||
/// 场景所有端口
|
||||
/// </summary>
|
||||
[Header("场景所有端口信息")] public List<GameObject> TmsPorts_go;
|
||||
[Header("场景所有端口信息")] public List<GameObject> TmsPorts_go = new List<GameObject>();
|
||||
/// <summary>
|
||||
/// 场景所有端口信息
|
||||
/// </summary>
|
||||
|
@ -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<ENVList> ENVs;
|
||||
|
||||
[Header("告警------------------------查询接口")] public TmsAlarmQuery.Root root_AllAlarm;
|
||||
[Header("告警------------------------查询接口")] public TmsAlarmQuery.Root root_AllAlarm = new TmsAlarmQuery.Root();
|
||||
public List<TmsAlarmList> tmsAlarms;
|
||||
|
||||
///// <summary>
|
||||
|
@ -156,7 +156,10 @@ public class GameManager : MonoBehaviour
|
|||
{
|
||||
if (Menu.M_数字孪生_场景管理 == CabinetUIManager.Instance.current_menu && nowDevice != null)
|
||||
{
|
||||
if (nowDevice.GetComponent<DeviceQuery>() == null) return;
|
||||
if (nowDevice.GetComponent<DeviceQuery>() == null)
|
||||
return;
|
||||
if (nowDevice.GetComponent<DeviceQuery>().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<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
if (GameManager.Inst.nowDevice.GetComponent<DeviceQuery>().deviceList.deviceType == "3")
|
||||
return;
|
||||
DeleteFunction();
|
||||
PatternChoose.Inst.sb_xz_page.gameObject.SetActive(false);
|
||||
});
|
||||
|
||||
PatternChoose.Inst.sb_bj_page.transform.Find("删除").GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
if (GameManager.Inst.nowDevice.GetComponent<DeviceQuery>().deviceList.deviceType == "3")
|
||||
return;
|
||||
DeleteFunction();
|
||||
PatternChoose.Inst.sb_bj_page.gameObject.SetActive(false);
|
||||
});
|
||||
|
@ -670,7 +677,7 @@ public class GameManager : MonoBehaviour
|
|||
{
|
||||
foreach (var item in Cabinets_go)
|
||||
{
|
||||
if (item.GetComponent<DeviceQuery>().deviceList.id == Racks[i].rackId)
|
||||
if (item.GetComponent<DeviceQuery>().deviceList.id == Racks[i].rackId && !string.IsNullOrEmpty(Racks[i].modelNum))
|
||||
{
|
||||
//获取模型编号
|
||||
string modelNum = Racks[i].modelNum;
|
||||
|
@ -1026,10 +1033,16 @@ public class GameManager : MonoBehaviour
|
|||
{
|
||||
callback.Invoke(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
//if (!string.IsNullOrEmpty(jsonResult3))
|
||||
{
|
||||
root_AllAlarm = JsonConvert.DeserializeObject<TmsAlarmQuery.Root>(jsonResult3);
|
||||
|
||||
if (root_AllAlarm.message == "操作成功")
|
||||
{
|
||||
Array.ForEach(GameObject.FindObjectsOfType<TmsAlarmQuery>(), itme =>
|
||||
{
|
||||
itme.tmsAlarmLists.Clear();
|
||||
|
@ -1040,9 +1053,22 @@ public class GameManager : MonoBehaviour
|
|||
Debug.Log("告警查询完成" /*+ "URL:" + Jk_URL.gj_cx + "Token:" + arguments.token + "返回内容" + jsonResult3*/);
|
||||
callback?.Invoke(jsonResult3);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("告警查询失败:" + root_AllAlarm.message);
|
||||
callback?.Invoke(null);
|
||||
}
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// callback?.Invoke(null);
|
||||
//}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogWarning("序列化-告警查询错误:" + e.Message);
|
||||
callback.Invoke(null);
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
@ -1887,7 +1913,7 @@ public class GameManager : MonoBehaviour
|
|||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("获取穿透错误!");
|
||||
Debug.Log("获取地址错误!");
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
@ -1943,6 +1969,11 @@ public class GameManager : MonoBehaviour
|
|||
return (d != null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 条件-机框
|
||||
/// </summary>
|
||||
/// <param name="go"></param>
|
||||
/// <returns></returns>
|
||||
public bool IsFindRacks_go(GameObject go)
|
||||
{
|
||||
DeviceQuery d = go.GetComponent<DeviceQuery>();
|
||||
|
@ -1952,6 +1983,7 @@ public class GameManager : MonoBehaviour
|
|||
// 读取地址
|
||||
public IEnumerator LoadAddress(Action<string> callback)
|
||||
{
|
||||
#region UnityWebRequest读取
|
||||
string filePath = Application.streamingAssetsPath + "/dz.txt";
|
||||
|
||||
UnityWebRequest www = UnityWebRequest.Get(filePath);
|
||||
|
@ -1987,6 +2019,11 @@ public class GameManager : MonoBehaviour
|
|||
Debug.LogError("获取穿透失败: " + www.error);
|
||||
callback(null);
|
||||
}
|
||||
#endregion
|
||||
|
||||
//yield return 1;
|
||||
//callback("http://192.168.41.106:8081/");
|
||||
|
||||
}
|
||||
|
||||
// 获取接口信息
|
||||
|
@ -2100,7 +2137,8 @@ public class GameManager : MonoBehaviour
|
|||
{
|
||||
for (int i = 0; i < TmsPorts_go.Count; i++)
|
||||
{
|
||||
if (FindParent(TmsPorts_go[i], IsDesiredParent).activeSelf)
|
||||
var g = FindParent(TmsPorts_go[i], IsDesiredParent);
|
||||
if (g && g.activeSelf)
|
||||
TmsPorts_go[i].GetComponent<PortQuery>().hight.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
@ -2229,7 +2267,7 @@ public class GameManager : MonoBehaviour
|
|||
|
||||
xllx_cx = ct + "machineRoom/sysParam/getByCode?code=line";
|
||||
|
||||
cdqx_cx = ct + "machineRoom/menu/getMenuListByRoleId?roleId=1681476304623587330";
|
||||
cdqx_cx = ct + "machineRoom/menu/getMenus";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -246,7 +246,7 @@ public static class CombineJSON
|
|||
}
|
||||
else
|
||||
{
|
||||
Debug.Log(apiUrl + " 请求POST接口失败: " + request.error + "\nURL: " + apiUrl);
|
||||
Debug.Log(apiUrl + " 请求POST接口失败: " + request.error + "\nURL: " + apiUrl + "\nrequest.downloadHandler:" + request.downloadHandler.text);
|
||||
callback.Invoke(null);
|
||||
}
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ public static class CombineJSON
|
|||
}
|
||||
else
|
||||
{
|
||||
Debug.Log(apiUrl + " 请求Get接口失败: " + request.error + "\nURL: " + apiUrl);
|
||||
Debug.Log(apiUrl + " 请求Get接口失败: " + request.error + "\nURL: " + apiUrl + "\nrequest.downloadHandler:" + request.downloadHandler.text);
|
||||
callback.Invoke(null);
|
||||
}
|
||||
}
|
||||
|
@ -335,16 +335,7 @@ public static class CombineJSON
|
|||
{
|
||||
while (true)
|
||||
{
|
||||
//if (CabinetUIManager.Instance.SomeMethod() && GameManager.Inst.isLoading)
|
||||
//{
|
||||
// yield return new WaitForSeconds(looptime);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// yield return null;
|
||||
//}
|
||||
|
||||
//using (UnityWebRequest request = UnityWebRequest.Post(apiUrl, ""))
|
||||
UnityWebRequest request = new UnityWebRequest(apiUrl, "POST");
|
||||
{
|
||||
request.SetRequestHeader("X-Token", token);
|
||||
|
@ -381,7 +372,7 @@ public static class CombineJSON
|
|||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("请求POST接口失败: " + request.error + "\nURL: " + apiUrl);
|
||||
Debug.Log("请求POST接口失败: " + request.error + "\nURL: " + apiUrl + "\nrequest.downloadHandler:" + request.downloadHandler.text);
|
||||
}
|
||||
}
|
||||
yield return new WaitForSeconds(looptime);
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class CableUI : MonoBehaviour
|
||||
{
|
||||
public Text port_A;
|
||||
public Text port_A_cabinet;
|
||||
public Text port_A_deviceName;
|
||||
public Text port_B;
|
||||
public Text port_B_cabinet;
|
||||
public Text port_B_deviceName;
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ba2bf3aa330068f4486b11efc6d57ca4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -56,6 +56,7 @@ public class PatternChoose : MonoBehaviour
|
|||
/// 线缆
|
||||
/// </summary>
|
||||
public ByCode xianlan;
|
||||
public GameObject xianlan_popup;
|
||||
|
||||
public UIToCabinet uiToCabinet;
|
||||
|
||||
|
@ -81,20 +82,56 @@ 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) =>
|
||||
{
|
||||
if (!x)
|
||||
return;
|
||||
niaoKan_fuc();
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 点击切换房间
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 点击全景
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 点击鸟瞰
|
||||
/// </summary>
|
||||
public void niaoKan_fuc()
|
||||
{
|
||||
GameManager.Inst.editorMenu.gameObject.SetActive(false);
|
||||
ExtendedFlycam.Inst.QieHuan(CabinetUIManager.Instance.current_menu, 3);
|
||||
});
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Toggle检测
|
||||
/// </summary>
|
||||
[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<Toggle>();
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ef35a4d1fe2185a43ac237b8bfeecad0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -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
|
|||
/// <summary>
|
||||
/// 记录权限开放的菜单名
|
||||
/// </summary>
|
||||
List<string> menu_name = new List<string>();
|
||||
public List<string> menu_name = new List<string>();
|
||||
|
||||
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
|
||||
/// </summary>
|
||||
/// <param name="token"></param>
|
||||
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<Root>(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<Root>(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
|
||||
+ "\n物体IsOn: " + menu_struct[i].toggle.isOn
|
||||
+ "\n初始IsOn:" + menu_struct[i]._ison);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化菜单信息
|
||||
/// </summary>
|
||||
|
@ -266,7 +292,7 @@ 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;
|
||||
|
@ -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<Toggle>().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
|
|||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int roleFlag;
|
||||
public string roleFlag;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string parentId;
|
||||
/// <summary>
|
||||
/// 만꽉데츰냔
|
||||
///
|
||||
/// </summary>
|
||||
public string parentName;
|
||||
/// <summary>
|
||||
/// 꽉데츰냔
|
||||
/// 机柜容量
|
||||
/// </summary>
|
||||
public string menuName;
|
||||
/// <summary>
|
||||
|
@ -674,11 +700,11 @@ public class WebInteraction : MonoBehaviour
|
|||
/// </summary>
|
||||
public string parentId;
|
||||
/// <summary>
|
||||
/// 만꽉데츰냔
|
||||
///
|
||||
/// </summary>
|
||||
public string parentName;
|
||||
/// <summary>
|
||||
/// 꽉데츰냔
|
||||
/// 数字孪生
|
||||
/// </summary>
|
||||
public string menuName;
|
||||
/// <summary>
|
||||
|
@ -739,7 +765,7 @@ public class WebInteraction : MonoBehaviour
|
|||
/// </summary>
|
||||
public string code;
|
||||
/// <summary>
|
||||
/// 럿쀼斤口
|
||||
/// 操作成功
|
||||
/// </summary>
|
||||
public string message;
|
||||
/// <summary>
|
||||
|
|
|
@ -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<SearchName1>().dragController.oriObjectPrefab.gameObject.name;
|
||||
}
|
||||
else if (GameManager.Inst.nowDevice.GetComponent<DeviceQuery>().deviceList.deviceType == "3")
|
||||
{
|
||||
var cabinet = GameManager.Inst.FindParent(GameManager.Inst.nowDevice, GameManager.Inst.IsDesiredParent);
|
||||
mybody.shelfId = cabinet.GetComponent<DeviceQuery>().deviceList.id;
|
||||
}
|
||||
}
|
||||
|
||||
public void init()
|
||||
|
@ -177,6 +184,7 @@ public class AddDevice : MonoBehaviour
|
|||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("添加设备失败原因:" + URlreturn.message);
|
||||
SecondConfirmPanel.DeleteConform(null, " 添加设备失败");
|
||||
refurbish();
|
||||
}
|
||||
|
@ -279,12 +287,22 @@ public class AddDevice : MonoBehaviour
|
|||
{
|
||||
DragTest1 d = new DragTest1();
|
||||
if (GameManager.Inst.nowDevice.GetComponent<DeviceQuery>())
|
||||
{
|
||||
DeviceQuery dq = GameManager.Inst.nowDevice.GetComponent<DeviceQuery>();
|
||||
if (dq.deviceList.deviceType == "1")
|
||||
{
|
||||
d = GameManager.Inst.nowDevice.GetComponent<DragTest1>();
|
||||
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<DeviceQuery>().deviceList.id;
|
||||
mybody.devicePosition = dq.deviceList.devicePosition;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mybody.type = type.value.ToString();
|
||||
|
|
|
@ -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;
|
||||
/// <summary>
|
||||
|
@ -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;
|
||||
|
||||
/// <summary>
|
||||
/// 端口
|
||||
|
@ -67,8 +70,14 @@ public class AddPort : MonoBehaviour
|
|||
//IMapper mapper;
|
||||
PortQuery.PortList portlist;
|
||||
|
||||
/// <summary>
|
||||
/// 对联设备ID和名字关联字典
|
||||
/// </summary>
|
||||
public Dictionary<string, string> conDevice_dic = new Dictionary<string, string>();
|
||||
public string conDevice_dic_id;
|
||||
private void Awake()
|
||||
{
|
||||
save_bt_img = save_bt.GetComponent<Image>();
|
||||
addconCabinet();
|
||||
conCabinet.captionText.text = null;
|
||||
gameObject.SetActive(false);
|
||||
|
@ -86,6 +95,8 @@ public class AddPort : MonoBehaviour
|
|||
|
||||
private void OnEnable()
|
||||
{
|
||||
mybody = new Body();
|
||||
conDevice_dic.Clear();
|
||||
if (conCabinet.options.Count == 0)
|
||||
{
|
||||
addconCabinet();
|
||||
|
@ -143,6 +154,33 @@ public class AddPort : MonoBehaviour
|
|||
//{
|
||||
// Debug.Log(e.StackTrace + "**********" + e.Message);
|
||||
//}
|
||||
|
||||
tbinfo();
|
||||
}
|
||||
|
||||
public void tbinfo()
|
||||
{
|
||||
var p = GameManager.Inst.nowDevice.GetComponent<PortQuery>();
|
||||
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<string> conDevice_list = new List<string>();//对联设备
|
||||
Dictionary<string, string> conDevice_list_dict = new Dictionary<string, string>();
|
||||
|
||||
if (index != conCabinet.options.Count - 1)
|
||||
{
|
||||
var _s = GameManager.Inst.Cabinets_go[index].GetComponentsInChildren<DeviceQuery>();
|
||||
|
||||
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) =>
|
||||
|
@ -221,6 +296,7 @@ public class AddPort : MonoBehaviour
|
|||
}
|
||||
else if (y == "2")
|
||||
{
|
||||
Debug.Log("添加端口失败:该端口未配置所属设备,端口:" + mybody.port);
|
||||
SecondConfirmPanel.DeleteConform(null, "该端口未配置所属设备");
|
||||
refurbish();
|
||||
}
|
||||
|
@ -246,6 +322,7 @@ 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<KeyValuePair<string, string>> orderedList = conDevice_dic.ToList();
|
||||
try
|
||||
{
|
||||
KeyValuePair<string, string> element = orderedList.ElementAt(arg0);
|
||||
conDevice_dic_id = element.Key;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
conDevice_dic_id = null;
|
||||
}
|
||||
|
||||
|
||||
List<string> conPort_ops = new List<string>();
|
||||
//对联设备下所有端口
|
||||
//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<PortQuery>().portList;
|
||||
if (n.deviceId == conDevice.options[arg0].text)
|
||||
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<string> 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;
|
||||
|
||||
|
|
|
@ -36,7 +36,8 @@ public class DeleteDevice : MonoBehaviour
|
|||
}
|
||||
else
|
||||
{
|
||||
SecondConfirmPanel.DeleteConform(null, "删除设备失败");
|
||||
Debug.Log("删除设备失败:" + URlreturn.message);
|
||||
SecondConfirmPanel.DeleteConform(null, "删除设备失败:" + URlreturn.message);
|
||||
refurbish();
|
||||
}
|
||||
}));
|
||||
|
|
|
@ -36,6 +36,7 @@ public class DeletePort : MonoBehaviour
|
|||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("删除端口失败: " + URlreturn.message);
|
||||
SecondConfirmPanel.DeleteConform(null, "删除端口失败");
|
||||
refurbish();
|
||||
}
|
||||
|
@ -90,12 +91,18 @@ public class DeletePort : MonoBehaviour
|
|||
}));
|
||||
}
|
||||
|
||||
public IEnumerator saveJson(Action<string> callback = null)
|
||||
public IEnumerator saveJson(Action<string> callback)
|
||||
{
|
||||
var newData = JsonConvert.SerializeObject(mybody);
|
||||
|
||||
yield return StartCoroutine(
|
||||
CombineJSON.UpdateJson_POST(GameManager.Inst.Jk_URL.dk_sc, GameManager.Inst.arguments.token, newData, (jsonResult) =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(jsonResult))
|
||||
{
|
||||
callback.Invoke(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -107,6 +114,8 @@ public class DeletePort : MonoBehaviour
|
|||
Debug.Log("删除端口错误:" + e.Message);
|
||||
callback.Invoke(null);
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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<DeviceQuery>().deviceList.deviceType == "3")
|
||||
{
|
||||
//var cabinet = GameManager.Inst.FindParent(GameManager.Inst.nowDevice, GameManager.Inst.IsDesiredParent);
|
||||
mybody.shelfId = GameManager.Inst.nowDevice.transform.parent.GetComponent<DeviceQuery>().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<string> 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
|
||||
|
|
|
@ -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;
|
||||
|
||||
/// <summary>
|
||||
|
@ -70,8 +74,17 @@ public class RedactPort : MonoBehaviour
|
|||
|
||||
public InputField cableName;
|
||||
|
||||
public Text deviceName;
|
||||
|
||||
/// <summary>
|
||||
/// 对联设备ID和名字关联字典
|
||||
/// </summary>
|
||||
public Dictionary<string, string> conDevice_dic = new Dictionary<string, string>();
|
||||
public string conDevice_dic_id;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
save_bt_img = save_bt.GetComponent<Image>();
|
||||
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<RedactPort.Body, PortQuery.PortList>();
|
||||
|
@ -121,40 +136,61 @@ public class RedactPort : MonoBehaviour
|
|||
addconCabinet();
|
||||
}
|
||||
syncInfo();
|
||||
#region 正式
|
||||
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 寻找对联机柜
|
||||
/// </summary>
|
||||
public void findconCabinet()
|
||||
public string findconCabinet()
|
||||
{
|
||||
GameObject _go = null;
|
||||
List<GameObject> gos = new List<GameObject>();
|
||||
|
@ -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<DeviceQuery>().deviceList.id == mybody.conDevice)
|
||||
if (gos[i].GetComponent<DeviceQuery>().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
|
|||
/// <summary>
|
||||
/// 获取端口的对联设备和对联端口选项
|
||||
/// </summary>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
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<string> conDevice_list = new List<string>();//对联设备
|
||||
List<string> conPort_list = new List<string>();// 对联端口
|
||||
conPort_list.Add("");
|
||||
conDevice_list.Add("");
|
||||
|
||||
//加载所有对联设备和对联端口选项
|
||||
Dictionary<string, string> conDevice_list_dict = new Dictionary<string, string>();
|
||||
Dictionary<string, string> conPort_list_dict = new Dictionary<string, string>();
|
||||
|
@ -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 = "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取端口的对联设备和对联端口选项
|
||||
/// </summary>
|
||||
/// <param name="conCabinet_name">对联机柜</param>
|
||||
public void init(string conCabinet_name)
|
||||
{
|
||||
List<string> conDevice_list = new List<string>();//对联设备
|
||||
List<string> conPort_list = new List<string>();// 对联端口
|
||||
conPort_list.Add("");
|
||||
|
||||
//加载所有对联设备和对联端口选项
|
||||
Dictionary<string, string> conDevice_list_dict = new Dictionary<string, string>();
|
||||
Dictionary<string, string> conPort_list_dict = new Dictionary<string, string>();
|
||||
|
||||
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<DeviceQuery>();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in d.gameObject.GetComponentsInChildren<PortQuery>())
|
||||
{
|
||||
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<string> portType_list = new List<string>();
|
||||
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,17 +610,39 @@ public class RedactPort : MonoBehaviour
|
|||
/// <param name="index"></param>
|
||||
public void OnDropdownValueChanged_conDevice(int index)
|
||||
{
|
||||
if (index == 0) return;
|
||||
List<KeyValuePair<string, string>> orderedList = conDevice_dic.ToList();
|
||||
try
|
||||
{
|
||||
KeyValuePair<string, string> element = orderedList.ElementAt(index);
|
||||
conDevice_dic_id = element.Key;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
conDevice_dic_id = null;
|
||||
}
|
||||
|
||||
//if (index == 0) return;
|
||||
List<string> conPort_list = new List<string>();//对联端口
|
||||
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))
|
||||
{
|
||||
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();
|
||||
conPort.AddOptions(conPort_list);
|
||||
|
||||
|
@ -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<string> conDevice_list = new List<string>();//对联设备
|
||||
conDevice_list.Add("");
|
||||
Dictionary<string, string> conDevice_list_dict = new Dictionary<string, string>();
|
||||
|
||||
conDevice_list_dict.Add("", "");
|
||||
if (index != conCabinet.options.Count - 1)
|
||||
{
|
||||
var _s = GameManager.Inst.Cabinets_go[index].GetComponentsInChildren<DeviceQuery>();
|
||||
|
||||
Array.ForEach(_s, (item) =>
|
||||
{
|
||||
if (!conDevice_list_dict.ContainsKey(item.deviceList.id))
|
||||
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.id);
|
||||
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 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;
|
||||
|
||||
|
|
|
@ -41,8 +41,11 @@ public class ByCode : MonoBehaviour
|
|||
callback.Invoke("1");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("线路类型查询失败:" + myroot.message);
|
||||
callback.Invoke(null);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Log("查询线路类型接口错误:" + e.Message + e.StackTrace);
|
||||
|
@ -50,7 +53,9 @@ public class ByCode : MonoBehaviour
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
callback.Invoke(null);
|
||||
}
|
||||
}));
|
||||
|
||||
}
|
||||
|
|
|
@ -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<Root>(jsonResult);
|
||||
|
||||
//foreach (var item in root.data)
|
||||
//{
|
||||
// if (item.pointId == eNVList.pointId)
|
||||
// {
|
||||
// eNVList = item;
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
|
|
@ -50,7 +50,8 @@ public class LineQuery : MonoBehaviour
|
|||
/// <summary>
|
||||
/// 查询线缆组
|
||||
/// </summary>
|
||||
public IEnumerator getJsonCoroutine(Action<Dictionary<string, string>> callback = null)
|
||||
//public IEnumerator getJsonCoroutine(Action<Dictionary<string, string>> callback = null)
|
||||
public IEnumerator getJsonCoroutine(Action<string> 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);
|
||||
}
|
||||
|
|
|
@ -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<UPosManger>();
|
||||
GameManager.Inst.gameObject.GetComponent<DeviceManager>().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,10 +261,15 @@ public class ClickEvent : MonoBehaviour
|
|||
//p.hight.GetComponent<Renderer>().materials[0] = Resources.Load<Material>("Materials/1Tou");
|
||||
PatternChoose.Inst.transform.Find("端口类/端口配置").gameObject.SetActive(true);//√
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Physics.Raycast(ray, out hit, 100, 1 << 6 | 1 << 14))
|
||||
|
||||
|
||||
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<DeviceQuery>().deviceList.type == "1" &&
|
||||
|
@ -267,7 +282,7 @@ public class ClickEvent : MonoBehaviour
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#region MyRegion
|
||||
|
@ -831,6 +846,8 @@ public class ClickEvent : MonoBehaviour
|
|||
/// </summary>
|
||||
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
|
|||
/// <param name="hit"></param>
|
||||
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;
|
||||
//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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -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<LineInfor>();
|
||||
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>();
|
||||
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<LineRendererInteraction>();
|
||||
interaction.lineInfor = lineInfor;
|
||||
interaction.lineRenderer = xian.GetComponent<LineRenderer>();
|
||||
|
||||
PortQuery p_a = A.GetComponent<PortQuery>();
|
||||
PortQuery p_b = B.GetComponent<PortQuery>();
|
||||
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<CableUI>();
|
||||
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>();
|
||||
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<BoxCollider>();
|
||||
boxCollider2.center = bounds2.center;
|
||||
//boxCollider2.size = bounds2.size;
|
||||
boxCollider2.size = new Vector3(0.5F, lineInfor.lineWidth_min, lineInfor.lineWidth_min);
|
||||
}
|
||||
|
||||
// 生成线缆预制体
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 24cd771d07949474fac8bd302c73b048
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -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);
|
||||
// }
|
||||
//}
|
||||
|
||||
if (CabinetUIManager.Instance.jieDiWang.activeSelf)
|
||||
{
|
||||
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
|
|||
/// <summary>
|
||||
/// 展示房间
|
||||
/// </summary>
|
||||
void showRoom()
|
||||
void showRoom(int _none = 1)
|
||||
{
|
||||
if (Room.None == room)
|
||||
{
|
||||
|
@ -551,7 +573,14 @@ public class ExtendedFlycam : MonoBehaviour
|
|||
jiFang[i].SetActive(false);
|
||||
}
|
||||
}
|
||||
if (_none == 1)
|
||||
JingTou(((int)cameraTypes));
|
||||
else
|
||||
{
|
||||
cameraTypes = CameraTypes.鸟瞰;
|
||||
JingTou(((int)cameraTypes));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -62,15 +62,15 @@ public class TransparentGlow : MonoBehaviour
|
|||
/// <summary>
|
||||
/// 原始机柜模型
|
||||
/// </summary>
|
||||
private List<Material> original_jigui = new List<Material>();
|
||||
[SerializeField] private List<Material> original_jigui = new List<Material>();
|
||||
/// <summary>
|
||||
/// 原始设备模型
|
||||
/// </summary>
|
||||
private List<Material> original_shebei = new List<Material>();
|
||||
[SerializeField] private List<Material> original_shebei = new List<Material>();
|
||||
|
||||
private List<Material> _jigui;
|
||||
private List<Material> _shebei;
|
||||
private bool search_u_wei, is_jigui;
|
||||
[SerializeField] private bool search_u_wei, is_jigui;
|
||||
|
||||
/// <summary>
|
||||
/// 若脚本在机柜上,则该字段为机柜材质
|
||||
|
@ -88,7 +88,7 @@ public class TransparentGlow : MonoBehaviour
|
|||
{
|
||||
Array.ForEach(GetComponent<MeshRenderer>().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<MeshRenderer>())
|
||||
Array.ForEach(transform.GetChild(i).GetComponent<MeshRenderer>().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<MeshRenderer>(), 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<Material> mats = jigui_mats;
|
||||
List<Material> 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;
|
||||
|
|
Loading…
Reference in New Issue