using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class MusicPanel : BasePanel
{
    public override void OnHide(object data = null)
    {
        
    }

    public override void OnInit(object data = null)
    {
        GetControl<Button>("btnBack").onClick.AddListener(() =>{ UIMgr.Getinstance().HidePanel<MusicPanel>(); });

        #region 通过数据初始化面板

        Dictionary<string, object> paras = new Dictionary<string, object>();
        paras.Add("song_id", 1);
        HttpTool.Instance._Get("app/v1/watermelon/songs_list", paras, new Action<SongBean>((result) =>
        {
            for (int i = 0; i < result.list.Count; i++)
            {
                GameObject obj = ResMgr.Getinstance().Load<GameObject>("Cells/MusicCell");
                obj.transform.SetParent(GetControl<ScrollRect>("svMusic").content.transform);
            }

        }), new Action<string, string>((code, msg) =>
        {
            Debug.unityLogger.Log("获取歌曲列表 " + code + " msg " + msg);
        }));
        #endregion
    }

    public override void OnRefresh(object data = null)
    {
        //UIMgr.GetInstance().HidePanel<MusicPanel>();
    }


}
