public async void calibrate(Action func, CancellationToken token, MeasureMode mode, string calibtype) { btnCancelCalibration.Visibility = Visibility.Visible; btnCalibrateIn.Visibility = Visibility.Hidden; btnCalibrateOut.Visibility = Visibility.Hidden; btnCalibrateLo.Visibility = Visibility.Hidden; log("start calibrate: " + mode + ", " + calibtype); var stopwatch = Stopwatch.StartNew(); dataTable = ((DataView)dataGrid.ItemsSource).ToTable(); calibrationTask = Task.Run(func, token); dataGrid.ItemsSource = dataTable.AsDataView(); await calibrationTask; btnCancelCalibration.Visibility = Visibility.Hidden; btnCalibrateIn.Visibility = Visibility.Visible; btnCalibrateOut.Visibility = Visibility.Visible; btnCalibrateLo.Visibility = Visibility.Visible; stopwatch.Stop(); log("end calibrate, run time: " + Math.Round(stopwatch.Elapsed.TotalMilliseconds / 1000, 2) + " sec"); sndAlert?.Play(); MessageBox.Show("Done."); }
private void Close(bool dontCalculateAStarColliders = false) { if (!_open) { return; } HandleDoorVisual(false, true, dontCalculateAStarColliders); _soundPlayer?.Play(SoundType.DOOR_OPEN_CLOSE); _open = false; }
public int linie() { int ile = wysokosc - 1; int i; int liczba = 0; bool linia = true; while (ile > 0 && liczba < 4) { for (i = 0; i < szerokosc; i++) if (!tablica[i, ile].spr()) linia = false; if (linia) { liczba++; for (int k = ile - 1; k >= 0; k--) przesun(k); Assembly assembly; SoundPlayer dzwiek; assembly = Assembly.GetExecutingAssembly(); dzwiek = new SoundPlayer(assembly.GetManifestResourceStream("projekt.bridge2.wav")); dzwiek.Play(); } else ile--; linia = true; } return liczba; }
public static void PlaySound(GSound s) { if (OnOrOff == false) { return; } if (s == GSound.Main) { sp_main?.PlayLooping(); } else if (s == GSound.TileClicked) { sp_tile_clicked?.Play(); } else if (s == GSound.TileMatched) { sp_tile_matched?.Play(); } else if (s == GSound.TileMismatch) { sp_tile_mismatched?.Play(); } else if (s == GSound.GameStart) { sp_game_start?.Play(); } else if (s == GSound.GameEnd) { sp_game_end?.Play(); } }
private void Start() { _uIHandler = FindObjectOfType <UIHandler>(); _doorAnimator = GetComponent <Animator>(); _collider = GetComponent <BoxCollider2D>(); _soundPlayer = FindObjectOfType <SoundPlayer>(); switch (_door) { case DoorId.ROOM2_DOOR: { EventManager.StartListening(EventManager.Event.ROOM2_DOOR_QUESTION_ANSWERED, () => { _doorAnimator.SetTrigger("OpenTrigger"); _collider.enabled = false; _soundPlayer?.Play(Sound.DOOR_OPEN); }); break; } } EventManager.StartListening(EventManager.Event.RESET_GAME, () => { _collider.enabled = true; // TODO: trigger }); }
private void InitializeButtonEvents() { DialogShowButton.ButtonAction += (sender, e) => { CustomDialog dialog = new CustomDialog(); dialog.Show(); }; PopupListShowButton.ButtonAction += (sender, e) => { Sound se = new Sound("/Application/assets/GAME_SE_01.wav"); sp = se.CreatePlayer(); sp.Play(); }; bgmButton.ButtonAction += (sender, e) => { if (!bgm_play) { bp.Play(); bgmButton.Text = "BGMStop"; } else { bp.Pause(); bgmButton.Text = "BGMPlay"; } bgm_play = !bgm_play; }; }
private void FulutonUpdate() { foreach (var entity in CachedPeds.Concat(CachedVehicles.Cast <Entity>()).Where( x => x.IsSafeExist() && x.IsInRangeOf(PlayerPed.Position, 15.0f) && !fulutonedEntityList.Contains(x.Handle) && x.IsAlive )) { if (entity.HasBeenDamagedByPed(PlayerPed) && ( entity.HasBeenDamagedBy(Weapon.UNARMED) )) { fulutonedEntityList.Add(entity.Handle); StartCoroutine(FulutonCoroutine(entity)); if (entity is Vehicle) { soundPlayerVehicleSetup?.Play(); } else { //pedの時は遅延させてならす Observable.Timer(TimeSpan.FromSeconds(0.3f)) .Subscribe(_ => soundPlayerPedSetup?.Play()); } } } }
private IEnumerable <object> BlackOutEnd() { soundPlayerEnd?.Play(); yield return(WaitForSeconds(1)); ParupunteEnd(); }
public void Play(string s, bool bAsync) { pl=new SoundPlayer(s); if (bAsync) pl.Play(); else pl.PlaySync(); }
public override void OnStart() { ReduceCounter = new ReduceCounter(15 * 1000); ReduceCounter.OnFinishedAsync.Subscribe(_ => ParupunteEnd()); AddProgressBar(ReduceCounter); soundPlayerStart?.Play(); GameplayCamera.StopShaking(); }
public override void OnStart() { ReduceCounter = new ReduceCounter(15 * 1000); AddProgressBar(ReduceCounter); ReduceCounter.OnFinishedAsync.Subscribe(_ => { ParupunteEnd(); }); soundPlayerStart?.Play(); }
public static void Inizialize(UnmanagedMemoryStream stream) { try { using var snd = new SoundPlayer(stream); snd.Load(); if (snd.IsLoadCompleted) { snd?.Play(); } } catch { } }
public static void Inizialize(UnmanagedMemoryStream stream) { try { using var snd = new SoundPlayer(stream); snd?.Load(); if (snd.IsLoadCompleted) { snd?.Play(); } } catch (Exception ex) { throw new Exception("Error MusicPlay: ", ex); } }
public void Play(WaveAudio a, bool bAsync) { m = new MemoryStream(); bw = new BinaryWriter(m); a.SaveWaveFile(bw); pl = new SoundPlayer(m); pl.Stream.Position = 0; // This line is necessary if (bAsync) pl.Play(); else pl.PlaySync(); }
public override void OnStart() { ReduceCounter = new ReduceCounter(15000); AddProgressBar(ReduceCounter); var ptfxName = "core"; if (!Function.Call <bool>(Hash.HAS_NAMED_PTFX_ASSET_LOADED, ptfxName)) { Function.Call(Hash.REQUEST_NAMED_PTFX_ASSET, ptfxName); } Function.Call(Hash._SET_PTFX_ASSET_NEXT_CALL, ptfxName); var animDict = "missfam5_yoga"; Function.Call(Hash.REQUEST_ANIM_DICT, animDict); core.PlayerPed.CanRagdoll = false; core.PlayerPed.CanSufferCriticalHits = false; core.PlayerPed.CanPlayGestures = false; core.PlayerPed.CanBeDraggedOutOfVehicle = false; core.PlayerPed.BlockPermanentEvents = false; foreach (var ped in core.CachedPeds.Where(x => x.IsSafeExist() && x.IsInRangeOf(core.PlayerPed.Position, 50) && x.IsAlive)) { pedList.Add(ped); ninjas.Add(ped.Handle); ped.CanPlayGestures = false; ped.CanRagdoll = false; StartCoroutine(YogaCoroutine(ped)); } ReduceCounter.OnFinishedAsync.Subscribe(_ => { foreach (var ped in pedList) { if (ped.IsSafeExist()) { SetAnimRate(ped, 1); Function.Call(Hash.TASK_FORCE_MOTION_STATE, ped, 0xFFF7E7A4, 0); } ped.CanPlayGestures = true; ped.CanRagdoll = true; } ParupunteEnd(); }); soundPlayerStart?.Play(); }
//Event handlers private void Gkh_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == hk_dwm_on && (hkmod_dwm_on == Keys.None || e.Modifiers == hkmod_dwm_on)) { ClearConsole(); RestoreDWM(); snd_dwm_on?.Play(); } else if (e.KeyCode == hk_dwm_off && (hkmod_dwm_off == Keys.None || e.Modifiers == hkmod_dwm_off)) { ClearConsole(); DisableDWM(); snd_dwm_off?.Play(); } }
private void Start() { Restart(); _soundPlayer?.Play(Sound.GAME_AMBIENT, 3); EventManager.StartListening(EventManager.Event.ENEMY_ATTENTION_LOST, () => { //_soundPlayer.Stop(_heartbeatSoundID); }); EventManager.StartListening(EventManager.Event.ENEMY_ATTENTION_LOW, () => { //_soundPlayer.Stop(_heartbeatSoundID); //_heartbeatSoundID = _soundPlayer.Play(Sound.HEARTBEAT_SLOW); }); EventManager.StartListening(EventManager.Event.ENEMY_ATTENTION_HIGH, () => { //_soundPlayer.Stop(_heartbeatSoundID); //_heartbeatSoundID = _soundPlayer.Play(Sound.HEARTBEAT_FAST); }); }
public override void OnStart() { ReduceCounter = new ReduceCounter(8000); AddProgressBar(ReduceCounter); if (AffectAllPed) { targetPeds = core.CachedPeds.Where(x => x.IsSafeExist() && x.IsAlive).ToList(); } targetPeds.Add(core.PlayerPed); foreach (var ped in targetPeds) { //コルーチン起動 coroutineId = StartCoroutine(MagicFireCoroutine(ped)); } soundPlayerStart?.Play(); }
public override void OnStart() { ReduceCounter = new ReduceCounter(15 * 1000); AddProgressBar(ReduceCounter); core.PlayerPed.IsInvincible = true; ReduceCounter.OnFinishedAsync.Subscribe(_ => { if (core.PlayerPed.IsInVehicle()) { core.PlayerPed.CurrentVehicle.IsCollisionProof = false; core.PlayerPed.CurrentVehicle.Repair(); } core.PlayerPed.IsInvincible = false; ParupunteEnd(); }); soundPlayerStart?.Play(); }
protected override void OnMouseDown(System.Windows.Input.MouseButtonEventArgs e) { player?.Play(); base.OnMouseDown(e); e.Handled = true; if (!_pressed) { SimulateKeyDown(); if (!FakeToggle) { timer.Interval = TimeSpan.FromMilliseconds(300); timer.Start(); } } else { SimulateKeyUp(); } }
public override void OnStart() { ReduceCounter = new ReduceCounter(15000); AddProgressBar(ReduceCounter); var ptfxName = "core"; if (!Function.Call <bool>(Hash.HAS_NAMED_PTFX_ASSET_LOADED, ptfxName)) { Function.Call(Hash.REQUEST_NAMED_PTFX_ASSET, ptfxName); } Function.Call(Hash._SET_PTFX_ASSET_NEXT_CALL, ptfxName); foreach (var ped in core.CachedPeds.Where(x => x.IsSafeExist() && x.IsInRangeOf(core.PlayerPed.Position, 30) && x.IsAlive)) { pedList.Add(ped); ninjas.Add(ped.Handle); ped.CanPlayGestures = false; ped.CanSwitchWeapons = false; ped.CanRagdoll = false; StartCoroutine(PlayCoroutine(ped)); } ReduceCounter.OnFinishedAsync.Subscribe(_ => { foreach (var ped in pedList) { if (ped.IsSafeExist()) { SetAnimRate(ped, 1); Function.Call(Hash.TASK_FORCE_MOTION_STATE, ped, 0xFFF7E7A4, 0); } ped.CanPlayGestures = true; ped.CanSwitchWeapons = true; ped.CanRagdoll = true; } ParupunteEnd(); }); soundPlayerStart?.Play(); }
private IEnumerable <object> BlackOutStart() { StartCoroutine(DrawBlackOutLine()); //効果音に合わせてチカチカさせる soundPlayerStart?.Play(); yield return(WaitForSeconds(1.5f)); var current = false; for (var i = 0; i < 10; i++) { GTA.World.SetBlackout(current); if (Random.Next(0, 2) % 2 == 0) { current = !current; } yield return(null); } GTA.World.SetBlackout(true); }
public override void OnStart() { ReduceCounter = new ReduceCounter(15000); AddProgressBar(ReduceCounter); var ptfxName = "core"; if (!Function.Call <bool>(Hash.HAS_NAMED_PTFX_ASSET_LOADED, ptfxName)) { Function.Call(Hash.REQUEST_NAMED_PTFX_ASSET, ptfxName); } Function.Call(Hash._SET_PTFX_ASSET_NEXT_CALL, ptfxName); var animDict = "missbigscore1switch_trevor_piss"; Function.Call(Hash.REQUEST_ANIM_DICT, animDict); foreach (var ped in core.CachedPeds.Where(x => x.IsSafeExist() && x.IsInRangeOf(core.PlayerPed.Position, 100) || x.IsDead && x.IsAlive)) { pedList.Add(ped); ninjas.Add(ped.Handle); StartCoroutine(PlayCoroutine(ped)); } ReduceCounter.OnFinishedAsync.Subscribe(_ => { foreach (var ped in pedList) { if (ped.IsSafeExist()) { SetAnimRate(ped, 1); Function.Call(Hash.TASK_FORCE_MOTION_STATE, ped, 0xFFF7E7A4, 0); } } ParupunteEnd(); }); soundPlayerStart?.Play(); }
public override void OnStart() { ReduceCounter = new ReduceCounter(15000); AddProgressBar(ReduceCounter); var dayTime = GTA.World.CurrentDayTime; Function.Call(Hash.SET_CLOCK_TIME, 1, dayTime.Minutes, dayTime.Seconds); if (AffectAllPed) { targetPeds = core.CachedPeds.Where(x => x.IsSafeExist() && x.IsAlive).ToList(); } targetPeds.Add(core.PlayerPed); foreach (var ped in targetPeds) { //コルーチン起動 coroutineId = StartCoroutine(MagicFireCoroutine(ped)); } soundPlayerStart?.Play(); }
public Speaker(RenderWindow window, VirtualMachine virtualMachine, XElement config) { var errorMsg = ""; try { errorMsg = "Bad Port"; devPort = short.Parse(Util.ElementValue(config, "Port", null)); errorMsg = "Bad SampleRate"; sampleRate = uint.Parse(Util.ElementValue(config, "SampleRate", null)); errorMsg = "Bad UpdateFrequency"; var updateFreq = uint.Parse(Util.ElementValue(config, "UpdateFrequency", null)); if (updateFreq == 0) throw new Exception("UpdateFrequency must be above 0"); errorMsg = "Init failed"; player = new SoundPlayer(sampleRate, updateFreq); generators = new List<ISoundGenerator>(); generators.Add(new Square()); generators.Add(new Square()); generators.Add(new Sine()); generators.Add(new Noise()); mixer = new SoundMixer(); generators.ForEach(mixer.AddSource); Reset(); player.Source = mixer; player.Play(); } catch (Exception e) { throw new Exception(string.Format("Speaker: {0}", errorMsg), e); } }
// This function plays sound on the click of deal button private void PlaySound() { log.Debug("PlaySound method of Hedgeem Table is called"); try { SoundPlayer sd = new SoundPlayer(); sd.SoundLocation = Server.MapPath("~/resources/waves/Deal-6.mp3 "); sd.Play(); sd.Play(); sd.Play(); sd.Play(); sd.Play(); } catch (Exception ex) { string my_error_popup = "Error in PlaySound method - " + ex.Message.ToString(); // ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", my_error_popup, true); HedgeEmLogEvent my_log = new HedgeEmLogEvent(); my_log.p_message = ex.Message; my_log.p_method_name = "PlaySound"; my_log.p_player_id = Convert.ToInt32(Session["p_session_player_id"]); my_log.p_game_id = game_id; my_log.p_table_id = p_session_personal_table_id; log.Error(my_log.ToString()); HedgeemerrorPopup my_popup_message = new HedgeemerrorPopup(); my_popup_message.p_detailed_message_str = ""; my_popup_message.p_is_visible = false; //ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", my_error_popup, true); my_popup_message.p_detailed_message_str = my_error_popup; my_popup_message.p_is_visible = true; Place_Holder_Popup_Message.Controls.Add(my_popup_message); } }
// While cycle of the game private static void GameCycle(SoundPlayer player, ref Symbol spider, ref int lifes, ref int score, ref List<Symbol> rain, ref List<Symbol> flies, Random randomGenerator) { while (keepPlaying) { Console.Clear(); PrintStaticElementsPlayfield(); RandomChanceFliesAndDrops(rain, flies, randomGenerator); List<Symbol> newListFlies = MovingFlies(ref spider, ref score, flies); flies = newListFlies; List<Symbol> newListDrops = MovingDrops(player, ref spider, ref lifes, ref score, rain, newListFlies); // keepPlaying is false, therefore the game ends if (keepPlaying == false) { SoundPlayer died = new SoundPlayer(); PlaySound(@"..\..\..\Died.wav", died); died.Play(); Console.ForegroundColor = ConsoleColor.Yellow; Console.SetCursorPosition(Console.WindowWidth / 2 - 5, Console.WindowHeight / 2 - 2); Console.Write("GAME OVER"); Thread.Sleep((int)3000); // Getting results to file Result(score); CompareResults(); Console.Clear(); // Printing all players score PrintingResults(); Thread.Sleep((int)1000); // After the scoreboard the player is given a choice between continuing and exiting // After his choice we exit the function ConsoleKeyInfo pressedKey = new ConsoleKeyInfo(); do { pressedKey = Console.ReadKey(true); if (pressedKey.Key == ConsoleKey.Enter) { throw new ContinuePlaying(); } else if (pressedKey.Key == ConsoleKey.Escape) { throw new StopPlaying(); } } while (pressedKey.Key != ConsoleKey.Enter && pressedKey.Key != ConsoleKey.Escape); } rain = newListDrops; PrintingDrops(rain); PrintingFlies(flies); PrintOnPosition(3, 2, "Player: " + playerName, ConsoleColor.Yellow); PrintOnPosition(3, 3, "Score: " + score, ConsoleColor.Magenta); PrintOnPosition(3, 4, "Lives: " + lifes, ConsoleColor.Green); spider = MovingAndPrintingSpider(spider); } }
private static void MoveCursor() { PrintCursor(x, y); while (true) { ConsoleKeyInfo key = Console.ReadKey(); if (key.Key == ConsoleKey.DownArrow) { if (y < 29) { PrintCursor(x, y += 3); Console.Beep(1000, 100); } else { PrintCursor(x, y); } } else if (key.Key == ConsoleKey.UpArrow) { if (y > 22) { PrintCursor(x, y -= 3); Console.Beep(1000, 100); } else { PrintCursor(x, y); } } if (key.Key == ConsoleKey.Enter && y == 20) { Console.Clear(); PlayGame(); } else if (key.Key == ConsoleKey.Enter && y == 23) { Console.Clear(); printHighScores(); //Console.WriteLine("Highscores here ! "); } else if (key.Key == ConsoleKey.Enter && y == 26) { Console.Clear(); //Instructions(); Console.WriteLine(@" ___ _ _ _ |_ _|_ __ ___| |_ _ __ _ _ ___| |_(_) ___ _ __ ___ | || '_ \/ __| __| '__| | | |/ __| __| |/ _ \| '_ \/ __| | || | | \__ \ |_| | | |_| | (__| |_| | (_) | | | \__ \ |___|_| |_|___/\__|_| \__,_|\___|\__|_|\___/|_| |_|___/ "); Console.SetCursorPosition(0, 15); Console.ForegroundColor = ConsoleColor.Blue; string[] message = { "Control your direction by pressing arrow keys on your keyboard.", "Eat bonus to grow and get points.", "Don't run into yourself.", "Hurry up, you can run out of time." }; for (int i = 0; i < message.Length; i++) { Console.Write(new string(' ', (Console.WindowWidth - message[i].Length) / 2)); Console.WriteLine(message[i] + "\n"); } Console.SetCursorPosition(Console.WindowWidth / 2 - 10, Console.WindowHeight - 15); Console.Write("---> BACK TO MENU"); Console.SetCursorPosition(0, 38); Console.ForegroundColor = ConsoleColor.Yellow; string dash = new string('-', 35); Console.WriteLine(" " + dash + " Team Scarlet Witch " + dash); ConsoleKeyInfo backspace = Console.ReadKey(); if (backspace.Key == ConsoleKey.Backspace) { Console.Clear(); ConsoleMenu(); MoveCursor(); } else { Console.Clear(); ConsoleMenu(); MoveCursor(); } } else if (key.Key == ConsoleKey.Enter && y == 29) { Console.Clear(); //Exit(); Console.WriteLine(@" ---_ ......._-_--. (|\ / / /| \ \ / / .' -=-' `. / / .' ) _/ / .' _.) / / o o _.-' / .' \ _.-' / .'*| \______.-'// .'.' \*| \| \ | // .'.' _ |*| ` \|// .'.'_ _ _|*| . .// .'.' | _ _ \*| \`-|\_/ / \ _ _ \*\ `/'\__/ \ _ _ \*\ /^| \ _ _ \* ' ` \ _ _ \ "); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine(@" ___ _ _ ____ _ _ _ _ ____ ____ ____ ____ | |__| |__| |\ | |_/ [__ |___ | | |__/ | | | | | | \| | \_ ___] | |__| | \ ___ _ ____ _ _ _ _ _ ____ |__] | |__| \_/ | |\ | | __ | |___ | | | | | \| |__] "); if (System.IO.File.Exists(@"..\..\Sounds\snake.wav")) { snakeSound = new SoundPlayer(@"..\..\Sounds\snake.wav"); snakeSound.Play(); } Console.SetCursorPosition(0, 38); Console.ForegroundColor = ConsoleColor.Yellow; string dash = new string('-', 35); Console.WriteLine(" " + dash + " Team Scarlet Witch " + dash); Console.ForegroundColor = ConsoleColor.White; Console.ReadKey(); System.Environment.Exit(0); } else { MoveCursor(); } } }
public static void playSimpleSound(string path) { SoundPlayer simpleSound = new SoundPlayer(path); simpleSound.Play(); }
internal static void PlaySound(SoundPlayer soundPlayer) => soundPlayer?.Play();
private void RefreshControllerState() { bool lowBatteryWarningSoundPlayed = false; while (true) { //Initialize controllers var controllers = new[] { new Controller(UserIndex.One), new Controller(UserIndex.Two), new Controller(UserIndex.Three), new Controller(UserIndex.Four) }; //Check if at least one is present _controller = controllers.FirstOrDefault(selectControler => selectControler.IsConnected); if (_controller != null) { //cycle through all recognized controllers foreach (var currentController in controllers) { var controllerIndexCaption = GetControllerIndexCaption(currentController.UserIndex); if (currentController.IsConnected) { var batteryInfo = currentController.GetBatteryInformation(BatteryDeviceType.Gamepad); //check if toast was already triggered and battery is no longer empty... if (batteryInfo.BatteryLevel != BatteryLevel.Empty) { if (toast_shown[numdict[$"{currentController.UserIndex}"]] == true) { //...reset the notification toast_shown[numdict[$"{currentController.UserIndex}"]] = false; ToastNotificationManager.History.Remove($"Controller{currentController.UserIndex}", "ControllerToast", APP_ID); } } //wired if (batteryInfo.BatteryType == BatteryType.Wired) { TooltipText = string.Format(Strings.ToolTip_Wired, controllerIndexCaption); ActiveIcon = $"Resources/battery_wired_{currentController.UserIndex.ToString().ToLower() + LightTheme()}.ico"; } //"disconnected", a controller that was detected but hasn't sent battery data yet has this state else if (batteryInfo.BatteryType == BatteryType.Disconnected) { TooltipText = string.Format(Strings.ToolTip_WaitingForData, controllerIndexCaption); ActiveIcon = $"Resources/battery_disconnected_{currentController.UserIndex.ToString().ToLower() + LightTheme()}.ico"; } //this state should never happen else if (batteryInfo.BatteryType == BatteryType.Unknown) { TooltipText = string.Format(Strings.ToolTip_Unknown, controllerIndexCaption); ActiveIcon = $"Resources/battery_disconnected_{currentController.UserIndex.ToString().ToLower() + LightTheme()}.ico"; } //a battery level was detected else { var batteryLevelCaption = GetBatteryLevelCaption(batteryInfo.BatteryLevel); TooltipText = string.Format(Strings.ToolTip_Wireless, controllerIndexCaption, batteryLevelCaption); ActiveIcon = $"Resources/battery_{batteryInfo.BatteryLevel.ToString().ToLower()}_{currentController.UserIndex.ToString().ToLower() + LightTheme()}.ico"; //when "empty" state is detected... if (batteryInfo.BatteryLevel == BatteryLevel.Empty) { //check if toast (notification) for current controller was already triggered if (toast_shown[numdict[$"{currentController.UserIndex}"]] == false) { //if not, trigger it toast_shown[numdict[$"{currentController.UserIndex}"]] = true; ShowToast(currentController.UserIndex); } //check if notification sound is enabled if (Settings.Default.LowBatteryWarningSound_Enabled) { if (Settings.Default.LowBatteryWarningSound_Loop_Enabled || !lowBatteryWarningSoundPlayed) { //Necessary to avoid crashing if the .wav file is missing try { _soundPlayer?.Play(); } catch (Exception ex) { Debug.WriteLine(ex); } lowBatteryWarningSoundPlayed = true; } } } } Thread.Sleep(5000); } } } else { TooltipText = Strings.ToolTip_NoController; ActiveIcon = $"Resources/battery_unknown{LightTheme()}.ico"; } Thread.Sleep(1000); } }
// This function plays sound on the click of deal button private void PlaySound() { log.Debug("PlaySound method of Hedgeem Table is called"); try { SoundPlayer sd = new SoundPlayer(); sd.SoundLocation = Server.MapPath("~/resources/waves/Deal-4.wav"); sd.Play(); sd.Play(); sd.Play(); sd.Play(); sd.Play(); } catch (Exception ex) { string my_error_popup = "alert('Error in PlaySound method - " + ex.Message.ToString() + "');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", my_error_popup, true); HedgeEmLogEvent my_log = new HedgeEmLogEvent(); my_log.p_message = ex.Message; my_log.p_method_name = "PlaySound"; my_log.p_player_id = f_get_player_id(); my_log.p_game_id = game_id; my_log.p_table_id = _table_id; log.Error(my_log.ToString()); } }
/// <summary> /// xxx this sound should be played on client side javascript not serverside as it introduces unecessary delay /// </summary> private void f_play_deal_cards_sound_effect() { SoundPlayer sd = new SoundPlayer(); sd.SoundLocation = Server.MapPath("~/resources/waves/Deal-4.wav"); sd.Play(); sd.Play(); sd.Play(); sd.Play(); sd.Play(); }
static void Main() { SoundPlayer simpleSound = new SoundPlayer(@"..\..\media\DisturbedTheGame.wav"); simpleSound.Play(); //Main ---> LoadScreen ---> PlayGame ---> ReadKey ---> PlayGame LoadScreen(); }
public void PlayWinnerSound() { _winnerSoundPlayer?.Play(); }
public void PlayTileChangeSound() { _tileChangeSoundPlayer?.Play(); }
public void Show() { worldPosition = body.position + localPosition; StartAnimation(); sound?.Play(); }
public override void OnStart() { StartCoroutine(IsonoCoroutine()); soundPlayerStart?.Play(); }
void Start() { _soundPlayer = FindObjectOfType <SoundPlayer>(); _soundPlayer?.Play(SoundType.BACKGROUND_MUSIC); _soundPlayer?.Play(SoundType.BACKGROUND_MUSIC2); }
private void play(string path) { // To play a File from a disk locaiton SoundPlayer objPlayer = new SoundPlayer(); objPlayer.SoundLocation = path; objPlayer.Play(); }
//Death Sound!!! private void loseLife() // checken of pacman op dezelfde positie als een geest is getekend, indien ja: leven kwijt { sp = new SoundPlayer(@"D:\phamner\Documents\Visual Studio 2013\Projects\Pacman\Pacman\Sounds\pacman_death.wav"); if ((pacman.X == redGhost.X) && ( pacman.Y == redGhost.Y) || (pacman.X == greenGhost.X) && ( pacman.Y == greenGhost.Y) || (pacman.X == yellowGhost.X) && ( pacman.Y == yellowGhost.Y)) { lives -= 1; sp.Play(); Thread.Sleep(2000); } if (lives == 0) { level = 1; tmrStep.Enabled = false; MessageBox.Show("Jou score is: " + score, "Game Over..."); resetProgress(); paper.Clear(Color.Black); resetField(); } lblLivesCount.Text = Convert.ToString(lives); }
public void FIND_M_1() { int CHECK_COUNT = 2; while (true) { GC.Collect(); if (DATA_M_1.Count == 15) { int count = 0; if (DATA_M_1[0].state == "0") { int index = 2; if (DATA_M_1[1].result == DATA_M_1[index].result) { index += 1; if (DATA_M_1[1].result == DATA_M_1[index].result) { index += 1; count = 2; if (DATA_M_1[0].result == DATA_M_1[index].result) { index += 1; count = 3; if (DATA_M_1[0].result == DATA_M_1[index].result) { index += 1; count = 4; if (DATA_M_1[0].result == DATA_M_1[index].result) { index += 1; count = 5; if (DATA_M_1[0].result == DATA_M_1[index].result) { index += 1; count = 6; if (DATA_M_1[0].result == DATA_M_1[index].result) { index += 1; count = 7; if (DATA_M_1[0].result == DATA_M_1[index].result) { index += 1; count = 8; if (DATA_M_1[0].result == DATA_M_1[index].result) { index += 1; count = 9; if (DATA_M_1[0].result == DATA_M_1[index].result) { index += 1; count = 10; } } } } } } } } } } if (DATA_M_1[1].result == "매수") { SetLabelText(label5, string.Format("SU : {0}", count)); } else if (DATA_M_1[1].result == "매도") { SetLabelText(label5, string.Format("DO : {0}", count)); } } else { int index = 1; if (DATA_M_1[0].result == DATA_M_1[index].result) { count = 2; index += 1; if (DATA_M_1[0].result == DATA_M_1[index].result) { index += 1; count = 3; if (DATA_M_1[0].result == DATA_M_1[index].result) { index += 1; count = 4; if (DATA_M_1[0].result == DATA_M_1[index].result) { index += 1; count = 5; if (DATA_M_1[0].result == DATA_M_1[index].result) { index += 1; count = 6; if (DATA_M_1[0].result == DATA_M_1[index].result) { index += 1; count = 7; if (DATA_M_1[0].result == DATA_M_1[index].result) { index += 1; count = 8; if (DATA_M_1[0].result == DATA_M_1[index].result) { index += 1; count = 9; if (DATA_M_1[0].result == DATA_M_1[index].result) { index += 1; count = 10; } } } } } } } } } if (DATA_M_1[1].result == "매수") { SetLabelText(label5, string.Format("SU : {0}", count)); } else if (DATA_M_1[1].result == "매도") { SetLabelText(label5, string.Format("DO : {0}", count)); } //if (count > 0) if (count >= Convert.ToInt32(comboBox1.Text)) { string PATH = System.Environment.CurrentDirectory.ToString(); SoundPlayer wp = new SoundPlayer(PATH + @"\1분.wav"); wp.Play(); MessageBox.Show("1"); } } } Thread.Sleep(1000 * 10); } }
private IEnumerable <object> FulutonCoroutine(Entity entity) { //Entityが消え去った後に処理したいので先に情報を保存しておく int hash = -1; bool isPed = false; var upForce = new Vector3(0, 0, 1); if (entity is Ped) { var p = entity as Ped; p.CanRagdoll = true; p.SetToRagdoll(); isPed = true; } else { var v = entity as Vehicle; Function.Call(Hash.SET_VEHICLE_DOORS_LOCKED, v, 1); LeaveAllPedsFromVehicle(v); } hash = entity.Model.Hash; entity.ApplyForce(upForce * 2.0f); foreach (var s in WaitForSeconds(3)) { if (!entity.IsSafeExist() || entity.IsDead) { yield break; } if (entity is Ped) { ((Ped)entity).SetToRagdoll(); } entity.ApplyForce(upForce * 1.07f); yield return(s); } if (!entity.IsSafeExist() || entity.IsRequiredForMission()) { yield break; } if (PlayerPed.CurrentVehicle.IsSafeExist() && PlayerPed.CurrentVehicle.Handle == entity.Handle) { yield break; } //弾みをつける yield return(WaitForSeconds(0.25f)); soundPlayerMove?.Play(); foreach (var s in WaitForSeconds(15)) { if (!entity.IsSafeExist() || entity.Position.DistanceTo(PlayerPed.Position) > 100) { if (PlayerPed.CurrentVehicle.IsSafeExist() && PlayerPed.CurrentVehicle.Handle == entity.Handle) { yield break; } if (isPed) { motherBasePeds.Enqueue((PedHash)hash); Game.Player.Money -= 100; if (entity.IsSafeExist()) { entity.Delete(); } } else { motherbaseVeh.Enqueue((GTA.Native.VehicleHash)hash); Game.Player.Money -= 1000; } DrawText("回収完了", 3.0f); yield break; } if (entity.IsDead) { yield break; } var force = upForce * 1.0f / Game.FPS * 500.0f; if (entity is Ped) { force = upForce * 1.0f / Game.FPS * 800.0f; } entity.ApplyForce(force); yield return(s); } }
public void setSE(int i) { //���ʉ��̐ݒ� //���ʉ���ID�ŊǗ�ID=0�Œ�~ string a = "janp"; //��ňʒu��C�� SoundPlayer player = new SoundPlayer(@"C:\Users\minami\Desktop\XNA\Scene0\Scene0Content\"+a+".wav"); if (player != null) stopSE(); player.Play(); }
public LipSync() { Interval = 100; var playkey = (Keys)Enum.Parse(typeof(Keys), Settings.GetValue("lipsync", "play", "J")); var stopkey = (Keys)Enum.Parse(typeof(Keys), Settings.GetValue("lipsync", "stop", "K")); var player = new SoundPlayer(); player.SoundLocation = Settings.GetValue("lipsync", "sound"); player_values = ReadWav(Settings.GetValue("lipsync", "vocal")); var playing = false; KeyUp += (sender, e) => { if (e.KeyCode == playkey) { stopwatch.Stop(); player.Stop(); playing = false; Function.Call(Hash.STOP_ANIM_TASK, Game.Player.Character.Handle, "mp_facial", "mic_chatter", -2.0f); if (player_values != null) { player.Play(); stopwatch.Restart(); } } else if (e.KeyCode == stopkey) { stopwatch.Stop(); player.Stop(); playing = false; Function.Call(Hash.STOP_ANIM_TASK, Game.Player.Character.Handle, "mp_facial", "mic_chatter", -2.0f); } }; Tick += (sender, e) => { { if (!stopwatch.IsRunning) return; double level = 0.0; var player_index = (int)(stopwatch.ElapsedMilliseconds / Interval); if (player_index < player_values.Length) { level = player_values[player_index]; } else { player.Stop(); stopwatch.Stop(); } if (playing && level < 0.1) { playing = false; //UI.Notify(String.Format("{0} - stop talking", player_index)); Function.Call(Hash.STOP_ANIM_TASK, Game.Player.Character.Handle, "mp_facial", "mic_chatter", -2.0f); } else if (!playing && level > 0.1) { playing = true; //UI.Notify(String.Format("{0} - start talking", player_index)); Function.Call(Hash.TASK_PLAY_ANIM, Game.Player.Character.Handle, "mp_facial", "mic_chatter", 8.0f, -2.0f, -1, 33, 0.0f, 0, 0, 0); } } }; }
void RandomScream() { _soundPlayer?.Play(SoundType.RANDOM_SCREAM); Invoke("RandomScream", Random.Range(30, 120)); }
// Moving Drops private static List<Symbol> MovingDrops(SoundPlayer player, ref Symbol spider, ref int lifes, ref int score, List<Symbol> rain, List<Symbol> newListFlies) { // Drops list List<Symbol> newListDrops = new List<Symbol>(); Symbol movingDrop = new Symbol(); for (int i = 0; i < rain.Count; i++) { // Moving drops if (rain[i].x - 1 >= 1 && rain[i].y + 1 < Console.WindowHeight - 1) { movingDrop.x = rain[i].x - 1; movingDrop.y = rain[i].y + 1; movingDrop.str = rain[i].str; movingDrop.color = rain[i].color; newListDrops.Add(movingDrop); } // Check for collision - if drop has hit us if (movingDrop.x >= spider.x + 1 && movingDrop.x <= spider.x + 3 && movingDrop.y >= spider.y && movingDrop.y <= spider.y + 1) { lifes--; player.Stop(); SoundPlayer lifeLost = new SoundPlayer(); PlaySound(@"..\..\..\LifeLost.wav", lifeLost); lifeLost.Play(); // Message that shows lives left if (lifes >= 0) { PrintOnPosition(spider.x, spider.y - 2, spider.str = "DIED!", spider.color = ConsoleColor.Yellow); PrintOnPosition(spider.x, spider.y - 1, spider.str = string.Format(" {0}", lifes), spider.color = ConsoleColor.Yellow); PrintOnPosition(spider.x, spider.y, spider.str = "lives", spider.color = ConsoleColor.Yellow); PrintOnPosition(spider.x, spider.y + 1, spider.str = "left!", spider.color = ConsoleColor.Yellow); Thread.Sleep(2000); Console.Clear(); newListDrops.Clear(); newListFlies.Clear(); rain.Clear(); player.Play(); } // Game over keepPlaying is false -> exit the function else { keepPlaying = false; } } } return newListDrops; }