You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.3 KiB
63 lines
2.3 KiB
4 years ago
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
|
||
|
public class PersonListToggle : BaseToggle {
|
||
|
public Transform Scrollview;
|
||
|
public Transform PersonContent;
|
||
|
public GameObject PersonListItem;
|
||
|
void Start()
|
||
|
{
|
||
|
//List<UserData> aa = new List<UserData>();
|
||
|
//aa.Add(new UserData());
|
||
|
//aa.Add(new UserData());
|
||
|
//aa.Add(new UserData());
|
||
|
//Room r = new Room()
|
||
|
//{
|
||
|
// UserList = aa
|
||
|
//};
|
||
|
//CurrentUserInfo.room = r;
|
||
|
|
||
|
Scrollview = transform.Find("Scroll View");
|
||
|
//for (int i = 0; i < CurrentUserInfo.room.UserList.Count; i++)
|
||
|
//{
|
||
|
// GameObject item = Instantiate(PersonListItem, PersonContent);
|
||
|
// item.name = CurrentUserInfo.room.UserList[i].UserInfo.RealName;
|
||
|
// //item.GetComponent<Text>().text = CurrentUserInfo.room.UserList[i].Org.DisplayName;//UserInfo.RealName + "(" + CurrentUserInfo.room.UserList[i].Org+")";
|
||
|
//}
|
||
|
}
|
||
|
public override void RespondFun(bool value)
|
||
|
{
|
||
|
Scrollview.gameObject.SetActive(value);
|
||
|
if (value)
|
||
|
{
|
||
|
if (PersonContent.childCount>0)
|
||
|
{
|
||
|
for (int i = 0; i < PersonContent.childCount; i++)
|
||
|
{
|
||
|
Destroy(PersonContent.GetChild(i).gameObject);
|
||
|
}
|
||
|
}
|
||
|
ShowPersonList();
|
||
|
}
|
||
|
}
|
||
|
private void ShowPersonList()
|
||
|
{
|
||
|
for (int i = 0; i < CurrentUserInfo.room.UserList.Count; i++)
|
||
|
{
|
||
|
GameObject item = Instantiate(PersonListItem, PersonContent);
|
||
|
item.name = CurrentUserInfo.room.UserList[i].UserInfo.RealName;
|
||
|
string displayname = CurrentUserInfo.room.UserList[i].Org.DisplayName;//UserInfo.RealName + "(" + CurrentUserInfo.room.UserList[i].Org+")";
|
||
|
if (CurrentUserInfo.room.UserList[i].Org.Level==5)
|
||
|
{
|
||
|
displayname = CurrentUserInfo.room.UserList[i].Org.DisplayName.Split('_')[0];
|
||
|
}
|
||
|
string realname = CurrentUserInfo.room.UserList[i].UserInfo.RealName;
|
||
|
string role = CurrentUserInfo.room.UserList[i].Role.ToString();
|
||
|
item.GetComponent<Text>().text = displayname + "_" + realname + "(" + role + ")";
|
||
|
}
|
||
|
}
|
||
|
}
|