Ejemplo n.º 1
0
    public AudioClip GetAudioClipBySongType(MusicSong _songType)
    {
        MusicSong songType = _songType;

        switch (songType)
        {
        case MusicSong.Action_A:
            return(Action_A);

        case MusicSong.Action_B:
            return(Action_B);

        case MusicSong.Action_C:
            return(Action_C);

        case MusicSong.Action_D:
            return(Action_D);

        case MusicSong.Action_E:
            return(Action_E);

        case MusicSong.Ambient_A:
            return(Ambient_A);

        case MusicSong.Ambient_B:
            return(Ambient_B);

        case MusicSong.Stress_A:
            return(Stress_A);
        }

        return(null);
    }
Ejemplo n.º 2
0
    void PlayNextSong()
    {
        currentSong = nextSong;
        nextSong    = null;

        AudioClip clip = LoadAudioClip(currentSong.resourcePath);

        if (clip != null)
        {
            audioSource.clip   = clip;
            audioSource.volume = 0;
            Go.killAllTweensWithTarget(audioSource);
            Go.to(audioSource, fadeInDuration, new TweenConfig().floatProp("volume", currentSong.volume));
            audioSource.loop = true;

            if (_isPaused)
            {
                songPauseTime = audioSource.time = currentSong.playTime;
                audioSource.Stop();
            }
            else
            {
                songPauseTime = audioSource.time = currentSong.playTime;
                audioSource.Play();
            }
        }
        else
        {
            audioSource.clip = null;            //don't play anything
            audioSource.Stop();
            currentSong = null;
        }
    }
Ejemplo n.º 3
0
        private void Update()
        {
            if (null == albumInfo)
            {
                return;
            }
            lblAlbum.Label  = albumInfo.Title;
            lblArtist.Label = albumInfo.Artist;
            lblDate.Label   = albumInfo.DateOfRelease;

            string rating = string.Empty;

            if (albumInfo.Rating > 0)
            {
                rating = String.Format("{0}/9", albumInfo.Rating);
            }
            lblRating.Label = rating;
            lblGenre.Label  = albumInfo.Genre;
            lblTone.Label   = albumInfo.Tones.Trim();
            lblStyles.Label = albumInfo.Styles.Trim();

            if (showReview)
            {
                tbTextArea.Clear();
                tbTextArea.Label = albumInfo.Review;
                btnTracks.Label  = GUILocalizeStrings.Get(182);
            }
            else
            {
                string line = string.Empty;
                for (int i = 0; i < albumInfo.NumberOfSongs; ++i)
                {
                    MusicSong song  = albumInfo.GetSong(i);
                    string    track = String.Format("{0}. {1}\n",
                                                    song.Track,
                                                    song.SongName);
                    line += track;
                }
                ;

                tbTextArea.Label = line;

                for (int i = 0; i < albumInfo.NumberOfSongs; ++i)
                {
                    MusicSong song = albumInfo.GetSong(i);
                    line = Util.Utils.SecondsToHMSString(song.Duration);
                    GUIMessage msg1 = new GUIMessage(GUIMessage.MessageType.GUI_MSG_LABEL2_SET, GetID, 0, tbTextArea.GetID, i, 0,
                                                     null);
                    msg1.Label = (line);
                    OnMessage(msg1);
                }

                btnTracks.Label = GUILocalizeStrings.Get(183);
            }
        }
Ejemplo n.º 4
0
    public void EndMusicWithFadeAndStartNewSong(MusicFadeType _fadeType, MusicSong _newSong, float _delay)
    {
        MusicFadeType fadeType = _fadeType;

        curFadeSpeed = GetFadeSpeedByType(fadeType);

        queuedSong = _newSong;

        newSongStartDelay = _delay;

        SetStatus(MusicPlayingStatus.FadingToNewMusic);
    }
Ejemplo n.º 5
0
    //

    void Update()
    {
        #region PassingDelay
        if (IsStatus(MusicPlayingStatus.PassingDelay))
        {
            newSongStartDelay = MathfPlus.DecByDeltatimeToZero(newSongStartDelay);

            if (newSongStartDelay == 0)
            {
                MapLogic.Instance.audioInfo_Music.SetCustomVolume(1);
                MapLogic.Instance.audioInfo_Music.PlayClip(GetAudioClipBySongType(curPlayingSong));

                SetStatus(MusicPlayingStatus.Playing);
            }
        }
        #endregion

        #region FadingToNewMusic
        if (IsStatus(MusicPlayingStatus.FadingToNewMusic))
        {
            MapLogic.Instance.audioInfo_Music.SetCustomVolume(MapLogic.Instance.audioInfo_Music.customVolume - Time.deltaTime * curFadeSpeed);

            if (MapLogic.Instance.audioInfo_Music.customVolume == 0)
            {
                curPlayingSong = queuedSong;

                queuedSong = MusicSong.None;

                SetStatus(MusicPlayingStatus.PassingDelay);
            }
        }
        #endregion

        #region FadingToNone
        if (IsStatus(MusicPlayingStatus.FadingToNone))
        {
            MapLogic.Instance.audioInfo_Music.SetCustomVolume(MapLogic.Instance.audioInfo_Music.customVolume - Time.deltaTime * curFadeSpeed);

            if (MapLogic.Instance.audioInfo_Music.customVolume == 0)
            {
                curPlayingSong = MusicSong.None;

                MapLogic.Instance.audioInfo_Music.Stop();

                SetStatus(MusicPlayingStatus.Idle);
            }
        }
        #endregion
    }
Ejemplo n.º 6
0
    public static void Update()
    {
        MusicSong songToPlay = currentSong;

        float fadeOutDuration = 0.3f;
        float fadeInDuration = 0.2f;

        if(Core.instance.currentPage is PlayerSelectPage)
        {
            songToPlay = MENU;
        }
        else
        {
            if(Arena.instance != null)
            {
                if(Arena.instance.dayManager.isDay)
                {
                    songToPlay = DAYTIME;
                }
                else
                {
                    songToPlay = NIGHTTIME;
                }
            }

        }

        if(!Config.SHOULD_PLAY_MUSIC)
        {
            songToPlay = null;
        }

        if(songToPlay != currentSong)
        {
            manager.fadeOutDuration = fadeOutDuration;
            manager.fadeInDuration = fadeInDuration;
            manager.PlaySong(songToPlay);
            currentSong = songToPlay;
        }
    }
Ejemplo n.º 7
0
    public void PlayMusic(MusicSong _song, float _delay)
    {
        MusicSong newSong = _song;
        float     delay   = _delay;

        if (curPlayingSong == newSong)
        {
            return;
        }

        if (curPlayingSong == MusicSong.None)
        {
            curPlayingSong    = newSong;
            newSongStartDelay = delay;

            SetStatus(MusicPlayingStatus.PassingDelay);

            return;
        }

        EndMusicWithFadeAndStartNewSong(MusicFadeType.Fast, newSong, delay);
    }
Ejemplo n.º 8
0
    static public void Update()
    {
        MusicSong songToPlay = currentSong;

        float fadeOutDuration = 0.3f;
        float fadeInDuration  = 0.2f;

        if (Core.instance.currentPage is PlayerSelectPage)
        {
            songToPlay = MENU;
        }
        else
        {
            if (Arena.instance != null)
            {
                if (Arena.instance.dayManager.isDay)
                {
                    songToPlay = DAYTIME;
                }
                else
                {
                    songToPlay = NIGHTTIME;
                }
            }
        }

        if (!Config.SHOULD_PLAY_MUSIC)
        {
            songToPlay = null;
        }

        if (songToPlay != currentSong)
        {
            manager.fadeOutDuration = fadeOutDuration;
            manager.fadeInDuration  = fadeInDuration;
            manager.PlaySong(songToPlay);
            currentSong = songToPlay;
        }
    }
Ejemplo n.º 9
0
    void PlayNextSong()
    {
        currentSong = nextSong;
        nextSong = null;

        AudioClip clip = LoadAudioClip(currentSong.resourcePath);

        if(clip != null)
        {
            audioSource.clip = clip;
            audioSource.volume = 0;
            Go.killAllTweensWithTarget(audioSource);
            Go.to(audioSource,fadeInDuration,new TweenConfig().floatProp("volume",currentSong.volume));
            audioSource.loop = true;

            if(_isPaused)
            {
                songPauseTime = audioSource.time = currentSong.playTime;
                audioSource.Stop();
            }
            else
            {
                songPauseTime = audioSource.time = currentSong.playTime;
                audioSource.Play();
            }
        }
        else
        {
            audioSource.clip = null;//don't play anything
            audioSource.Stop();
            currentSong = null;
        }
    }
Ejemplo n.º 10
0
    public void PlaySong(MusicSong song)
    {
        nextSong = song;

        FadeOutCurrentSong();
    }
Ejemplo n.º 11
0
    public void PlaySong(MusicSong song)
    {
        nextSong = song;

        FadeOutCurrentSong();
    }