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

public class TestDataFlow : MonoBehaviour
{
    /// <summary>
    /// 当前谱面文件的主要时间组,决定拍线的渲染方式
    /// </summary>
    private BPMGroup MainBPMGroup;
    private NotePoolManager NotePool  = new NotePoolManager();
    private SongInformationContainer songInformationContainer = new SongInformationContainer();
    //依据设计书输入数值
    private float DefaultBaseSpeed = 25;
    private float DefaultTrackLength = 125;
    //可修改的数值
    private float DefaultNoteStream = 5f;
    private float DefaultBPM = 128;
    private float DefaultBaseBPM = 128;
    public float currentTime = 0;
    public DataFlowController Prefab_DataFlow;


    private void Awake()
    {
        songInformationContainer.UpdateSongInformation(currentTime);
        MainBPMGroup = InitDefaultBPMList();
        print(MainBPMGroup.ToString());
    }
    private void Update()
    {
        currentTime += Input.mouseScrollDelta.y * 0.05f;
        songInformationContainer.UpdateSongInformation(currentTime);

    }
    private void Start()
    {

        //然后获得点集合

        //这里输入开始的坐标
        NotePool.Get<DataFlowController>(Prefab_DataFlow).Init(
            new Vector2(-2f, -2f),
            new Vector2(2, 2),
            0,
            1,
            0.4f,
            songInformationContainer,
            MainBPMGroup, 
            ReferencePointLocation.RightBottom
            ) ;
    }
    private BPMGroup InitDefaultBPMList()
    {

        var Main = new BPMGroup(
            currentBPM: DefaultBPM,
            groupNum: 0,//自动生成编号为0的BPM组
            noteStream: DefaultNoteStream,
            baseSpeed: DefaultBaseSpeed,
            baseBPM: DefaultBaseBPM,
            trackLength: DefaultTrackLength);

        return Main;
    }
}
