Commit 922a634d authored by 王雪伟's avatar 王雪伟

填充红包面板数据

parent a8c07a3c
......@@ -155,7 +155,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: "\u518D\u8D5A\u53D611111111111111"
m_Text:
--- !u!1 &4471334563280762286
GameObject:
m_ObjectHideFlags: 0
......
using System;
using System.Collections.Generic;
[Serializable]
public class RewarBean
{
/// <summary>
/// 奖励数(单位为分)
/// </summary>
public int reward { get; set; }
/// <summary>
///
/// </summary>
public bool @double { get; set; }
/// <summary>
/// 当前余额(单位为分)
/// </summary>
public int available { get; set; }
/// <summary>
/// 距离提现还差多少 单位为分)
/// </summary>
public int disparity { get; set; }
}
fileFormatVersion: 2
guid: 9aa1e2c0a2073b1469d1e352b58b59f4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -6,6 +6,8 @@ using UnityEngine.UI;
public class MainPanel : BasePanel
{
public int GetCurrentSongId { get { return int.Parse(currentSongId); } }
protected override void Awake()
{
base.Awake();
......@@ -27,7 +29,7 @@ public class MainPanel : BasePanel
{
EventCenter.Getinstance().AddUpdateListener("FlyNote", AddSongProgress);
GetHomeInfo();
GetNextNoteList(nextSongId);
GetNextNoteList();
}
public override void OnRefresh(object data = null)
......@@ -67,7 +69,7 @@ public class MainPanel : BasePanel
GetNoteCompleted();
IsSuccess = true;
Debug.unityLogger.Log("合成音符红包");
//UIMgr.Getinstance().ShowPanel<MusicRedBagPanel>(E_Layer.mid);
UIMgr.Getinstance().ShowPanel<MusicRedBagPanel>(E_Layer.mid);
}
GetControl<Text>("ProgressTv").text = playNoteIndex + "/" + notesList.Count;
......@@ -80,10 +82,10 @@ public class MainPanel : BasePanel
/// <summary>
/// 获取接下来将要掉落的音符组及所属歌曲
/// </summary>
public void GetNextNoteList(int song_id)
public void GetNextNoteList()
{
Dictionary<string, object> paras = new Dictionary<string, object>();
paras.Add("song_id", song_id);
paras.Add("song_id", nextSongId);
HttpTool.Instance._Get2("app/v1/watermelon/notes", paras, new Action<Response<List<string>>>((result) =>
{
currentSongId = result.result.song_id;
......@@ -93,7 +95,6 @@ public class MainPanel : BasePanel
notesList = result.result.data;
GetControl<Text>("ProgressTv").text = "0/" + result.result.data.Count;
GetControl<Image>("ProgressBar").fillAmount = 0 / (float)result.result.data.Count;
Debug.unityLogger.Log("");
}), new Action<string, string>((code, msg) =>
{
Debug.unityLogger.Log("获取下一组生成的球 " + code + " msg " + msg);
......
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class MoneyRedBagPanel : BasePanel
{
public override void OnHide(object data = null)
{
UIMgr.Getinstance().GetPanel<MainPanel>().GetHomeInfo();
}
public override void OnInit(object data = null)
{
GetReward();
GetControl<Button>("btnCashOut").onClick.AddListener(() =>
{
UIMgr.Getinstance().HidePanel<MoneyRedBagPanel>();
UIMgr.Getinstance().GetPanel<MainPanel>().GetNextNoteList();
ToastPlugin.ToastHelper.ShowToast("立即提现");
});
GetControl<Button>("btnClose").onClick.AddListener(() =>
{
UIMgr.Getinstance().GetPanel<MainPanel>().GetNextNoteList();
UIMgr.Getinstance().HidePanel<MoneyRedBagPanel>();
});
GetControl<Button>("btnContinue").onClick.AddListener(() =>
{
UIMgr.Getinstance().GetPanel<MainPanel>().GetNextNoteList();
UIMgr.Getinstance().HidePanel<MoneyRedBagPanel>();
});
}
public override void OnRefresh(object data = null)
{
}
/// <summary>
/// 获取合成奖励
/// </summary>
/// <param name="song_id"></param>
public void GetReward()
{
Dictionary<string, object> paras = new Dictionary<string, object>();
paras.Add("type", 1);
HttpTool.Instance._Get("app/v1/watermelon/reward", paras, new Action<RewarBean>((result) =>
{
GetControl<Text>("txtTopMoney").text = (result.reward / 100f).ToString("0.00") + "元";
GetControl<Text>("txtMoney").text = (result.available / 100f).ToString("0.00") + "元";
GetControl<Text>("txtDiscribe").text = "再赚取" + (result.disparity / 100f).ToString("0.00") + "元可以提现";
}), new Action<string, string>((code, msg) =>
{
Debug.unityLogger.Log("获取合成奖励 " + code + " msg " + msg);
}));
}
}
fileFormatVersion: 2
guid: dc4829ee7b7cf1f458c63d9bf7f9a184
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class MusicRedBagPanel : BasePanel
{
public override void OnHide(object data = null)
{
//throw new System.NotImplementedException();
}
public override void OnInit(object data = null)
{
//throw new System.NotImplementedException();
GetControl<Button>("btnOpen").onClick.AddListener(() =>
{
UIMgr.Getinstance().HidePanel<MusicRedBagPanel>();
UIMgr.Getinstance().ShowPanel<MoneyRedBagPanel>(E_Layer.mid);
});
GetControl<Button>("btnClose").onClick.AddListener(() =>
{
UIMgr.Getinstance().GetPanel<MainPanel>().GetNextNoteList();
UIMgr.Getinstance().HidePanel<MusicRedBagPanel>();
});
Dictionary<string, object> paras = new Dictionary<string, object>();
paras.Add("song_id", UIMgr.Getinstance().GetPanel<MainPanel>().GetCurrentSongId);
HttpTool.Instance._Get("app/v1/watermelon/songs_list", paras, new Action<SongBean>((result) =>
{
for (int i = 0; i < result.list.Count; i++)
{
if (UIMgr.Getinstance().GetPanel<MainPanel>().GetCurrentSongId == result.list[i].song_id)
{
GetControl<Text>("txtMusicName").text = "你合成了歌曲“" + result.list[i].song_name + "”";
break;
}
}
}), new Action<string, string>((code, msg) =>
{
Debug.unityLogger.Log("获取歌曲列表 " + code + " msg " + msg);
}));
}
public override void OnRefresh(object data = null)
{
//throw new System.NotImplementedException();
}
}
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