Beispiel #1
0
 /// <summary>
 /// Remove a registered scene.
 /// </summary>
 /// <param name="scenename">The name to revoke.</param>
 public void RevokeRegisteredScene(string scenename)
 {
     RegisteredScenes.Remove(scenename);
     if (CurrentScenes.Contains(scenename))
     {
         CurrentScenes.Remove(scenename);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Update the current scenes
        /// </summary>
        /// <param name></param>
        public void Update()
        {
            //TODO:lock buttons if transitioning
            //if you started fading, continue fading
            if (fadeAmount > 0)
            {
                fadeAmount += 5;//adjust how fast you fade
                //if you faded the full amount, switch out your current scenes
                if (fadeAmount > 255)
                {
                    fadeAmount = 0;
                    CurrentScenes.Clear();
                    foreach (string scenename in AlmostCurrentScenes)
                    {
                        AddCurrentScene(scenename);
                    }
                    AlmostCurrentScenes.Clear();
                }
            }

            foreach (String scenename in CurrentScenes)
            {
                RegisteredScenes[scenename].Update();

                //a full fadeaway/scene change
                if (transitioningScenes)
                {
                    transitioningScenes = false;
                    fadeAmount          = 1;
                    break;
                }
                //a small scene change (ex. semi-transparent menu being removed)
                if (changedCurrentScenes)
                {
                    changedCurrentScenes = false;
                    break;
                }
            }


            if (Globals.waveAudio != null && Globals.wave != null && !Globals.songPaused)
            {
                Globals.nextBlock = Globals.wave.next(Globals.waveAudio.framesAvailable());
                if (Globals.nextBlock.p >= Globals.wave.get_data_p() + Globals.wave.get_data_size())
                {
                    Globals.wave.reset();
                }
            }

            if (Globals.waveAudio != null && !Globals.songPaused)
            {
                Globals.waveAudio.setChannelVolume(0, Options.Volumes.GlobalVolume * Options.Volumes.MusicVolume);
                Globals.waveAudio.setChannelVolume(1, Options.Volumes.GlobalVolume * Options.Volumes.MusicVolume);
                Globals.waveAudio.fillBuffer();
            }
        }
Beispiel #3
0
        } // Scene

        #endregion

        #region Dispose

        /// <summary>
        /// Dispose managed resources.
        /// </summary>
        protected override void DisposeManagedResources()
        {
            Unitialize();
            CurrentScenes.Remove(this);
        } // DisposeManagedResources
Beispiel #4
0
        } // Scene

        protected Scene()
        {
            CurrentScenes.Add(this);
        } // Scene
Beispiel #5
0
 public void AddCurrentScene(string scenename)
 {
     CurrentScenes.Add(scenename);
     RegisteredScenes[scenename].Initialize();
 }