Commit 1c9e3705 authored by LiLiuZhou's avatar LiLiuZhou

11

parent d2be866f
This diff is collapsed.
......@@ -585,3 +585,4 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ed82f0e40e7586f479aaa574bfe84b67, type: 3}
m_Name:
m_EditorClassIdentifier:
PlayingCell: {fileID: 0}
This diff is collapsed.
......@@ -5,6 +5,7 @@ using UnityEngine.UI;
public class MusicCell : BasePanel
{
public SongItemBean bean;
public override void OnHide(object data = null)
{
......@@ -12,20 +13,39 @@ public class MusicCell : BasePanel
public override void OnInit(object data = null)
{
MusicPanel panel = UIMgr.Getinstance().GetPanel<MusicPanel>();
GetControl<Toggle>("togPlay").group = panel.GetControl<ToggleGroup>("Content");
SongItemBean bean = data as SongItemBean;
this.bean = bean;
GetControl<Toggle>("togPlay").onValueChanged.AddListener( value =>
GetControl<Button>("btnPlayMusic").onClick.AddListener(() =>
{
GetControl<Image>("imgTogBK").enabled = value;
GetControl<Image>("imgTogCheckMark").enabled = value;
MusicPanel panel = UIMgr.Getinstance().GetPanel<MusicPanel>();
panel.ChangeMusic(this);
});
GetControl<Text>("txtNum").text = bean.song_id.ToString();
GetControl<Text>("txtNum").color = bean.song_id <= 3 ? Color.red : Color.black;
GetControl<Text>("txtMusicName").text = bean.song_name;
}
public override void OnRefresh(object data = null)
{
throw new System.NotImplementedException();
}
public void OnStartMusic()
{
if (bean == null)
{
throw new System.Exception("cell数据为空");
}
}
public void OnStopMusic()
{
if (bean == null)
{
throw new System.Exception("cell数据为空");
}
}
}
......@@ -6,6 +6,8 @@ using UnityEngine.UI;
public class MusicPanel : BasePanel
{
//当前正在播放的格子
public MusicCell PlayingCell;
public override void OnHide(object data = null)
{
......@@ -21,11 +23,13 @@ public class MusicPanel : BasePanel
paras.Add("song_id", 1);
HttpTool.Instance._Get("app/v1/watermelon/songs_list", paras, new Action<SongBean>((result) =>
{
print(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);
obj.transform.ReSet();
obj.GetComponent<MusicCell>().OnInit(result.list[i]);
}
}), new Action<string, string>((code, msg) =>
......@@ -40,5 +44,9 @@ public class MusicPanel : BasePanel
//UIMgr.GetInstance().HidePanel<MusicPanel>();
}
public void ChangeMusic(MusicCell cell)
{
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment