搜索框
This commit is contained in:
parent
4113906db5
commit
8278a08c0d
|
@ -21,10 +21,12 @@ public class SearchName : MonoBehaviour
|
||||||
//չʾµÄÃû×Ö
|
//չʾµÄÃû×Ö
|
||||||
private List<string> SearchObjects = new List<string>();
|
private List<string> SearchObjects = new List<string>();
|
||||||
|
|
||||||
|
public List<GameObject> button_objects = new List<GameObject>();
|
||||||
|
|
||||||
public SearchType searchType;
|
public SearchType searchType;
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
searchType = SearchType.None;
|
//searchType = SearchType.None;
|
||||||
//scrollView.SetActive(false);
|
//scrollView.SetActive(false);
|
||||||
InputFieldEvent();
|
InputFieldEvent();
|
||||||
}
|
}
|
||||||
|
@ -129,6 +131,7 @@ public class SearchName : MonoBehaviour
|
||||||
GameObject tmp = Instantiate(prefabsText, scrollViewContent, false);
|
GameObject tmp = Instantiate(prefabsText, scrollViewContent, false);
|
||||||
TextMeshProUGUI text = tmp.GetComponentInChildren<TextMeshProUGUI>();
|
TextMeshProUGUI text = tmp.GetComponentInChildren<TextMeshProUGUI>();
|
||||||
text.text = SearchObjects[i];
|
text.text = SearchObjects[i];
|
||||||
|
button_objects.Add(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
addonClick();
|
addonClick();
|
||||||
|
@ -144,25 +147,28 @@ public class SearchName : MonoBehaviour
|
||||||
int childCount = SearchObjects.Count;
|
int childCount = SearchObjects.Count;
|
||||||
for (int i = 0; i < childCount; i++)
|
for (int i = 0; i < childCount; i++)
|
||||||
{
|
{
|
||||||
|
int co = i;
|
||||||
int eventCount = scrollViewContent.GetChild(i).GetComponent<Button>().onClick.GetPersistentEventCount();
|
int eventCount = scrollViewContent.GetChild(i).GetComponent<Button>().onClick.GetPersistentEventCount();
|
||||||
|
|
||||||
if (eventCount > 0)
|
if (eventCount > 0)
|
||||||
scrollViewContent.GetChild(i).GetComponent<Button>().onClick.RemoveAllListeners();
|
scrollViewContent.GetChild(i).GetComponent<Button>().onClick.RemoveAllListeners();
|
||||||
//FindGo(objs, i, (go) =>
|
//FindGo(objs, i, (go) =>
|
||||||
//{
|
//{
|
||||||
var jigui = GameManager.Inst.FindParent(scrollViewContent.GetChild(i).gameObject, GameManager.Inst.IsDesiredParent);
|
//var jigui = GameManager.Inst.FindParent(scrollViewContent.GetChild(i).gameObject, GameManager.Inst.IsDesiredParent);
|
||||||
switch (searchType)
|
switch (searchType)
|
||||||
{
|
{
|
||||||
case SearchType.None:
|
case SearchType.None:
|
||||||
break;
|
break;
|
||||||
case SearchType.»ú¹ñ:
|
case SearchType.»ú¹ñ:
|
||||||
{
|
{
|
||||||
scrollViewContent.GetChild(i).GetComponent<Button>().onClick.AddListener(() =>
|
scrollViewContent.GetChild(co).GetComponent<Button>().onClick.AddListener(() =>
|
||||||
{
|
{
|
||||||
if (jigui)
|
Debug.Log(co);
|
||||||
{
|
objs[co].GetComponent<ClickEvent>().Zoomin();
|
||||||
jigui.GetComponent<ClickEvent>().Zoomin();
|
//if (jigui)
|
||||||
}
|
//{
|
||||||
|
// jigui.GetComponent<ClickEvent>().Zoomin();
|
||||||
|
//}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -12,6 +12,9 @@ public class SearchItem : MonoBehaviour
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
|
search_button.onClick.AddListener(() =>
|
||||||
|
{
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue