forked from cbluoss/OpenHacknet
/
SongChangerDaemon.cs
56 lines (52 loc) · 2.08 KB
/
SongChangerDaemon.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using Hacknet.Effects;
using Hacknet.Gui;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace Hacknet
{
internal class SongChangerDaemon : Daemon
{
private readonly MovingBarsEffect botEffect;
private readonly MovingBarsEffect topEffect;
public SongChangerDaemon(Computer c, OS os)
: base(c, "Music Changer", os)
{
topEffect = new MovingBarsEffect();
botEffect = new MovingBarsEffect
{
IsInverted = true
};
}
public override void draw(Rectangle bounds, SpriteBatch sb)
{
base.draw(bounds, sb);
topEffect.Update((float) os.lastGameTime.ElapsedGameTime.TotalSeconds);
botEffect.Update((float) os.lastGameTime.ElapsedGameTime.TotalSeconds);
var height = 30;
var rectangle1 = new Rectangle(bounds.X + 30, bounds.Y + bounds.Height/2 - height/2, bounds.Width - 60,
height);
var bounds1 = rectangle1;
bounds1.Height = 60;
bounds1.Y -= bounds1.Height;
topEffect.Draw(sb, bounds1, 1f, 3f, 1f, os.highlightColor);
if (Button.doButton(73518921, rectangle1.X, rectangle1.Y, rectangle1.Width, rectangle1.Height,
"Shuffle Music", os.highlightColor))
{
var maxValue = 12;
MissionFunctions.runCommand(Utils.random.Next(maxValue) + 1, "changeSong");
}
bounds1.Y += bounds1.Height + height;
botEffect.Draw(sb, bounds1, 1f, 3f, 1f, os.highlightColor);
var rectangle2 = new Rectangle(bounds.X + 4, bounds.Y + bounds.Height - 4 - 20, (int) (bounds.Width*0.5), 20);
if (
!Button.doButton(73518924, rectangle2.X, rectangle2.Y, rectangle2.Width, rectangle2.Height, "Exit",
os.lockedColor))
return;
os.display.command = "connect";
}
public override string getSaveString()
{
return "<SongChangerDaemon />";
}
}
}