|
@@ -34,6 +34,7 @@ public class zhanghaomanager : MonoBehaviour
|
|
|
}
|
|
|
int choose =-1;
|
|
|
private void Awake() {
|
|
|
+ list.Add(go);
|
|
|
t1.onValueChanged.AddListener((b)=>{
|
|
|
|
|
|
if(b)
|
|
@@ -81,7 +82,7 @@ public class zhanghaomanager : MonoBehaviour
|
|
|
}
|
|
|
}
|
|
|
List<JsonData> datamsg =new List<JsonData>();
|
|
|
- int MaxLiebiao=11;
|
|
|
+ int MaxLiebiao=11;
|
|
|
public void RemoveAll()
|
|
|
{
|
|
|
datamsg=new List<JsonData>();
|
|
@@ -91,30 +92,7 @@ public class zhanghaomanager : MonoBehaviour
|
|
|
{
|
|
|
RemoveAll();
|
|
|
startinit=false;
|
|
|
- for (int i = 0; i < list.Count; i++)
|
|
|
- {
|
|
|
- list[i].SetActive(false);
|
|
|
- }
|
|
|
- List<JsonData> ndatamsg =new List<JsonData>();
|
|
|
- for (int i = 0;i<datamsg.Count;i++)
|
|
|
- {
|
|
|
- if(datamsg[i]["name"].ToString().Contains(searchstr.text)||datamsg[i]["account"].ToString().Contains(searchstr.text))
|
|
|
- {
|
|
|
- if(ndatamsg.Count<MaxLiebiao)
|
|
|
- {
|
|
|
- list[i].GetComponent<UserInfoItem>().init(datamsg[i]);
|
|
|
- list[i].SetActive(true);
|
|
|
- }
|
|
|
- ndatamsg.Add(datamsg[i]);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- list[i].SetActive(false);
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- Debug.Log("搜索到:"+ndatamsg.Count);
|
|
|
- uiScroll.InitList(0, ndatamsg.Count);
|
|
|
+ StartCoroutine(getreplist());
|
|
|
}
|
|
|
public Text searchstr;
|
|
|
public IEnumerator getreplist()
|
|
@@ -135,11 +113,18 @@ public class zhanghaomanager : MonoBehaviour
|
|
|
|
|
|
if(jd["data"]["list"].ToString()!="[]"&&jd["data"]["list"].Count> i)
|
|
|
{
|
|
|
- if(choose==-1||choose.ToString()==jd["data"]["list"][i]["admin"].ToString())
|
|
|
+ if(jd["data"]["list"][i]["name"].ToString().Contains(searchstr.text)||jd["data"]["list"][i]["account"].ToString().Contains(searchstr.text))
|
|
|
{
|
|
|
- list[i].GetComponent<UserInfoItem>().init(jd["data"]["list"][i]);
|
|
|
- list[i].SetActive(true);
|
|
|
- datamsg.Add(jd["data"]["list"][i]);
|
|
|
+ if(choose==-1||choose.ToString()==jd["data"]["list"][i]["admin"].ToString())
|
|
|
+ {
|
|
|
+ list[i].GetComponent<UserInfoItem>().init(jd["data"]["list"][i]);
|
|
|
+ //list[i].SetActive(true);
|
|
|
+ datamsg.Add(jd["data"]["list"][i]);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ list[i].SetActive(false);
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -153,14 +138,18 @@ public class zhanghaomanager : MonoBehaviour
|
|
|
}
|
|
|
for (int i = datamsg.Count;i<jd["data"]["list"].Count;i++)
|
|
|
{
|
|
|
- if(choose==-1||choose.ToString()==jd["data"]["list"][i]["admin"].ToString())
|
|
|
+ if(jd["data"]["list"][i]["name"].ToString().Contains(searchstr.text)||jd["data"]["list"][i]["account"].ToString().Contains(searchstr.text))
|
|
|
{
|
|
|
- if(i<list.Count)
|
|
|
+ if(choose==-1||choose.ToString()==jd["data"]["list"][i]["admin"].ToString())
|
|
|
{
|
|
|
- list[i].GetComponent<UserInfoItem>().init(jd["data"]["list"][i]);
|
|
|
- list[i].SetActive(true);
|
|
|
+ if(i<list.Count)
|
|
|
+ {
|
|
|
+ list[i].GetComponent<UserInfoItem>().init(jd["data"]["list"][i]);
|
|
|
+ // list[i].SetActive(true);
|
|
|
+ }
|
|
|
+ if(i>=MaxLiebiao)
|
|
|
+ datamsg.Add(jd["data"]["list"][i]);
|
|
|
}
|
|
|
- datamsg.Add(jd["data"]["list"][i]);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -172,7 +161,20 @@ public class zhanghaomanager : MonoBehaviour
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ if(datamsg.Count!=0)
|
|
|
+ {
|
|
|
+ Debug.Log("datamsg===>"+datamsg.Count);
|
|
|
uiScroll.InitList(0, datamsg.Count);
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ for (int i = 0; i < list.Count; i++)
|
|
|
+ {
|
|
|
+ list[i].SetActive(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
startinit=true;
|
|
|
|
|
|
}));
|