//セーブデータ用のバイナリ読み込み
        public void ReadSaveDataBuffer(BinaryReader reader)
        {
            int version = reader.ReadInt32();

            if (version == VERSION)
            {
                int count = reader.ReadInt32();
                for (int i = 0; i < count; ++i)
                {
                    string          streamName = reader.ReadString();
                    SoundStreamFade stream     = GetStreamAndCreateIfMissing(streamName);
                    stream.ReadSaveData(reader, () => SoundMangaer.GetMasterVolume(streamName));
                }
            }
            else if (version == VERSION_0)
            {
                //BGMと環境音のみを再生
                GetStreamAndCreateIfMissing(SoundManager.IdBgm).ReadSaveData(reader, () => SoundMangaer.GetMasterVolume(SoundManager.IdBgm));
                GetStreamAndCreateIfMissing(SoundManager.IdAmbience).ReadSaveData(reader, () => SoundMangaer.GetMasterVolume(SoundManager.IdAmbience));
            }
            else
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
            }
        }
Beispiel #2
0
        SoundStreamFade CreateSoundStreamFade(string name)
        {
            GameObject      go     = UtageToolKit.AddChild(this.transform, new GameObject(name));
            SoundStreamFade stream = go.AddComponent <SoundStreamFade>();

            return(stream);
        }
        public bool IsPlaying(string streamName)
        {
            SoundStreamFade stream = GetStream(streamName);

            if (stream == null)
            {
                return(false);
            }
            return(stream.IsPlaying());
        }
 //セーブデータ用のバイナリ書き込み
 public void WriteSaveData(BinaryWriter writer)
 {
     writer.Write(VERSION);
     writer.Write(saveStreamNameList.Count);
     foreach (string saveStreamName in saveStreamNameList)
     {
         writer.Write(saveStreamName);
         SoundStreamFade stream = GetStreamAndCreateIfMissing(saveStreamName);
         stream.WriteSaveData(writer);
     }
 }
        SoundStream PlaySub(string streamName, AudioClip clip, float volume, bool isLoop, bool isStreaming, float fadeInTime, float fadeOutTime, bool isReplay, Func <float> callbackMasterVolume)
        {
            SoundStreamFade stream = GetStreamAndCreateIfMissing(streamName);

            if (isReplay || !stream.IsPlaying(clip))
            {
                return(stream.Play(clip, fadeInTime, fadeOutTime, volume, isLoop, isStreaming, callbackMasterVolume));
            }
            else
            {
                return(stream.Current);
            }
        }
        public float GetCurrentSamplesVolume(string streamName)
        {
            SoundStreamFade stream = GetStreamAndCreateIfMissing(streamName);

            return(stream.GetCurrentSamplesVolume());
        }
        public void Stop(string streamName, float fadeTime)
        {
            SoundStreamFade stream = GetStreamAndCreateIfMissing(streamName);

            stream.Stop(fadeTime);
        }
        public bool IsPlaying(string streamName)
        {
            SoundStreamFade stream = GetStreamAndCreateIfMissing(streamName);

            return(stream.IsPlaying());
        }