Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
 public void Stop(Sound sound)
 {
     sound.iSound.Stop();
 }
Exemplo n.º 5
0
 public void SetVolume(Sound sound, float value)
 {
     sound.Volume = value;
     SetVolume(sound);
 }
Exemplo n.º 6
0
 public void SetVolume(Sound sound)
 {
     sound.iSourceSource.DefaultVolume = sound.Volume;
     sound.iSound.Volume = sound.Volume;
 }
Exemplo n.º 7
0
 public void SetPosition(Sound sound, float x, float y, float z)
 {
     sound.Position = new TV_3DVECTOR(x, y, z);
 }
Exemplo n.º 8
0
 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;
     }
 }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
0
 public void StopMusic()
 {
     if (music != null)
     {
         Core.UnloadComponent(music);
         music = null;
     }
 }
Exemplo n.º 11
0
 public void Play2DSound(Sound sound)
 {
     Play(sound);
 }