2018-09-15 19:05:14 +00:00
|
|
|
|
using Microsoft.Xna.Framework;
|
|
|
|
|
using Microsoft.Xna.Framework.Content;
|
|
|
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
|
|
|
using RhythmBullet.Zer01HD.UI;
|
2018-09-16 06:37:48 +00:00
|
|
|
|
using RhythmBullet.Zer01HD.Utilities.UI;
|
2018-09-15 19:05:14 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2018-10-31 06:10:15 +00:00
|
|
|
|
using System.Diagnostics;
|
2018-09-15 19:05:14 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace RhythmBullet.Zer01HD.Game
|
|
|
|
|
{
|
2018-10-31 23:21:44 +00:00
|
|
|
|
class LoadingScreen : Screen
|
2018-09-15 19:05:14 +00:00
|
|
|
|
{
|
|
|
|
|
Texture2D recrown;
|
2018-10-31 23:21:44 +00:00
|
|
|
|
Color color;
|
2018-10-31 00:47:01 +00:00
|
|
|
|
Rectangle rectangleBounds;
|
2018-10-31 06:10:15 +00:00
|
|
|
|
float proportion = 0.4f;
|
|
|
|
|
RhythmBulletGame rhythmBullet;
|
2018-10-31 23:21:44 +00:00
|
|
|
|
double progress;
|
|
|
|
|
double timePassed;
|
|
|
|
|
public LoadingScreen(RhythmBulletGame rhythmBullet, Rectangle dimensions)
|
2018-09-15 19:05:14 +00:00
|
|
|
|
{
|
2018-10-31 23:21:44 +00:00
|
|
|
|
color = Color.White;
|
2018-10-31 06:10:15 +00:00
|
|
|
|
this.recrown = rhythmBullet.Content.Load<Texture2D>("RhythmBullet");
|
|
|
|
|
this.rhythmBullet = rhythmBullet;
|
|
|
|
|
rectangleBounds = new Rectangle(0, 0, (int)(dimensions.Height * proportion), (int)(dimensions.Height * proportion));
|
|
|
|
|
rectangleBounds.X = (dimensions.Width - rectangleBounds.Width) / 2;
|
|
|
|
|
rectangleBounds.Y = (dimensions.Height - rectangleBounds.Height) / 2;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Update(GameTime gameTime)
|
|
|
|
|
{
|
2018-10-31 23:21:44 +00:00
|
|
|
|
if (progress < 1f)
|
2018-10-31 06:10:15 +00:00
|
|
|
|
{
|
2018-10-31 23:21:44 +00:00
|
|
|
|
double delta = gameTime.ElapsedGameTime.TotalSeconds;
|
|
|
|
|
timePassed += delta;
|
|
|
|
|
progress = timePassed / 4;
|
|
|
|
|
if (progress > 0.9f)
|
2018-10-31 06:10:15 +00:00
|
|
|
|
{
|
2018-10-31 23:21:44 +00:00
|
|
|
|
progress = 0.9f;
|
2018-10-31 06:10:15 +00:00
|
|
|
|
}
|
|
|
|
|
rhythmBullet.BackgroundColor.R = (byte)(progress * 255);
|
|
|
|
|
rhythmBullet.BackgroundColor.G = (byte)(progress * 255);
|
|
|
|
|
rhythmBullet.BackgroundColor.B = (byte)(progress * 255);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
base.Update(gameTime);
|
2018-09-15 19:05:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Draw(SpriteBatch spriteBatch)
|
|
|
|
|
{
|
2018-10-31 23:21:44 +00:00
|
|
|
|
spriteBatch.Draw(recrown, rectangleBounds, color);
|
2018-09-15 19:05:14 +00:00
|
|
|
|
base.Draw(spriteBatch);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|