private void PrepareTimeLine() { CStatic stat = Statics[htStatics(StaticTimeLine)]; switch (CConfig.TimerLook) { case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL: _TimeLineRect = new SRectF(stat.Rect.X, stat.Rect.Y, 0f, stat.Rect.H, stat.Rect.Z); Statics[htStatics(StaticTimePointer)].Visible = false; break; case ETimerLook.TR_CONFIG_TIMERLOOK_EXPANDED: _TimeRects.Clear(); Statics[htStatics(StaticTimePointer)].Visible = true; CSong song = CGame.GetSong(); if (song == null) { return; } float TotalTime = CSound.GetLength(_CurrentStream); if (song.Finish != 0) { TotalTime = song.Finish; } TotalTime -= song.Start; if (TotalTime <= 0f) { return; } CLines[] Lines = new CLines[song.Notes.Lines.Length]; Lines = song.Notes.Lines; for (int i = 0; i < Lines.Length; i++) { CLine[] Line = Lines[i].Line; for (int j = 0; j < Line.Length; j++) { TimeRect trect = new TimeRect(); trect.startBeat = Line[j].FirstBeat; trect.endBeat = Line[j].EndBeat; trect.rect = new CStatic(new STexture(-1), new SColorF(1f, 1f, 1f, 1f), new SRectF(stat.Rect.X + stat.Rect.W * ((CGame.GetTimeFromBeats(trect.startBeat, song.BPM) + song.Gap - song.Start) / TotalTime), stat.Rect.Y, stat.Rect.W * (CGame.GetTimeFromBeats((trect.endBeat - trect.startBeat), song.BPM) / TotalTime), stat.Rect.H, stat.Rect.Z)); _TimeRects.Add(trect); } } break; } }
protected void SelectSong(int nr) { if (CSongs.Category >= 0 && (CSongs.NumVisibleSongs > 0) && (nr >= 0) && ((_actsong != nr) || (_streams.Count == 0))) { foreach (int stream in _streams) { CSound.FadeAndStop(stream, 0f, 1f); } _streams.Clear(); CVideo.VdClose(_video); _video = -1; CDraw.RemoveTexture(ref _vidtex); _actsong = nr; if (_actsong >= CSongs.NumVisibleSongs) { _actsong = 0; } int _stream = CSound.Load(Path.Combine(CSongs.VisibleSongs[_actsong].Folder, CSongs.VisibleSongs[_actsong].MP3FileName), true); CSound.SetStreamVolumeMax(_stream, _MaxVolume); CSound.SetStreamVolume(_stream, 0f); float startposition = CSongs.VisibleSongs[_actsong].PreviewStart; if (startposition == 0f) { startposition = CSound.GetLength(_stream) / 4f; } CSound.SetPosition(_stream, startposition); CSound.Play(_stream); CSound.Fade(_stream, 100f, 3f); _streams.Add(_stream); _actsongstream = _stream; if (CSongs.VisibleSongs[_actsong].VideoFileName != String.Empty && CConfig.VideoPreview == EOffOn.TR_CONFIG_ON) { _video = CVideo.VdLoad(Path.Combine(CSongs.VisibleSongs[_actsong].Folder, CSongs.VisibleSongs[_actsong].VideoFileName)); if (_video == -1) { return; } CVideo.VdSkip(_video, startposition, CSongs.VisibleSongs[_actsong].VideoGap); _VideoFadeTimer.Stop(); _VideoFadeTimer.Reset(); _VideoFadeTimer.Start(); } } }
public override void Draw() { foreach (CStatic tile in _Tiles) { if (tile.Selected && _Active) { tile.Draw(1.2f, tile.Rect.Z - 0.1f, EAspect.Crop, false); } else { if (tile.Texture.index != _CoverTexture.index) { tile.Draw(1f, tile.Rect.Z, EAspect.Crop, false); } else { tile.Draw(1f, tile.Rect.Z, EAspect.Stretch, false); } } } if (CSongs.Category >= 0) { int actsong = _PreviewSelected; if ((CSongs.NumVisibleSongs > actsong) && (actsong >= 0)) { CSong song = CSongs.VisibleSongs[actsong]; _CoverBig.Texture = song.CoverTextureSmall; _Artist.Text = song.Artist; _Title.Text = song.Title; _DuetIcon.Visible = song.IsDuet; _VideoIcon.Visible = song.VideoFileName.Length > 0; _MedleyCalcIcon.Visible = song.Medley.Source == EMedleySource.Calculated; _MedleyTagIcon.Visible = song.Medley.Source == EMedleySource.Tag; float Time = CSound.GetLength(_SongStream); if (song.Finish != 0) { Time = song.Finish; } Time -= song.Start; int min = (int)Math.Floor(Time / 60f); int sec = (int)(Time - min * 60f); _SongLength.Text = min.ToString("00") + ":" + sec.ToString("00"); } } else { int actcat = _PreviewSelected; if ((CSongs.NumCategories > actcat) && (actcat >= 0)) { _CoverBig.Texture = CSongs.Categories[actcat].CoverTextureSmall; _Artist.Text = CSongs.Categories[actcat].Name; int num = CSongs.NumSongsInCategory(actcat); if (num != 1) { _Title.Text = CLanguage.Translate("TR_SCREENSONG_NUMSONGS").Replace("%v", num.ToString()); } else { _Title.Text = CLanguage.Translate("TR_SCREENSONG_NUMSONG").Replace("%v", num.ToString()); } _SongLength.Text = String.Empty; _DuetIcon.Visible = false; _VideoIcon.Visible = false; _MedleyCalcIcon.Visible = false; _MedleyTagIcon.Visible = false; } } _TextBG.Draw(); _CoverBig.Draw(1f, EAspect.Crop); if (_vidtex.color.A < 1) { _CoverBig.Draw(1f, EAspect.Crop); } if (_vidtex.index != -1 && _Video != -1) { RectangleF bounds = new RectangleF(_CoverBig.Rect.X, _CoverBig.Rect.Y, _CoverBig.Rect.W, _CoverBig.Rect.H); RectangleF rect = new RectangleF(0f, 0f, _vidtex.width, _vidtex.height); CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); CDraw.DrawTexture(_vidtex, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z), _vidtex.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false); CDraw.DrawTextureReflection(_vidtex, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z), _vidtex.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), _CoverBig.ReflectionSpace, _CoverBig.ReflectionHeight); } _Artist.Draw(); _Title.Draw(); _SongLength.Draw(); _DuetIcon.Draw(); _VideoIcon.Draw(); _MedleyCalcIcon.Draw(); _MedleyTagIcon.Draw(); }
private void UpdateTimeLine() { CSong song = CGame.GetSong(); if (song == null) { return; } float TotalTime = CSound.GetLength(_CurrentStream); if (song.Finish != 0) { TotalTime = song.Finish; } float RemainingTime = TotalTime - _CurrentTime; TotalTime -= song.Start; float CurrentTime = _CurrentTime - song.Start; if (TotalTime <= 0f) { return; } switch (CConfig.TimerMode) { case ETimerMode.TR_CONFIG_TIMERMODE_CURRENT: int min = (int)Math.Floor(CurrentTime / 60f); int sec = (int)(CurrentTime - min * 60f); Texts[htTexts(TextTime)].Text = min.ToString("00") + ":" + sec.ToString("00"); break; case ETimerMode.TR_CONFIG_TIMERMODE_REMAINING: min = (int)Math.Floor(RemainingTime / 60f); sec = (int)(RemainingTime - min * 60f); Texts[htTexts(TextTime)].Text = "-" + min.ToString("00") + ":" + sec.ToString("00"); break; case ETimerMode.TR_CONFIG_TIMERMODE_TOTAL: min = (int)Math.Floor(TotalTime / 60f); sec = (int)(TotalTime - min * 60f); Texts[htTexts(TextTime)].Text = "#" + min.ToString("00") + ":" + sec.ToString("00"); break; } switch (CConfig.TimerLook) { case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL: _TimeLineRect.W = Statics[htStatics(StaticTimeLine)].Rect.W * (CurrentTime / TotalTime); break; case ETimerLook.TR_CONFIG_TIMERLOOK_EXPANDED: CStatic stat = Statics[htStatics(StaticTimeLine)]; int CurrentBeat = CGame.CurrentBeat; for (int i = 0; i < _TimeRects.Count; i++) { if (CurrentBeat >= _TimeRects[i].startBeat && CurrentBeat <= _TimeRects[i].endBeat) { _TimeRects[i].rect.Texture = Statics[htStatics(StaticTimeLineExpandedHighlighted)].Texture; _TimeRects[i].rect.Color = Statics[htStatics(StaticTimeLineExpandedHighlighted)].Color; } else { _TimeRects[i].rect.Texture = Statics[htStatics(StaticTimeLineExpandedNormal)].Texture; _TimeRects[i].rect.Color = Statics[htStatics(StaticTimeLineExpandedNormal)].Color; } } Statics[htStatics(StaticTimePointer)].Rect.X = stat.Rect.X + stat.Rect.W * (CurrentTime / TotalTime); break; } }