-
Notifications
You must be signed in to change notification settings - Fork 1
/
SceneWin.cs
64 lines (49 loc) · 1.84 KB
/
SceneWin.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
57
58
59
60
61
62
63
64
using LD52;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
internal class SceneWin : Scene
{
private SceneService _sceneService;
public override void Load()
{
_sceneService = ServiceLocator.GetService<SceneService>();
_controlManager.SetMethodKey("play", Keys.Space);
base.Load();
}
public override void Update(GameTime gameTime)
{
base.Update(gameTime);
if (_controlManager.Pressed("play"))
{
_sceneService.ChangeScene(SceneManager.sceneType.Menu);
}
}
public override void Draw()
{
SpriteBatch spriteBatch = ServiceLocator.GetService<SpriteBatch>();
FontManager fontManager = ServiceLocator.GetService<FontManager>();
SpriteFont font = fontManager.getFont(FontManager.fontStyle.title);
Vector2 size;
string text;
int y = 20;
text = "Your time: " + GameState.lastTime.ToString() + "s";
size = font.MeasureString(text);
spriteBatch.DrawString(font, text, new Vector2((200 - size.X) / 2, y), Color.White);
y += 20;
text = "Your harvest: " + GameState.lastPercent.ToString() + "%";
size = font.MeasureString(text);
spriteBatch.DrawString(font, text, new Vector2((200 - size.X) / 2, y), Color.White);
y += 20;
text = "Dead chickens: " + GameState.lastChicken.ToString() + "";
size = font.MeasureString(text);
spriteBatch.DrawString(font, text, new Vector2((200 - size.X) / 2, y), Color.White);
y += 20;
text = "Best time 100%: " + GameState.bestTime.ToString() + "";
size = font.MeasureString(text);
spriteBatch.DrawString(font, text, new Vector2((200 - size.X) / 2, y), Color.White);
}
public override void DrawUI()
{
}
}