Esempio n. 1
0
        public override void Render(Vector2 windowSize)
        {
            foreach (Numbers number in background)
            {
                Vector2 position = number.Position;
                position.Y = (float)Math.Round(position.Y);
                position  *= 16;

                for (int i = 0; i < number.Values.Count; i++)
                {
                    int value = number.Values[i];
                    TextureRenderer.Draw(Textures.Get("Font"), position - new Vector2(0, i * 16), Vector2.One * 2, number.Color, new RectangleF(((value + 16) % 16) * 6, ((value + 16) / 16) * 6, 6, 6));
                }
            }

            if (!clickedNums.All(x => x == null))
            {
                string s = "";
                for (int i = maxNums - 1; i >= 0; i--)
                {
                    s += clickedNums[i].ToString();
                }

                TextBlock number = new TextBlock(s, 3);
                if (correctAnimation > 0)
                {
                    number.Color = (correctAnimation / 10) % 2 == 0 ? Color.Green : Color.White;
                }
                else if (wrongAnimation > 0)
                {
                    number.Color = (wrongAnimation / 10) % 2 == 0 ? Color.Red : Color.White;
                }
                else
                {
                    number.Color = Color.White;
                }

                number.SetConstraints(
                    new PixelConstraint(20),
                    new PixelConstraint(20, RelativeTo.Window, Direction.Bottom),
                    new PixelConstraint((int)number.TextWidth),
                    new PixelConstraint((int)number.TextHeight));

                number.Render(windowSize);
                number.Dispose();
            }

            ui.Render(windowSize);
        }