Newer
Older
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
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PuzzlePlayer_Namespace.Resources
{
internal class ShopMenu : Form
{
public ShopMenu()
{
ClientSize = new Size(1115, 755);
Text = "Thme Shop";
Theme currentTheme = UserDataManager.Theme;
BackColor = currentTheme.primaryColor;
SetupUI();
}
void SetupUI()
{
Label moneyLabel = new Label();
moneyLabel.Text = $"Money: {UserDataManager.Money}$";
Font mlFont = new Font(UserDataManager.MainFont.FontFamily, UserDataManager.FONTSIZE * 2);
moneyLabel.Font = mlFont;
moneyLabel.Size *= 2;
Controls.Add(moneyLabel);
FlowLayoutPanel buyableThemes = new FlowLayoutPanel();
buyableThemes.Size = this.Size;
buyableThemes.Location = new Point(0, 100);
List<Theme> allThemes = UserDataManager.GetThemes();
foreach (Theme theme in allThemes)
{
if(theme.unlocked)
{
Bitmap bm = new Bitmap(Width / 4, Width / 4);
Graphics graphics = Graphics.FromImage(bm);
graphics.FillRectangle(new SolidBrush(theme.primaryColor),0,0,bm.Width,bm.Height/3);
graphics.FillRectangle(new SolidBrush(theme.secondaryColor),0,bm.Height/3,bm.Width,bm.Height/3);
graphics.FillRectangle(new SolidBrush(theme.tertiaryColor),0, bm.Height / 3*2, bm.Width,bm.Height/3);
Button button = new Button();
button.Text = theme.name;
button.Size = bm.Size;
button.Image = bm;
buyableThemes.Controls.Add(button);
}
}
Controls.Add(buyableThemes);
}
}
}