private void refresh() { //todo show some animation during this transitioning = true; songNameList.Clear(); SongLibrary.cacheSongInfo(); //prob should make separate method since searching forces cache refresh lol. we are good coders dont worry foreach (var pair in SongLibrary.songInfos) { Text temp = new Text(Config.ClientSize, new Size(550, 35), new Point(0, 0)); /*SizeF temp1 = temp.getStringSize(pair.Value.Artist + " - " + pair.Value.SongName); * temp.TextureSize = new Size((int)temp1.Width, (int)temp1.Height);*/ temp.Update(pair.Value.Artist + " - " + pair.Value.SongName); temp.Shadow = true; SelectComponent sc = new SelectComponent(game, new Rectangle(-50, 0, 550, 90), pair.Value.Artist, pair.Value.SongName); sc.clickEvent += new Action <int, SelectComponent>(sc_clickEvent); SongPair sp = new SongPair(sc, pair.Value); songNameList.Add(sp); sc.index = songNameList.IndexOf(sp); } songNameList.Sort(new Comparison <SongPair>(delegate(SongPair f, SongPair j) { return(-f.Info.SongName.CompareTo(j.Info.SongName)); })); foreach (SongPair sp in songNameList) { sp.select.index = songNameList.IndexOf(sp); } }
// Use this for initialization void Start() { songPair = SongManager.Load(Application.dataPath + "/Songs/Distant.rhyvr"); Debug.Log(songPair.song.name); InitializeUI(); //Load Side Info //Set up difficulties //Load difficulty with chosen to }
void Start() { GameObject messenger = GameObject.Find("Messenger"); songPair = messenger.GetComponent <Messenger>().songToPlay; Destroy(messenger); Debug.Log(songPair.song.bpm); Debug.Log(songPair.song.subdivision); secsBetweenNotes = 60f / (float)(songPair.song.bpm * songPair.song.subdivision); SetUpDrums(); Invoke("PlayMusic", songPair.song.offset); }
private void LoadMenu() { foreach (string file in Directory.GetFiles(Application.dataPath + "/Songs")) { if (file.Contains(".rhyvr")) { string fileExtension = file.Substring(file.IndexOf(".rhyvr"), file.Length - file.IndexOf(".rhyvr")); if (fileExtension == ".rhyvr") { SongPair song = SongManager.Load(file); GameObject listItem = (GameObject)Instantiate(songMenuItem, Vector3.zero, Quaternion.identity); listItem.transform.parent = listParent.transform; listItem.transform.localScale = Vector3.one; listItem.GetComponentInChildren <Text>().text = song.song.name; menuItems.Add(listItem); menuItemSongs.Add(song); } } } maxIndex = menuItems.Count - 1; UpdateMenuSelection(); }