Esempio n. 1
0
        public void PlayNewSong(string name, float fadeDuration, bool interrupt)
        {
            if (SoundManager.NoMusic)
            {
                return;
            }
            TrackedSong currentlyPlayingSong = this.CurrentlyPlayingSong;

            if (!interrupt)
            {
                this.ShelvedSong = this.ActiveSong;
            }
            else if (this.ActiveSong != null)
            {
                this.ActiveSong.FadeOutAndRemoveComponent(fadeDuration);
            }
            if (string.IsNullOrEmpty(name))
            {
                this.ActiveSong = (ActiveTrackedSong)null;
            }
            else
            {
                TrackedSong song = this.CMProvider.CurrentLevel.Load <TrackedSong>("Music/" + name);
                song.Initialize();
                ServiceHelper.AddComponent((IGameComponent)(this.ActiveSong = new ActiveTrackedSong(this.Game, song, this.LevelManager.MutedLoops)));
            }
            if (currentlyPlayingSong == this.CurrentlyPlayingSong)
            {
                return;
            }
            this.SongChanged();
        }
Esempio n. 2
0
        public void PlayNewSong(float fadeDuration)
        {
            if (SoundManager.NoMusic)
            {
                return;
            }
            TrackedSong currentlyPlayingSong = this.CurrentlyPlayingSong;

            if (this.ActiveSong != null)
            {
                this.ActiveSong.FadeOutAndRemoveComponent(fadeDuration);
            }
            if (this.LevelManager.Song == null)
            {
                this.ActiveSong = (ActiveTrackedSong)null;
            }
            else
            {
                ServiceHelper.AddComponent((IGameComponent)(this.ActiveSong = new ActiveTrackedSong(this.Game)));
            }
            if (currentlyPlayingSong == this.CurrentlyPlayingSong)
            {
                return;
            }
            this.SongChanged();
        }
Esempio n. 3
0
        private void RefreshSounds()
        {
            this.CollectSounds = new SoundEffect[8];
            TrackedSong currentlyPlayingSong = this.SoundManager.CurrentlyPlayingSong;

            ShardNotes[] shardNotesArray;
            if (currentlyPlayingSong != null)
            {
                shardNotesArray = currentlyPlayingSong.Notes;
            }
            else
            {
                shardNotesArray = new ShardNotes[8]
                {
                    ShardNotes.C2,
                    ShardNotes.D2,
                    ShardNotes.E2,
                    ShardNotes.F2,
                    ShardNotes.G2,
                    ShardNotes.A2,
                    ShardNotes.B2,
                    ShardNotes.C3
                }
            };
            for (int index = 0; index < shardNotesArray.Length; ++index)
            {
                this.CollectSounds[index] = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Collects/SplitUpCube/" + (object)shardNotesArray[index]);
            }
        }
Esempio n. 4
0
 public override void Initialize()
 {
     if (this.Song == null)
     {
         this.Song = this.LevelManager.Song;
     }
     if (this.MutedLoops == null)
     {
         this.MutedLoops = this.LevelManager.MutedLoops;
     }
     if (this.Song == null)
     {
         this.Enabled = false;
         ServiceHelper.RemoveComponent <ActiveTrackedSong>(this);
     }
     else
     {
         this.BarsCounted = this.BeatsCounted = 0L;
         this.Enabled     = false;
         Waiters.Wait(0.1, (Action)(() =>
         {
             foreach (Loop item_0 in this.Song.Loops)
             {
                 bool local_1 = this.IgnoreDayPhase;
                 if (!this.IgnoreDayPhase)
                 {
                     local_1 = ((((((((local_1 ? 1 : 0) | (!this.TimeManager.IsDayPhaseForMusic(DayPhase.Day) ? 0 : (item_0.Day ? 1 : 0))) != 0 ? 1 : 0) | (!this.TimeManager.IsDayPhaseForMusic(DayPhase.Night) ? 0 : (item_0.Night ? 1 : 0))) != 0 ? 1 : 0) | (!this.TimeManager.IsDayPhaseForMusic(DayPhase.Dawn) ? 0 : (item_0.Dawn ? 1 : 0))) != 0 ? 1 : 0) | (!this.TimeManager.IsDayPhaseForMusic(DayPhase.Dusk) ? 0 : (item_0.Dusk ? 1 : 0))) != 0;
                 }
                 ActiveLoop local_2 = new ActiveLoop(item_0, this.MutedLoops.Contains(item_0.Name), local_1, item_0.OneAtATime);
                 if (item_0.OneAtATime)
                 {
                     local_2.CycleLink = new Action(this.CycleOaaTs);
                 }
                 this.ActiveLoops.Add(local_2);
             }
             this.AllOaaTs = Enumerable.ToArray <ActiveLoop>(Enumerable.Where <ActiveLoop>((IEnumerable <ActiveLoop>) this.ActiveLoops, (Func <ActiveLoop, bool>)(x => x.Loop.OneAtATime)));
             if (this.Song.Loops.Count > 0 && this.AllOaaTs.Length > 0)
             {
                 this.CycleOaaTs();
             }
             this.Enabled = true;
             this.Watch.Start();
         }));
     }
 }
Esempio n. 5
0
 public ActiveTrackedSong(Game game, TrackedSong song, IList <string> mutedLoops)
     : this(game)
 {
     this.Song       = song;
     this.MutedLoops = mutedLoops;
 }