Ejemplo n.º 1
0
        private void DrawSlide(float CurrentBeat)
        {
            float x = _X - _width / 2;

            foreach (SNote note in _Notes)
            {
                _Text.X     = x;
                _Text.Style = EStyle.Bold;
                _Text.Text  = note.Text;
                RectangleF rect = CDraw.GetTextBounds(_Text);

                if (note.Type == ENoteType.Freestyle)
                {
                    _Text.Style = EStyle.BoldItalic;
                }

                if (CurrentBeat >= note.StartBeat)
                {
                    if (CurrentBeat <= note.EndBeat)
                    {
                        _Text.Color = ColorProcessed;


                        float diff = note.EndBeat - note.StartBeat;
                        if (diff == 0)
                        {
                            _Text.Draw(0f, 1f);
                        }
                        else
                        {
                            _Text.Draw(0f, (CurrentBeat - note.StartBeat) / diff);
                            _Text.Color = Color;
                            _Text.Draw((CurrentBeat - note.StartBeat) / diff, 1f);
                        }
                    }
                    else
                    {
                        _Text.Color = ColorProcessed;
                        _Text.Draw();
                    }
                }
                else
                {
                    _Text.Color = Color;
                    _Text.Draw();
                }

                x += rect.Width;
            }
        }
Ejemplo n.º 2
0
        public void Draw()
        {
            if (!Visible && CSettings.GameState != EGameState.EditTheme)
            {
                return;
            }

            STexture Texture           = CTheme.GetSkinTexture(_Theme.TextureName);
            STexture TextureArrowLeft  = CTheme.GetSkinTexture(_Theme.TextureArrowLeftName);
            STexture TextureArrowRight = CTheme.GetSkinTexture(_Theme.TextureArrowRightName);

            STexture STexture           = CTheme.GetSkinTexture(_Theme.STextureName);
            STexture STextureArrowLeft  = CTheme.GetSkinTexture(_Theme.STextureArrowLeftName);
            STexture STextureArrowRight = CTheme.GetSkinTexture(_Theme.STextureArrowRightName);

            STexture HTexture = CTheme.GetSkinTexture(_Theme.HTextureName);

            if (Selected)
            {
                if (Highlighted)
                {
                    CDraw.DrawTexture(HTexture, Rect, HColor);
                }
                else
                {
                    CDraw.DrawTexture(STexture, Rect, SColor);
                }
            }
            else
            {
                CDraw.DrawTexture(Texture, Rect, Color);
            }

            if (_Selection > 0 || CSettings.GameState == EGameState.EditTheme)
            {
                if (_ArrowLeftSelected)
                {
                    CDraw.DrawTexture(STextureArrowLeft, RectArrowLeft, SColorArrow);
                }
                else
                {
                    CDraw.DrawTexture(TextureArrowLeft, RectArrowLeft, ColorArrow);
                }
            }

            if (_Selection < _ValueNames.Count - 1 || CSettings.GameState == EGameState.EditTheme)
            {
                if (_ArrowRightSelected)
                {
                    CDraw.DrawTexture(STextureArrowRight, RectArrowRight, SColorArrow);
                }
                else
                {
                    CDraw.DrawTexture(TextureArrowRight, RectArrowRight, ColorArrow);
                }
            }

            if (_NumVisible < 1 || _ValueNames.Count == 0)
            {
                return;
            }

            float x  = Rect.X + Rect.W * 0.1f;
            float dx = Rect.W * 0.8f / _NumVisible;
            //float y = Rect.Y + (Rect.H - TextH);

            int offset = _Selection - (int)_NumVisible / 2;

            if (_ValueNames.Count - _NumVisible - offset < 0)
            {
                offset = _ValueNames.Count - _NumVisible;
            }

            if (offset < 0)
            {
                offset = 0;
            }


            int numvis = _NumVisible;

            if (_ValueNames.Count < numvis)
            {
                numvis = _ValueNames.Count;
            }

            _ValueBounds.Clear();
            for (int i = 0; i < numvis; i++)
            {
                CText   Text  = new CText(0, 0, 0, TextH, MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, TextColor, _ValueNames[i + offset]);
                SColorF Alpha = new SColorF(1f, 1f, 1f, 0.35f);
                if (i + offset == _Selection)
                {
                    Text.Color = STextColor;
                    Alpha      = new SColorF(1f, 1f, 1f, 1f);
                }

                RectangleF bounds = CDraw.GetTextBounds(Text);
                Text.X = x + dx / 2f + dx * i;

                if (!WithTextures)
                {
                    Text.Y = (int)(Rect.Y + (Rect.H - bounds.Height) / 2);
                }
                else
                {
                    Text.Y = (int)(Rect.Y + (Rect.H - bounds.Height));
                }

                Text.Z = Rect.Z;
                Text.Draw();

                if (WithTextures)
                {
                    float  dh   = Text.Y - Rect.Y - Rect.H * 0.1f;
                    SRectF rect = new SRectF(Text.X - dh / 2, Rect.Y + Rect.H * 0.05f, dh, dh, Rect.Z);
                    CDraw.DrawTexture(_Textures[i + offset], rect, Alpha);
                    _ValueBounds.Add(rect);
                }
                else
                {
                    _ValueBounds.Add(new SRectF(Text.X - bounds.Width / 2f, Text.Y, bounds.Width, bounds.Height, Rect.Z));
                }
            }
        }