Exemplo n.º 1
0
        public override void Initialize()
        {
            base.Initialize();

            font = Game.Content.Load<SpriteFont>("PixelFont" + Game.DefaultFontSize);
            logoTexture = Game.Content.Load<Texture2D>("logo");
            startSound = Game.Content.Load<SoundEffect>("jingle");

            // Logo
            logo = new Image(Game)
            {
                Texture = logoTexture,
            };
            components.Add(logo);

            // TextLabel: Touch to Start
            label = new TextLabel(Game)
            {
                Font = font,
                Text = "Touch to Start",
                Color = Color.White,
            };
            components.Add(label);

            animProvider.CreateChain()
                .Wait(500)
                .Then(() =>
                {
                    isEnabled = true;
                });
        }
Exemplo n.º 2
0
        public override void Initialize()
        {
            SaveScore();

            base.Initialize();
            font = Game.Content.Load<SpriteFont>("PixelFont" + Game.DefaultFontSize);

            titleLabel = new TextLabel(Game)
            {
                Text = "RESULT",
                Font = font,
                Color = Color.White,
            };
            components.Add(titleLabel);

            scoreLabel = new TextLabel(Game)
            {
                Text = string.Format("SCORE:{0, 5}", Score),
                Font = font,
                Color = Color.White,
            };
            components.Add(scoreLabel);

            highScoreLabel = new TextLabel(Game)
            {
                Text = string.Format(
                    "YOUR TOP SCORE:{0, 5}\n  SECOND SCORE:{1, 5}\n   THIRD SCORE:{2, 5}",
                    scores[0], scores[1], scores[2]),
                Font = font,
                Color = Color.White,
            };
            components.Add(highScoreLabel);

            backButton = new TextButton(Game)
            {
                Font = font,
                Text = "BACK TO TITLE"
            };
            backButton.Released += BackPressed;
            components.Add(backButton);

            retryButton = new TextButton(Game)
            {
                Font = font,
                Text = "RETRY"
            };
            retryButton.Released += RetryPressed;
            components.Add(retryButton);
        }
Exemplo n.º 3
0
        public override void Initialize()
        {
            base.Initialize();

            font = Game.Content.Load<SpriteFont>("PixelFont" + Game.DefaultFontSize);
            countSound = Game.Content.Load<SoundEffect>("count");
            startSound = Game.Content.Load<SoundEffect>("start");

            // TextLabel
            label = new TextLabel(Game)
            {
                Font = font,
                Text = "",
                Color = Color.Black,
            };
            components.Add(label);

            // setup countdown animation
            Action<int> updateCount = count =>
            {
                label.Text = count.ToString();
                countSound.Play(0.5f, 0, 0);
            };
            animProvider.CreateChain()
                .Wait(1000)
                .Then(() => label.Text = "READY")
                .Wait(2000)
                .Then(() => updateCount(3))
                .Blink(label, 200, 5)
                .Then(() => updateCount(2))
                .Blink(label, 200, 5)
                .Then(() => updateCount(1))
                .Blink(label, 200, 5)
                .Then(() =>
                {
                    label.Text = "START!";
                    startSound.Play(0.5f, 0, 0);
                })
                .Blink(label, 200, 5)
                .Then(() =>
                {
                    if (Started != null)
                    {
                        Started(this, EventArgs.Empty);
                    }
                    Game.SceneManager.Pop();
                });
        }
Exemplo n.º 4
0
        public override void Initialize()
        {
            base.Initialize();

            backgroundTexture = Game.Content.Load<Texture2D>("white_border");
            activeTexture = Game.Content.Load<Texture2D>("white_border_active");

            background = new NinePatchBox(Game)
            {
                Texture = backgroundTexture,
                Bounds = Bounds,
            };
            components.Add(background);

            label = new TextLabel(Game)
            {
                Text = Text,
                Font = Font,
                Position = Bounds.Center.ToVector2(),
                Color = Color.White
            };
            components.Add(label);
        }
Exemplo n.º 5
0
        public override void Initialize()
        {
            base.Initialize();

            font = Game.Content.Load<SpriteFont>("PixelFont" + Game.DefaultFontSize);
            gongSound = Game.Content.Load<SoundEffect>("gong");

            image = new Image(Game)
            {
                Texture = Game.Content.Load<Texture2D>("white_pixel"),
                Color = Color.Black
            };
            components.Add(image);

            text = new TextLabel(Game)
            {
                Text = "TIMEUP",
                Color = Color.White,
                Font = font
            };
            components.Add(text);

            gongSound.Play(0.5f, 0, 0);
        }
Exemplo n.º 6
0
 public static AnimChain.IChain FadeIn(this AnimChain.IChain chain, TextLabel target, int time)
 {
     var origin = target.Alpha;
     chain.Next(time, p =>
     {
         target.Alpha = origin + (1 - origin) * p;
     });
     return chain;
 }
Exemplo n.º 7
0
 public static AnimChain.IChain Blink(this AnimChain.IChain chain, TextLabel target, int span, int count)
 {
     chain.Next(span * count, p =>
     {
         target.Alpha = (Math.Cos(p * count * Math.PI * 2) + 1) / 2;
     });
     return chain;
 }
Exemplo n.º 8
0
        public override void Initialize()
        {
            base.Initialize();

            font = Game.Content.Load<SpriteFont>("PixelFont" + Game.DefaultFontSize);

            // itembox
            itembox = new ItemBox(Game);
            components.Add(itembox);

            // splash
            var center = new Vector2(Game.ScreenWidth / 2, Game.ScreenHeight / 2);
            splash = new Splash(
                Game, center, Game.ScreenWidth,
                Color.Black, 0, 0.05, 0.3, 2);
            components.Add(splash);

            // box
            backgroundBox = new Image(Game)
            {
                Texture = Game.Content.Load<Texture2D>("white_pixel"),
                Color = Color.Black,
                Alpha = 0
            };
            components.Add(backgroundBox);

            // text
            text = new TextLabel(Game)
            {
                Text = SpecialName,
                Color = Color.White,
                Font = font,
                Alpha = 0,
            };
            components.Add(text);
        }