//获取注册时间列表
    private void LoadEventSampleTime()
    {
        KoreographyTrack        rhythmTrack = playingKoreo.GetTrackByID(eventID);
        List <KoreographyEvent> rawEvents   = rhythmTrack.GetAllEvents();

        for (int i = 0; i < rawEvents.Count; i++)
        {
            TwoDData temp = new TwoDData {
                beginTime = rawEvents[i].StartSample, typeEnum = rawEvents[i].GetIntValue()
            };
            eventSampleTimeList.Add(temp);
        }
    }
예제 #2
0
        void Start()
        {
            InitializeLeadIn();

            // Initialize all the Lanes.
            for (int i = 0; i < noteLanes.Count; ++i)
            {
                noteLanes[i].Initialize(this);
            }
            Debug.Log(noteLanes.Count);//6

            // Initialize events.
            playingKoreo = Koreographer.Instance.GetKoreographyAtIndex(0);

            // Grab all the events out of the Koreography.
            KoreographyTrack        rhythmTrack = playingKoreo.GetTrackByID(eventID);
            List <KoreographyEvent> rawEvents   = rhythmTrack.GetAllEvents();

            for (int i = 0; i < rawEvents.Count; ++i)
            {
                KoreographyEvent evt     = rawEvents[i];
                string           payload = evt.GetTextValue();

                // Find the right lane.
                for (int j = 0; j < noteLanes.Count; ++j)
                {
                    LaneController lane = noteLanes[j];
                    if (lane.DoesMatchPayload(payload))
                    {
                        // Add the object for input tracking.
                        lane.AddEventToLane(evt);

                        // Break out of the lane searching loop.
                        break;
                    }
                }
            }
        }
    void Start()
    {
        InitializeLeadIn();
        for (int i = 0; i < noteLines.Count; i++)
        {
            noteLines[i].Initialize(this);//音轨初始化
        }
        //获取到koreography对象
        playingKoreo = Koreographer.Instance.GetKoreographyAtIndex(0);
        KoreographyTrack rhythmTrack = playingKoreo.GetTrackByID(eventID);
        //获取事件
        List <KoreographyEvent> rawEvents = rhythmTrack.GetAllEvents();

        for (int i = 0; i < rawEvents.Count; i++)
        {
            KoreographyEvent evt = rawEvents[i];
            int noteID           = evt.GetIntValue();
            //遍历所有音轨
            for (int j = 0; j < noteLines.Count; j++)
            {
                LaneController lane = noteLines[j];
                if (noteID > 6)
                {
                    noteID = noteID - 6;
                    if (noteID > 6)
                    {
                        noteID = noteID - 6;
                    }
                }
                if (lane.DoesMatch(noteID))
                {
                    lane.AddEventToLane(evt);
                    break;
                }
            }
        }
        hitWindowRangeInSamples = (int)(SampleRate * hitWindowRangeInMS * 0.0001f);
    }
예제 #4
0
        void Start()
        {
            gameManager = GameObject.Find("GameManager");
            //PlayerPrefs.SetFloat("noteSpeed", noteSpeed);
            //PlayerPrefs.SetFloat("hitDelay", hitDelay);
            noteSpeed = PlayerPrefs.GetFloat("noteSpeed", 6f);
            hitDelay  = PlayerPrefs.GetFloat("hitDelay", 0.08f);
            gameManager.transform.position = new Vector3(0, (float)(-noteSpeed * hitDelay - (2 + 0.5) * noteSpeed / 6), 0);//holy shit
            string songName;

            if (PlayerPrefs.GetString("PlayMode", "Play") == "Play")
            {
                songName = PlayerPrefs.GetString("SongName", GameStatics.songs[0].PlayBackName);
                eventID  = PlayerPrefs.GetString("Difficulty", "Easy");
            }
            else
            {
                songName = GameStatics.testSong.PlayBackName;
                eventID  = "Easy";
            }
            Debug.Log(songName);
            simpleMusicPlayer = GameObject.Find(songName).GetComponent <SimpleMusicPlayer>();
            audioCom          = GameObject.Find(songName).GetComponent <AudioSource>();

            Koreographer.Instance.EventDelayInSeconds = 0f;
            InitializeLeadIn();

            // Initialize all the Lanes.
            for (int i = 0; i < noteLanes.Count; ++i)
            {
                noteLanes[i].Initialize(this);
            }
            //Debug.Log(noteLanes.Count);//9

            // Initialize events.

            if (songName == GameStatics.songs[0].PlayBackName)
            {
                playingKoreo = Koreographer.Instance.GetKoreographyAtIndex(0);
            }
            else
            {
                playingKoreo = Koreographer.Instance.GetKoreographyAtIndex(1);
            }

            //playingKoreo = Koreographer.Instance.

            // Grab all the events out of the Koreography.
            KoreographyTrack        rhythmTrack = playingKoreo.GetTrackByID(eventID);//Easy or Hard
            List <KoreographyEvent> rawEvents   = rhythmTrack.GetAllEvents();

            Debug.Log(rawEvents.Count);

            for (int i = 0; i < rawEvents.Count; ++i)
            {
                KoreographyEvent evt     = rawEvents[i];
                string           payload = evt.GetTextValue();

                // Find the right lane.
                for (int j = 0; j < noteLanes.Count; ++j)
                {
                    Lane lane = noteLanes[j];
                    if (lane.DoesMatchPayload(payload))
                    {
                        // Add the object for input tracking.
                        lane.AddEventToLane(evt);

                        // Break out of the lane searching loop.
                        //break;
                    }
                }
            }
        }