summaryrefslogtreecommitdiff
path: root/Penguloon/Controls/LevelSelector.cs
diff options
context:
space:
mode:
authoraldrikboy <aldrikboy@gmail.com>2017-12-29 17:27:49 +0100
committeraldrikboy <aldrikboy@gmail.com>2017-12-29 17:27:49 +0100
commitda38e93e55b6ff46a53dcd9d2be393149089d329 (patch)
treec19fdb964ee6f8dd8dd3102b22de541828850983 /Penguloon/Controls/LevelSelector.cs
parent5373e919a0d9e389fc2076963f610d044c21ccb5 (diff)
obejct info, new level selector, credits haHA
Diffstat (limited to 'Penguloon/Controls/LevelSelector.cs')
-rw-r--r--Penguloon/Controls/LevelSelector.cs83
1 files changed, 73 insertions, 10 deletions
diff --git a/Penguloon/Controls/LevelSelector.cs b/Penguloon/Controls/LevelSelector.cs
index c04aef3..0309b68 100644
--- a/Penguloon/Controls/LevelSelector.cs
+++ b/Penguloon/Controls/LevelSelector.cs
@@ -17,9 +17,11 @@ namespace Penguloon.Controls
public List<LevelBase> Levels { get; set; } = new List<LevelBase>();
+ public Rectangle Panel0 { get; set; }
public Rectangle Panel1 { get; set; }
public Rectangle Panel2 { get; set; }
public Rectangle Panel3 { get; set; }
+ public Rectangle Panel4 { get; set; }
public LevelSelector(SceneBase parentScene, Vector2 position, Vector2 size) : base(parentScene, position, size)
{
@@ -31,16 +33,21 @@ namespace Penguloon.Controls
PanelWidth = ((int)((StaticUIValues.ScreenViewport.X - ((MaxPanels + 1) * PanelMarginX)) / MaxPanels));
+ int panel0posX = (PanelMarginX + (PanelMarginX * 0) + (PanelWidth * -1)) + 40;
int panel1posX = (PanelMarginX + (PanelMarginX * 0) + (PanelWidth * 0)) + 20;
int panel2posX = (PanelMarginX + (PanelMarginX * 1) + (PanelWidth * 1));
int panel3posX = (PanelMarginX + (PanelMarginX * 2) + (PanelWidth * 2)) - 20;
+ int panel4posX = (PanelMarginX + (PanelMarginX * 3) + (PanelWidth * 3)) - 80;
int sidePanelMarginY = 25;
int centerPanelWidth = (int)(PanelWidth * 1.2);
+ int outterPanelHeight = (int)((size.Y - sidePanelMarginY) * 0.8);
+ Panel0 = new Rectangle(panel0posX, (int)position.Y + (sidePanelMarginY / 2) + ((((int)size.Y - sidePanelMarginY) - outterPanelHeight) / 2), (int)(PanelWidth), outterPanelHeight);
Panel1 = new Rectangle(panel1posX, (int)position.Y + (sidePanelMarginY / 2), (int)(PanelWidth * 1), (int)size.Y - sidePanelMarginY);
Panel2 = new Rectangle(panel2posX - ((centerPanelWidth - PanelWidth) / 2), (int)position.Y, centerPanelWidth, (int)size.Y);
Panel3 = new Rectangle(panel3posX, (int)position.Y + (sidePanelMarginY / 2), (int)(PanelWidth * 1), (int)size.Y - sidePanelMarginY);
+ Panel4 = new Rectangle(panel4posX, (int)position.Y + (sidePanelMarginY / 2) + ((((int)size.Y - sidePanelMarginY) - outterPanelHeight) / 2), (int)(PanelWidth), outterPanelHeight);
this.OnClick += LevelSelector_OnClick;
@@ -51,21 +58,46 @@ namespace Penguloon.Controls
{
Rectangle fingerRec = new Rectangle(e.ClickPosition.ToPoint(), new Point(1, 1));
+ if (Panel2.Intersects(fingerRec) && Levels[selectedMap].MinimumLevel <= UserdataManager.Level)
+ {
+ SoundManager.PlayClickSound();
+ SceneManager.GameScene = new GameScene(ParentScene.Main, Levels[selectedMap]);
+ SceneManager.SelectedScene = SelectedScene.Ingame;
+
+ SoundManager.PlayClickSound2();
+ return;
+ }
+
if (Panel1.Intersects(fingerRec) && selectedMap > 0)
{
selectedMap--;
+
+ SoundManager.PlayClickSound2();
+ return;
}
- if (Panel2.Intersects(fingerRec) && Levels[selectedMap].MinimumLevel <= UserdataManager.Level)
+ if (Panel0.Intersects(fingerRec) && selectedMap > 1)
{
- SoundManager.PlayClickSound();
- SceneManager.GameScene = new GameScene(ParentScene.Main, Levels[selectedMap]);
- SceneManager.SelectedScene = SelectedScene.Ingame;
+ selectedMap -= 2;
+
+ SoundManager.PlayClickSound2();
+ return;
}
if (Panel3.Intersects(fingerRec) && selectedMap < Levels.Count - 1)
{
selectedMap++;
+
+ SoundManager.PlayClickSound2();
+ return;
+ }
+
+ if (Panel4.Intersects(fingerRec) && selectedMap < Levels.Count - 2)
+ {
+ selectedMap += 2;
+
+ SoundManager.PlayClickSound2();
+ return;
}
}
@@ -85,6 +117,23 @@ namespace Penguloon.Controls
private void DrawPanels()
{
+ if (selectedMap - 2 >= 0)
+ {
+ ParentScene.Main.SpriteBatch.Draw(Levels[selectedMap - 2].SplashArt,
+ destinationRectangle: Panel0);
+
+ if (Levels[selectedMap - 2].MinimumLevel > UserdataManager.Level)
+ {
+ ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("SplashArt/locked"),
+ destinationRectangle: Panel0);
+
+ ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("UI/lock"),
+ destinationRectangle: new Rectangle(Panel0.X + 25, Panel0.Y + 25, 100, 100));
+
+ //DrawLevel(new Vector2(Panel0.X + 25, Panel0.Y + Panel0.Height - 20), Levels[selectedMap - 2].MinimumLevel);
+ }
+ }
+
if (selectedMap - 1 >= 0)
{
ParentScene.Main.SpriteBatch.Draw(Levels[selectedMap - 1].SplashArt,
@@ -97,9 +146,24 @@ namespace Penguloon.Controls
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 + 2 < Levels.Count)
+ {
+ ParentScene.Main.SpriteBatch.Draw(Levels[selectedMap + 2].SplashArt,
+ destinationRectangle: Panel4);
+
+ if (Levels[selectedMap + 2].MinimumLevel > UserdataManager.Level)
+ {
+ ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("SplashArt/locked"),
+ destinationRectangle: Panel4);
- DrawLevel(new Vector2(Panel1.X + 25, Panel1.Y + Panel1.Height - 10), Levels[selectedMap - 1].MinimumLevel);
+ ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("UI/lock"),
+ destinationRectangle: new Rectangle(Panel4.X + 25, Panel4.Y + 25, 100, 100));
}
+ DrawLevel(new Vector2(Panel4.X + 25, Panel4.Y + Panel4.Height - 10), Levels[selectedMap + 2].MinimumLevel);
}
if (selectedMap + 1 < Levels.Count)
@@ -114,9 +178,8 @@ namespace Penguloon.Controls
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);
}
+ DrawLevel(new Vector2(Panel3.X + 25, Panel3.Y + Panel3.Height - 10), Levels[selectedMap + 1].MinimumLevel);
}
ParentScene.Main.SpriteBatch.Draw(Levels[selectedMap].SplashArt,
@@ -129,9 +192,9 @@ namespace Penguloon.Controls
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);
}
+
+ DrawLevel(new Vector2(Panel2.X + 25, Panel2.Y + Panel2.Height - 10), Levels[selectedMap].MinimumLevel);
}
private void DrawLevel(Vector2 position, int minLevel)
@@ -146,7 +209,7 @@ namespace Penguloon.Controls
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);
+ TextAllignment.LeftBottom, Color.FromNonPremultiplied(111, 138, 183, 255), Color.Black, 2);
}
}
} \ No newline at end of file