public Sound Load2DSound(string fileName) { var sound = new Sound(Core) { Name = Guid.NewGuid().ToString(), FileName = fileName, Volume = 1.0f, Stopped = true, Loop = false, Is3D = false, ScriptEnabled = false, IsFromScript = true }; Core.LoadComponent<Sound>(sound); return sound; }
public void PlayMusic(string fileName, bool loop) { if (!IsMusicPlaying() && music != null) { Stop(music); } music = new Sound(Core) { Name = Guid.NewGuid().ToString(), FileName = fileName, Volume = Helpers.GameSettings.MusicVolume / 100f, Stopped = false, Loop = loop, Is3D = false, ScriptEnabled = false, IsFromScript = true }; Core.LoadComponent<Sound>(music); }
public void Load(Sound sound) { sound.iSourceSource = soundEngine.GetSoundSource(sound.FileName, true); switch (sound.Is3D) { case true: sound.iSound = soundEngine.Play3D(sound.iSourceSource, sound.Position.x, sound.Position.y, sound.Position.z, sound.Loop, sound.Stopped, false); break; default: sound.iSound = soundEngine.Play2D(sound.iSourceSource, sound.Loop, sound.Stopped, false); break; } StopAllSounds(); }
public void Stop(Sound sound) { sound.iSound.Stop(); }
public void SetVolume(Sound sound, float value) { sound.Volume = value; SetVolume(sound); }
public void SetVolume(Sound sound) { sound.iSourceSource.DefaultVolume = sound.Volume; sound.iSound.Volume = sound.Volume; }
public void SetPosition(Sound sound, float x, float y, float z) { sound.Position = new TV_3DVECTOR(x, y, z); }
public void Play(Sound sound) { switch (sound.Is3D) { case true: sound.iSound = soundEngine.Play3D(sound.iSourceSource, sound.Position.x, sound.Position.y, sound.Position.z, sound.Loop, false, false); break; default: sound.iSound = soundEngine.Play2D(sound.iSourceSource, sound.Loop, false, false); break; } }
public UIView(ICore core, UIType menuType, int width, int height, UIFlags flags, bool transparent) : base(core) { webCore = core.GetService<IUIManagerService>().GetWebCore(); this.menuType = menuType; this.width = width; this.height = height; this.flags = flags; this.isTransparent = transparent; isLoading = false; pageLoaded = false; webTextureID = TextureFactory.CreateTexture(width, height, isTransparent); hudPosX = 0; hudPosY = 0; hud = new TVScreen2DImmediate(); Keyboard = core.GetService<IKeyboardService>(); Mouse = core.GetService<IMouseService>(); JoyStick = core.GetService<IJoyStickService>(); Gamepad = core.GetService<IGamepadsService>(); CanculateHudPosition(flags); View = webCore.CreateWebView(width, height, isTransparent, true); View.OnFinishLoading += OnFinishLoading; View.OnCallback += OnCallback; View.Focus(); buttonClickSound = Core.GetService<ISoundManagerService>().Load2DSound(Path.Combine(Application.StartupPath, @"Data\Sounds\menu\button_click.mp3")); buttonFocusSound = Core.GetService<ISoundManagerService>().Load2DSound(Path.Combine(Application.StartupPath, @"Data\Sounds\menu\button_focus.mp3")); Core.GetService<ISoundManagerService>().SetVolume(buttonClickSound, 0.5f); Core.GetService<ISoundManagerService>().SetVolume(buttonFocusSound, 0.5f); }
public void StopMusic() { if (music != null) { Core.UnloadComponent(music); music = null; } }
public void Play2DSound(Sound sound) { Play(sound); }