Beispiel #1
0
        public static void LoadConfig()
        {
            MusicConfig = new MusicConfig();
            if (!Directory.Exists(Main.SavePath))
            {
                Directory.CreateDirectory(Main.SavePath);
            }
            string path = string.Concat(new object[]
            {
                Main.SavePath,
                Path.DirectorySeparatorChar,
                CONFIG_FILE_NAME
            });

            FirstTimeUse = false;
            if (File.Exists(path))
            {
                using (StreamReader r = new StreamReader(path))
                {
                    string json = r.ReadToEnd();
                    MusicConfig = JsonConvert.DeserializeObject <MusicConfig>(json);
                }
            }
            else
            {
                FirstTimeUse = true;
            }
        }
        private bool IsStartMusic()
        {
            MusicConfig musicConfig = new MusicConfig();
            var         config      = musicConfig.GetConfig();

            return(config.IsStart == 1);
        }
Beispiel #3
0
        static MusicConfig GetInstance()
        {
            if (s_config == null)
            {
                s_config = new MusicConfig();
            }

            return(s_config);
        }
        public void StartWallpapaer()
        {
            MusicConfig musicConfig = new MusicConfig();
            var         config      = musicConfig.GetConfig();

            if (wallpaper == null)
            {
                wallpaper = new Wallpaper();
            }
            wallpaper.SetWallpaper(config.Path, config.Volume);
        }
Beispiel #5
0
        void Awake()
        {
            m_source = GetComponent <UnityEngine.AudioSource>();
            // In order to use our procedural filter as the input to the AudioSource,
            // we need to detach any potential AudioClip from it.
            // see: https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnAudioFilterRead.html
            m_source.clip = null;
            // must loop over the buffer, since it is refilled at each step.
            m_source.loop = true;
            m_source.Stop();

            m_sampleRate = MusicConfig.GetSampleRate();
        }
Beispiel #6
0
        void Awake()
        {
            m_source = GetComponent <UnityEngine.AudioSource>();
            // In order to use our procedural filter as the input to the AudioSource,
            // we need to detach any potential AudioClip from it.
            // see: https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnAudioFilterRead.html
            m_source.clip = null;

            // must loop over buffer
            m_source.loop = true;

            m_sampleRate = MusicConfig.GetSampleRate();

            Load(file, startingNumberVoices);
        }
        private void SetStart(bool isStart)
        {
            MusicConfig musicConfig = new MusicConfig();

            musicConfig.SetStart(isStart);
        }
 void Update()
 {
     m_sampleRate = MusicConfig.GetSampleRate();
 }
 private void OnDestroy()
 {
     s_instance = null;
 }
 private void Awake()
 {
     s_instance = this;
 }