public HostDialog(GameInfo defaultGame) { InitializeComponent(); ZklBaseControl.Init(cbType); cbType.Items.Add(AutohostMode.GameChickens.Description()); cbType.Items.Add(AutohostMode.Teams.Description()); cbType.Items.Add(AutohostMode.Game1v1.Description()); cbType.Items.Add(AutohostMode.GameFFA.Description()); cbType.Items.Add(AutohostMode.None.Description()); cbType.SelectedIndex = 0; battleTitleBox.Text = Program.TasClient.UserName + "'s game"; if (Program.Conf.HasHosted) { try { battleTitleBox.Text = Program.Conf.HostBattle_Title; } catch (Exception e) { Trace.WriteLine("Error in restoring battle configuration: " + e); } } }
public HostDialog(GameInfo defaultGame) { InitializeComponent(); gameBox.SelectedIndexChanged += gameBox_TextChanged; battleTitleBox.Text = Program.TasClient.MyUser + "'s Battle"; HideAdvanced(); gameBox.DropDownStyle = ComboBoxStyle.DropDownList; if (Program.Conf.ShowOfficialBattles) gameBox.Items.AddRange(KnownGames.List.Where(x=>x.IsPrimary).ToArray()); else gameBox.Items.AddRange(KnownGames.List.ToArray()); if (defaultGame == null || gameBox.Items.Cast<GameInfo>().SingleOrDefault(n => n == defaultGame) == null) gameBox.SelectedIndex = new Random().Next(0, gameBox.Items.Count); else gameBox.SelectedIndex = gameBox.Items.IndexOf(gameBox.Items.Cast<GameInfo>().Single(n => n == defaultGame)); rapidTagBox.Text = KnownGames.List.Single(g => g.ToString() == gameBox.Text).RapidTag; if (Program.Conf.HasHosted) { try { battleTitleBox.Text = Program.Conf.HostBattle_Title; springieCommandsBox.Text = Program.Conf.HostBattle_SpringieCommands; } catch (Exception e) { Trace.WriteLine("Error in restoring battle configuration: " + e); } } }
public HostDialog(GameInfo defaultGame) { InitializeComponent(); battleTitleBox.Text = Program.TasClient.MyUser + "'s Battle"; game = defaultGame ?? KnownGames.List.First(x => x.IsPrimary); if (Program.Conf.HasHosted) { try { battleTitleBox.Text = Program.Conf.HostBattle_Title; } catch (Exception e) { Trace.WriteLine("Error in restoring battle configuration: " + e); } } }
public void ShowHostDialog(GameInfo filter) { using (var dialog = new HostDialog(filter)) { if (dialog.ShowDialog() != DialogResult.OK) return; string[] springieCommands = dialog.SpringieCommands.Lines(); ActionHandler.StopBattle(); ActionHandler.SpawnAutohost(dialog.GameName, dialog.BattleTitle, dialog.Password, springieCommands); } }
public void ShowHostDialog(GameInfo filter) { using (var dialog = new HostDialog(filter)) { if (dialog.ShowDialog() != DialogResult.OK) return; ActionHandler.StopBattle(); ActionHandler.HostBattle(title: dialog.BattleTitle, password:dialog.Password, mode: dialog.Mode); } }