Exemple #1
0
 internal bool LoadMusic(string name, string path)
 {
     if (!Music.ContainsKey(name))
     {
         Music.Add(name, Load <Song>(path));
         return(true);
     }
     return(false);
 }
Exemple #2
0
        public static void LoadMusic(string music, string path)
        {
            if (Music == null)
            {
                Music = new Dictionary <string, Song>();
            }

            Music.Add(music, AssetLoader.LoadAsset <Song>(path));
        }
    void Awake()
    {
        if (main != null)
        {
            Destroy(gameObject);
            return;
        }
        main = this;

        foreach (SongInfo s in trackSets)
        {
            foreach (AudioClip clip in s.songs)
            {
                Music.Add(s.name, clip);
            }
        }
        fadein = true;
        DontDestroyOnLoad(gameObject);
    }
        private void Service_DownloadComplete(object sender, DownloadAudioFile e)
        {
            if (e == null)
            {
                return;
            }

            if (e.AudioFile.Source == null)
            {
                return;
            }
            VisibilityNoDownloadsTracks = Visibility.Collapsed;
            Changed("VisibilityNoDownloadsTracks");

            if (Music.Any(a => a == e.AudioFile))
            {
                return;
            }

            Music.Add(e.AudioFile);
            Changed("Music");
        }
        private void reloadMusic()
        {
            if (Design.IsDesignMode)
            {
                return;
            }
            lock (GameBase.lockObj)
            {
                Music.Clear();

                string[] files = PathMod.GetModFiles(GraphicsManager.MUSIC_PATH, "*.ogg");

                Music.Add("None");
                for (int ii = 0; ii < files.Length; ii++)
                {
                    string song = Path.GetFileName(files[ii]);
                    Music.Add(song);
                    if (song == ZoneManager.Instance.CurrentGround.Music)
                    {
                        ChosenMusic = ii + 1;
                    }
                }
            }
        }
 //public static Form1 MainForm;
 public Record()
 {
     InitializeComponent();
     KeyBoardListenerr.GetKeyDownEvent((key) =>
     {
         if (key == "CtrlP")
         {
             if (!isStart)
             {
                 Music.Start(DateTime.Now);
                 isStart = true;
             }
             else
             {
                 Music.End();
                 isStart = false;
             }
         }
         else
         {
             Music.Add(DateTime.Now, key);
         }
     });
 }
Exemple #7
0
        public async void FileDropped(DragEventArgs e)
        {
            var dragFileList = ((DataObject)e.Data)
                               .GetFileDropList();


            foreach (var file in dragFileList)
            {
                if (Path.GetExtension(file) != ".mp3")
                {
                    break;
                }

                _selectedKey          = string.Empty;
                _selectedFilename     = Path.GetFileName(file);
                _hookActivate         = true;
                VolumeSliderIsVisible = Visibility.Hidden;



                await Task.Run(() =>
                {
                    SetHookAlert = "”становите гор¤чую клавишу!";
                    while (_selectedKey == string.Empty)
                    {
                    }

                    _hookActivate         = false;
                    VolumeSliderIsVisible = Visibility.Visible;
                    SetHookAlert          = string.Empty;
                });

                if (_selectedKey != string.Empty)
                {
                    string filePath = Path
                                      .Combine(_musicPath, _selectedFilename);

                    if (!File.Exists(filePath))
                    {
                        try
                        {
                            File.Copy(file, filePath);
                        }
                        catch { }
                    }


                    SoundModel sound = new SoundModel
                    {
                        HotKey = _selectedKey
                                 .ToString()
                                 .Replace("KEY_", string.Empty)
                                 .Replace("OEM_", string.Empty),

                        SoundName = _selectedFilename
                                    .Substring(0, _selectedFilename.Length - 4),

                        FullPath = filePath,

                        Id = (Music.Count + 1)
                    };

                    Music.Add(sound);
                    _selectedFilename = string.Empty;

                    await _soundService.CreateAsync(sound);
                }
            }
        }
Exemple #8
0
 public void Add(Track t)
 {
     Music.Add(t);
 }