53 lines
1.1 KiB
C#
53 lines
1.1 KiB
C#
using System.ComponentModel;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using skyscraper5.Skyscraper.Plugins;
|
|
using skyscraper8.UI.MonoGame.Bridge;
|
|
|
|
namespace skyscraper8.UI.MonoGame.Screenhacks
|
|
{
|
|
[PluginPriority(1)]
|
|
[DisplayName("Your Waifu")]
|
|
internal class _1_YourWaifu : IScreenhack
|
|
{
|
|
private bool disabled;
|
|
private FileInfo fileInfo;
|
|
public _1_YourWaifu()
|
|
{
|
|
DirectoryInfo di = new DirectoryInfo("wallpapers");
|
|
if (!di.Exists)
|
|
{
|
|
disabled = true;
|
|
return;
|
|
}
|
|
|
|
FileInfo[] files = di.GetFiles("*.png");
|
|
fileInfo = new Random().NextItem(files);
|
|
}
|
|
|
|
public void Draw(GameTime gameTime, SpriteBatch spriteBatch, Rectangle windowBounds)
|
|
{
|
|
if (disabled)
|
|
return;
|
|
if (texture2D == null)
|
|
return;
|
|
|
|
spriteBatch.Draw(texture2D, windowBounds, Color.White);
|
|
}
|
|
|
|
private Texture2D texture2D;
|
|
public void SetGraphicsDevice(GraphicsDevice graphicsDevice, Rectangle presentationParametersBounds)
|
|
{
|
|
if (disabled)
|
|
return;
|
|
|
|
texture2D = Texture2D.FromFile(graphicsDevice, fileInfo.FullName);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
texture2D.Dispose();
|
|
}
|
|
}
|
|
}
|