Esempio n. 1
0
    private void OnGameStart()
    {
        waveClipList.Clear();

        MusicStatus.MusicInfo musicInfo = GameManager.Instance.musicStatus.GetMusicInfo();
        foreach (var pair in musicInfo.WaveList)
        {
            string    path      = Path.GetFileNameWithoutExtension(pair.Value);
            AudioClip audioClip = Resources.Load(path) as AudioClip;
            if (audioClip == null)
            {
                Debug.LogError("[OnGameStart] audioClip is null. path = " + path);
                continue;
            }

            waveClipList.Add(pair.Key, audioClip);
        }
    }
Esempio n. 2
0
    private void ReadMusicList(string filePath)
    {
        if (GameManager.Instance.musicStatus == null)
        {
            return;
        }

        FileInfo fileInfo = new FileInfo(filePath);

        if (fileInfo == null)
        {
            Debug.LogError("file not found.");
            return;
        }

        StreamReader streamReader = fileInfo.OpenText();
        // 첫줄은 기본 경로로 사용
        string basePath = streamReader.ReadLine();

        while (!streamReader.EndOfStream)
        {
            string line = streamReader.ReadLine();
            if (line == null)
            {
                Debug.LogError("[ReadMusicList] line is null.");
                return;
            }

            if (line.Length <= 0)
            {
                continue;
            }

            string title = GameManager.Instance.musicStatus.ReadBmsFile(basePath + line);
            MusicStatus.MusicInfo musicInfo = GameManager.Instance.musicStatus.GetMusicInfo(title);
            AddMusicList(musicInfo.Title);
        }
    }
Esempio n. 3
0
    private void OnStartGame()
    {
        foreach (Line line in lines)
        {
            line.Clear();
        }

        CurrentScore = 0;
        currentHitCounts.Clear();
        musicInfo = GameManager.Instance.musicStatus.GetMusicInfo();

        maxTotalBit = 0;
        foreach (int node in musicInfo.NoteInfoList.Keys)
        {
            maxTotalBit = Mathf.Max(maxTotalBit, node * MusicStatus.DividePerNode);
        }

        foreach (HitRateForUI info in hitRateTexts)
        {
            info.CountText.text = "0";
        }

        // 라인 활성화, 키설정
        {
            KeyInfo keyInfo = keyInfos.Find(info => { return(info.KeyCodes.Count == musicInfo.EnableLines.Count); });

            int enableLineIndex = 0;
            for (int i = 0; i < lines.Count; ++i)
            {
                bool isEnable = musicInfo.EnableLines.Contains(i);
                lines[i].gameObject.SetActive(isEnable);

                if (isEnable)
                {
                    if (keyInfo.KeyCodes == null)
                    {
                        Debug.LogError("[OnStartGame] keyCodes is null. lineCount = " + musicInfo.EnableLines.Count);
                        continue;
                    }

                    lines[i].keyCode = keyInfo.KeyCodes[enableLineIndex];

                    UnityEngine.UI.Image image = lines[i].GetComponent <UnityEngine.UI.Image>();
                    if (image != null)
                    {
                        image.color = lineColors[enableLineIndex % lineColors.Count];
                    }

                    ++enableLineIndex;
                }
            }
        }

        // ex) 480 = 60000 / 125
        milliSecondsPerNode = 60000 / musicInfo.Bpm;
        // ex) 15 = 480 / 32
        milliSecondsPerBit = milliSecondsPerNode / MusicStatus.DividePerNode * 4; // 임시로 4배속 처리
        currentNode        = 0;
        currentBit         = 0;
        currentTotalBit    = 0;

        stopWatch.Reset();
        stopWatch.Start();
        OnChangeResume?.Invoke(false);
    }