screen fades to red as connection timer goes down

This commit is contained in:
Michael 2017-08-02 08:58:31 -04:00
parent c832b78308
commit 52319b29ee
3 changed files with 21 additions and 2 deletions

View file

@ -204,7 +204,15 @@ namespace ShiftOS.Frontend.Desktop
Width = GetSize().Width;
Height = GetSize().Height;
var now = DateTime.Now.TimeOfDay;
var newDateTimeString = $"{now.Hours}:{now.Minutes}:{now.Seconds}";
var newDateTimeString = $"{now.Hours}:{now.Minutes}:{now.Seconds} - ";
if(Hacking.CurrentHackable == null)
{
newDateTimeString += SaveSystem.CurrentSave.SystemName;
}
else
{
newDateTimeString += Hacking.CurrentHackable.Data.SystemName;
}
if(newDateTimeString != dateTimeString)
{
dateTimeString = newDateTimeString;

View file

@ -252,15 +252,22 @@ namespace ShiftOS.Frontend
if (Hacking.CurrentHackable.DoConnectionTimeout)
{
Hacking.CurrentHackable.MillisecondsCountdown -= gameTime.ElapsedGameTime.TotalMilliseconds;
if(Hacking.CurrentHackable.MillisecondsCountdown <= 0)
shroudOpacity = (float)GUI.ProgressBar.linear(Hacking.CurrentHackable.MillisecondsCountdown, Hacking.CurrentHackable.TotalConnectionTimeMS, 0, 0, 1);
if (Hacking.CurrentHackable.MillisecondsCountdown <= 0)
{
Hacking.FailHack();
}
}
}
else
{
shroudOpacity = 0;
}
base.Update(gameTime);
}
float shroudOpacity = 0.0f;
private GUI.TextControl framerate = new GUI.TextControl();
/// <summary>
@ -292,6 +299,8 @@ namespace ShiftOS.Frontend
spriteBatch.Draw(MouseTexture, new Rectangle(mousepos.X+1, mousepos.Y+1, MouseTexture.Width, MouseTexture.Height), Color.Black * 0.5f);
spriteBatch.Draw(MouseTexture, new Rectangle(mousepos.X, mousepos.Y, MouseTexture.Width, MouseTexture.Height), Color.White);
spriteBatch.Draw(UIManager.SkinTextures["PureWhite"], new Rectangle(0, 0, UIManager.Viewport.Width, UIManager.Viewport.Height), Color.Red * shroudOpacity);
if(Hacking.CurrentHackable != null)
{
if (Hacking.CurrentHackable.DoConnectionTimeout)

View file

@ -96,6 +96,7 @@ namespace ShiftOS.Engine
{
hsys.MillisecondsCountdown = 0;
}
hsys.TotalConnectionTimeMS = (int)hsys.MillisecondsCountdown;
hsys.PortsToUnlock = new List<Objects.Port>();
hsys.VectorsUnlocked = new List<Objects.SystemType>();
hsys.PayloadExecuted = new List<Objects.Payload>();
@ -215,6 +216,7 @@ namespace ShiftOS.Engine
public class HackableSystem
{
public int TotalConnectionTimeMS { get; set; }
public Objects.Hackable Data { get; set; }
public List<Objects.Port> PortsToUnlock { get; set; }
public List<Objects.SystemType> VectorsUnlocked { get; set; }