1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using XRTool.Util;
- public class UserList : UnitySingleton<UserList>
- {
- public GameObject Item;
- public void Init(List<InviteUserConfig> inviteUserConfigList)
- {
- if (transform.childCount > 0)
- {
- for (int i = 0; i < transform.childCount; i++)
- {
- Destroy(transform.GetChild(i).gameObject);
- }
- }
- AddItem(inviteUserConfigList);
- }
- private void AddItem(List<InviteUserConfig> inviteUserConfigList)
- {
- for (int i = 0; i < inviteUserConfigList.Count; i++)
- {
- GameObject obj = Instantiate(Item, transform) as GameObject;
- obj.transform.GetComponent<UserItem>().Init(inviteUserConfigList[i]);
- }
- }
- public void DestoryAll()
- {
- if (transform.childCount > 0)
- {
- for (int i = 0; i < transform.childCount; i++)
- {
- Destroy(transform.GetChild(i).gameObject);
- }
- }
- }
- }
|