public GameClient() { Action onClickAction = null; Action action2 = null; Action action3 = null; Action action4 = null; Action action5 = null; Action action6 = null; Action action7 = null; Action action8 = null; expanded = true; InitializeComponent(); Settings.Load(); base.Size = new Size(Settings.GetValue <int>("Resolution.Width"), Settings.GetValue <int>("Resolution.Height")); skillsImage = new List <PictureBox>(); skillsText = new List <Label>(); Text = Text + " | Logged in as " + forumUsername; MinimumSize = new Size(800, 600); var browser = new UISystem.UIBrowser(5, 30, base.Width - 270, base.Height - 50, "http://codeusa.net/play/web.html") { Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top }; base.Controls.Add(clientBrowser = browser); var panel = new UISystem.UISimplePanel(clientBrowser.Right + 5, 30, (base.Width - clientBrowser.Right) - 10, ((int)(base.Height * 0.75f)) - 50) { Anchor = AnchorStyles.Right | AnchorStyles.Top }; base.Controls.Add(toolPanel = panel); onClickAction = () => { clientBrowser.Dispose(); browser = new UISystem.UIBrowser(5, 30, base.Width - 270, base.Height - 50, "http://codeusa.net/play/web.html") { Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top }; base.Controls.Add(clientBrowser = browser); }; var button = new UISystem.UIButton(toolPanel.Left, toolPanel.Bottom + 5, toolPanel.Width, 0x19, "Reload Applet", onClickAction) { Anchor = AnchorStyles.Right | AnchorStyles.Top }; base.Controls.Add(button); if (action2 == null) { action2 = () => { if (!hiscoresPanel.Visible) { hiscoresPanel.Visible = true; screenshotPanel.Visible = false; hiscoresButton.Resize(0, 4); screenshotButton.Resize(0, -4); } }; } var button2 = new UISystem.UIButton(2, 2, 0x4c, 0x1a, "Hiscores", action2) { Anchor = AnchorStyles.Left | AnchorStyles.Top }; toolPanel.Controls.Add(hiscoresButton = button2); var panel2 = new UISystem.UISimplePanel(2, 30, toolPanel.Width - 4, toolPanel.Height - 0x20) { Visible = true }; toolPanel.Controls.Add(hiscoresPanel = panel2); if (action3 == null) { action3 = () => { if (!screenshotPanel.Visible) { hiscoresPanel.Visible = false; screenshotPanel.Visible = true; hiscoresButton.Resize(0, -4); screenshotButton.Resize(0, 4); } }; } var button3 = new UISystem.UIButton(80, 2, 0x4c, 0x16, "Screenshots", action3) { Anchor = AnchorStyles.Left | AnchorStyles.Top }; toolPanel.Controls.Add(screenshotButton = button3); var panel3 = new UISystem.UISimplePanel(2, 30, toolPanel.Width - 4, toolPanel.Height - 0x20) { Visible = false }; toolPanel.Controls.Add(screenshotPanel = panel3); var autoCompleteValues = new List <string>(); if (Settings.GetValue <bool>("Hiscores.AutoComplete")) { using (var client = new WebClient()) { autoCompleteValues.AddRange( client.DownloadString("http://codeusa.net/play/list.php").Split(new[] { '\n' })); } } hiscoresPanel.Controls.Add(playerTextbox = new UISystem.UITextBox(2, 3, 0x9d, 20, autoCompleteValues)); playerTextbox.KeyPress += playerTextbox_KeyPress; hiscoresPanel.Controls.Add(skillsPanel = new UISystem.UISimplePanel(0, 0x1a, hiscoresPanel.Width, 350)); var x = 2; var y = 5; var index = 0; while (index < skills.Length) { if ((x + 0x37) >= hiscoresPanel.Width) { x = 2; y += 0x24; } Image image = null; if (File.Exists("./data/skill/" + skills[index] + ".png")) { image = Image.FromFile("./data/skill/" + skills[index] + ".png"); } else { Debug.PrintLine("There was an error downloading the skill image for: " + skills[index]); } var item = new PictureBox { Location = new Point(x, y), Size = new Size(0x20, 0x20), SizeMode = PictureBoxSizeMode.CenterImage, Image = image }; var label = new Label { Visible = true, AutoSize = true, Location = new Point(item.Location.X + 0x20, item.Location.Y + 8), Text = "0", ForeColor = Color.White }; skillsImage.Add(item); skillsText.Add(label); skillsPanel.Controls.AddRange(new Control[] { item, label }); index++; x += 0x37; } var box4 = new UISystem.UILabelBox(2, skillsPanel.Height - 0x5e, 180, 0x5c, "No User", 1) { labelFont = UISystem.UITheme.normalFont }; skillsPanel.Controls.Add(infoBox = box4); if (action4 == null) { action4 = delegate { Thread t = null; new Thread(() => { if ((playerTextbox.Text = playerTextbox.Text.Trim()).Length == 0) { infoBox.SetText("No player name entered!"); } else { infoBox.SetText("Looking up " + playerTextbox.Text + "..."); using (var client = new WebClient()) { var strArray = client.DownloadString("http://codeusa.net/hiscores/lookup.php?user="******"false") { MessageBox.Show(playerTextbox.Text + " is not in our hiscores!", "Sorry, we could not find that player!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); infoBox.SetText("Could not find " + playerTextbox.Text); return; } var totalLevel = 0; uint totalXp = 0; for (var i = 1; i < strArray.Length; i++) { var info = strArray[i].Split(new[] { '#' }); totalLevel += int.Parse(info[1]); totalXp += (uint)int.Parse(info[2].Replace(",", "")); var toolText = string.Concat(new object[] { char.ToUpper(info[0][0]), info[0].Substring(1), "\nRank: ", client.DownloadString( "http://codeusa.net/hiscores/lookup.php?do=rank&query=" + info[0] + "xp&user="******"\nExperience: ", info[2] }); Invoke(new MethodInvoker(() => { skillsText[i - 1].Text = info[1]; toolTip1.SetToolTip(skillsText[i - 1], toolText); toolTip1.SetToolTip(skillsImage[i - 1], toolText); })); } var overallRank = client.DownloadString("http://codeusa.net/hiscores/lookup.php?do=rank&user="******"Username: "******"\nRank: ", overallRank, "\nTotal Level: ", totalLevel, "\nTotal XP: ", totalXp.ToString("0,0", CultureInfo.InvariantCulture) })))); } Thread.CurrentThread.Abort(); } }).Start(); }; } hiscoresPanel.Controls.Add(findButton = new UISystem.UIButton(160, 2, 40, 0x16, "Find", action4)); if (action5 == null) { action5 = () => { Image image = new Bitmap(clientBrowser.Width, clientBrowser.Height); var graphics = Graphics.FromImage(image); var upperLeftSource = new Point(base.Location.X + clientBrowser.Left, base.Location.Y + clientBrowser.Top); graphics.CopyFromScreen(upperLeftSource, new Point(0, 0), clientBrowser.Size); var filename = "./" + Settings.GetValue <string>("Screenshot.ImageDirectory") + "/" + DateTime.Now.ToString().Replace("/", ".").Replace(":", "-") + ".png"; if (!Settings.GetValue <bool>("Screenshot.DontSave")) { image.Save(filename, ImageFormat.Png); if (!File.Exists(filename)) { MessageBox.Show("There was an error saving the screenshot to:\n" + filename, "Oops!", MessageBoxButtons.OK, MessageBoxIcon.Hand); } } if (!Settings.GetValue <bool>("Screenshot.PreviewBeforeUpload")) { new PreviewScreenshot(image).PostToImgur(image, takeScreenshotButton); } else { new PreviewScreenshot(image).Show(); } }; } screenshotPanel.Controls.Add( takeScreenshotButton = new UISystem.UIButton(2, 2, screenshotPanel.Width - 4, 0x18, "Take Screenshot", action5)); if (action6 == null) { action6 = delegate { if ((optionsWindow == null) || optionsWindow.IsDisposed) { optionsWindow = new Options(); } optionsWindow.Show(); optionsWindow.Location = new Point((Screen.PrimaryScreen.WorkingArea.Width / 2) - (optionsWindow.Width / 2), (Screen.PrimaryScreen.WorkingArea.Height / 2) - (optionsWindow.Height / 2)); }; } var button4 = new UISystem.UIButton(0x9e, 2, 0x4c, 0x16, "Options", action6) { Anchor = AnchorStyles.Left | AnchorStyles.Top }; toolPanel.Controls.Add(button4); var button5 = new UISystem.UIButton(base.Width - 0x21, 5, 0x19, 15, "", () => Process.GetCurrentProcess().Kill()) { Anchor = AnchorStyles.Right | AnchorStyles.Top, buttonImage = Image.FromFile("./data/close.png") }; base.Controls.Add(button5); if (action7 == null) { action7 = delegate { clientBrowser.Anchor = AnchorStyles.None; base.WindowState = FormWindowState.Minimized; minimized = true; }; } var button6 = new UISystem.UIButton(base.Width - 60, 5, 0x19, 15, "", action7) { Anchor = AnchorStyles.Right | AnchorStyles.Top, buttonImage = Image.FromFile("./data/minimize.png") }; base.Controls.Add(button6); if (action8 == null) { action8 = delegate { expanded = !expanded; if (panelButton.buttonText == "<") { base.Width = clientBrowser.Right + 5; panelButton.buttonText = ">"; toolPanelWidth = toolPanel.Width; clientBrowser.SetSize(base.Width - 10, clientBrowser.Height); toolPanel.Width = 0; } else { base.Width += toolPanelWidth + 5; toolPanel.Width = toolPanelWidth; panelButton.buttonText = "<"; } base.Invalidate(); }; } var button7 = new UISystem.UIButton(base.Width - 0x60, 5, 0x19, 15, "<", action8) { Anchor = AnchorStyles.Right | AnchorStyles.Top }; base.Controls.Add(panelButton = button7); var box5 = new UISystem.UILabelBox(0, 0, base.Width, 0x19, Text, 0x11) { Anchor = AnchorStyles.Left | AnchorStyles.Top }; formTitleBar = box5; formTitleBar.MouseMove += GameClient_MouseMove; base.Controls.Add(formTitleBar); var box3 = new UISystem.UIDragBox(this) { Anchor = AnchorStyles.Right | AnchorStyles.Bottom }; base.Controls.Add(box3); visibleRegion = new Rectangle(0, 0, base.Width - 1, base.Height - 1); var di = new DirectoryInfo("./" + Settings.GetValue <string>("Screenshot.ImageDirectory")); if (!di.Exists) { di.Create(); } }
public GameClient() { Action onClickAction = null; Action action2 = null; Action action3 = null; Action action4 = null; Action action5 = null; Action action6 = null; Action action7 = null; Action action8 = null; expanded = true; InitializeComponent(); Settings.Load(); base.Size = new Size(Settings.GetValue<int>("Resolution.Width"), Settings.GetValue<int>("Resolution.Height")); skillsImage = new List<PictureBox>(); skillsText = new List<Label>(); Text = Text + " | Logged in as " + forumUsername; MinimumSize = new Size(800, 600); var browser = new UISystem.UIBrowser(5, 30, base.Width - 270, base.Height - 50, "http://codeusa.net/play/web.html") { Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top }; base.Controls.Add(clientBrowser = browser); var panel = new UISystem.UISimplePanel(clientBrowser.Right + 5, 30, (base.Width - clientBrowser.Right) - 10, ((int) (base.Height*0.75f)) - 50) { Anchor = AnchorStyles.Right | AnchorStyles.Top }; base.Controls.Add(toolPanel = panel); onClickAction = () => { clientBrowser.Dispose(); browser = new UISystem.UIBrowser(5, 30, base.Width - 270, base.Height - 50, "http://codeusa.net/play/web.html") { Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top }; base.Controls.Add(clientBrowser = browser); }; var button = new UISystem.UIButton(toolPanel.Left, toolPanel.Bottom + 5, toolPanel.Width, 0x19, "Reload Applet", onClickAction) { Anchor = AnchorStyles.Right | AnchorStyles.Top }; base.Controls.Add(button); if (action2 == null) { action2 = () => { if (!hiscoresPanel.Visible) { hiscoresPanel.Visible = true; screenshotPanel.Visible = false; hiscoresButton.Resize(0, 4); screenshotButton.Resize(0, -4); } }; } var button2 = new UISystem.UIButton(2, 2, 0x4c, 0x1a, "Hiscores", action2) { Anchor = AnchorStyles.Left | AnchorStyles.Top }; toolPanel.Controls.Add(hiscoresButton = button2); var panel2 = new UISystem.UISimplePanel(2, 30, toolPanel.Width - 4, toolPanel.Height - 0x20) { Visible = true }; toolPanel.Controls.Add(hiscoresPanel = panel2); if (action3 == null) { action3 = () => { if (!screenshotPanel.Visible) { hiscoresPanel.Visible = false; screenshotPanel.Visible = true; hiscoresButton.Resize(0, -4); screenshotButton.Resize(0, 4); } }; } var button3 = new UISystem.UIButton(80, 2, 0x4c, 0x16, "Screenshots", action3) { Anchor = AnchorStyles.Left | AnchorStyles.Top }; toolPanel.Controls.Add(screenshotButton = button3); var panel3 = new UISystem.UISimplePanel(2, 30, toolPanel.Width - 4, toolPanel.Height - 0x20) { Visible = false }; toolPanel.Controls.Add(screenshotPanel = panel3); var autoCompleteValues = new List<string>(); if (Settings.GetValue<bool>("Hiscores.AutoComplete")) { using (var client = new WebClient()) { autoCompleteValues.AddRange( client.DownloadString("http://codeusa.net/play/list.php").Split(new[] {'\n'})); } } hiscoresPanel.Controls.Add(playerTextbox = new UISystem.UITextBox(2, 3, 0x9d, 20, autoCompleteValues)); playerTextbox.KeyPress += playerTextbox_KeyPress; hiscoresPanel.Controls.Add(skillsPanel = new UISystem.UISimplePanel(0, 0x1a, hiscoresPanel.Width, 350)); var x = 2; var y = 5; var index = 0; while (index < skills.Length) { if ((x + 0x37) >= hiscoresPanel.Width) { x = 2; y += 0x24; } Image image = null; if (File.Exists("./data/skill/" + skills[index] + ".png")) { image = Image.FromFile("./data/skill/" + skills[index] + ".png"); } else { Debug.PrintLine("There was an error downloading the skill image for: " + skills[index]); } var item = new PictureBox { Location = new Point(x, y), Size = new Size(0x20, 0x20), SizeMode = PictureBoxSizeMode.CenterImage, Image = image }; var label = new Label { Visible = true, AutoSize = true, Location = new Point(item.Location.X + 0x20, item.Location.Y + 8), Text = "0", ForeColor = Color.White }; skillsImage.Add(item); skillsText.Add(label); skillsPanel.Controls.AddRange(new Control[] {item, label}); index++; x += 0x37; } var box4 = new UISystem.UILabelBox(2, skillsPanel.Height - 0x5e, 180, 0x5c, "No User", 1) { labelFont = UISystem.UITheme.normalFont }; skillsPanel.Controls.Add(infoBox = box4); if (action4 == null) { action4 = delegate { Thread t = null; new Thread(() => { if ((playerTextbox.Text = playerTextbox.Text.Trim()).Length == 0) { infoBox.SetText("No player name entered!"); } else { infoBox.SetText("Looking up " + playerTextbox.Text + "..."); using (var client = new WebClient()) { var strArray = client.DownloadString("http://codeusa.net/hiscores/lookup.php?user="******"false") { MessageBox.Show(playerTextbox.Text + " is not in our hiscores!", "Sorry, we could not find that player!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); infoBox.SetText("Could not find " + playerTextbox.Text); return; } var totalLevel = 0; uint totalXp = 0; for (var i = 1; i < strArray.Length; i++) { var info = strArray[i].Split(new[] {'#'}); totalLevel += int.Parse(info[1]); totalXp += (uint) int.Parse(info[2].Replace(",", "")); var toolText = string.Concat(new object[] { char.ToUpper(info[0][0]), info[0].Substring(1), "\nRank: ", client.DownloadString( "http://codeusa.net/hiscores/lookup.php?do=rank&query=" + info[0] + "xp&user="******"\nExperience: ", info[2] }); Invoke(new MethodInvoker(() => { skillsText[i - 1].Text = info[1]; toolTip1.SetToolTip(skillsText[i - 1], toolText); toolTip1.SetToolTip(skillsImage[i - 1], toolText); })); } var overallRank = client.DownloadString("http://codeusa.net/hiscores/lookup.php?do=rank&user="******"Username: "******"\nRank: ", overallRank, "\nTotal Level: ", totalLevel, "\nTotal XP: ", totalXp.ToString("0,0", CultureInfo.InvariantCulture) })))); } Thread.CurrentThread.Abort(); } }).Start(); }; } hiscoresPanel.Controls.Add(findButton = new UISystem.UIButton(160, 2, 40, 0x16, "Find", action4)); if (action5 == null) { action5 = () => { Image image = new Bitmap(clientBrowser.Width, clientBrowser.Height); var graphics = Graphics.FromImage(image); var upperLeftSource = new Point(base.Location.X + clientBrowser.Left, base.Location.Y + clientBrowser.Top); graphics.CopyFromScreen(upperLeftSource, new Point(0, 0), clientBrowser.Size); var filename = "./" + Settings.GetValue<string>("Screenshot.ImageDirectory") + "/" + DateTime.Now.ToString().Replace("/", ".").Replace(":", "-") + ".png"; if (!Settings.GetValue<bool>("Screenshot.DontSave")) { image.Save(filename, ImageFormat.Png); if (!File.Exists(filename)) { MessageBox.Show("There was an error saving the screenshot to:\n" + filename, "Oops!", MessageBoxButtons.OK, MessageBoxIcon.Hand); } } if (!Settings.GetValue<bool>("Screenshot.PreviewBeforeUpload")) { new PreviewScreenshot(image).PostToImgur(image, takeScreenshotButton); } else { new PreviewScreenshot(image).Show(); } }; } screenshotPanel.Controls.Add( takeScreenshotButton = new UISystem.UIButton(2, 2, screenshotPanel.Width - 4, 0x18, "Take Screenshot", action5)); if (action6 == null) { action6 = delegate { if ((optionsWindow == null) || optionsWindow.IsDisposed) { optionsWindow = new Options(); } optionsWindow.Show(); optionsWindow.Location = new Point((Screen.PrimaryScreen.WorkingArea.Width/2) - (optionsWindow.Width/2), (Screen.PrimaryScreen.WorkingArea.Height/2) - (optionsWindow.Height/2)); }; } var button4 = new UISystem.UIButton(0x9e, 2, 0x4c, 0x16, "Options", action6) { Anchor = AnchorStyles.Left | AnchorStyles.Top }; toolPanel.Controls.Add(button4); var button5 = new UISystem.UIButton(base.Width - 0x21, 5, 0x19, 15, "", () => Process.GetCurrentProcess().Kill()) { Anchor = AnchorStyles.Right | AnchorStyles.Top, buttonImage = Image.FromFile("./data/close.png") }; base.Controls.Add(button5); if (action7 == null) { action7 = delegate { clientBrowser.Anchor = AnchorStyles.None; base.WindowState = FormWindowState.Minimized; minimized = true; }; } var button6 = new UISystem.UIButton(base.Width - 60, 5, 0x19, 15, "", action7) { Anchor = AnchorStyles.Right | AnchorStyles.Top, buttonImage = Image.FromFile("./data/minimize.png") }; base.Controls.Add(button6); if (action8 == null) { action8 = delegate { expanded = !expanded; if (panelButton.buttonText == "<") { base.Width = clientBrowser.Right + 5; panelButton.buttonText = ">"; toolPanelWidth = toolPanel.Width; clientBrowser.SetSize(base.Width - 10, clientBrowser.Height); toolPanel.Width = 0; } else { base.Width += toolPanelWidth + 5; toolPanel.Width = toolPanelWidth; panelButton.buttonText = "<"; } base.Invalidate(); }; } var button7 = new UISystem.UIButton(base.Width - 0x60, 5, 0x19, 15, "<", action8) { Anchor = AnchorStyles.Right | AnchorStyles.Top }; base.Controls.Add(panelButton = button7); var box5 = new UISystem.UILabelBox(0, 0, base.Width, 0x19, Text, 0x11) { Anchor = AnchorStyles.Left | AnchorStyles.Top }; formTitleBar = box5; formTitleBar.MouseMove += GameClient_MouseMove; base.Controls.Add(formTitleBar); var box3 = new UISystem.UIDragBox(this) { Anchor = AnchorStyles.Right | AnchorStyles.Bottom }; base.Controls.Add(box3); visibleRegion = new Rectangle(0, 0, base.Width - 1, base.Height - 1); var di = new DirectoryInfo("./" + Settings.GetValue<string>("Screenshot.ImageDirectory")); if (!di.Exists) { di.Create(); } }
public Options() { Action onClickAction = null; InitializeComponent(); settings = Settings.GetSettings(); var settingsPanel = new UISystem.UISimplePanel(90, 30, base.Width - 100, base.Height - 40); base.Controls.Add(settingsPanel); var themePanel = new UISystem.UISimplePanel(90, 30, base.Width - 100, base.Height - 40) { Visible = false }; base.Controls.Add(themePanel); if (onClickAction == null) { onClickAction = () => base.Close(); } var button = new UISystem.UIButton(base.Width - 0x21, 5, 0x19, 15, "X", onClickAction) { Anchor = AnchorStyles.Right | AnchorStyles.Top }; base.Controls.Add(button); base.Controls.Add(new UISystem.UIButton(3, 0x1b, 70, 0x16, "Save", () => Settings.Save())); base.Controls.Add(new UISystem.UIButton(3, 0x34, 70, 0x16, "Load", () => { Settings.Load(); foreach (Control control in settingsPanel.Controls) { control.Invalidate(); } })); base.Controls.Add(new UISystem.UIButton(3, 0x4d, 70, 0x16, "Theme", element => { if (element.buttonText == "Theme") { element.buttonText = "Settings"; settingsPanel.Visible = false; themePanel.Visible = true; } else { element.buttonText = "Theme"; settingsPanel.Visible = true; themePanel.Visible = false; } })); var box = new UISystem.UILabelBox(0, 0, base.Width, 0x19, Text, 0x11) { Anchor = AnchorStyles.Left }; formTitleBar = box; formTitleBar.MouseMove += formTitleBar_MouseMove; base.Controls.Add(formTitleBar); visibleRegion = new Rectangle(0, 0, base.Width - 1, base.Height - 1); var x = 3; var y = 3; foreach (var str in Settings.GetHeads()) { foreach (var setting in Settings.GetSettingsForHead(str)) { UISystem.UIElement element = null; if (setting.type == typeof (bool)) { settingsPanel.Controls.Add(element = new UISystem.UICheckBox(x, y, "Bool", setting)); } else if ((setting.type == typeof (int)) || (setting.type == typeof (string))) { settingsPanel.Controls.Add(element = new UISystem.UIValueEditor(x, y, 70, setting)); } else if (setting.type == typeof (Color)) { themePanel.Controls.Add( element = new UISystem.UIButton(x, y, 100, 0x19, setting.name, () => { })); } else if (setting.type == typeof (SolidBrush)) { themePanel.Controls.Add( element = new UISystem.UIButton(x, y, 100, 0x19, setting.name, () => { })); } if (element != null) { if ((y + element.Height) > settingsPanel.Height) { y = 3; x += 200; element.Location = new Point(x, y); y += element.Height + 5; } else { y += element.Height + 5; } } } } }
public Options() { Action onClickAction = null; InitializeComponent(); settings = Settings.GetSettings(); var settingsPanel = new UISystem.UISimplePanel(90, 30, base.Width - 100, base.Height - 40); base.Controls.Add(settingsPanel); var themePanel = new UISystem.UISimplePanel(90, 30, base.Width - 100, base.Height - 40) { Visible = false }; base.Controls.Add(themePanel); if (onClickAction == null) { onClickAction = () => base.Close(); } var button = new UISystem.UIButton(base.Width - 0x21, 5, 0x19, 15, "X", onClickAction) { Anchor = AnchorStyles.Right | AnchorStyles.Top }; base.Controls.Add(button); base.Controls.Add(new UISystem.UIButton(3, 0x1b, 70, 0x16, "Save", () => Settings.Save())); base.Controls.Add(new UISystem.UIButton(3, 0x34, 70, 0x16, "Load", () => { Settings.Load(); foreach (Control control in settingsPanel.Controls) { control.Invalidate(); } })); base.Controls.Add(new UISystem.UIButton(3, 0x4d, 70, 0x16, "Theme", element => { if (element.buttonText == "Theme") { element.buttonText = "Settings"; settingsPanel.Visible = false; themePanel.Visible = true; } else { element.buttonText = "Theme"; settingsPanel.Visible = true; themePanel.Visible = false; } })); var box = new UISystem.UILabelBox(0, 0, base.Width, 0x19, Text, 0x11) { Anchor = AnchorStyles.Left }; formTitleBar = box; formTitleBar.MouseMove += formTitleBar_MouseMove; base.Controls.Add(formTitleBar); visibleRegion = new Rectangle(0, 0, base.Width - 1, base.Height - 1); var x = 3; var y = 3; foreach (var str in Settings.GetHeads()) { foreach (var setting in Settings.GetSettingsForHead(str)) { UISystem.UIElement element = null; if (setting.type == typeof(bool)) { settingsPanel.Controls.Add(element = new UISystem.UICheckBox(x, y, "Bool", setting)); } else if ((setting.type == typeof(int)) || (setting.type == typeof(string))) { settingsPanel.Controls.Add(element = new UISystem.UIValueEditor(x, y, 70, setting)); } else if (setting.type == typeof(Color)) { themePanel.Controls.Add( element = new UISystem.UIButton(x, y, 100, 0x19, setting.name, () => { })); } else if (setting.type == typeof(SolidBrush)) { themePanel.Controls.Add( element = new UISystem.UIButton(x, y, 100, 0x19, setting.name, () => { })); } if (element != null) { if ((y + element.Height) > settingsPanel.Height) { y = 3; x += 200; element.Location = new Point(x, y); y += element.Height + 5; } else { y += element.Height + 5; } } } } }