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

public class GameController : MonoBehaviour
{
    private static GameController Instance;
    public static GameController GetInstance()
    {
        if (Instance == null)
        {
            GameObject obj = new GameObject("GameController");
            Instance = obj.AddComponent<GameController>();
            DontDestroyOnLoad(obj);
        }
        return Instance;
    }

    //准备销毁的水果集合
    public LinkedList<GameObject> TempList = new LinkedList<GameObject>();

    //红线高度
    public float RedLinePosY => ColliderAdapter.Instance.RedLinePosY;



    /// <summary>
    /// 获取接下来将要掉落的音符组及所属歌曲
    /// </summary>
    public void GetNextNoteList(int song_id)
    {
        Dictionary<string, object> paras = new Dictionary<string, object>();
        paras.Add("song_id", song_id);
        HttpTool.Instance._Get("app/v1/watermelon/notes", paras, new Action<List<string>>((result) =>
        {
            Debug.unityLogger.Log("");
        }), new Action<string, string>((code, msg) =>
        {
            Debug.unityLogger.Log("获取下一组生成的球 " + code + " msg " + msg);
        }));
    }

    /// <summary>
    /// 获取提现列表
    /// 类型（1 合成提现，3大额提现）
    /// </summary>
    public void GetWithdrawList(int type)
    {
        Dictionary<string, object> paras = new Dictionary<string, object>();
        paras.Add("type", type);
        HttpTool.Instance._Get("app/v1/watermelon/list_wd", paras, new Action<WithDrawBean>((result) =>
        {

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


    /// <summary>
    /// 获取歌曲列表
    /// </summary>
    public void GetSongsList(int song_id)
    {
        Dictionary<string, object> paras = new Dictionary<string, object>();
        paras.Add("song_id", song_id);
        HttpTool.Instance._Get("app/v1/watermelon/songs_list", paras, new Action<SongBean>((result) =>
        {

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

    /// <summary>
    /// 合成歌曲上报
    /// </summary>
    public void GetNoteCompleted(int song_id)
    {
        Dictionary<string, object> paras = new Dictionary<string, object>();
        paras.Add("song_id", song_id);
        HttpTool.Instance._Get("app/v1/watermelon/note_completed", paras, new Action<EmptyBean>((result) =>
        {

        }), new Action<string, string>((code, msg) =>
        {
            Debug.unityLogger.Log("合成歌曲上报 " + code + " msg " + msg);
        }));
    }



}
