Skip to content
This repository has been archived by the owner on Jan 11, 2018. It is now read-only.

Commit

Permalink
Updated LoaderGUI to support changing game modes
Browse files Browse the repository at this point in the history
One can now select the wanted game mode on the LoaderGUI before clicking
startbot, to select which mode should be played.
  • Loading branch information
Skeen committed Mar 19, 2014
1 parent 0c874d8 commit cab2021
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions projects/LoaderGUI/src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace HearthstoneBot
{
public class GUI : Form
{
private const int WIDTH = 320;
private const int WIDTH = 340;
private const int HEIGHT = 170;

private const string log_directory = "logs/";
Expand Down Expand Up @@ -212,7 +212,18 @@ private void reload_scripts(object sender, EventArgs e)
private void startbot(object sender, EventArgs e)
{
setStatus("Starting bot");
bool b = loader_commandline("startbot");
bool b = false;

string selectedItem = (string) cmb.SelectedItem;
if(selectedItem == null)
{
b = loader_commandline("startbot");
}
else
{
b = loader_commandline("--set_mode=" + selectedItem + " startbot");
}

if(b)
{
setStatus("Error during startbot");
Expand Down Expand Up @@ -256,6 +267,8 @@ private void HearthstonePathSetter(Panel parent)
tb.TextChanged += new EventHandler(onKeyUpEvent);
}

private ComboBox cmb = null;

public GUI()
{
Text = "LoaderGUI";
Expand Down Expand Up @@ -284,9 +297,6 @@ public GUI()
btn1.Anchor = AnchorStyles.Right;
btn1.Click += new EventHandler(inject);

int total_spacing = WIDTH - 3*btn1.Width;
int one_spacing = total_spacing / 3;

Button btn2 = new Button();
btn2.Text = "Regen";
btn2.Parent = buttons1;
Expand Down Expand Up @@ -315,6 +325,19 @@ public GUI()
btn5.Anchor = AnchorStyles.Right;
btn5.Click += new EventHandler(stopbot);

cmb = new ComboBox();
cmb.DropDownStyle = ComboBoxStyle.DropDownList;
cmb.Parent = buttons2;
cmb.Anchor = AnchorStyles.Right;

string[] game_modes =
new string[]{"TOURNAMENT_RANKED", "TOURNAMENT_UNRANKED",
"PRATICE_NORMAL", "PRATICE_EXPERT"};

cmb.Items.AddRange(game_modes);
cmb.Name = "GameMode";
cmb.Size = new Size(btn5.Width*2, btn5.Height);

// Create status bar
sb = new StatusBar();
sb.Parent = this;
Expand Down

0 comments on commit cab2021

Please sign in to comment.