698 lines
26 KiB
C#
698 lines
26 KiB
C#
using DG.Tweening;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
|
|
|
|
/// <summary>
|
|
/// 搜索框
|
|
/// </summary>
|
|
public class SearchName : MonoBehaviour
|
|
{
|
|
public GameObject scrollView;
|
|
public Transform scrollViewContent;
|
|
public TMP_InputField inputField;
|
|
public GameObject prefabsText;
|
|
/// <summary>
|
|
/// 搜索按钮
|
|
/// </summary>
|
|
public Button serarchBtn;
|
|
[Header("加入需要搜索的设备名称")]
|
|
public List<GameObject> objs = new List<GameObject>();
|
|
public List<string> objs_str = new List<string>();
|
|
//展示的名字
|
|
private List<string> SearchObjects = new List<string>();
|
|
|
|
public List<GameObject> button_objects = new List<GameObject>();
|
|
|
|
public SearchType searchType;
|
|
|
|
/// <summary>
|
|
/// 线缆组中不包含线缆的线缆组名
|
|
/// </summary>
|
|
public Dictionary<string, string> dic_notContain = new Dictionary<string, string>();
|
|
|
|
public float initialHeight;
|
|
public RectTransform rectTransform;
|
|
public GameObject biaoTou;
|
|
public Image bg;
|
|
|
|
private void Awake()
|
|
{
|
|
rectTransform = scrollView.GetComponent<RectTransform>();
|
|
initialHeight = rectTransform.sizeDelta.y;
|
|
rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, 0);
|
|
gameObject.SetActive(false);
|
|
biaoTou.SetActive(false);
|
|
}
|
|
void Start()
|
|
{
|
|
//searchType = SearchType.None;
|
|
//scrollView.SetActive(false);
|
|
InputFieldEvent();
|
|
|
|
OnClickSearchBtn();
|
|
}
|
|
|
|
private void OnClickSearchBtn()
|
|
{
|
|
serarchBtn.onClick.AddListener(() =>
|
|
{
|
|
//PatternChoose.Inst.DetectCharacters((x) =>
|
|
//{
|
|
// if (x)
|
|
// {
|
|
// PatternChoose.Inst.sb_ck_page.SetActive(false);
|
|
// show_menu();
|
|
// }
|
|
// else
|
|
// return;
|
|
//}, inputField);
|
|
if (searchType == SearchType.None)
|
|
return;
|
|
if (!string.IsNullOrEmpty(inputField.text))
|
|
{
|
|
Serach(inputField.text);
|
|
}
|
|
else
|
|
{
|
|
Serach(null);
|
|
}
|
|
PatternChoose.Inst.sb_ck_page.SetActive(false);
|
|
show_menu();
|
|
});
|
|
}
|
|
|
|
void InputFieldEvent()
|
|
{
|
|
inputField.onValueChanged.AddListener(a =>
|
|
{
|
|
if (searchType == SearchType.None)
|
|
return;
|
|
if (a != "")
|
|
{
|
|
Serach(a);
|
|
}
|
|
else
|
|
{
|
|
Serach(null);
|
|
}
|
|
});
|
|
}
|
|
|
|
public void Serach(string strName = null)
|
|
{
|
|
|
|
if (string.IsNullOrEmpty(strName))
|
|
{
|
|
for (int i = 0; i < scrollViewContent.childCount; i++)
|
|
{
|
|
scrollViewContent.GetChild(i).gameObject.SetActive(true);
|
|
}
|
|
return;
|
|
}
|
|
|
|
//SearchObjects.Clear();
|
|
|
|
for (int i = 0; i < scrollViewContent.childCount; i++)
|
|
{
|
|
//Destroy(scrollViewContent.GetChild(i).gameObject);
|
|
scrollViewContent.GetChild(i).gameObject.SetActive(false);
|
|
}
|
|
|
|
int index = 0;
|
|
foreach (var go in objs_str)
|
|
{
|
|
if (!string.IsNullOrEmpty(strName))
|
|
{
|
|
if (go.Contains(strName))
|
|
{
|
|
//SearchObjects.Add(go);
|
|
scrollViewContent.GetChild(index).gameObject.SetActive(true);
|
|
}
|
|
}
|
|
//else
|
|
//{
|
|
// SearchObjects.Add(go);
|
|
//}
|
|
index++;
|
|
}
|
|
|
|
//if (string.IsNullOrEmpty(strName))
|
|
//{
|
|
// for (int i = 0; i < scrollViewContent.childCount; i++)
|
|
// {
|
|
// //Destroy(scrollViewContent.GetChild(i).gameObject);
|
|
// scrollViewContent.GetChild(i).gameObject.SetActive(true);
|
|
// }
|
|
//}
|
|
|
|
for (int i = 0; i < SearchObjects.Count; i++)
|
|
{
|
|
//GameObject tmp = Instantiate(prefabsText, scrollViewContent, false);
|
|
//TextMeshProUGUI text = tmp.GetComponentInChildren<TextMeshProUGUI>();
|
|
TextMeshProUGUI text = scrollViewContent.GetChild(i).GetComponentInChildren<TextMeshProUGUI>();
|
|
text.text = SearchObjects[i];
|
|
}
|
|
|
|
addonClick();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 机柜列表
|
|
/// </summary>
|
|
public void LoadCabinet(SearchType type)
|
|
{
|
|
inputField.text = string.Empty;
|
|
searchType = type;
|
|
if (!gameObject.activeSelf)
|
|
gameObject.SetActive(true);
|
|
|
|
|
|
init();
|
|
|
|
for (int i = 0; i < GameManager.Inst.Cabinets_go.Count; i++)
|
|
{
|
|
objs.Add(GameManager.Inst.Cabinets_go[i]);
|
|
string s = GameManager.Inst.Cabinets_go[i].GetComponent<DeviceQuery>().deviceList.deviceName;
|
|
objs_str.Add(s);
|
|
SearchObjects.Add(s);
|
|
}
|
|
|
|
for (int i = 0; i < SearchObjects.Count; i++)
|
|
{
|
|
GameObject tmp = Instantiate(prefabsText, scrollViewContent, false);
|
|
TextMeshProUGUI text = tmp.GetComponentInChildren<TextMeshProUGUI>();
|
|
text.text = SearchObjects[i];
|
|
button_objects.Add(tmp);
|
|
}
|
|
|
|
addonClick();
|
|
|
|
}
|
|
|
|
public int _co = -1;
|
|
public RoomInspection roomInspection = new RoomInspection();
|
|
/// <summary>
|
|
/// 添加列表点击方法
|
|
/// </summary>
|
|
public void addonClick()
|
|
{
|
|
int childCount = SearchObjects.Count;
|
|
for (int i = 0; i < childCount; i++)
|
|
{
|
|
var co = i;
|
|
int eventCount = scrollViewContent.GetChild(i).GetComponent<Button>().onClick.GetPersistentEventCount();
|
|
|
|
if (eventCount > 0)
|
|
scrollViewContent.GetChild(i).GetComponent<Button>().onClick.RemoveAllListeners();
|
|
//FindGo(objs, i, (go) =>
|
|
//{
|
|
//var jigui = GameManager.Inst.FindParent(scrollViewContent.GetChild(i).gameObject, GameManager.Inst.IsDesiredParent);
|
|
switch (searchType)
|
|
{
|
|
case SearchType.None:
|
|
break;
|
|
case SearchType.机柜:
|
|
{
|
|
scrollViewContent.GetChild(co).GetComponent<Button>().onClick.AddListener(() =>
|
|
{
|
|
//Debug.Log(co);
|
|
_co = co;
|
|
objs[co].GetComponent<ClickEvent>().Change_hide(objs[co], true, true);
|
|
//if (jigui)
|
|
//{
|
|
// jigui.GetComponent<ClickEvent>().Zoomin();
|
|
//}
|
|
});
|
|
}
|
|
break;
|
|
case SearchType.线缆组_展示:
|
|
{
|
|
scrollViewContent.GetChild(co).GetComponent<Button>().onClick.AddListener(() =>
|
|
{
|
|
//List<TransparentGlow> t = new List<TransparentGlow>();
|
|
//TransparentGlowManage.Inst.transparencyALL(t.ToArray());
|
|
|
|
//CreateLine createLine = PatternChoose.Inst.huaXian;
|
|
//var lines = createLine.xianLan.Find(objs[i].GetComponent<PortQuery>().portList.remark).GetComponent<LineInfor>().lines;
|
|
|
|
|
|
|
|
//var A = GameManager.Inst.FindParent(objs[co].gameObject, GameManager.Inst.IsDesiredParent);
|
|
////var B = GameManager.Inst.FindParent(lines[1].gameObject, GameManager.Inst.IsDesiredParent);
|
|
//var B_ = Array.Find(GameManager.Inst.TmsPorts_go.ToArray(), (item) =>
|
|
// {
|
|
// try
|
|
// {
|
|
// return (item.GetComponent<PortQuery>().portList.conPort == objs[co].GetComponent<PortQuery>().portList.port &&
|
|
// item.GetComponent<PortQuery>().portList.remark == objs[co].GetComponent<PortQuery>().portList.remark);
|
|
// }
|
|
// catch
|
|
// {
|
|
// return false;
|
|
|
|
// }
|
|
// });
|
|
//var B = GameManager.Inst.FindParent(B_, GameManager.Inst.IsDesiredParent);
|
|
|
|
//List<TransparentGlow> transparentGlows = new List<TransparentGlow>();
|
|
|
|
//transparentGlows.Add(A.GetComponent<TransparentGlow>());
|
|
//transparentGlows.Add(B.GetComponent<TransparentGlow>());
|
|
|
|
#region 没封装
|
|
//List<TransparentGlow> transparentGlows = new List<TransparentGlow>();
|
|
|
|
//var s = PatternChoose.Inst.xianlan.gameObject.GetComponentsInChildren<LineInfor>(true);
|
|
//Array.ForEach(s, (item) =>
|
|
//{
|
|
// if (item.cableGroupName == objs_str[co])
|
|
// {
|
|
// if (ExtendedFlycam.Room.配电室 != ExtendedFlycam.Inst.room)
|
|
// {
|
|
// for (int i = 0; i < GameManager.Inst.Cabinets_go.Count; i++)
|
|
// {
|
|
// GameManager.Inst.Cabinets_go[i].GetComponent<TransparentGlow>().F1();
|
|
// }
|
|
// ;
|
|
// GameObject go1 = GameManager.Inst.FindParent(item.lines[0].gameObject, GameManager.Inst.IsDesiredParent);
|
|
// GameObject go2 = GameManager.Inst.FindParent(item.lines[1].gameObject, GameManager.Inst.IsDesiredParent);
|
|
// transparentGlows.Add(go1.GetComponent<TransparentGlow>());
|
|
// transparentGlows.Add(go2.GetComponent<TransparentGlow>());
|
|
// item.gameObject.SetActive(true);
|
|
// }
|
|
// else
|
|
// {
|
|
// PatternChoose.Inst.quanJing_fuc();
|
|
// for (int i = 0; i < GameManager.Inst.Cabinets_go.Count; i++)
|
|
// {
|
|
// GameManager.Inst.Cabinets_go[i].GetComponent<TransparentGlow>().F1();
|
|
// }
|
|
// GameObject go1 = GameManager.Inst.FindParent(item.lines[0].gameObject, GameManager.Inst.IsDesiredParent);
|
|
// GameObject go2 = GameManager.Inst.FindParent(item.lines[1].gameObject, GameManager.Inst.IsDesiredParent);
|
|
// transparentGlows.Add(go1.GetComponent<TransparentGlow>());
|
|
// transparentGlows.Add(go2.GetComponent<TransparentGlow>());
|
|
// item.gameObject.SetActive(true);
|
|
// }
|
|
// }
|
|
// else if (dic_notContain.ContainsKey(objs_str[co]))
|
|
// {
|
|
// //弹出提示——该线缆组不包含线缆
|
|
// SecondConfirmPanel.DeleteConform(null, "该线缆组不包含线缆");
|
|
// //关闭多余线缆机柜
|
|
// item.gameObject.SetActive(false);
|
|
// }
|
|
// else
|
|
// {
|
|
// item.gameObject.SetActive(false);
|
|
// }
|
|
//});
|
|
|
|
//for (int i = 0; i < PatternChoose.Inst.xianlan.transform.childCount; i++)
|
|
//{
|
|
// if (PatternChoose.Inst.xianlan.transform.GetChild(i).name == objs_str[co])
|
|
// {
|
|
// var _CAB = PatternChoose.Inst.xianlan.transform.GetChild(i).GetComponentsInChildren<LineInfor>(true);
|
|
// foreach (var item in _CAB)
|
|
// {
|
|
// GameObject go1 = GameManager.Inst.FindParent(item.lines[0].gameObject, GameManager.Inst.IsDesiredParent);
|
|
// GameObject go2 = GameManager.Inst.FindParent(item.lines[1].gameObject, GameManager.Inst.IsDesiredParent);
|
|
// transparentGlows.Add(go1.GetComponent<TransparentGlow>());
|
|
// transparentGlows.Add(go2.GetComponent<TransparentGlow>());
|
|
// }
|
|
// PatternChoose.Inst.xianlan.transform.GetChild(i).gameObject.SetActive(true);
|
|
// }
|
|
// else if (dic_notContain.ContainsKey(objs_str[co]))
|
|
// {
|
|
// //弹出提示——该线缆组不包含线缆
|
|
// SecondConfirmPanel.DeleteConform(null, "该线缆组不包含线缆");
|
|
// //关闭多余线缆机柜
|
|
// PatternChoose.Inst.xianlan.transform.GetChild(i).gameObject.SetActive(false);
|
|
// }
|
|
// else
|
|
// {
|
|
// PatternChoose.Inst.xianlan.transform.GetChild(i).gameObject.SetActive(false);
|
|
// }
|
|
//}
|
|
|
|
|
|
//TransparentGlowManage.Inst.renewALL(transparentGlows.ToArray());
|
|
#endregion
|
|
_co = co;
|
|
showXianLan(_co);
|
|
});
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
//});
|
|
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 展示线缆组
|
|
/// </summary>
|
|
/// <param name="co"></param>
|
|
public void showXianLan(int co)
|
|
{
|
|
bool isFind = false;
|
|
List<TransparentGlow> transparentGlows = new List<TransparentGlow>();
|
|
|
|
var s = PatternChoose.Inst.xianlan.gameObject.GetComponentsInChildren<LineInfor>(true);
|
|
Array.ForEach(s, (item) =>
|
|
{
|
|
if (item.cableGroupName == objs_str[co])
|
|
{
|
|
isFind = true;
|
|
if (ExtendedFlycam.Room.配电室 != ExtendedFlycam.Inst.room)
|
|
{
|
|
for (int i = 0; i < GameManager.Inst.Cabinets_go.Count; i++)
|
|
{
|
|
GameManager.Inst.Cabinets_go[i].GetComponent<TransparentGlow>().F1();
|
|
}
|
|
;
|
|
GameObject go1 = GameManager.Inst.FindParent(item.lines[0].gameObject, GameManager.Inst.IsDesiredParent);
|
|
GameObject go2 = GameManager.Inst.FindParent(item.lines[1].gameObject, GameManager.Inst.IsDesiredParent);
|
|
transparentGlows.Add(go1.GetComponent<TransparentGlow>());
|
|
transparentGlows.Add(go2.GetComponent<TransparentGlow>());
|
|
item.gameObject.SetActive(true);
|
|
item.transform.parent.gameObject.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
PatternChoose.Inst.quanJing_fuc();
|
|
for (int i = 0; i < GameManager.Inst.Cabinets_go.Count; i++)
|
|
{
|
|
GameManager.Inst.Cabinets_go[i].GetComponent<TransparentGlow>().F1();
|
|
}
|
|
GameObject go1 = GameManager.Inst.FindParent(item.lines[0].gameObject, GameManager.Inst.IsDesiredParent);
|
|
GameObject go2 = GameManager.Inst.FindParent(item.lines[1].gameObject, GameManager.Inst.IsDesiredParent);
|
|
transparentGlows.Add(go1.GetComponent<TransparentGlow>());
|
|
transparentGlows.Add(go2.GetComponent<TransparentGlow>());
|
|
item.gameObject.SetActive(true);
|
|
item.transform.parent.gameObject.SetActive(true);
|
|
}
|
|
}
|
|
//else if (dic_notContain.ContainsKey(objs_str[co]))
|
|
//{
|
|
// //弹出提示——该线缆组不包含线缆
|
|
// SecondConfirmPanel.DeleteConform(null, "该线缆组不包含线缆");
|
|
// //关闭多余线缆机柜
|
|
// item.gameObject.SetActive(false);
|
|
//}
|
|
else
|
|
{
|
|
item.gameObject.SetActive(false);
|
|
}
|
|
});
|
|
|
|
if (!isFind)
|
|
{
|
|
//弹出提示——该线缆组不包含线缆
|
|
SecondConfirmPanel.DeleteConform(null, "该线缆组不包含线缆");
|
|
//关闭多余线缆机柜
|
|
//item.gameObject.SetActive(false);
|
|
}
|
|
|
|
//for (int i = 0; i < PatternChoose.Inst.xianlan.transform.childCount; i++)
|
|
//{
|
|
// if (PatternChoose.Inst.xianlan.transform.GetChild(i).name == objs_str[co])
|
|
// {
|
|
// var _CAB = PatternChoose.Inst.xianlan.transform.GetChild(i).GetComponentsInChildren<LineInfor>(true);
|
|
// foreach (var item in _CAB)
|
|
// {
|
|
// GameObject go1 = GameManager.Inst.FindParent(item.lines[0].gameObject, GameManager.Inst.IsDesiredParent);
|
|
// GameObject go2 = GameManager.Inst.FindParent(item.lines[1].gameObject, GameManager.Inst.IsDesiredParent);
|
|
// transparentGlows.Add(go1.GetComponent<TransparentGlow>());
|
|
// transparentGlows.Add(go2.GetComponent<TransparentGlow>());
|
|
// }
|
|
// PatternChoose.Inst.xianlan.transform.GetChild(i).gameObject.SetActive(true);
|
|
// }
|
|
// else if (dic_notContain.ContainsKey(objs_str[co]))
|
|
// {
|
|
// //弹出提示——该线缆组不包含线缆
|
|
// SecondConfirmPanel.DeleteConform(null, "该线缆组不包含线缆");
|
|
// //关闭多余线缆机柜
|
|
// PatternChoose.Inst.xianlan.transform.GetChild(i).gameObject.SetActive(false);
|
|
// }
|
|
// else
|
|
// {
|
|
// PatternChoose.Inst.xianlan.transform.GetChild(i).gameObject.SetActive(false);
|
|
// }
|
|
//}
|
|
|
|
|
|
TransparentGlowManage.Inst.renewALL(transparentGlows.ToArray());
|
|
}
|
|
|
|
/// <summary>
|
|
/// 展示线缆组
|
|
/// </summary>
|
|
public void showXianLan(string co)
|
|
{
|
|
bool isFind = false;
|
|
List<TransparentGlow> transparentGlows = new List<TransparentGlow>();
|
|
|
|
var s = PatternChoose.Inst.xianlan.gameObject.GetComponentsInChildren<LineInfor>(true);
|
|
Array.ForEach(s, (item) =>
|
|
{
|
|
if (item.cableName == co)
|
|
{
|
|
isFind = true;
|
|
if (ExtendedFlycam.Room.配电室 != ExtendedFlycam.Inst.room)
|
|
{
|
|
for (int i = 0; i < GameManager.Inst.Cabinets_go.Count; i++)
|
|
{
|
|
GameManager.Inst.Cabinets_go[i].GetComponent<TransparentGlow>().F1();
|
|
}
|
|
;
|
|
GameObject go1 = GameManager.Inst.FindParent(item.lines[0].gameObject, GameManager.Inst.IsDesiredParent);
|
|
GameObject go2 = GameManager.Inst.FindParent(item.lines[1].gameObject, GameManager.Inst.IsDesiredParent);
|
|
transparentGlows.Add(go1.GetComponent<TransparentGlow>());
|
|
transparentGlows.Add(go2.GetComponent<TransparentGlow>());
|
|
item.gameObject.SetActive(true);
|
|
item.transform.parent.gameObject.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
PatternChoose.Inst.quanJing_fuc();
|
|
for (int i = 0; i < GameManager.Inst.Cabinets_go.Count; i++)
|
|
{
|
|
GameManager.Inst.Cabinets_go[i].GetComponent<TransparentGlow>().F1();
|
|
}
|
|
GameObject go1 = GameManager.Inst.FindParent(item.lines[0].gameObject, GameManager.Inst.IsDesiredParent);
|
|
GameObject go2 = GameManager.Inst.FindParent(item.lines[1].gameObject, GameManager.Inst.IsDesiredParent);
|
|
transparentGlows.Add(go1.GetComponent<TransparentGlow>());
|
|
transparentGlows.Add(go2.GetComponent<TransparentGlow>());
|
|
item.gameObject.SetActive(true);
|
|
item.transform.parent.gameObject.SetActive(true);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
item.gameObject.SetActive(false);
|
|
}
|
|
});
|
|
|
|
if (!isFind)
|
|
{
|
|
//弹出提示——该线缆组不包含线缆
|
|
SecondConfirmPanel.DeleteConform(null, "该线缆组不包含线缆");
|
|
//关闭多余线缆机柜
|
|
//item.gameObject.SetActive(false);
|
|
}
|
|
TransparentGlowManage.Inst.renewALL(transparentGlows.ToArray());
|
|
}
|
|
|
|
Predicate<Transform> findCabinet = (Transform go) =>
|
|
{
|
|
//端口-设备 go.parent
|
|
//端口-板卡-设备 go.parent.parent
|
|
var p = go.parent;
|
|
|
|
if (p.parent.parent.parent.parent.GetComponent<DeviceQuery>())
|
|
{
|
|
if (p.parent.parent.parent.parent.GetComponent<DeviceQuery>().deviceList.type == "1")
|
|
{
|
|
return true;
|
|
}
|
|
else if (p.parent.parent.parent.GetComponent<DeviceQuery>())
|
|
{
|
|
if (p.parent.parent.parent.GetComponent<DeviceQuery>().deviceList.type == "1")
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
else if (p.parent.parent.parent.GetComponent<DeviceQuery>())
|
|
{
|
|
if (p.parent.parent.parent.GetComponent<DeviceQuery>().deviceList.type == "1")
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
};
|
|
|
|
private bool Isitive(Transform obj)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
|
|
|
|
// 寻找机柜
|
|
void FindGo(List<GameObject> objs, int index, Action<GameObject> callback)
|
|
{
|
|
|
|
GameObject go = null;
|
|
try
|
|
{
|
|
go = objs[index].transform.Find(objs[index].name).gameObject;
|
|
}
|
|
catch
|
|
{
|
|
go = objs[index];
|
|
}
|
|
|
|
callback?.Invoke(go);
|
|
}
|
|
|
|
|
|
public void LoadXianLan(SearchType type)
|
|
{
|
|
inputField.text = string.Empty;
|
|
searchType = type;
|
|
if (!gameObject.activeSelf)
|
|
gameObject.SetActive(true);
|
|
|
|
init();
|
|
|
|
Dictionary<string, string> dic = new Dictionary<string, string>();
|
|
|
|
CreateLine createLine = PatternChoose.Inst.huaXian;
|
|
|
|
for (int i = 0; i < createLine.list7.Count; i++)
|
|
{
|
|
if (i != 0 && i % 2 != 0)
|
|
{
|
|
objs.Add(createLine.list7[i].gameObject);
|
|
string s = createLine.list7[i].GetComponent<PortQuery>().portList.cableGroupName;
|
|
if (string.IsNullOrEmpty(s) || dic.ContainsKey(s))
|
|
continue;
|
|
dic.Add(s, "");
|
|
objs_str.Add(s);
|
|
SearchObjects.Add(s);
|
|
}
|
|
}
|
|
|
|
dic_notContain.Clear();
|
|
foreach (var item in LineQuery.Inst.keyValues.Keys)
|
|
{
|
|
if (!dic.ContainsKey(item))
|
|
{
|
|
objs_str.Add(item);
|
|
SearchObjects.Add(item);
|
|
dic_notContain.Add(item, "");
|
|
}
|
|
}
|
|
|
|
for (int i = 0; i < SearchObjects.Count; i++)
|
|
{
|
|
GameObject tmp = Instantiate(prefabsText, scrollViewContent, false);
|
|
TextMeshProUGUI text = tmp.GetComponentInChildren<TextMeshProUGUI>();
|
|
text.text = SearchObjects[i];
|
|
}
|
|
var cabinets = CabinetUIManager.Instance.transform.Find("机柜");
|
|
TransparentGlowManage.Inst.renewALL(cabinets.GetComponentsInChildren<TransparentGlow>(true));
|
|
|
|
addonClick();
|
|
}
|
|
|
|
void init()
|
|
{
|
|
var count = scrollViewContent.childCount;
|
|
|
|
for (int i = count - 1; i >= 0; i--)
|
|
{
|
|
DestroyImmediate(scrollViewContent.GetChild(i).gameObject);
|
|
}
|
|
|
|
objs.Clear();
|
|
objs_str.Clear();
|
|
SearchObjects.Clear();
|
|
button_objects.Clear();
|
|
|
|
inputField.transform.Find("Text Area/Placeholder").GetComponent<TextMeshProUGUI>().text = "请输入要搜索的" + searchType.ToString().Split('_')[0];
|
|
|
|
scrollView.transform.Find("表头/Text (TMP)").GetComponent<TextMeshProUGUI>().text = searchType.ToString().Split('_')[0] + "名称";
|
|
}
|
|
|
|
|
|
private void Update()
|
|
{
|
|
if (!EventSystem.current.IsPointerOverGameObject() && !inputField.isFocused && biaoTou.activeSelf)
|
|
{
|
|
hide_menu();
|
|
}
|
|
bg.raycastTarget = scrollView.activeSelf;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 隐藏搜索菜单
|
|
/// </summary>
|
|
public void hide_menu()
|
|
{
|
|
{
|
|
DOTween.Kill(rectTransform, false);
|
|
|
|
biaoTou.SetActive(false);
|
|
|
|
float targetHeight = 0;
|
|
float duration = 1f;
|
|
|
|
rectTransform.DOSizeDelta(new Vector2(rectTransform.sizeDelta.x, targetHeight), duration).OnComplete(() =>
|
|
{
|
|
scrollView.SetActive(false);
|
|
});
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 显示搜索菜单
|
|
/// </summary>
|
|
public void show_menu()
|
|
{
|
|
{
|
|
DOTween.Kill(rectTransform, false);
|
|
|
|
scrollView.SetActive(true);
|
|
biaoTou.SetActive(true);
|
|
|
|
float targetHeight = initialHeight;
|
|
float duration = 1f;
|
|
|
|
rectTransform.DOSizeDelta(new Vector2(rectTransform.sizeDelta.x, targetHeight), duration);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 搜索框类型
|
|
/// </summary>
|
|
public enum SearchType
|
|
{
|
|
None,
|
|
机柜,
|
|
线缆组_展示
|
|
}
|
|
}
|
|
|