コード例 #1
0
        /// <summary>
        /// SoundEnumの秒読みに対応するファイル名を返す
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        private static string ByoyomiFileNameOf(SoundEnum e)
        {
            switch (e)
            {
            case SoundEnum.BYOYOMI_10BYO: return("10byou.wav");

            case SoundEnum.BYOYOMI_20BYO: return("20byou.wav");

            case SoundEnum.BYOYOMI_30BYO: return("30byou.wav");

            case SoundEnum.BYOYOMI_40BYO: return("40byou.wav");

            case SoundEnum.BYOYOMI_50BYO: return("50byou.wav");

            case SoundEnum.BYOYOMI_1: return("01.wav");

            case SoundEnum.BYOYOMI_2: return("02.wav");

            case SoundEnum.BYOYOMI_3: return("03.wav");

            case SoundEnum.BYOYOMI_4: return("04.wav");

            case SoundEnum.BYOYOMI_5: return("05.wav");

            case SoundEnum.BYOYOMI_6: return("06.wav");

            case SoundEnum.BYOYOMI_7: return("07.wav");

            case SoundEnum.BYOYOMI_8: return("08.wav");

            case SoundEnum.BYOYOMI_9: return("09.wav");

            default: return("");
            }
        }
コード例 #2
0
        /// <summary>
        /// 対応する音声ファイル名を返す。
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        public static string FileNameOf(SoundEnum e)
        {
            if (e.IsKoma())
            {
                return(KomaFileNameOf(e));
            }

            if (SoundEnum.SQ_11 <= e && e <= SoundEnum.SQ_99)
            {
                return(FileNameOf((Square)(e - SoundEnum.SQ_11)));
            }

            if (SoundEnum.PiecePAWN <= e && e <= SoundEnum.PieceLast)
            {
                return(FileNameOf((Piece)(e - SoundEnum.PiecePAWN + (int)Piece.PAWN)));
            }

            if (e.IsByoyomi())
            {
                return(ByoyomiFileNameOf(e));
            }

            // それ以外なので特別なもののはず..
            return(SpecialFileNameOf(e));
        }
コード例 #3
0
ファイル: SoundManager.cs プロジェクト: qhapaq-49/MyShogi
 /// <summary>
 /// 駒音の再生。これは即座に再生される。
 /// </summary>
 /// <param name="crash"></param>
 public void PlayPieceSound(SoundEnum e)
 {
     if (TheApp.app.config.PieceSoundInTheGame != 0)
     {
         TheApp.app.soundManager.Play(e);
     }
 }
コード例 #4
0
ファイル: SoundPlayer.cs プロジェクト: clime57/Stars
 /// <summary>
 /// 播放在AssetBundle中的音效
 /// </summary>
 /// <param name="soundEnum"></param>
 public void playAssetBundleSound(SoundEnum soundEnum)
 {
     if (_audioClips != null && _audioClips.Length > (int)soundEnum)
     {
         playNoCacheSound(_audioClips[(int)soundEnum]);
     }
 }
コード例 #5
0
    public void PlaySound(SoundEnum sound, bool loop = false, float volume = 0, float pitch = 1)
    {
        if (sound == SoundEnum.None)
        {
            return;
        }

        var s = _soundEffectDict[sound];

        if (volume == 0)
        {
            volume = s.defaultVolume;
        }
        var source = GetFreeAudioSource();

        if (source == null)
        {
            return;
        }

        source.pitch = pitch;

        source.Stop();
        source.clip   = s.sound;
        source.volume = volume;
        source.Play();
    }
コード例 #6
0
 public SoundSheet GetSoundSheet(SoundEnum key)
 {
     if (mSoundSheetDict == null)
     {
         InitSoundSheet();
     }
     return(mSoundSheetDict[key]);
 }
コード例 #7
0
 public SoundEffect GetSoundEffect(SoundEnum soundEffectType)
 {
     if (RunningLikeCardiO && cardiB.ContainsKey(soundEffectType))
     {
         return(cardiB[soundEffectType]);
     }
     return(soundEffects[soundEffectType]);
 }
コード例 #8
0
ファイル: SoundController.cs プロジェクト: n-rudolph/Omega
    public void PlaySoundEffect(SoundEnum key)
    {
        AudioClip temp;

        if (soundEffects.TryGetValue(key, out temp))
        {
            audioSource.PlayOneShot(temp, 1.0f);
        }
    }
コード例 #9
0
    private AudioSource Audio(SoundEnum _sound, GameObject gameObject)
    {
        AudioSource audioSource = gameObject.GetComponent <AudioSource>();

        audioSource.loop   = true;
        audioSource.clip   = sound[(int)_sound].audioClip;
        audioSource.volume = sound[(int)_sound].volume;
        return(audioSource);
    }
コード例 #10
0
        public async Task PlaySoundAsync(SoundEnum sound)
        {
            var audioStream = GetAudioStream(sound);

            if (audioStream != null && Player.Load(audioStream))
            {
                Player.Play();
            }
        }
コード例 #11
0
ファイル: SoundController.cs プロジェクト: n-rudolph/Omega
    public void PlayBackgroundSound(SoundEnum key)
    {
        AudioClip temp;

        if (backgroundSounds.TryGetValue(key, out temp))
        {
            audioSource.PlayOneShot(temp, 1.0f);
        }
    }
        public async Task <bool> AskQuestionAsync(string message, SoundEnum sound, string title = "Atenção", string acceptBunttonText = "SIM",
                                                  string cancelButtonText = "NÃO")
        {
            await _soundService.PlaySoundAsync(sound);

            return(await _dialogService.DisplayAlertAsync(title,
                                                          message,
                                                          acceptBunttonText,
                                                          cancelButtonText));
        }
コード例 #13
0
 public void StopSound(SoundEnum soundEnum)
 {
     for (int i = 0; i < _soundModels.Count; i++)
     {
         if (_soundModels[i].SoundType == soundEnum)
         {
             _soundModels[i].StopMusic();
             break;
         }
     }
 }
コード例 #14
0
 public void playSound(SoundEnum sound)
 {
     if (audioClips != null)
     {
         AudioClip clip = audioClips[(int)sound];
         if (myAudioSource != null && clip != null)
         {
             myAudioSource.PlayOneShot(clip);
         }
     }
 }
コード例 #15
0
 public void stopSound(SoundEnum soundEnum)
 {
     foreach (var s in this.sounds)
     {
         if (s.sound == soundEnum)
         {
             s.audioSource.Stop();
             return;
         }
     }
 }
コード例 #16
0
 public void playSoundOnce(SoundEnum soundEnum)
 {
     foreach (var s in this.sounds)
     {
         if (s.sound == soundEnum)
         {
             s.audioSource.Play();
             return;
         }
     }
 }
コード例 #17
0
ファイル: Sound.cs プロジェクト: johnfriedrich/RomanDefenders
 public void PlaySoundClip(SoundEnum searchEnum)
 {
     foreach (SoundData data in soundClips)
     {
         if (data.name == searchEnum)
         {
             //soundPlayer.clip = data.clip;
             soundPlayer.PlayOneShot(data.clip);
         }
     }
 }
コード例 #18
0
        public Stream GetAudioStream(SoundEnum sound)
        {
            try
            {
                var assembly = typeof(App).GetTypeInfo().Assembly;
                return(assembly.GetManifestResourceStream($"TmsCollectorAndroid.Assets.Sounds.{sound.GetDescription()}"));
            }
            catch (Exception) { }

            return(null);
        }
コード例 #19
0
        public static SoundInstance PlaySound(SoundEnum soundEnum)
        {
            var inst = Scene.Current.FindComponent <SoundManager> ();

            if (inst == null)
            {
                Log.Game.WriteError("No soundManager in scene");
                return(null);
            }
            return(inst.PlaySoundInst(soundEnum));
        }
コード例 #20
0
        /// <summary>
        /// 駒音に対応するファイル名を返す。
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        private static string KomaFileNameOf(SoundEnum e)
        {
            switch (e)
            {
            case SoundEnum.KOMA_S1: return("koma_s1.wav");

            case SoundEnum.KOMA_B1: return("koma_b1.wav");

            case SoundEnum.KOMA_C1: return("koma_c1.wav");

            default: return("");
            }
        }
コード例 #21
0
        public void PlaySound(SoundEnum sound, bool loop = false, float volumeDb = 0f)
        {
            GD.Print($"Playing {sound}. Loop? {loop} volumeDb? {volumeDb} ");
            Dictionary <SoundEnum, string> sounds = Constants.SoundEffects();
            string soundPath            = sounds[sound];
            AudioStreamOGGVorbis stream = (AudioStreamOGGVorbis)GD.Load(soundPath);

            stream.Loop = loop;
            UnitDb      = volumeDb;
            MaxDb       = volumeDb;
            Stream      = stream;
            Playing     = true;
        }
コード例 #22
0
    public void PlaySound(SoundEnum sound, bool loop = false)
    {
        if (!EnableSound)
        {
            return;
        }

        var audioSource = getFreeSoundSource(sound);

        if (audioSource != null)
        {
            audioSource.Play(loop?1:0);
        }
    }
コード例 #23
0
        /// <summary>
        /// SoundEnumの特別なものに対応するファイル名を返す
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        private static string SpecialFileNameOf(SoundEnum e)
        {
            switch (e)
            {
            case SoundEnum.Start:   return("start.wav");

            case SoundEnum.End:     return("win.wav");

            case SoundEnum.Sente:   return("sente.wav");

            case SoundEnum.Gote:    return("gote.wav");

            case SoundEnum.Uwate:   return("uwate.wav");

            case SoundEnum.Shitate: return("shitate.wav");

            case SoundEnum.Naru:    return("naru.wav");

            case SoundEnum.Narazu:  return("narazu.wav");

            case SoundEnum.Onajiku: return("onajiku.wav");

            case SoundEnum.Migi:    return("migi.wav");

            case SoundEnum.Hidari:  return("hidari.wav");

            case SoundEnum.Sugu:    return("sugu.wav");

            case SoundEnum.Hiku:    return("hiku.wav");

            case SoundEnum.Utsu:    return("utsu.wav");

            case SoundEnum.Yoru:    return("yoru.wav");

            case SoundEnum.Agaru:   return("agaru.wav");

            case SoundEnum.Yuku:    return("yuku.wav");

            case SoundEnum.Jisyougi:  return("jisyougi.wav");

            case SoundEnum.Sennichite: return("sennichite.wav");

            case SoundEnum.Tsumi:     return("tsumi.wav");

            case SoundEnum.Jikangire: return("jikangire.wav");

            default: return("");
            }
        }
コード例 #24
0
        public void PlaySound(SoundEnum key)
        {
            SoundSheet sound     = SheetManager.Instance.GetSoundSheet(key);
            string     audioPath = sound.Path;
            AudioClip  clip      = AudioManager.Instance.LoadClip(audioPath, true);

            if (sound.Repeat == 0)
            {
                AudioManager.Instance.PlayOneShot(clip);
            }
            else
            {
                AudioManager.Instance.RepeatSFX(clip, sound.Repeat, sound.Single);
            }
        }
コード例 #25
0
        /// <summary>
        /// すぐに再生する。他の再生を待たずに。
        /// </summary>
        /// <param name="e"></param>
        public void Play(SoundEnum e)
        {
            if (!dic.ContainsKey(e))
            {
                var subFolder = e.IsKoma() ? KomaSoundPath : ReadOutSoundPath;
                var filename  = Path.Combine(Path.Combine(SoundPath, subFolder), SoundHelper.FileNameOf(e));
                var s         = new SoundLoader();
                s.ReadFile(filename);
                dic.Add(e, s);
            }

            var sound = dic[e];

            sound.Play();
        }
コード例 #26
0
 public void playMusic(SoundEnum soundEnum)
 {
     foreach (var s in this.sounds)
     {
         if (s.sound == soundEnum && s.isMusic)
         {
             s.audioSource.Play();
             return;
         }
         else if (s.isMusic)
         {
             s.audioSource.Stop();
         }
     }
 }
コード例 #27
0
        public static void PlaySound(SoundEnum soundEnum)
        {
            var sound = soundEnum.ToString();
            // Get the sound from the XAP file
            var info = App.GetResourceStream(
                new Uri(String.Format("Resources/Music/{0}.wav", sound), UriKind.Relative));
            // Load the SoundEffect
            var effect = SoundEffect.FromStream(info.Stream);

            // Tell the XNA Libraries to continue to run
            FrameworkDispatcher.Update();

            // Play the Sound
            effect.Play();
        }
コード例 #28
0
 public void PlaySoundClipWithSource(SoundEnum soundEnum, AudioSource source, float duration, float volume)
 {
     foreach (SoundData data in soundClips)
     {
         if (data.name == soundEnum)
         {
             source.clip = data.clip;
             source.PlayOneShot(data.clip, volume);
             if (duration > 0)
             {
                 StartCoroutine(PlayForDuration(duration, source));
             }
         }
     }
 }
コード例 #29
0
        /// <summary>
        /// 再生queueに追加する。
        /// このメソッドは毎回同じスレッドから呼び出されるものとする。
        ///
        /// GlobalConfig.KifuReadOutがオフ(0)だと再生されない。
        /// </summary>
        /// <param name=""></param>
        public void ReadOut(SoundEnum e)
        {
            if (TheApp.app.config.KifuReadOut == 0)
            {
                return;
            }

            if (!dic.ContainsKey(e))
            {
                var subFolder = e.IsKoma() ? KomaSoundPath : ReadOutSoundPath;
                var filename  = Path.Combine(Path.Combine(SoundPath, subFolder), SoundHelper.FileNameOf(e));
                var s         = new SoundLoader();
                s.ReadFile(filename);
                dic.Add(e, s);
            }

            var sound = dic[e];

            queue.AddQueue(sound);
        }
コード例 #30
0
    public AudioClip GetAudioClip(SoundEnum soundId)
    {
        if (soundId == SoundEnum.NONE)
        {
            return(null);
        }

        AudioClip audioClip = null;

        foreach (var soundConfig in SoundConfigs)
        {
            if (soundConfig.SoundId == soundId)
            {
                audioClip = soundConfig.Clip;
                break;
            }
        }

        return(audioClip);
    }
コード例 #31
0
        public static void Play(SoundEnum se)
        {
            switch (se)
                {

                    case SoundEnum.RangeHit:
                        if(s_instance[1].State==SoundState.Stopped)
                        s_instance[1].Play();
                        break;
                    case SoundEnum.SelectedMaterial:
                         if(s_instance[0].State==SoundState.Stopped)
                        s_instance[0].Play();
                        break;
                    case SoundEnum.Gater:
                        if (s_instance[2].State == SoundState.Stopped)
                            s_instance[2].Play();
                        break;
                    default:
                        break;

                }
        }