1234567891011121314151617181920212223242526272829303132333435 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class AvatarList : MonoBehaviour
- {
- public GameObject Avatar;
- public void Init()
- {
- if (this.transform.childCount <= 0)
- {
- NetWorkHeaders.GetUserAvater((aData) =>
- {
- for (int i = 0; i < aData["data"]["user"].Count; i++)
- {
- GameObject avatarobj = Instantiate(Avatar, transform) as GameObject;
- if (avatarobj)
- {
- AvatarToggle avatarToggle = avatarobj.transform.GetComponent<AvatarToggle>();
- if (avatarToggle)
- {
- avatarToggle.Init(aData["data"]["user"][i].ToString());
- NetWorkHeaders.Instance.getNetTexture(aData["data"]["user"][i].ToString(), null, (Texture tex) => {
- if (tex)
- {
- avatarToggle.Init(tex);
- }
- });
- }
- }
- }
- });
- }
- }
- }
|