summaryrefslogtreecommitdiff
path: root/Penguloon/Controls/LevelSelector.cs
diff options
context:
space:
mode:
authoraldrikboy <aldrikboy@gmail.com>2017-12-29 00:32:34 +0100
committeraldrikboy <aldrikboy@gmail.com>2017-12-29 00:32:34 +0100
commit5373e919a0d9e389fc2076963f610d044c21ccb5 (patch)
treedafaf1e2f4857d37bb8ba36cd02c8ccd7d40635e /Penguloon/Controls/LevelSelector.cs
parenta9adf4d4d52a9d42b885e2fc1dee9ea2f4451331 (diff)
level implementation XDDDDDDDd
Diffstat (limited to 'Penguloon/Controls/LevelSelector.cs')
-rw-r--r--Penguloon/Controls/LevelSelector.cs55
1 files changed, 52 insertions, 3 deletions
diff --git a/Penguloon/Controls/LevelSelector.cs b/Penguloon/Controls/LevelSelector.cs
index 4878e4c..c04aef3 100644
--- a/Penguloon/Controls/LevelSelector.cs
+++ b/Penguloon/Controls/LevelSelector.cs
@@ -23,6 +23,8 @@ namespace Penguloon.Controls
public LevelSelector(SceneBase parentScene, Vector2 position, Vector2 size) : base(parentScene, position, size)
{
+ UserdataManager.Level = UserdataManager.GetLevel();
+
this.BackgroundIdle = ContentManager.GetTexture("UI/btnIdle");
this.BackgroundPressed = ContentManager.GetTexture("UI/btnIdle");
this.BackgroundDisabled = ContentManager.GetTexture("UI/btnIdle");
@@ -54,7 +56,7 @@ namespace Penguloon.Controls
selectedMap--;
}
- if (Panel2.Intersects(fingerRec))
+ if (Panel2.Intersects(fingerRec) && Levels[selectedMap].MinimumLevel <= UserdataManager.Level)
{
SoundManager.PlayClickSound();
SceneManager.GameScene = new GameScene(ParentScene.Main, Levels[selectedMap]);
@@ -70,8 +72,7 @@ namespace Penguloon.Controls
private void CreateLevels()
{
Levels.Add(new IceLevel());
- Levels.Add(new IceLevel());
- Levels.Add(new IceLevel());
+ Levels.Add(new IceLevel2());
}
public override void Draw(float deltaTime)
@@ -88,16 +89,64 @@ namespace Penguloon.Controls
{
ParentScene.Main.SpriteBatch.Draw(Levels[selectedMap - 1].SplashArt,
destinationRectangle: Panel1);
+
+ if (Levels[selectedMap - 1].MinimumLevel > UserdataManager.Level)
+ {
+ ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("SplashArt/locked"),
+ destinationRectangle: Panel1);
+
+ ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("UI/lock"),
+ destinationRectangle: new Rectangle(Panel1.X + 25, Panel1.Y + 25, 100, 100));
+
+ DrawLevel(new Vector2(Panel1.X + 25, Panel1.Y + Panel1.Height - 10), Levels[selectedMap - 1].MinimumLevel);
+ }
}
if (selectedMap + 1 < Levels.Count)
{
ParentScene.Main.SpriteBatch.Draw(Levels[selectedMap + 1].SplashArt,
destinationRectangle: Panel3);
+
+ if (Levels[selectedMap + 1].MinimumLevel > UserdataManager.Level)
+ {
+ ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("SplashArt/locked"),
+ destinationRectangle: Panel3);
+
+ ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("UI/lock"),
+ destinationRectangle: new Rectangle(Panel3.X + 25, Panel3.Y + 25, 100, 100));
+
+ DrawLevel(new Vector2(Panel3.X + 25, Panel3.Y + Panel3.Height - 10), Levels[selectedMap + 1].MinimumLevel);
+ }
}
ParentScene.Main.SpriteBatch.Draw(Levels[selectedMap].SplashArt,
destinationRectangle: Panel2);
+
+ if (Levels[selectedMap].MinimumLevel > UserdataManager.Level)
+ {
+ ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("SplashArt/locked"),
+ destinationRectangle: Panel2);
+
+ ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("UI/lock"),
+ destinationRectangle: new Rectangle(Panel2.X + 25, Panel2.Y + 25, 100, 100));
+
+ DrawLevel(new Vector2(Panel2.X + 25, Panel2.Y + Panel2.Height - 10), Levels[selectedMap].MinimumLevel);
+ }
+ }
+
+ private void DrawLevel(Vector2 position, int minLevel)
+ {
+ ParentScene.DrawText(ContentManager.GetFont(StaticUIValues.StatsFont),
+ minLevel.ToString(),
+ new Vector2((int)position.X + ContentManager.GetFont(StaticUIValues.StatsFont).MeasureString(ParentScene.Main.Resources.GetString(Resource.String.StatsLevel) + " ").X, position.Y),
+ new Vector2(0, 0),
+ TextAllignment.LeftBottom, Color.White, Color.Black, 2);
+
+ ParentScene.DrawText(ContentManager.GetFont(StaticUIValues.StatsFont),
+ ParentScene.Main.Resources.GetString(Resource.String.StatsLevel) + " ",
+ new Vector2((int)position.X, position.Y),
+ new Vector2(0, 0),
+ TextAllignment.LeftBottom, Color.FromNonPremultiplied(200, 200, 200, 200), Color.Black, 2);
}
}
} \ No newline at end of file