本文整理汇总了C#中Microsoft.Xna.Framework.Audio.Cue.Stop方法的典型用法代码示例。如果您正苦于以下问题:C# Cue.Stop方法的具体用法?C# Cue.Stop怎么用?C# Cue.Stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Audio.Cue
的用法示例。
在下文中一共展示了Cue.Stop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SoundManager
private SoundManager()
{
_audioEngine = new AudioEngine("Content/Sounds/TetrisGame.xgs");
_waveBank = new WaveBank(_audioEngine, "Content/Sounds/WaveBank.xwb");
_soundBank = new SoundBank(_audioEngine, "Content/Sounds/SoundBank.xsb");
_audioEngine.Update();
_currentMusic = _soundBank.GetCue("m_Silence");
_currentMusic.Stop(AudioStopOptions.Immediate);
_currentSounds = new Cue[20];
SetMusicVolume(100);
SetSoundVolume(100);
}
示例2: GameOverScreen
public GameOverScreen(PlayerIndex p1Index, PlayerIndex? p2Index, Player p1, Player p2, Cue actionBgm)
: base("Game Over")
{
this.p1Index = p1Index;
this.p2Index = p2Index;
this.p1 = p1;
this.p2 = p2;
if (actionBgm.IsPlaying) actionBgm.Stop(AudioStopOptions.Immediate);
MenuEntry share = new MenuEntry("Share Highscore");
MenuEntry restart = new MenuEntry("Restart Game");
MenuEntry back = new MenuEntry("Exit to Menu");
share.Selected += ShareSelected;
restart.Selected += RestartSelected;
back.Selected += BackSelected;
MenuEntries.Add(restart);
MenuEntries.Add(share);
MenuEntries.Add(back);
}
示例3: Restart
public void Restart()
{
firstPlayerHasJoined = false;
App.Instance.Model.AddPlayer += new EventHandler<SurfaceTower.Model.EventArguments.PlayerArgs>(OnAddPlayer);
App.Instance.Model.RemovePlayer += new EventHandler<SurfaceTower.Model.EventArguments.PlayerArgs>(OnRemovePlayer);
App.Instance.Model.NewEnemy += new EventHandler<SurfaceTower.Model.EventArguments.EnemyArgs>(OnNewEnemy);
App.Instance.Model.Tower.ZeroHealth += new EventHandler(Tower_ZeroHealth);
heartbeatCue = soundBank.GetCue("Hearbeat");
introCue = soundBank.GetCue("Intro");
introCue.Play();
audioEngine.GetCategory("Music").SetVolume(MelodyPlayer.musicVolume);
audioEngine.GetCategory("Drums").SetVolume(DrumPlayer.drumVolume);
if(heartbeatCue.IsPlaying)
heartbeatCue.Stop(AudioStopOptions.Immediate);
if(heartbeatOnlyMode)
heartbeatOnlyMode = false;
if (outroCue != null && outroCue.IsPlaying)
outroCue.Stop(AudioStopOptions.Immediate);
}
示例4: Update
public virtual void Update(DodgerX gameobject, GameTime gameTime)
{
if (prevmousestate == null) prevmousestate = Mouse.GetState();
ElapseCounter += gameTime.ElapsedGameTime;
if (ElapseCounter > SpawnObjectDelay)
{
ElapseCounter = ElapseCounter - SpawnObjectDelay;
for (int i = 0; i < 2; i++)
{
AttackingObject ao = new AttackingObject(new Vector2(0, 0), new Vector2(0, 0),
gameobject.attackerTexture);
ao.SetRandomStartPosition(gameobject, 8);
grd.Attackers.Add(ao);
}
}
_grd.Update(gameobject, gameTime);
MenuSelect = DodgerX.soundBank.GetCue("MenuSel");
//Update the selected item based on the mouse position.
MenuStateItem foundhit = null;
foreach (var msi in MenuItems)
{
if (msi.HitTest(gameobject, new Vector2(Mouse.GetState().X, Mouse.GetState().Y)))
{
foundhit = msi;
break;
}
}
if (SelectedItem != foundhit)
{
if (MenuSelect.IsPlaying) MenuSelect.Stop(AudioStopOptions.AsAuthored);
try
{
MenuSelect.Play();
} catch
{
}
}
SelectedItem = foundhit;
Debug.Print("SelectedItem is now " + (SelectedItem==null?"Null":SelectedItem.Caption));
if (SelectedItem != null)
{
if (Mouse.GetState().LeftButton == ButtonState.Pressed && prevmousestate.Value.LeftButton==ButtonState.Released)
{
//gameobject.CurrentState = SelectedItem.AdvanceState;
InvokeClick(SelectedItem,gameobject);
SelectedItem.AdvanceRoutine(SelectedItem, gameobject);
}
}
prevmousestate = Mouse.GetState();
}
示例5: stopCue
/// <summary>
/// Stops a sound immediately.
/// </summary>
/// <param name="cue">The handle of the sound to stop.</param>
public static void stopCue(Cue cue)
{
cue.Stop(AudioStopOptions.Immediate);
}
示例6: ChangeGameState
public void ChangeGameState(GameState state, int level)
{
currentGameState = state;
CancelPowerUps();
switch (currentGameState)
{
case GameState.LEVEL_CHANGE:
splashScreen.SetData("Level " + (level + 1),
GameState.LEVEL_CHANGE);
modelManager.Enabled = false;
modelManager.Visible = false;
splashScreen.Enabled = true;
splashScreen.Visible = true;
//Stop the sound track look
trackCue.Stop(AudioStopOptions.Immediate);
break;
case GameState.PLAY:
modelManager.Enabled = true;
modelManager.Visible = true;
splashScreen.Enabled = false;
splashScreen.Visible = false;
if (trackCue.IsPlaying)
trackCue.Stop(AudioStopOptions.Immediate);
//To play a stopped cue, get the cue from the sound back a gian
trackCue = soundBank.GetCue("Tracks");
trackCue.Play();
break;
case GameState.END:
splashScreen.SetData("Game Over.\nLevel: " + (level + 1) +
"\nScore: " + score, GameState.END);
modelManager.Enabled = false;
modelManager.Visible = false;
splashScreen.Enabled = true;
splashScreen.Visible = true;
//Stop the sound loop
trackCue.Stop(AudioStopOptions.Immediate);
break;
}
}
示例7: Stop
public Cue Stop(Cue cue)
{
cue.Stop(AudioStopOptions.AsAuthored);
return cue;
}
示例8: StopSound
/// <summary>
/// stops the sound
/// </summary>
/// <param name="cue">playing sound</param>
public bool StopSound(Cue cue)
{
if (soundOn == false || cue == null)
return false;
if (cue.IsPaused || cue.IsPlaying)
{
cue.Stop(AudioStopOptions.Immediate);
return true;
}
return false;
}
示例9: StopSound
/// <summary>
/// Immediatly stops the sound currently playing.
/// </summary>
/// <param name="cue">The sound to be stopped</param>
public static void StopSound(Cue cue)
{
cue.Stop(AudioStopOptions.AsAuthored);
}
示例10: Stop
/// <summary>
/// Stops a previously playing cue
/// </summary>
/// <param name="cue">The cue to stop that you got returned from Play(sound)
/// </param>
public static void Stop(Cue cue)
{
if (cue != null)
{
cue.Stop(AudioStopOptions.Immediate);
}
}
示例11: ChangeGameState
public void ChangeGameState(GameState state, int level)
{
if(splashDelay < 0){
currentGameState = state;
CancelPowerUps();
switch (currentGameState)
{
case GameState.START:
splashDelay = 10;
splashScreen.SetData("Welcome to space Defender!",
GameState.START);
modelManager.Enabled = false;
modelManager.Visible = false;
splashScreen.Enabled = true;
splashScreen.Visible = true;
startMenu.Visible = false;
startMenu.Enabled = false;
break;
case GameState.LEVEL_CHANGE:
splashScreen.SetData("Level " + (level + 1),
GameState.LEVEL_CHANGE);
modelManager.Enabled = false;
modelManager.Visible = false;
splashScreen.Enabled = true;
splashScreen.Visible = true;
//Stop the sound track look
trackCue.Stop(AudioStopOptions.Immediate);
break;
case GameState.PLAY:
modelManager.Enabled = true;
modelManager.Visible = true;
splashScreen.Enabled = false;
splashScreen.Visible = false;
if (trackCue.IsPlaying)
trackCue.Stop(AudioStopOptions.Immediate);
//To play a stopped cue, get the cue from the sound back a gian
trackCue = soundBank.GetCue("Tracks");
trackCue.Play();
break;
case GameState.END:
splashScreen.SetData("Game Over.\nLevel: " + (level + 1) +
"\nScore: " + score, GameState.END);
modelManager.Enabled = false;
modelManager.Visible = false;
splashScreen.Enabled = true;
splashScreen.Visible = true;
//Stop the sound loop
trackCue.Stop(AudioStopOptions.Immediate);
break;
case GameState.PAUSE:
splashScreen.SetData("Game Paused",
GameState.PAUSE);
modelManager.Enabled = false;
modelManager.Visible = false;
splashScreen.Enabled = true;
splashScreen.Visible = true;
//Stop the sound track look
trackCue.Stop(AudioStopOptions.Immediate);
break;
case GameState.MENU:
splashDelay = 10;
modelManager.Enabled = false;
modelManager.Visible = false;
splashScreen.Enabled = false;
splashScreen.Visible = false;
startMenu.Visible = true;
startMenu.Enabled = true;
about.Visible = false;
about.Enabled = false;
instructions.Visible = false;
instructions.Enabled = false;
break;
case GameState.ABOUT:
splashDelay = 10;
modelManager.Enabled = false;
modelManager.Visible = false;
splashScreen.Enabled = false;
splashScreen.Visible = false;
startMenu.Visible = false;
startMenu.Enabled = false;
about.Visible = true;
about.Enabled = true;
break;
case GameState.INSTRUCTIONS:
splashDelay = 10;
modelManager.Enabled = false;
modelManager.Visible = false;
//.........这里部分代码省略.........
示例12: play
/// <summary>
/// Begin playing the music and beat tracking.
/// </summary>
public void play()
{
tick.Reset();
ResetBeats();
try
{
#if WINDOWS
// System.Diagnostic.Debug.WriteLine("Playing: " + track.IsPlaying +
//"\n Stopped: " + track.IsStopped +
//"\n Stopping: " + track.IsStopping +
//"\n Prepared: " + track.IsPrepared +
//"\n Preparing: " + track.IsPreparing +
//"\n Created: " + track.IsCreated;
#endif
//if (!track.IsPlaying)//Sometimes track.IsPlaying is true although track.IsDisposed is also true
{
track = soundBank.GetCue(currentTrack);
track.Play();
}
}
catch (Exception e)
{
//System.Diagnostics.Debug.WriteLine(e.Message);
if (track.IsPlaying)
{
track.Stop(AudioStopOptions.Immediate);
}
track = soundBank.GetCue(currentTrack);
while (track.IsPreparing)
{
}
track.Play();
}
tick.Start();
shouldPlay = true;
}
示例13: Stop
public void Stop(Cue cue)
{
cue.Stop(AudioStopOptions.Immediate);
}
示例14: StopSoundMainSE
private void StopSoundMainSE(string se)
{
if (engineSound2 != null)
{
engineSound2 = soundBank2.GetCue(se);
engineSound2.Stop(AudioStopOptions.AsAuthored);
waveBank2.Dispose();
soundBank2.Dispose();
engineSound2.Dispose();
audioEngine.Update();
engineSound2 = null;
}
}
示例15: CloseSoundMain
private void CloseSoundMain()
{
if (engineSound != null)
{
engineSound = soundBank.GetCue(bgmname);
engineSound.Stop(AudioStopOptions.AsAuthored);
waveBank.Dispose();
soundBank.Dispose();
engineSound.Dispose();
audioEngine.Update();
}
}