Пример #1
0
        public void Draw(EAspect aspect, float scale = 1f, float zModify = 0f, bool forceDraw = false)
        {
            CTextureRef texture = Texture;
            SRectF      bounds  = Rect.Scale(scale);

            bounds.Z += zModify;
            SRectF rect  = texture == null ? bounds : CHelper.FitInBounds(bounds, texture.OrigAspect, aspect);
            var    color = new SColorF(Color.R, Color.G, Color.B, Color.A * Alpha);

            if (Visible || forceDraw || (CBase.Settings.GetProgramState() == EProgramState.EditTheme))
            {
                if (texture != null)
                {
                    CBase.Drawing.DrawTexture(texture, rect, color, bounds);
                    if (Reflection)
                    {
                        CBase.Drawing.DrawTextureReflection(texture, rect, color, bounds, ReflectionSpace, ReflectionHeight);
                    }
                }
                else
                {
                    CBase.Drawing.DrawRect(color, rect);
                }
            }

            if (Selected && (CBase.Settings.GetProgramState() == EProgramState.EditTheme))
            {
                CBase.Drawing.DrawRect(new SColorF(1f, 1f, 1f, 0.5f), rect);
            }
        }
Пример #2
0
        private void _DrawCovers()
        {
            int i = 0;

            foreach (CStatic cover in _Covers)
            {
                EAspect aspect = (cover.Texture != _CoverBGTexture) ? EAspect.Crop : EAspect.Stretch;
                if (cover.Selected)
                {
                    SRectF selectedrect = new SRectF(_Tile.X, _Tile.Y, _Tile.H, _Tile.H, _Tile.Z);
                    selectedrect.Y = Rect.Y - _ListDragDiffY + i * (_TileCoverH + _TileSpacing);
                    selectedrect   = selectedrect.Scale(SelectedTileZoomFactor);
                    selectedrect.X = MaxRect.X - (MaxRect.W * (SelectedTileZoomFactor - 1) / 2);
                    selectedrect.Y = (float)Math.Round(selectedrect.Y);
                    selectedrect.H = (float)Math.Round(selectedrect.H);
                    selectedrect.W = (float)Math.Round(selectedrect.W);
                    selectedrect.X = MaxRect.X - (MaxRect.W * (SelectedTileZoomFactor - 1) / 2);
                    cover.MaxRect  = selectedrect;
                    cover.Color.A  = 1f;
                    cover.Z        = Rect.Z - 0.1f;
                    cover.Draw();
                }
                else
                {
                    cover.MaxRect = new SRectF(_Tile.X, _Tile.Y, _Tile.H, _Tile.H, _Tile.Z);
                    cover.Y       = Rect.Y - _ListDragDiffY + i * (_TileCoverH + _TileSpacing);
                    cover.Color.A = 0.5f;
                    cover.Draw(aspect);
                }
                i++;
            }
        }
Пример #3
0
        public override void Draw()
        {
            foreach (CStatic tile in _Tiles)
            {
                if (tile.Selected)
                {
                    tile.Draw(EAspect.Crop, SelectedTileZoomFactor, -0.1f);
                }
                else
                {
                    EAspect aspect = (tile.Texture != _CoverBGTexture) ? EAspect.Crop : EAspect.Stretch;
                    tile.Draw(aspect);
                }
            }

            //highlight the text of the selected song
            int i = 0;

            foreach (CText text in _Texts)
            {
                if (i < _Tiles.Count && _Tiles[i].Selected)
                {
                    text.Font.Style = EStyle.BoldItalic;
                }
                else if (i < _Tiles.Count)
                {
                    text.Font.Style = EStyle.Normal;
                }
                else
                {
                    text.Text = "";
                }
                text.Draw();
                i++;
            }
            _TextBG.Draw();

            CTextureRef vidtex = CBase.BackgroundMusic.IsPlayingPreview() ? CBase.BackgroundMusic.GetVideoTexture() : null;

            if (vidtex != null)
            {
                if (vidtex.Color.A < 1)
                {
                    _CoverBig.Draw(EAspect.Crop);
                }
                SRectF rect = CHelper.FitInBounds(_CoverBig.Rect, vidtex.OrigAspect, EAspect.Crop);
                CBase.Drawing.DrawTexture(vidtex, rect, vidtex.Color, _CoverBig.Rect);
                CBase.Drawing.DrawTextureReflection(vidtex, rect, vidtex.Color, _CoverBig.Rect, _CoverBig.ReflectionSpace, _CoverBig.ReflectionHeight);
            }
            else
            {
                _CoverBig.Draw(EAspect.Crop);
            }

            foreach (IMenuElement element in _SubElements)
            {
                element.Draw();
            }
        }
Пример #4
0
        /// <summary>
        ///     Draws a texture fitting it within the given color and bounds with the method specified by aspect
        /// </summary>
        /// <param name="textureRef"></param>
        /// <param name="bounds">Where to draw the texture</param>
        /// <param name="aspect">How to fit a texture in the bounds if the size differs</param>
        /// <param name="color">Color to use</param>
        public static void DrawTexture(CTextureRef textureRef, SRectF bounds, EAspect aspect, SColorF color)
        {
            if (textureRef == null)
            {
                return;
            }

            SRectF rect = CHelper.FitInBounds(bounds, textureRef.OrigAspect, aspect);

            DrawTexture(textureRef, rect, color, bounds);
        }
Пример #5
0
        /// <summary>
        /// Updates the fill colour of the lamp based on the signal's aspect.
        /// </summary>
        private void UpdateColour()
        {
            EAspect          aspect         = (SignalObject != null) ? SignalObject.Aspects.AspectAt(Head) : EAspect.Red;
            ControlledSignal cs             = SignalObject as ControlledSignal;
            bool             approachLocked = (cs != null) ? cs.ApproachLocked : false;

            switch (aspect)
            {
            case EAspect.Red:
                if ((BlinkClockSource == null) || BlinkClockSource.Value || !approachLocked)
                {
                    Lamp.Fill = (Brush)FindResource("SignalRed");
                }
                else
                {
                    Lamp.Fill = (Brush)FindResource("BG");
                }
                break;

            case EAspect.Green:
                Lamp.Fill = (Brush)FindResource("SignalGreen");
                break;

            case EAspect.Yellow:
                Lamp.Fill = (Brush)FindResource("SignalYellow");
                break;

            case EAspect.FlashingYellow:
                if ((BlinkClockSource == null) || BlinkClockSource.Value)
                {
                    Lamp.Fill = (Brush)FindResource("SignalYellow");
                }
                else
                {
                    Lamp.Fill = (Brush)FindResource("BG");
                }
                break;

            case EAspect.Lunar:
                Lamp.Fill = (Brush)FindResource("SignalLunar");
                break;
            }
            if (BlinkClockSource != null)
            {
                BlinkClockSource.PropertyChanged -= OnBlinkClockChanged;
                if ((aspect == EAspect.FlashingYellow) || approachLocked)
                {
                    BlinkClockSource.PropertyChanged += OnBlinkClockChanged;
                }
            }
        }
Пример #6
0
        public void Draw(float scale, float z, EAspect aspect, bool ForceDraw)
        {
            STexture texture;

            if (_Texture.index != -1)
            {
                texture = _Texture;
            }
            else
            {
                texture = CTheme.GetSkinTexture(_Theme.TextureName);
            }

            SRectF bounds = new SRectF(
                Rect.X - Rect.W * (scale - 1f),
                Rect.Y - Rect.H * (scale - 1f),
                Rect.W + 2 * Rect.W * (scale - 1f),
                Rect.H + 2 * Rect.H * (scale - 1f),
                z);

            SRectF rect = bounds;

            if (aspect != EAspect.Stretch)
            {
                RectangleF bounds2 = new RectangleF(bounds.X, bounds.Y, bounds.W, bounds.H);
                RectangleF rect2   = new RectangleF(0f, 0f, texture.width, texture.height);
                CHelper.SetRect(bounds2, ref rect2, texture.width / texture.height, aspect);

                rect.X = rect2.X;
                rect.Y = rect2.Y;
                rect.W = rect2.Width;
                rect.H = rect2.Height;
            }

            SColorF color = new SColorF(Color.R, Color.G, Color.B, Color.A * Alpha);

            if (Visible || ForceDraw || (CSettings.GameState == EGameState.EditTheme))
            {
                CDraw.DrawTexture(texture, rect, color, bounds);
                if (Reflection)
                {
                    CDraw.DrawTextureReflection(texture, rect, color, bounds, ReflectionSpace, ReflectionHeight);
                }
            }

            if (Selected && (CSettings.GameState == EGameState.EditTheme))
            {
                CDraw.DrawColor(new SColorF(1f, 1f, 1f, 0.5f), rect);
            }
        }
Пример #7
0
        public static void DrawTexture(CStatic StaticBounds, STexture Texture, EAspect Aspect)
        {
            RectangleF bounds = new RectangleF(StaticBounds.Rect.X, StaticBounds.Rect.Y, StaticBounds.Rect.W, StaticBounds.Rect.H);
            RectangleF rect   = new RectangleF(0f, 0f, Texture.width, Texture.height);

            if (rect.Height <= 0f)
            {
                return;
            }

            CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, Aspect);
            DrawTexture(Texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, StaticBounds.Rect.Z),
                        Texture.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false);
        }
Пример #8
0
        public void Draw(EAspect aspect, float scale = 1f, float zModify = 0f, bool forceDraw = false)
        {
            CTextureRef texture = Texture;
            SRectF      bounds  = Rect.Scale(scale);

            //Change bounds if rect size should be modified without adjusting texture
            if (ModH != -1)
            {
                bounds.H = ModH * scale;
            }
            if (ModW != -1)
            {
                bounds.W = ModW * scale;
            }

            bounds.Z += zModify;

            SRectF rect = texture == null ? bounds : CHelper.FitInBounds(bounds, texture.OrigAspect, aspect);

            //Use original rect
            if (ModH != -1 || ModW != -1)
            {
                rect = Rect.Scale(scale);
            }

            var color = new SColorF(Color.R, Color.G, Color.B, Color.A * Alpha);

            if (Visible || forceDraw || (CBase.Settings.GetProgramState() == EProgramState.EditTheme))
            {
                if (texture != null)
                {
                    CBase.Drawing.DrawTexture(texture, rect, color, bounds, false, AllMonitors);
                    if (Reflection)
                    {
                        CBase.Drawing.DrawTextureReflection(texture, rect, color, bounds, ReflectionSpace, ReflectionHeight, AllMonitors);
                    }
                }
                else
                {
                    CBase.Drawing.DrawRect(color, rect);
                }
            }

            if (Selected && (CBase.Settings.GetProgramState() == EProgramState.EditTheme))
            {
                CBase.Drawing.DrawRect(new SColorF(1f, 1f, 1f, 0.5f), rect);
            }
        }
Пример #9
0
        public CStatic(CStatic s)
        {
            _PartyModeID = s._PartyModeID;

            _Texture         = s.Texture;
            Color            = s.Color;
            MaxRect          = s.MaxRect;
            Reflection       = s.Reflection;
            ReflectionSpace  = s.ReflectionHeight;
            ReflectionHeight = s.ReflectionSpace;
            AllMonitors      = s.AllMonitors;

            Alpha   = s.Alpha;
            Visible = s.Visible;

            Aspect = s.Aspect;
        }
Пример #10
0
        public override void Draw()
        {
            foreach (CStatic tile in _Tiles)
            {
                if (tile.Selected)
                {
                    tile.Draw(EAspect.Crop, SelectedTileZoomFactor, -0.1f);
                }
                else
                {
                    EAspect aspect = (tile.Texture != _CoverBGTexture) ? EAspect.Crop : EAspect.Stretch;
                    tile.Draw(aspect);
                }
            }

            _TextBG.Draw();

            CTextureRef vidtex = null;

            if (CBase.Config.GetVideoPreview() == EOffOn.TR_CONFIG_ON)
            {
                vidtex = (CBase.BackgroundMusic.IsPlayingPreview() ? CBase.BackgroundMusic.GetVideoTexture() : null);
            }

            if (vidtex != null)
            {
                if (vidtex.Color.A < 1)
                {
                    _CoverBig.Draw(EAspect.Crop);
                }
                SRectF rect = CHelper.FitInBounds(_CoverBig.Rect, vidtex.OrigAspect, EAspect.Crop);
                CBase.Drawing.DrawTexture(vidtex, rect, vidtex.Color, _CoverBig.Rect);
                CBase.Drawing.DrawTextureReflection(vidtex, rect, vidtex.Color, _CoverBig.Rect, _CoverBig.ReflectionSpace, _CoverBig.ReflectionHeight);
            }
            else
            {
                _CoverBig.Draw(EAspect.Crop);
            }

            foreach (IMenuElement element in _SubElements)
            {
                element.Draw();
            }
        }
Пример #11
0
        public static void SetRect(RectangleF Bounds, ref RectangleF Rect, float RectAspect, EAspect Aspect)
        {
            float rW = Bounds.Right - Bounds.Left;
            float rH = Bounds.Bottom - Bounds.Top;
            float rA = rW / rH;

            float ScaledWidth  = rW;
            float ScaledHeight = rH;

            switch (Aspect)
            {
            case EAspect.Crop:
                if (rA >= RectAspect)
                {
                    ScaledWidth  = rW;
                    ScaledHeight = rH * rA / RectAspect;
                }
                else
                {
                    ScaledHeight = rH;
                    ScaledWidth  = rW * RectAspect / rA;
                }
                break;

            case EAspect.LetterBox:
                if (RectAspect >= 1)
                {
                    ScaledWidth  = rW;
                    ScaledHeight = rH * rA / RectAspect;
                }
                else
                {
                    ScaledHeight = rH;
                    ScaledWidth  = rW * RectAspect / rA;
                }
                break;

            default:
                ScaledWidth  = rW;
                ScaledHeight = rH;
                break;
            }

            float Left  = (rW - ScaledWidth) / 2 + Bounds.Left;
            float Rigth = Left + ScaledWidth;

            float Upper = (rH - ScaledHeight) / 2 + Bounds.Top;
            float Lower = Upper + ScaledHeight;

            Rect = new RectangleF(Left, Upper, Rigth - Left, Lower - Upper);
        }
Пример #12
0
 public void DrawTexture(CTextureRef textureRef, SRectF bounds, EAspect aspect, SColorF color)
 {
     CDraw.DrawTexture(textureRef, bounds, aspect, color);
 }
Пример #13
0
 public void DrawTexture(CTextureRef textureRef, SRectF bounds, EAspect aspect)
 {
     CDraw.DrawTexture(textureRef, bounds, aspect);
 }
Пример #14
0
        public static void DrawTexture(CStatic StaticBounds, STexture Texture, EAspect Aspect)
        {
            RectangleF bounds = new RectangleF(StaticBounds.Rect.X, StaticBounds.Rect.Y, StaticBounds.Rect.W, StaticBounds.Rect.H);
            RectangleF rect = new RectangleF(0f, 0f, Texture.width, Texture.height);

            if (rect.Height <= 0f)
                return;

            CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, Aspect);
            DrawTexture(Texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, StaticBounds.Rect.Z),
                    Texture.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false);
        }
Пример #15
0
 public void Draw(EAspect aspect)
 {
     Draw(1f, Rect.Z, aspect, false);
 }
Пример #16
0
 public void Draw(float scale, EAspect aspect)
 {
     Draw(scale, Rect.Z, aspect, false);
 }
Пример #17
0
        public CSong(CSong song)
        {
            this._CoverTextureSmall = song._CoverTextureSmall;
            this._CoverTextureBig   = song._CoverTextureBig;

            this.Medley             = new SMedley();
            this.Medley.Source      = song.Medley.Source;
            this.Medley.StartBeat   = song.Medley.StartBeat;
            this.Medley.EndBeat     = song.Medley.EndBeat;
            this.Medley.FadeInTime  = song.Medley.FadeInTime;
            this.Medley.FadeOutTime = song.Medley.FadeOutTime;

            this.CalculateMedley = song.CalculateMedley;
            this.PreviewStart    = song.PreviewStart;

            this.ShortEnd  = song.ShortEnd;
            this.DuetPart1 = song.DuetPart1;
            this.DuetPart2 = song.DuetPart2;

            this.Encoding   = song.Encoding;
            this.Folder     = song.Folder;
            this.FolderName = song.FolderName;
            this.FileName   = song.FileName;
            this.Relative   = song.Relative;

            this.MP3FileName        = song.MP3FileName;
            this.CoverFileName      = song.CoverFileName;
            this.BackgroundFileName = song.BackgroundFileName;
            this.VideoFileName      = song.VideoFileName;

            this.VideoAspect    = song.VideoAspect;
            this._CoverLoaded   = song._CoverLoaded;
            this.CoverBigLoaded = song.CoverBigLoaded;
            this._NotesLoaded   = song._NotesLoaded;

            this.Artist = song.Artist;
            this.Title  = song.Title;

            this.Start  = song.Start;
            this.Finish = song.Finish;

            this.BPM      = song.BPM;
            this.Gap      = song.Gap;
            this.VideoGap = song.VideoGap;

            this.Comment = new List <string>();
            foreach (string value in song.Comment)
            {
                this.Comment.Add(value);
            }

            this.ID       = song.ID;
            this.Visible  = song.Visible;
            this.CatIndex = song.CatIndex;
            this.Selected = song.Selected;

            this.Edition = new List <string>();
            foreach (string value in song.Edition)
            {
                this.Edition.Add(value);
            }

            this.Genre = new List <string>();
            foreach (string value in song.Genre)
            {
                this.Genre.Add(value);
            }

            this.Year = song.Year;

            this.Language = new List <string>();
            foreach (string value in song.Language)
            {
                this.Language.Add(value);
            }

            this.Notes = new CNotes(song.Notes);
        }
Пример #18
0
        private void LoadNextSong()
        {
            CGame.NextRound();

            if (CGame.IsFinished())
            {
                CGraphics.FadeTo(EScreens.ScreenScore);
                _FadeOut = true;
                return;
            }

            CSong song = CGame.GetSong();

            if (song == null)
            {
                CLog.LogError("Critical Error! ScreenSing.LoadNextSong() song is null!");
                return;
            }

            CloseSong();

            if (!song.CoverSmallLoaded)
                song.ReadNotes();

            string songname = song.Artist + " - " + song.Title;
            int rounds = CGame.GetNumSongs();
            if (rounds > 1)
                songname += " (" + CGame.RoundNr + "/" + rounds.ToString() + ")";
            Texts[htTexts(TextSongName)].Text = songname;

            _CurrentStream = CSound.Load(song.GetMP3(), true);
            CSound.SetStreamVolumeMax(_CurrentStream, CConfig.GameMusicVolume);
            CSound.SetStreamVolume(_CurrentStream, _Volume);
            CSound.SetPosition(_CurrentStream, song.Start);
            _CurrentTime = song.Start;
            _FinishTime = song.Finish;
            _TimeToFirstNote = 0f;
            _TimeToFirstNoteDuet = 0f;
            int[] duet_player = new int[CGame.NumPlayer];
            if (song.IsDuet)
            {
                //Save duet-assignment before resetting
                for (int i = 0; i < duet_player.Length; i++)
                {
                    duet_player[i] = CGame.Player[i].LineNr;
                }
            }
            CGame.ResetPlayer();

            CDraw.RemoveTexture(ref _CurrentVideoTexture);

            if (song.VideoFileName != String.Empty)
            {
                _CurrentVideo = CVideo.VdLoad(Path.Combine(song.Folder, song.VideoFileName));
                CVideo.VdSkip(_CurrentVideo, song.Start, song.VideoGap);
                _VideoAspect = song.VideoAspect;
            }

            CDraw.RemoveTexture(ref _Background);
            if (song.BackgroundFileName != String.Empty)
                _Background = CDraw.AddTexture(Path.Combine(song.Folder, song.BackgroundFileName));

            SingNotes[htSingNotes(SingBars)].Reset();

            bool LyricsOnTop = (CGame.NumPlayer != 1) && CConfig.LyricsOnTop == EOffOn.TR_CONFIG_ON;
            if (song.IsDuet)
            {
                Texts[htTexts(TextDuetName1)].Text = song.DuetPart1;
                Texts[htTexts(TextDuetName2)].Text = song.DuetPart2;
                //More than one song: Player is not assigned to line by user
                //Otherwise, this is done by CScreenNames
                if (CGame.GetNumSongs() > 1)
                {
                    for (int i = 0; i < CGame.NumPlayer; i++)
                    {
                        if ((i % 2) == 0)
                            CGame.Player[i].LineNr = 1;
                        else
                            CGame.Player[i].LineNr = 0;
                    }
                }
                else
                {
                    for (int i = 0; i < CGame.NumPlayer; i++)
                    {
                        CGame.Player[i].LineNr = duet_player[i];
                    }
                }
                Statics[htStatics(StaticLyricsDuet)].Visible = true;
                Lyrics[htLyrics(LyricMainDuet)].Visible = true;
                Lyrics[htLyrics(LyricSubDuet)].Visible = true;

                Lyrics[htLyrics(LyricMainTop)].Visible = false;
                Lyrics[htLyrics(LyricSubTop)].Visible = false;
                Statics[htStatics(StaticLyricsTop)].Visible = false;
            }
            else
            {
                Statics[htStatics(StaticLyricsDuet)].Visible = false;
                Lyrics[htLyrics(LyricMainDuet)].Visible = false;
                Lyrics[htLyrics(LyricSubDuet)].Visible = false;

                Lyrics[htLyrics(LyricMainTop)].Visible = LyricsOnTop;
                Lyrics[htLyrics(LyricSubTop)].Visible = LyricsOnTop;
                Statics[htStatics(StaticLyricsTop)].Visible = LyricsOnTop;
            }

            for (int p = 0; p < CGame.NumPlayer; p++)
            {
                NoteLines[p] = SingNotes[htSingNotes(SingBars)].AddPlayer(
                    SingNotes[htSingNotes(SingBars)].BarPos[p, CGame.NumPlayer - 1],
                    CTheme.GetPlayerColor(p + 1),
                    p);
            }

            /*
                case 4:
                    NoteLines[0] = SingNotes[htSingNotes(SingBars)].AddPlayer(new SRectF(35f, 100f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[0]);
                    NoteLines[1] = SingNotes[htSingNotes(SingBars)].AddPlayer(new SRectF(35f, 350f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[1]);
                    NoteLines[2] = SingNotes[htSingNotes(SingBars)].AddPlayer(new SRectF(640f, 100f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[2]);
                    NoteLines[3] = SingNotes[htSingNotes(SingBars)].AddPlayer(new SRectF(640f, 350f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[3]);
                    break;
            */


            _TimerSongText.Stop();
            _TimerSongText.Reset();
            _TimerDuetText1.Stop();
            _TimerDuetText1.Reset();
            _TimerDuetText2.Stop();
            _TimerDuetText2.Reset();

            if (song.Notes.Lines.Length != 2)
            {
                _TimerSongText.Start();
            }

            StartSong();
        }
Пример #19
0
        public CSong(CSong song)
        {
            this._CoverTextureSmall = song._CoverTextureSmall;
            this._CoverTextureBig = song._CoverTextureBig;

            this.Medley = new SMedley();
            this.Medley.Source = song.Medley.Source;
            this.Medley.StartBeat = song.Medley.StartBeat;
            this.Medley.EndBeat = song.Medley.EndBeat;
            this.Medley.FadeInTime = song.Medley.FadeInTime;
            this.Medley.FadeOutTime = song.Medley.FadeOutTime;

            this.CalculateMedley = song.CalculateMedley;
            this.PreviewStart = song.PreviewStart;

            this.ShortEnd = song.ShortEnd;
            this.DuetPart1 = song.DuetPart1;
            this.DuetPart2 = song.DuetPart2;

            this.Encoding = song.Encoding;
            this.Folder = song.Folder;
            this.FolderName = song.FolderName;
            this.FileName = song.FileName;
            this.Relative = song.Relative;

            this.MP3FileName = song.MP3FileName;
            this.CoverFileName = song.CoverFileName;
            this.BackgroundFileName = song.BackgroundFileName;
            this.VideoFileName = song.VideoFileName;

            this.VideoAspect = song.VideoAspect;
            this._CoverLoaded = song._CoverLoaded;
            this.CoverBigLoaded = song.CoverBigLoaded;
            this._NotesLoaded = song._NotesLoaded;

            this.Artist = song.Artist;
            this.Title = song.Title;
            
            this.Start = song.Start;
            this.Finish = song.Finish;

            this.BPM = song.BPM;
            this.Gap = song.Gap;
            this.VideoGap = song.VideoGap;

            this.Comment = new List<string>();
            foreach (string value in song.Comment)
            {
                this.Comment.Add(value);
            }

            this.ID = song.ID;
            this.Visible = song.Visible;
            this.CatIndex = song.CatIndex;
            this.Selected = song.Selected;

            this.Edition = new List<string>();
            foreach (string value in song.Edition)
            {
                this.Edition.Add(value);
            }

            this.Genre = new List<string>();
            foreach (string value in song.Genre)
            {
                this.Genre.Add(value);
            }

            this.Year = song.Year;

            this.Language = new List<string>();
            foreach (string value in song.Language)
            {
                this.Language.Add(value);
            }

            this.Notes = new CNotes(song.Notes);
        }
Пример #20
0
        public void Draw(float scale, float z, EAspect aspect, bool ForceDraw)
        {
            STexture texture;
            if (_Texture.index != -1)
                texture = _Texture;
            else
                texture = CTheme.GetSkinTexture(_Theme.TextureName);

            SRectF bounds = new SRectF(
                Rect.X - Rect.W * (scale - 1f),
                Rect.Y - Rect.H * (scale - 1f),
                Rect.W + 2 * Rect.W * (scale - 1f),
                Rect.H + 2 * Rect.H * (scale - 1f),
                z);

            SRectF rect = bounds;

            if (aspect != EAspect.Stretch)
            {
                RectangleF bounds2 = new RectangleF(bounds.X, bounds.Y, bounds.W, bounds.H);
                RectangleF rect2 = new RectangleF(0f, 0f, texture.width, texture.height);
                CHelper.SetRect(bounds2, ref rect2, texture.width / texture.height, aspect);

                rect.X = rect2.X;
                rect.Y = rect2.Y;
                rect.W = rect2.Width;
                rect.H = rect2.Height;
            }
            
            SColorF color = new SColorF(Color.R, Color.G, Color.B, Color.A * Alpha);
            if (Visible || ForceDraw || (CSettings.GameState == EGameState.EditTheme))
            {
                CDraw.DrawTexture(texture, rect, color, bounds);
                if (Reflection)
                {
                    CDraw.DrawTextureReflection(texture, rect, color, bounds, ReflectionSpace, ReflectionHeight);
                }
            }

            if (Selected && (CSettings.GameState == EGameState.EditTheme))
            {
                CDraw.DrawColor(new SColorF(1f, 1f, 1f, 0.5f), rect);
            }
        }
Пример #21
0
 public void Draw(float scale, EAspect aspect)
 {
     Draw(scale, Rect.Z, aspect, false);
 }
Пример #22
0
        private void LoadNextSong()
        {
            CGame.NextRound();

            if (CGame.IsFinished())
            {
                CGraphics.FadeTo(EScreens.ScreenScore);
                _FadeOut = true;
                return;
            }

            CSong song = CGame.GetSong();

            if (song == null)
            {
                CLog.LogError("Critical Error! ScreenSing.LoadNextSong() song is null!");
                return;
            }

            CloseSong();

            if (!song.CoverSmallLoaded)
            {
                song.ReadNotes();
            }

            string songname = song.Artist + " - " + song.Title;
            int    rounds   = CGame.GetNumSongs();

            if (rounds > 1)
            {
                songname += " (" + CGame.RoundNr + "/" + rounds.ToString() + ")";
            }
            Texts[htTexts(TextSongName)].Text = songname;

            _CurrentStream = CSound.Load(song.GetMP3(), true);
            CSound.SetStreamVolume(_CurrentStream, _Volume);
            CSound.SetPosition(_CurrentStream, song.Start);
            _CurrentTime         = song.Start;
            _FinishTime          = song.Finish;
            _TimeToFirstNote     = 0f;
            _TimeToFirstNoteDuet = 0f;
            CGame.ResetPlayer();

            CDraw.RemoveTexture(ref _CurrentVideoTexture);

            if (song.VideoFileName != String.Empty)
            {
                _CurrentVideo = CVideo.VdLoad(Path.Combine(song.Folder, song.VideoFileName));
                CVideo.VdSkip(_CurrentVideo, song.Start, song.VideoGap);
                _VideoAspect = song.VideoAspect;
            }

            CDraw.RemoveTexture(ref _Background);
            if (song.BackgroundFileName != String.Empty)
            {
                _Background = CDraw.AddTexture(Path.Combine(song.Folder, song.BackgroundFileName));
            }

            SingNotes[htSingNotes(SingBars)].Reset();

            bool LyricsOnTop = CGame.NumPlayer == 2 && CConfig.LyricsOnTop == EOffOn.TR_CONFIG_ON;

            if (song.IsDuet)
            {
                CGame.Player[1].LineNr = 1;
                Statics[htStatics(StaticLyricsDuet)].Visible = true;
                Lyrics[htLyrics(LyricMainDuet)].Visible      = true;
                Lyrics[htLyrics(LyricSubDuet)].Visible       = true;

                Lyrics[htLyrics(LyricMainTop)].Visible      = false;
                Lyrics[htLyrics(LyricSubTop)].Visible       = false;
                Statics[htStatics(StaticLyricsTop)].Visible = false;
            }
            else
            {
                Statics[htStatics(StaticLyricsDuet)].Visible = false;
                Lyrics[htLyrics(LyricMainDuet)].Visible      = false;
                Lyrics[htLyrics(LyricSubDuet)].Visible       = false;

                Lyrics[htLyrics(LyricMainTop)].Visible      = LyricsOnTop;
                Lyrics[htLyrics(LyricSubTop)].Visible       = LyricsOnTop;
                Statics[htStatics(StaticLyricsTop)].Visible = LyricsOnTop;
            }

            for (int p = 0; p < CGame.NumPlayer; p++)
            {
                NoteLines[p] = SingNotes[htSingNotes(SingBars)].AddPlayer(
                    SingNotes[htSingNotes(SingBars)].BarPos[p, CGame.NumPlayer - 1],
                    CTheme.GetPlayerColor(p + 1),
                    p);
            }

            /*
             *  case 4:
             *      NoteLines[0] = SingNotes[htSingNotes(SingBars)].AddPlayer(new SRectF(35f, 100f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[0]);
             *      NoteLines[1] = SingNotes[htSingNotes(SingBars)].AddPlayer(new SRectF(35f, 350f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[1]);
             *      NoteLines[2] = SingNotes[htSingNotes(SingBars)].AddPlayer(new SRectF(640f, 100f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[2]);
             *      NoteLines[3] = SingNotes[htSingNotes(SingBars)].AddPlayer(new SRectF(640f, 350f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[3]);
             *      break;
             */


            _TimerSongText.Stop();
            _TimerSongText.Reset();

            if (song.Notes.Lines.Length != 2)
            {
                _TimerSongText.Start();
            }

            StartSong();
        }
Пример #23
0
        private void LoadNextSong()
        {
            CGame.NextRound();

            if (CGame.IsFinished())
            {
                CGraphics.FadeTo(EScreens.ScreenScore);
                _FadeOut = true;
                return;
            }

            CSong song = CGame.GetSong();

            if (song == null)
            {
                CLog.LogError("Critical Error! ScreenSing.LoadNextSong() song is null!");
                return;
            }

            CloseSong();

            if (!song.CoverSmallLoaded)
                song.ReadNotes();

            string songname = song.Artist + " - " + song.Title;
            int rounds = CGame.GetNumSongs();
            if (rounds > 1)
                songname += " (" + CGame.RoundNr + "/" + rounds.ToString() + ")";
            Texts[htTexts(TextSongName)].Text = songname;

            _CurrentStream = CSound.Load(song.GetMP3(), true);
            CSound.SetStreamVolume(_CurrentStream, _Volume);
            CSound.SetPosition(_CurrentStream, song.Start);
            _CurrentTime = song.Start;
            _FinishTime = song.Finish;
            _TimeToFirstNote = 0f;
            _TimeToFirstNoteDuet = 0f;
            CGame.ResetPlayer();

            CDraw.RemoveTexture(ref _CurrentVideoTexture);

            if (song.VideoFileName != String.Empty)
            {
                _CurrentVideo = CVideo.VdLoad(Path.Combine(song.Folder, song.VideoFileName));
                CVideo.VdSkip(_CurrentVideo, song.Start, song.VideoGap);
                _VideoAspect = song.VideoAspect;
            }

            CDraw.RemoveTexture(ref _Background);
            if (song.BackgroundFileName != String.Empty)
                _Background = CDraw.AddTexture(Path.Combine(song.Folder, song.BackgroundFileName));

            SingNotes[htSingNotes(SingBars)].Reset();

            bool LyricsOnTop = CGame.NumPlayer == 2 && CConfig.LyricsOnTop == EOffOn.TR_CONFIG_ON;
            if (song.IsDuet)
            {
                CGame.Player[1].LineNr = 1;
                Statics[htStatics(StaticLyricsDuet)].Visible = true;
                Lyrics[htLyrics(LyricMainDuet)].Visible = true;
                Lyrics[htLyrics(LyricSubDuet)].Visible = true;

                Lyrics[htLyrics(LyricMainTop)].Visible = false;
                Lyrics[htLyrics(LyricSubTop)].Visible = false;
                Statics[htStatics(StaticLyricsTop)].Visible = false;
            }
            else
            {
                Statics[htStatics(StaticLyricsDuet)].Visible = false;
                Lyrics[htLyrics(LyricMainDuet)].Visible = false;
                Lyrics[htLyrics(LyricSubDuet)].Visible = false;

                Lyrics[htLyrics(LyricMainTop)].Visible = LyricsOnTop;
                Lyrics[htLyrics(LyricSubTop)].Visible = LyricsOnTop;
                Statics[htStatics(StaticLyricsTop)].Visible = LyricsOnTop;
            }

            for (int p = 0; p < CGame.NumPlayer; p++)
            {
                NoteLines[p] = SingNotes[htSingNotes(SingBars)].AddPlayer(
                    SingNotes[htSingNotes(SingBars)].BarPos[p, CGame.NumPlayer - 1],
                    CTheme.GetPlayerColor(p + 1),
                    p);
            }

            /*
                case 4:
                    NoteLines[0] = SingNotes[htSingNotes(SingBars)].AddPlayer(new SRectF(35f, 100f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[0]);
                    NoteLines[1] = SingNotes[htSingNotes(SingBars)].AddPlayer(new SRectF(35f, 350f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[1]);
                    NoteLines[2] = SingNotes[htSingNotes(SingBars)].AddPlayer(new SRectF(640f, 100f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[2]);
                    NoteLines[3] = SingNotes[htSingNotes(SingBars)].AddPlayer(new SRectF(640f, 350f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[3]);
                    break;
            */

            _TimerSongText.Stop();
            _TimerSongText.Reset();

            if (song.Notes.Lines.Length != 2)
                _TimerSongText.Start();

            StartSong();
        }
Пример #24
0
        public CSong(CSong song)
        {
            _CoverTextureSmall = song._CoverTextureSmall;
            _CoverTextureBig   = song._CoverTextureBig;

            Medley = song.Medley;

            _CalculateMedley = song._CalculateMedley;
            Preview          = song.Preview;

            ShortEnd = song.ShortEnd;

            Encoding       = song.Encoding;
            ManualEncoding = song.ManualEncoding;
            Folder         = song.Folder;
            FolderName     = song.FolderName;
            FileName       = song.FileName;
            Relative       = song.Relative;

            MP3FileName         = song.MP3FileName;
            CoverFileName       = song.CoverFileName;
            BackgroundFileNames = song.BackgroundFileNames;
            VideoFileName       = song.VideoFileName;

            VideoAspect = song.VideoAspect;
            NotesLoaded = song.NotesLoaded;

            Artist        = song.Artist;
            Title         = song.Title;
            ArtistSorting = song.ArtistSorting;
            TitleSorting  = song.TitleSorting;

            Creator     = song.Creator;
            Version     = song.Version;
            Length      = song.Length;
            Source      = song.Source;
            UnknownTags = new List <string>(song.UnknownTags);

            Start  = song.Start;
            Finish = song.Finish;

            BPM      = song.BPM;
            Gap      = song.Gap;
            VideoGap = song.VideoGap;

            _Comment = song._Comment;

            ID        = song.ID;
            _Visible  = song._Visible;
            _CatIndex = song._CatIndex;
            _Selected = song._Selected;

            Editions = new List <string>(song.Editions);
            Genres   = new List <string>(song.Genres);
            Album    = song.Album;
            Year     = song.Year;

            Languages = new List <string>(song.Languages);

            DataBaseSongID   = song.DataBaseSongID;
            DateAdded        = song.DateAdded;
            NumPlayed        = song.NumPlayed;
            NumPlayedSession = song.NumPlayedSession;

            Notes = new CNotes(song.Notes);
        }
Пример #25
0
 /// <summary>
 ///     Draws a texture fitting it within the given bounds with the method specified by aspect
 /// </summary>
 /// <param name="textureRef"></param>
 /// <param name="bounds">Where to draw the texture</param>
 /// <param name="aspect">How to fit a texture in the bounds if the size differs</param>
 public static void DrawTexture(CTextureRef textureRef, SRectF bounds, EAspect aspect)
 {
     DrawTexture(textureRef, bounds, aspect, textureRef.Color);
 }
Пример #26
0
        /// <summary>
        ///     Places a rect within the bounds maintaining the aspectRatio and using the given aspect
        /// </summary>
        /// <param name="bounds">Bounds to fit the rect in</param>
        /// <param name="aspectRatio">The original aspectRatio of the rect/image/...</param>
        /// <param name="aspect">
        ///     Crop: No empty space in bounds but has overhanging parts (same on both sides)<br />
        ///     LetterBox: Fit the long side possibly leaving some space on the other (rect will be centered)<br />
        ///     StretcH: Just fit the rect in the bounds (rect=bounds)
        /// </param>
        public static SRectF FitInBounds(SRectF bounds, float aspectRatio, EAspect aspect)
        {
            if (aspect == EAspect.Stretch)
            {
                return(bounds);
            }

            float boundsAspectRatio = bounds.W / bounds.H;

            float scaledWidth, scaledHeight;

            switch (aspect)
            {
            case EAspect.Automatic:
            case EAspect.Crop:
                if (boundsAspectRatio >= aspectRatio)
                {
                    scaledWidth  = bounds.W;
                    scaledHeight = bounds.W / aspectRatio;
                }
                else
                {
                    scaledHeight = bounds.H;
                    scaledWidth  = bounds.H * aspectRatio;
                }
                break;

            case EAspect.Zoom1:
                if (boundsAspectRatio >= aspectRatio)
                {
                    scaledWidth  = bounds.W * 1.33f;
                    scaledHeight = bounds.W * 1.33f / aspectRatio;
                }
                else
                {
                    scaledHeight = bounds.H / 1.33f;
                    scaledWidth  = bounds.H / 1.33f * aspectRatio;
                }
                break;

            case EAspect.Zoom2:
                if (boundsAspectRatio >= aspectRatio)
                {
                    scaledWidth  = bounds.W * 1.17f;
                    scaledHeight = bounds.W * 1.17f / aspectRatio;
                }
                else
                {
                    scaledHeight = bounds.H / 1.17f;
                    scaledWidth  = bounds.H / 1.17f * aspectRatio;
                }
                break;

            case EAspect.LetterBox:
                if (boundsAspectRatio < aspectRatio)
                {
                    scaledWidth  = bounds.W;
                    scaledHeight = bounds.W / aspectRatio;
                }
                else
                {
                    scaledHeight = bounds.H;
                    scaledWidth  = bounds.H * aspectRatio;
                }
                break;

            case EAspect.PillarBox:
                scaledWidth  = bounds.W * 0.77f;
                scaledHeight = bounds.W / aspectRatio;
                break;

            default:
                return(bounds);
            }
            float left = (bounds.W - scaledWidth) / 2 + bounds.X;
            float top  = (bounds.H - scaledHeight) / 2 + bounds.Y;

            return(new SRectF(left, top, scaledWidth, scaledHeight, bounds.Z));
        }
Пример #27
0
 public void Draw(EAspect aspect)
 {
     Draw(1f, Rect.Z, aspect, false);
 }