Пример #1
0
        public override void Draw(SpriteBatch batch, GameTime gameTime)
        {
            {
                var     bg      = ContentLoader.GetTexture("loading-background");
                Vector2 size    = bg.ScaleToWindow(1.0f);
                int     offsetx = (TruckerX.WindowWidth - (int)size.X) / 2;
                int     offsety = (TruckerX.WindowHeight - (int)size.Y) / 2;
                batch.Draw(bg, new Rectangle(offsetx, offsety, (int)size.X, (int)size.Y), Color.White);
            }

            {
                var     trees   = ContentLoader.GetTexture("trees");
                Vector2 size    = trees.ScaleToWindow(1.0f);
                int     offsetx = (TruckerX.WindowWidth - (int)size.X) / 2;
                int     offsety = (TruckerX.WindowHeight - (int)size.Y) / 2;
                batch.Draw(trees, new Rectangle(offsetx, offsety, (int)size.X, (int)size.Y), Color.White);

                if (leafParticleEffectTree2 != null)
                {
                    leafParticleEffectTree2.Size     = new Vector2(200, 200);
                    leafParticleEffectTree2.Position = new Vector2(TruckerX.WindowWidth - 200, 20);
                    leafParticleEffectTree2.Draw(batch, gameTime);
                }

                if (leafParticleEffectTree1 != null)
                {
                    leafParticleEffectTree1.Size     = new Vector2(200, 200);
                    leafParticleEffectTree1.Position = new Vector2(20, 20);
                    leafParticleEffectTree1.Draw(batch, gameTime);
                }
            }

            int offsetY = (int)(-300 + (300 * buttonsEnterScreenAnimation.Percentage));
            var rope    = ContentLoader.GetTexture("rope");

            batch.Draw(rope, new Rectangle(200, offsetY, 43, 500), Color.White);
            batch.Draw(rope, new Rectangle(400 - 43, offsetY, 43, 500), Color.White);

            buttonCampaign.Position = new Vector2(buttonCampaign.Position.X, 100 + offsetY);
            buttonFreePlay.Position = new Vector2(buttonFreePlay.Position.X, 200 + offsetY);
            buttonSettings.Position = new Vector2(buttonSettings.Position.X, 300 + offsetY);
            buttonCampaign.Draw(batch, gameTime);
            buttonFreePlay.Draw(batch, gameTime);
            buttonSettings.Draw(batch, gameTime);

            clickEffect.Draw(batch, gameTime);

            base.Draw(batch, gameTime);
        }
Пример #2
0
        public override void Draw(SpriteBatch batch, GameTime gameTime)
        {
            if (!ContentLoader.Done)
            {
                return;
            }

#if false
            if (MediaPlayer.PlayPosition.TotalMilliseconds == 0)
            {
                var bgSong = this.GetSong("background-song");
                MediaPlayer.IsRepeating = true;
                MediaPlayer.Volume      = 0.01f;
                MediaPlayer.Play(bgSong);
            }
#endif

            {
                var     bg      = ContentLoader.GetTexture("loading-background");
                Vector2 size    = bg.ScaleToWindow(1.0f);
                int     offsetx = (TruckerX.WindowWidth - (int)size.X) / 2;
                int     offsety = (TruckerX.WindowHeight - (int)size.Y) / 2;
                batch.Draw(bg, new Rectangle(offsetx, offsety, (int)size.X, (int)size.Y), Color.White);
            }

            {
                var     trees   = ContentLoader.GetTexture("trees");
                Vector2 size    = trees.ScaleToWindow(1.0f);
                int     offsetx = (TruckerX.WindowWidth - (int)size.X) / 2;
                int     offsety = (TruckerX.WindowHeight - (int)size.Y) / 2;
                batch.Draw(trees, new Rectangle(offsetx, offsety, (int)size.X, (int)size.Y), Color.White);

                if (leafParticleEffectTree2 != null)
                {
                    leafParticleEffectTree2.Size     = new Vector2(200, 200);
                    leafParticleEffectTree2.Position = new Vector2(TruckerX.WindowWidth - 200, 20);
                    leafParticleEffectTree2.Draw(batch, gameTime);
                }
            }

            {
                var     logo    = ContentLoader.GetTexture("sloth");
                Vector2 size    = logo.ScaleToWindow(0.6f);
                int     offsetx = (TruckerX.WindowWidth - (int)size.X) / 2;
                int     offsety = (TruckerX.WindowHeight - (int)size.Y) / 2;
                batch.Draw(logo, new Rectangle(offsetx, offsety, (int)size.X, (int)size.Y), Color.White);
            }

            {
                if (leafParticleEffectTree1 != null)
                {
                    leafParticleEffectTree1.Size     = new Vector2(200, 200);
                    leafParticleEffectTree1.Position = new Vector2(20, 20);
                    leafParticleEffectTree1.Draw(batch, gameTime);
                }
            }

            {
                var     sign    = ContentLoader.GetTexture("loading-bg");
                Vector2 size    = sign.ScaleToWindow(0.4f);
                int     offsetx = (TruckerX.WindowWidth - (int)(size.X * loadingBgMoveIn.Percentage));
                int     offsety = (TruckerX.WindowHeight - (int)size.Y);
                batch.Draw(sign, new Rectangle(offsetx - 4, offsety, (int)size.X, (int)size.Y), Color.FromNonPremultiplied(0, 0, 0, 100));
                batch.Draw(sign, new Rectangle(offsetx, offsety, (int)size.X, (int)size.Y), Color.White);

                var    font    = ContentLoader.GetFont("main_font_24");
                string text    = "LOADING";
                var    strSize = font.MeasureString(text);
                float  angle   = (float)Math.PI * -45.0f / 180.0f;
                int    margin  = 45;
                offsetx = offsetx + margin * 2 + 2;
                offsety = offsetx + margin * 2;

                if (starParticleEffect != null)
                {
                    starParticleEffect.Position = new Vector2(offsetx + 60, offsety - 30);
                    starParticleEffect.Draw(batch, gameTime);
                }

                batch.DrawString(font, text, new Vector2(offsetx, TruckerX.WindowHeight - margin + 2), Color.Black, angle, new Vector2(0, 0), 1.0f, SpriteEffects.None, 1.0f);
                batch.DrawString(font, text, new Vector2(offsetx, TruckerX.WindowHeight - margin), Color.White, angle, new Vector2(0, 0), 1.0f, SpriteEffects.None, 1.0f);
            }

            base.Draw(batch, gameTime);
        }