Пример #1
0
        public void Draw(bool ForceDraw)
        {
            if (!Visible && CSettings.GameState != EGameState.EditTheme && !ForceDraw)
            {
                return;
            }

            STexture texture = new STexture(-1);

            if (!Selected)
            {
                texture = CTheme.GetSkinTexture(_Theme.TextureName);
                CDraw.DrawTexture(texture, Rect, Color);
                if (Reflection)
                {
                    CDraw.DrawTextureReflection(texture, Rect, Color, Rect, ReflectionSpace, ReflectionHeight);
                }
            }
            else
            {
                texture = CTheme.GetSkinTexture(_Theme.STextureName);
                CDraw.DrawTexture(texture, Rect, SColor);
                if (Reflection)
                {
                    CDraw.DrawTextureReflection(texture, Rect, SColor, Rect, ReflectionSpace, ReflectionHeight);
                }
            }

            Text.DrawRelative(Rect.X, Rect.Y);
            if (Reflection)
            {
                Text.DrawRelative(Rect.X, Rect.Y, ReflectionSpace, ReflectionHeight, Rect.H);
            }
        }
Пример #2
0
        private void DrawNoteBG(SRectF Rect, SColorF Color, float factor, Stopwatch Timer)
        {
            const int   spacing = 0;
            const float period  = 1.5f; //[s]

            if (!Timer.IsRunning)
            {
                Timer.Start();
            }

            if (Timer.ElapsedMilliseconds / 1000f > period)
            {
                Timer.Reset();
                Timer.Start();
            }

            float alpha = (float)((Math.Cos((Timer.ElapsedMilliseconds / 1000f) / period * Math.PI * 2) + 1) / 2.0) / 2f + 0.5f;
            float d     = (1f - factor) / 2 * Rect.H;
            float dw    = d;

            if (2 * dw > Rect.W)
            {
                dw = Rect.W / 2;
            }

            SRectF r = new SRectF(
                Rect.X + dw + spacing,
                Rect.Y + d + spacing,
                Rect.W - 2 * dw - 2 * spacing,
                Rect.H - 2 * d - 2 * spacing,
                Rect.Z
                );

            STexture NoteBackgroundBegin  = CTheme.GetSkinTexture(_Theme.SkinBackgroundLeftName);
            STexture NoteBackgroundMiddle = CTheme.GetSkinTexture(_Theme.SkinBackgroundMiddleName);
            STexture NoteBackgroundEnd    = CTheme.GetSkinTexture(_Theme.SkinBackgroundRightName);

            float dx = NoteBackgroundBegin.width * r.H / NoteBackgroundBegin.height;

            if (2 * dx > r.W)
            {
                dx = r.W / 2;
            }

            SColorF col = new SColorF(Color.R, Color.G, Color.B, Color.A * alpha);

            CDraw.DrawTexture(NoteBackgroundBegin, new SRectF(r.X, r.Y, dx, r.H, r.Z), col);
            CDraw.DrawTexture(NoteBackgroundMiddle, new SRectF(r.X + dx, r.Y, r.W - 2 * dx, r.H, r.Z), col);
            CDraw.DrawTexture(NoteBackgroundEnd, new SRectF(r.X + r.W - dx, r.Y, dx, r.H, r.Z), col);
        }
Пример #3
0
        public void Draw(float scale, float z, bool 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)
            {
                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, EAspect.Crop);

                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);
            }
        }
Пример #4
0
        public void LoadTextures()
        {
            _TextureEmptyTile    = CTheme.GetSkinTexture(_Theme.TextureEmptyTileName);
            _TextureTileSelected = CTheme.GetSkinTexture(_Theme.TextureTileSelectedName);

            if (_Theme.ColorEmptyTileName != String.Empty)
            {
                ColorEmptyTile = CTheme.GetColor(_Theme.ColorEmptyTileName);
            }

            if (_Theme.NameColorName != String.Empty)
            {
                _Theme.NameColor = CTheme.GetColor(_Theme.NameColorName);
            }
        }
Пример #5
0
        private bool DrawTexture()
        {
            STexture Texture = CTheme.GetSkinTexture(_Theme.TextureName);

            if (Texture.height > 0)
            {
                RectangleF bounds = new RectangleF(0f, 0f, CSettings.iRenderW, CSettings.iRenderH);
                RectangleF rect   = new RectangleF(0f, 0f, Texture.width, Texture.height);
                CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop);

                CDraw.DrawTexture(Texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CSettings.zFar / 4));
                return(true);
            }
            return(false);
        }
Пример #6
0
        public override void Init()
        {
            base.Init();

            _Rect = _Theme.songMenuTileBoard.TileRect;

            _NumW   = _Theme.songMenuTileBoard.numW;
            _NumH   = _Theme.songMenuTileBoard.numH;
            _SpaceW = _Theme.songMenuTileBoard.spaceW;
            _SpaceH = _Theme.songMenuTileBoard.spaceH;

            _PendingTime = 100L;

            _TileW = (int)((_Theme.songMenuTileBoard.TileRect.W - _SpaceW * (_NumW - 1)) / _NumW);
            _TileH = (int)((_Theme.songMenuTileBoard.TileRect.H - _SpaceH * (_NumH - 1)) / _NumH);

            _CoverTexture    = CTheme.GetSkinTexture(_Theme.CoverBackgroundName);
            _CoverBigTexture = CTheme.GetSkinTexture(_Theme.CoverBigBackgroundName);

            _Tiles = new List <CStatic>();
            for (int i = 0; i < _NumH; i++)
            {
                for (int j = 0; j < _NumW; j++)
                {
                    SRectF rect = new SRectF(_Theme.songMenuTileBoard.TileRect.X + j * (_TileW + _SpaceW),
                                             _Theme.songMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z);
                    CStatic tile = new CStatic(_CoverTexture, Color, rect);
                    _Tiles.Add(tile);
                }
            }

            _ScrollRect = new SRectF(0, 0, CSettings.iRenderW, CSettings.iRenderH, _Theme.songMenuTileBoard.TileRect.Z);

            _PreviewSelected = -1;
            _Offset          = 0;

            _CoverBig       = _Theme.songMenuTileBoard.StaticCoverBig;
            _TextBG         = _Theme.songMenuTileBoard.StaticTextBG;
            _DuetIcon       = _Theme.songMenuTileBoard.StaticDuetIcon;
            _VideoIcon      = _Theme.songMenuTileBoard.StaticVideoIcon;
            _MedleyCalcIcon = _Theme.songMenuTileBoard.StaticMedleyCalcIcon;
            _MedleyTagIcon  = _Theme.songMenuTileBoard.StaticMedleyTagIcon;

            _Artist     = _Theme.songMenuTileBoard.TextArtist;
            _Title      = _Theme.songMenuTileBoard.TextTitle;
            _SongLength = _Theme.songMenuTileBoard.TextSongLength;
        }
Пример #7
0
        private void AddPerfectNote(SRectF Rect, int n, float factor)
        {
            const int spacing = 0;

            float d  = (1f - factor) / 2 * Rect.H;
            float dw = d;

            if (2 * dw > Rect.W)
            {
                dw = Rect.W / 2;
            }

            SRectF r = new SRectF(
                Rect.X + dw + spacing,
                Rect.Y + d + spacing,
                Rect.W - 2 * dw - 2 * spacing,
                Rect.H - 2 * d - 2 * spacing,
                Rect.Z
                );

            STexture NoteBegin = CTheme.GetSkinTexture(_Theme.SkinLeftName);
            float    dx        = NoteBegin.width * r.H / NoteBegin.height;

            if (2 * dx > r.W)
            {
                dx = r.W / 2;
            }

            r = new SRectF(
                r.X + r.W - dx,
                r.Y,
                dx * 0.5f,
                dx * 0.2f,
                Rect.Z
                );

            CParticleEffect stars = new CParticleEffect(CGame.Rand.Next(2) + 1, new SColorF(1f, 1f, 1f, 1f), r, _Theme.SkinPerfectNoteStarName, 35, EParticeType.PerfNoteStar);

            _PlayerNotes[n].PerfectNoteEffect.Add(stars);
        }
Пример #8
0
        private void DrawNote(SRectF Rect, SColorF Color, float factor)
        {
            const int spacing = 0;

            float d  = (1f - factor) / 2 * Rect.H;
            float dw = d;

            if (2 * dw > Rect.W)
            {
                dw = Rect.W / 2;
            }

            SRectF r = new SRectF(
                Rect.X + dw + spacing,
                Rect.Y + d + spacing,
                Rect.W - 2 * dw - 2 * spacing,
                Rect.H - 2 * d - 2 * spacing,
                Rect.Z
                );

            STexture NoteBegin  = CTheme.GetSkinTexture(_Theme.SkinLeftName);
            STexture NoteMiddle = CTheme.GetSkinTexture(_Theme.SkinMiddleName);
            STexture NoteEnd    = CTheme.GetSkinTexture(_Theme.SkinRightName);

            float dx = NoteBegin.width * r.H / NoteBegin.height;

            if (2 * dx > r.W)
            {
                dx = r.W / 2;
            }


            CDraw.DrawTexture(NoteBegin, new SRectF(r.X, r.Y, dx, r.H, r.Z), Color);
            CDraw.DrawTexture(NoteMiddle, new SRectF(r.X + dx, r.Y, r.W - 2 * dx, r.H, r.Z), Color);
            CDraw.DrawTexture(NoteEnd, new SRectF(r.X + r.W - dx, r.Y, dx, r.H, r.Z), Color);
        }
Пример #9
0
        private void DrawToneHelper(int n, int BaseLine, float XOffset)
        {
            int TonePlayer = CSound.RecordGetToneAbs(_PlayerNotes[n].PlayerNr);

            SRectF Rect = _PlayerNotes[n].Rect;

            while (TonePlayer - BaseLine < 0)
            {
                TonePlayer += 12;
            }

            while (TonePlayer - BaseLine > 12)
            {
                TonePlayer -= 12;
            }

            if (XOffset < 0f)
            {
                XOffset = 0f;
            }

            if (XOffset > Rect.W)
            {
                XOffset = Rect.W;
            }

            float  dy   = Rect.H / (CSettings.NumNoteLines);
            SRectF rect = new SRectF(
                Rect.X - dy + XOffset,
                Rect.Y + dy * (CSettings.NumNoteLines - 1 - (TonePlayer - BaseLine) / 2f),
                dy,
                dy,
                Rect.Z
                );

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

            STexture ToneHelper = CTheme.GetSkinTexture(_Theme.SkinToneHelperName);

            CDraw.DrawTexture(ToneHelper, rect, color);


            while (TonePlayer - BaseLine < 12)
            {
                TonePlayer += 12;
            }

            while (TonePlayer - BaseLine > 24)
            {
                TonePlayer -= 12;
            }

            rect = new SRectF(
                Rect.X - dy + XOffset,
                Rect.Y + dy * (CSettings.NumNoteLines - 1 - (TonePlayer - BaseLine) / 2f),
                dy,
                dy,
                Rect.Z
                );

            CDraw.DrawTexture(ToneHelper, rect, color);
        }
Пример #10
0
        public override void SetSmallView(bool SmallView)
        {
            base.SetSmallView(SmallView);

            _SmallView = SmallView;

            if (_SmallView)
            {
                _NumH = _Theme.songMenuTileBoard.numHsmall;
                _NumW = _Theme.songMenuTileBoard.numWsmall;

                _TileW = (int)((_Theme.songMenuTileBoard.TileRectSmall.W - _SpaceW * (_NumW - 1)) / _NumW);
                _TileH = (int)((_Theme.songMenuTileBoard.TileRectSmall.H - _SpaceH * (_NumH - 1)) / _NumH);

                _CoverTexture    = CTheme.GetSkinTexture(_Theme.CoverBackgroundName);
                _CoverBigTexture = CTheme.GetSkinTexture(_Theme.CoverBigBackgroundName);

                _Tiles = new List <CStatic>();
                for (int i = 0; i < _NumH; i++)
                {
                    for (int j = 0; j < _NumW; j++)
                    {
                        SRectF rect = new SRectF(_Theme.songMenuTileBoard.TileRectSmall.X + j * (_TileW + _SpaceW),
                                                 _Theme.songMenuTileBoard.TileRectSmall.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z);
                        CStatic tile = new CStatic(_CoverTexture, Color, rect);
                        _Tiles.Add(tile);
                    }
                }

                _Rect       = _Theme.songMenuTileBoard.TileRectSmall;
                _ScrollRect = new SRectF(0, 0, CSettings.iRenderW, CSettings.iRenderH, _Theme.songMenuTileBoard.TileRectSmall.Z);
            }
            else
            {
                _NumH = _Theme.songMenuTileBoard.numH;
                _NumW = _Theme.songMenuTileBoard.numW;

                _TileW = (int)((_Theme.songMenuTileBoard.TileRect.W - _SpaceW * (_NumW - 1)) / _NumW);
                _TileH = (int)((_Theme.songMenuTileBoard.TileRect.H - _SpaceH * (_NumH - 1)) / _NumH);

                _CoverTexture    = CTheme.GetSkinTexture(_Theme.CoverBackgroundName);
                _CoverBigTexture = CTheme.GetSkinTexture(_Theme.CoverBigBackgroundName);

                _Tiles = new List <CStatic>();
                for (int i = 0; i < _NumH; i++)
                {
                    for (int j = 0; j < _NumW; j++)
                    {
                        SRectF rect = new SRectF(_Theme.songMenuTileBoard.TileRect.X + j * (_TileW + _SpaceW),
                                                 _Theme.songMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z);
                        CStatic tile = new CStatic(_CoverTexture, Color, rect);
                        _Tiles.Add(tile);
                    }
                }

                _Rect       = _Theme.songMenuTileBoard.TileRect;
                _ScrollRect = new SRectF(0, 0, CSettings.iRenderW, CSettings.iRenderH, _Theme.songMenuTileBoard.TileRect.Z);
            }

            UpdateList(_Offset);
        }
Пример #11
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));
                }
            }
        }