예제 #1
0
        public MainPageCS()
        {
            Title = "lyb!mania 4k";
            var padding = new Thickness(0, Device.OnPlatform(40, 40, 0), 0, 0);

            ButtonDemoPage  playpage   = new ButtonDemoPage();
            BeatmapInfoPage bminfopage = new BeatmapInfoPage();

            Children.Add(playpage);
            Children.Add(bminfopage);
        }
예제 #2
0
        private void Lst_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            try
            {
                string path     = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
                string filename = "scores";
                string dbPath   = Path.Combine(path, filename);

                string line = ""; string title = ""; string artist = ""; int bmid = 0;
                string creator = ""; string ver = ""; int bpm = 0;

                index = (list.ItemsSource as List <BMSong>).IndexOf(e.SelectedItem as BMSong); // to get a index value or postion value
                using (StreamReader sr = new StreamReader(fullpath[index]))
                {
                    while ((line = sr.ReadLine()) != null)
                    {
                        if (line.Contains("Title") == true)
                        {
                            title = line.Replace("Title:", "");
                        }

                        if (line.Contains("Artist:") == true)
                        {
                            artist = line.Replace("Artist:", "");
                        }

                        if (line.Contains("Creator:") == true)
                        {
                            creator = line.Replace("Creator:", "");
                        }

                        if (line.Contains("Version:") == true)
                        {
                            ver = line.Replace("Version:", "");
                        }

                        if (line.Contains("BeatmapID:") == true)
                        {
                            string temp = line.Replace("BeatmapID:", "");
                            bmid = int.Parse(temp);
                        }

                        if (line.Contains("[TimingPoints]") == true)
                        {
                            string   asdf  = sr.ReadLine();
                            string[] asdfg = asdf.Split(',');



                            bpm = System.Convert.ToInt32(Math.Round((double)(60000 / Decimal.Parse(asdfg[1], new CultureInfo("en-US")))));
                        }
                    }
                    ;
                }
                //BeatmapInfoPage.set_data(title, artist, ver, creator, bmid, bpm);
                var parent = Parent as MainPageCS;
                parent.PageRight();
                {
                    //ManagedBass.Bass.Free();
                    //ManagedBass.Bass.Init(-1, 44100, ManagedBass.DeviceInitFlags.Default, System.IntPtr.Zero);
                    //ManagedBass.Bass.StreamFree(previewchan);
                    ManagedBass.Bass.StreamFree(mania4key_v2.Game1.i);
                    ManagedBass.Bass.Free();
                    var song = e.SelectedItem as BMSong;
                    BeatmapInfoPage.set_data2(song);
                    if (lyb_rhythmdroid.Game1.mediaPlayer != null)
                    {
                        lyb_rhythmdroid.Game1.mediaPlayer.Reset();
                    }
                    lyb_rhythmdroid.Game1.mediaPlayer = MediaPlayer.Create(Android.App.Application.Context, Android.Net.Uri.Parse(song.dir + song.audiopath));
                    lyb_rhythmdroid.Game1.mediaPlayer.SetVolume(0, 0);
                    lyb_rhythmdroid.Game1.mediaPlayer.SeekTo(song.audiopreview);
                    lyb_rhythmdroid.Game1.mediaPlayer.Start();
                    //previewchan = ManagedBass.Bass.CreateStream(dir[index] + AudioFilename[index]);
                    //ManagedBass.Bass.ChannelSetAttribute(previewchan, ManagedBass.ChannelAttribute.Volume, 0);
                    vol = 0;
                    //ManagedBass.Bass.ChannelPlay(previewchan);
                    System.Threading.Tasks.Task.Run(() =>
                    {
                        while (vol < 1)
                        {
                            vol = vol + 0.01f;
                            lyb_rhythmdroid.Game1.mediaPlayer.SetVolume(vol, vol);
                            //ManagedBass.Bass.ChannelSetAttribute(previewchan, ManagedBass.ChannelAttribute.Volume, vol);
                            System.Threading.Thread.Sleep(5);
                        }
                    });
                    //ManagedBass.Bass.ChannelSetPosition(previewchan, ManagedBass.Bass.ChannelSeconds2Bytes(previewchan, AudioPreview[index] / 1000), ManagedBass.PositionFlags.Bytes);
                    //lastpreview = AudioFilename[index];
                }
            }
            catch (Exception ex)
            {
                Ini ini = new Ini("/sdcard/lybmania4key/lyb_errlog.txt");
                ini.WriteValue("loadbm", ex.Message);
                ini.Save();
            }
            //((ListView)sender).SelectedItem = null;
        }