/// <summary> /// Stops the sound. /// </summary> public void Stop() { if (!IsPlaying || _voice == null) { return; } if (_looped) { _voice.ExitLoop(); _loopCount = 0; } else { _voice.Stop(); _voice.FlushSourceBuffers(); SoundService.DeactivateSound(this); } IsPaused = false; IsPlaying = false; Stopped.Fire(_soundId); TrackPosition = TimeSpan.Zero; }
public TipViewModel(RestService reset, SoundService sound, ConfigService config, StatisticService statistic, MainService main, App app, KeyboardShortcutsService keyboardShortcuts, PreAlertService preAlert, ThemeService theme) { this.reset = reset; this.reset.TimeChanged += new RestEventHandler(timeChanged); this.reset.RestCompleted += new RestEventHandler(resetCompleted); this.sound = sound; this.config = config; this.config.Changed += config_Changed; resetCommand = new Command(new Action <object>(resetCommand_action)); busyCommand = new Command(new Action <object>(busyCommand_action)); this.statistic = statistic; this.main = main; this.keyboardShortcuts = keyboardShortcuts; this.preAlert = preAlert; this.theme = theme; theme.OnChangedTheme += Theme_OnChangedTheme; ChangedEvent += TipViewModel_ChangedEvent; LoadConfig(); }
private async void IoTHubDeviceService_TakePictureCommandReceived(object sender, TakePictureCommandEventArgs e) { //Using a zero based index... Hmm... if (e.Camera >= 0 && e.Camera < CameraService.Cameras.Count) { await SoundService.PlayAudioFileAsync("pictake01.wav"); //Debug.WriteLine(String.Format("Taking picture for Team {0} with camera: {1}", e.CommandMessage.Team, e.Camera)); try { //string fileName = await CameraService.ProcessTakePictureCommand(e); string fileName = await CameraService.ProcessTakePictureCommandFixed(e); string msg = String.Format("Team {0}, the photo from camera {1} has been uploaded to '{0}-<correlation-id>.jpg'", e.CommandMessage.Team, e.Camera); SendDeviceMessage(e.CommandMessage.Team, e.Message.MessageId, msg); } catch (Exception ex) { string msg = String.Format("Team {0}, there was a problem uploading the photo from camera {1}.", e.CommandMessage.Team, e.Camera); SendDeviceMessage(e.CommandMessage.Team, e.Message.MessageId, msg); } } else { await SoundService.PlayAudioFileAsync("soundeffect02.wav"); string msg = String.Format("Team {0}, the following camera is invalid: {1}", e.CommandMessage.Team, e.Camera); SendDeviceMessage(e.CommandMessage.Team, e.Message.MessageId, msg); } }
public GameplayScreen(ContentManager content, Game game, Client client) : base(content, game) { Client = client; ChampionsInfo = new ChampionsInfo(); GameTime = null; TimeSinceLastInputSent = 0.0; Match = new GameMatch(Path.Combine("Content", MapLoader.MAIN_MAP_PATH)); LastStateUpdateData = new List <StateUpdateData>(); RemarkableEvents = new List <RemarkableEventData>(); Spells = new Dictionary <ulong, DrawableSpell>(); TimeOfLastStateUpdate = 0.0; Champions = new List <ClientChampion>(); GameWorld = new Container(); Structures = new List <DrawableStructure>(); Camera = new CameraService(); Services.AddService(typeof(CameraService), Camera); ((SoundService)Services.GetService(typeof(SoundService))).CameraService = Camera; Parallax = new Parallax(); KillDisplay = new KillDisplay(ChampionsInfo); GameScore = new GameScore(); Sound = (SoundService)Services.GetService(typeof(SoundService)); }
/// <inheritdoc /> public override void Destroy() { base.Destroy(); Stop(); SoundService.RemoveSound(this); _callback?.Dispose(); }
/// <summary> /// Initializes a new instance of the <see cref="TradebarViewModel" /> class. /// </summary> /// <param name="eventAggregator">The event aggregator.</param> /// <param name="clientLurker">The client lurker.</param> /// <param name="processLurker">The process lurker.</param> /// <param name="keyboardLurker">The keyboard lurker.</param> /// <param name="dockingHelper">The docking helper.</param> /// <param name="keyboardHelper">The keyboard helper.</param> /// <param name="settingsService">The settings service.</param> /// <param name="windowManager">The window manager.</param> /// <param name="soundService">The sound service.</param> /// <param name="pushBulletService">The PushBullet service.</param> public TradebarViewModel( IEventAggregator eventAggregator, ClientLurker clientLurker, ProcessLurker processLurker, KeyboardLurker keyboardLurker, DockingHelper dockingHelper, PoeKeyboardHelper keyboardHelper, SettingsService settingsService, IWindowManager windowManager, SoundService soundService, PushBulletService pushBulletService) : base(windowManager, dockingHelper, processLurker, settingsService) { this._eventAggregator = eventAggregator; this._keyboardHelper = keyboardHelper; this._soundService = soundService; this._clientLurker = clientLurker; this._pushBulletService = pushBulletService; this._keyboardLurker = keyboardLurker; this.TradeOffers = new ObservableCollection <OfferViewModel>(); this._soldOffers = new List <TradeEvent>(); this._context = new TradebarContext(this.RemoveOffer, this.AddActiveOffer, this.AddToSoldOffer, this.SetActiveOffer, this.ClearAll); this.DisplayName = "Poe Lurker"; }
private void Initialize(SceneManagerService sceneManagerService, IPromiseTimerService promiseTimerService, SoundService soundService, LevelResolver resolver) { _sceneManagerService = sceneManagerService; _promiseTimerService = promiseTimerService; _soundService = soundService; _levelResolver = resolver; }
public MainPage() { this.InitializeComponent(); SoundService.GetAllSounds().ForEach(a => Items.Add(a)); MenuItems.Add(new MenuItem { IconFile = "Assets/Icons/animals.png", Category = SoundCategory.Animals }); MenuItems.Add(new MenuItem { IconFile = "Assets/Icons/cartoon.png", Category = SoundCategory.Cartoons }); MenuItems.Add(new MenuItem { IconFile = "Assets/Icons/taunt.png", Category = SoundCategory.Taunts }); MenuItems.Add(new MenuItem { IconFile = "Assets/Icons/warning.png", Category = SoundCategory.Warnings }); }
/// <summary> /// Initializes a new instance of the <see cref="SettingsViewModel" /> class. /// </summary> /// <param name="windowManager">The window manager.</param> /// <param name="keyboardHelper">The keyboard helper.</param> /// <param name="settingsService">The settings service.</param> /// <param name="hotkeyService">The key code service.</param> /// <param name="soundService">The sound service.</param> /// <param name="githubService">The github service.</param> /// <param name="pushBulletService">The PushBullet service.</param> public SettingsViewModel( IWindowManager windowManager, KeyboardHelper keyboardHelper, SettingsService settingsService, HotkeyService hotkeyService, SoundService soundService, GithubService githubService, PushBulletService pushBulletService) : base(windowManager) { this._keyboardHelper = keyboardHelper; this._settingService = settingsService; this._hotkeyService = hotkeyService; this._soundService = soundService; this.DisplayName = "Settings"; this._excludePropertyNames = this.GetExcludedPropertyNames(); this.PropertyChanged += this.SettingsViewModel_PropertyChanged; if (!AssetService.Exists(LottieFileName)) { AssetService.Create(LottieFileName, GetResourceContent(LottieFileName)); } this.BuildManager = new BuildManagerViewModel(this.ShowMessage, githubService); this.PushBullet = new PushBulletViewModel(pushBulletService); this.SetupHotkeys(); }
private void Initialize(SceneManagerService sceneManagerService, IPromiseTimerService promiseTimerService, SoundService soundService, TappableShoe[] shoes) { _sceneManagerService = sceneManagerService; _promiseTimerService = promiseTimerService; _soundService = soundService; _shoes = shoes; }
private void HandleShapeAndSound(SoundService soundService, ShapeAndSoundTuple shapeAndSound, SoundAction soundAction, LongSoundOwner longSoundOwner) { if (shapeAndSound != null) { if (shapeAndSound.Shape != null && !this._BabyShapes.Components.Contains(shapeAndSound.Shape)) { this._BabyShapes.Components.Add(shapeAndSound.Shape); } if (shapeAndSound.Sound != null) { if (soundAction == SoundAction.Button) { soundService.TryPlaySoundButton(shapeAndSound.Sound); } else if (soundAction == SoundAction.Analogue) { soundService.TryPlaySoundLong(shapeAndSound.Sound, longSoundOwner); } else if (soundAction == SoundAction.ForceButton) { soundService.ForcePlaySoundButton(shapeAndSound.Sound); } else if (soundAction == SoundAction.ForceAnalogue) { soundService.TryPlaySoundLong(shapeAndSound.Sound, longSoundOwner); } else { throw new ApplicationException("Forgot a soundType."); } } } }
// Use this for initialization private void Start() { Reset(); _audioSource = SoundService.GetAudioSourceFromPool(); GameObjectsProviderService.CurrentWeaponController.IncrementPowerEvent += OnIncrementPowerEvent; GameObjectsProviderService.CurrentWeaponController.ResetPowerEvent += OnResetPowerEvent; }
private void DropCopy(IDropInfo dropInfo) { Action <ISound, int> insertSoundAction; if (ReferenceEquals(dropInfo.TargetCollection, SoundService.ActiveSounds)) { insertSoundAction = (soundToInsert, i) => { SoundService.Add(soundToInsert); }; } else { insertSoundAction = (soundToInsert, i) => { ObservableCollection <ISound> targetCollection = dropInfo.TargetCollection as ObservableCollection <ISound>; targetCollection?.Insert(i, soundToInsert); }; } ISound sound = dropInfo.Data as ISound; IEnumerable <ISound> sounds = dropInfo.Data as IEnumerable <ISound>; DataObject dataObject = dropInfo.Data as DataObject; if (sound != null) { DropSounds(insertSoundAction, dropInfo.InsertIndex, sound); } else if (sounds != null) { DropSounds(insertSoundAction, dropInfo.InsertIndex, sounds.ToArray()); } else if (dataObject != null) { DropFiles(insertSoundAction, dropInfo.InsertIndex, dataObject); } }
public override StateChangeInformation OnUpdate(float elapsedTime) { _globalTime += elapsedTime; _explosionManager.Update(elapsedTime); _gameBackground.Update(elapsedTime); _carManager.Update(elapsedTime); _player.Update(elapsedTime); _weather.Update(elapsedTime); if (_playerIsDead) { _waitTimer += elapsedTime; if (_waitTimer >= 3.0f) { return(StateChangeInformation.StateChange(typeof(GameOverState), typeof(FlipTransition), _player.Points)); } } else if (!_playerIsDead && _player.PlayerState == PlayerState.Dead) { SoundService.StopCurrentSong(); _playerIsDead = true; _waitTimer = 0; } _carManager.spawnTime = (100 - _player.Points / 50); if (_carManager.spawnTime <= 10) { _carManager.spawnTime = 10; } _carManager.points = _player.Points + 150; return(StateChangeInformation.Empty); }
public OptionsViewModel(ConfigService config, MainService mainService, SystemResourcesService systemResources, SoundService sound, ThemeService theme) { this.config = config; this.mainService = mainService; this.systemResources = systemResources; this.sound = sound; this.theme = theme; Model = new OptionsModel(); Model.Data = config.options; Model.Themes = systemResources.Themes; Model.Animations = systemResources.Animations; Model.PreAlertActions = systemResources.PreAlertActions; string[] version = Assembly.GetExecutingAssembly().GetName().Version.ToString().Split('.'); Model.Version = version[0] + "." + version[1] + "." + version[2]; applyCommand = new Command(new Action <object>(applyCommand_action)); openurlCommand = new Command(new Action <object>(openurlCommand_action)); inkCommand = new Command(new Action <object>(inkCommand_action)); soundTestCommand = new Command(new Action <object>(soundTestCommand_actionAsync)); updateCommand = new Command(new Action <object>(updateCommand_action)); showWindowCommand = new Command(new Action <object>(showWindowCommand_action)); addBreackProcessCommand = new Command(new Action <object>(addBreackProcessCommand_action)); removeBreackProcessCommand = new Command(new Action <object>(removeBreackProcessCommand_action)); openWindowCommand = new Command(new Action <object>(openWindowCommand_action)); }
/// <inheritdoc /> protected override void OnAncestryChanged(Instance child, Instance parent) { base.OnAncestryChanged(child, parent); _parentPart = parent as Part; _is3D = _parentPart != null; _attenuation = 1.0f; SoundService.SetSound3D(this, _is3D); }
// Use this for initialization void Start() { loadingBar = transform.Find("loadingbar").GetComponent <Slider> (); SoundService.Instance().PlayMusic("mainMainMusic.mp3"); // 需要初始化的逻辑 //LogicManager.Instance().AddLogic<LoginLogic>(); }
private async void IotHubDeviceService_BrewCommandReceived(object sender, Models.BrewCommandEventArgs e) { await SoundService.PlayAudioFileAsync("brew.wav"); string msg = String.Format("Brewing Coffee for {0}: {1}", e.CommandMessage.Team, e.Payload); SendDeviceMessage(e.CommandMessage.Team, e.Message.MessageId, msg); }
private void Reset() { foreach (var b in Bars) { b.gameObject.SetActive(false); } SoundService.StopPlaying(_audioSource); }
private async void IotHubDeviceService_UnknownCommandReceived(object sender, Models.CommandEventArgs e) { await SoundService.PlayAudioFileAsync("laserwoowoo.wav"); string msg = String.Format("Unknown command received from Team {0}: {1}", e.CommandMessage.Team, e.CommandMessage.Command); SendDeviceMessage(e.CommandMessage.Team, e.Message.MessageId, msg); }
public TestsFixture() { PersistanceManager = new Mock <IPersistenceManager>(); SoundWrapper = new Mock <ISoundWrapper>(); SoundService = new SoundService(PersistanceManager.Object, SoundWrapper.Object); PersistanceManager.Setup(x => x.Read(It.IsAny <string>())).Returns(Path); Path = @"..\..\Media\Sounds\Level2.mp3"; }
public void ReplaceSoundService(SoundService newInstance) { var index = IOComponentsLookup.SoundService; var component = CreateComponent <SoundServiceComponent>(index); component.instance = newInstance; ReplaceComponent(index, component); }
private async void IoTHubDeviceService_BrewCommandReceived(object sender, BrewCommandEventArgs e) { await SoundService.PlayAudioFileAsync("brew.wav"); string msg = "Brewing Coffee!"; SendDeviceMessage(e.CommandMessage.Team, e.Message.MessageId, msg); }
public void Init() { _persistanceManager = new Mock <IPersistenceManager>(); _soundWrapper = new Mock <ISoundWrapper>(); _soundService = new SoundService(_persistanceManager.Object, _soundWrapper.Object); _persistanceManager.Setup(x => x.Read(It.IsAny <string>())).Returns(Path); }
private async void IoTHubDeviceService_PingCommandReceived(object sender, PingCommandEventArgs e) { await SoundService.PlayAudioFileAsync("ping.wav"); string msg = String.Format("Ping Response: {0}", e.Payload); SendDeviceMessage(e.CommandMessage.Team, e.Message.MessageId, msg); }
private async void IotHubDeviceService_BadMessageReceived(object sender, Models.MessageEventArgs e) { await SoundService.PlayAudioFileAsync("allyourbase.wav"); string msg = String.Format("Malformed message received: {0}", e.MessageString); //Debug.WriteLine(msg); SendDeviceMessage("unknown", e.Message.MessageId, msg); }
public PomodoroPageViewModel(IEventAggregator eventAggregator) { this.soundService = new SoundService(); this.eventAggregator = eventAggregator; StartStopCommand = new DelegateCommand(StartStop); ChangeStateCommand = new DelegateCommand <string>(ChangeState); Loadconfiguracion(); ConfigureTimer(); }
private void MenuListView_ItemClick(object sender, ItemClickEventArgs e) { var menuItem = e.ClickedItem as MenuItem; Items.Clear(); SoundService.GetSounds(menuItem.Category).ForEach(a => Items.Add(a)); CategoryTextBlock.Text = menuItem.Category.ToString(); MenuSplitView.IsPaneOpen = false; }
/// <summary> /// Initializes a new instance of the <see cref="SettingsViewModel"/> class. /// </summary> public SettingsViewModel(IWindowManager windowManager, KeyboardHelper keyboardHelper, SettingsService settingsService, SoundService soundService) : base(windowManager) { this._keyboardHelper = keyboardHelper; this._settingService = settingsService; this._soundService = soundService; this.DisplayName = "Settings"; this.PropertyChanged += this.SettingsViewModel_PropertyChanged; }
private void Jump() { _isOnGround = false; VelocityY = _jumpSpeed; VelocityX /= 4; SoundService.PlaySound(Sound.Jump); Shield(); }
// Use this for initialization void Start() { Service.Init(); Service.Get<HUDService>().StartScene(); // _newsDataList = new List<NewsDataItem> (); m_bgm = Resources.Load("Music/headlinesmusic") as AudioClip; m_soundService = Service.Get<SoundService>(); m_soundService.PlayMusic(m_bgm, true); // InitializeDummy (); InitializeNews (); }
// Use this for initialization void Start() { m_enemyMgr = EnemyManager.Get(); m_battleMgr = BattleManager.Get(); m_handler = Service.Get<HUDService>().HUDControl; m_inputMgr = InputManager.Get(); // Initialize base value of player m_player = new PlayerStats(); m_player.atk = 10; m_player.hp = 100; m_player.bravebar = 0; m_skills = new Skill[3]; m_skills[0].name = "Punch"; m_skills[0].energyCost = 1; m_skills[0].dmg = 4.7f; m_skills[0].id = 1; m_skills[1].name = "Kick"; m_skills[1].energyCost = 2; m_skills[1].dmg = 9.0f; m_skills[1].id = 2; m_skills[2].name = "Strike A Pose"; m_skills[2].energyCost = 4; m_skills[2].dmg = 19.0f; m_skills[2].id = 3; //Create Skill Buttons m_camService = Service.Get<MapService>(); m_camService.Init(); if(m_handler != null) { m_handler.AddActionButton("NormalAttack", this.gameObject, m_skills[0]); m_handler.AddActionButton("NormalAttack", this.gameObject, m_skills[1]); m_handler.AddActionButton("NormalAttack", this.gameObject, m_skills[2]); m_handler.InitializeGauge((int)GAUGE.PLAYER, m_player.hp, m_player.hp, "Ellie"); } // l2dInterface.LoadProfile (); l2dInterface.GetModel ().StopBasicMotion (true); l2dInterface.PlayCombatIdleAnim (); m_soundService = Service.Get<SoundService>(); }
void Awake() { m_soundService = Service.Get<SoundService>(); }
void Start() { m_enemyMgr = EnemyManager.Get(); m_playerMgr = PlayerManager.Get(); m_gestureHandler = InputManager.Get(); m_gestureStart = false; m_beginFinisher = false; m_gestureState = GestureState.START; m_phase = BattlePhase.START; gaugeCount = 0; m_win = true; Service.Init(); m_HUDService = Service.Get<HUDService>(); m_HUDService.StartScene(); // Create Battle HUD m_HUDService.CreateBattleHUD(); m_HUDService.ShowBottom(false); m_HUDService.HUDControl.SetSpecialEnable(false); // Create Sound Service m_soundService = Service.Get<SoundService>(); m_soundService.PreloadSFXResource(new string[13]{"attack01", "attack02", "attack03", "countdown", "enemyattack", "finalstrokeappear", "gaugefull", "magicnotecorrect", "playermoveattack", "sceneswish", "supermove", "win", "LadyKnight_Shine"}); m_BGM = Resources.Load("Music/" + m_bgmMusic) as AudioClip; m_SPECIAL = Resources.Load("Music/supermove_jingle" ) as AudioClip; m_soundService.PlayMusic(m_BGM, true); // Create Battle HUD if (nextBattleArea == 1) { m_bgTexture.mainTexture = Resources.Load ("Texture/BG_battle3") as Texture; } else if (nextBattleArea == 2) { m_bgTexture.mainTexture = Resources.Load ("Texture/BG_battle2") as Texture; } }
void Awake() { //Check if object exist in scene GameObject HUDObject = GameObject.Find("HUD"); if (HUDObject == null) { HUDObject = Instantiate (Resources.Load ("Prefabs/HUD")) as GameObject; } m_handler = HUDObject.GetComponentInChildren<HUDHandler>(); m_transitor = GameObject.Find("LoadTransitor"); if (m_transitor == null) { m_transitor = Instantiate (Resources.Load ("Prefabs/LoadTransitor")) as GameObject; DontDestroyOnLoad(m_transitor); } m_scene = m_transitor.GetComponentInChildren<SceneFadeInOut>(); m_sound = Service.Get<SoundService>(); }
// Use this for initialization void Start() { Service.Init(); m_hudService = Service.Get<HUDService>(); m_hudService.StartScene(); m_hudService.HUDControl.ShowRankingGrp (false); costumeBGM = Resources.Load("Music/costumemusic") as AudioClip; armoryBGM = Resources.Load ("Music/weapon_bgm") as AudioClip; m_soundService = Service.Get<SoundService>(); m_soundService.PlayMusic(costumeBGM, true); PutTestData (); currentGroupID = costumeGroupID = 0; _l2dModel.LoadProfile (); _l2dModel.GetModel ().StopBasicMotion (true); _l2dModel.PlayAnimation ("COSTUME_IDLE"); }
// static Quest currentQuest; //multiple sceneFiles in one scene later // Use this for initialization void Start() { Service.Init(); m_hudService = Service.Get<HUDService>(); m_hudService.StartScene(); m_hudService.ShowBottom (true); choiceList = new List<QuestChoiceOption> (); charaInSceneCount = 0; playerChara.PlayIdleAnim (); // LoadScene ("TextData/Quest2"); if (nextSceneID == -1) { LoadScene (sceneFiles [firstQuest]); nextSceneID = firstQuest; } else LoadScene (sceneFiles [nextSceneID]); foreach (GameObject obj in sceneFXContainer) obj.SetActive (false); sceneFXContainer [nextSceneID].SetActive (true); switch (nextSceneID){ case 0: { m_bgm = Resources.Load("Music/room") as AudioClip; } break; case 1: m_bgm = Resources.Load ("Music/outside") as AudioClip; break; case 2: { m_bgm = Resources.Load("Music/shopping") as AudioClip; } break; } m_soundService = Service.Get<SoundService>(); m_soundService.PlayMusic(m_bgm, true); InitializeScene (); isDisplayingBattleStart = false; m_hudService.HUDControl.EnableRanking (true); }