/// <summary> /// Replaces the <see cref="MatchRun.CurrentMatch"/> with a new <see cref="Match"/> with specific indexes /// given for <see cref="Shared.Controller"/>s. /// </summary> /// <param name="idx">The current index of the parameter stream.</param> /// <param name="param">The string of parameters made by the user.</param> public static void Match(int idx, params string[] param) { var playControllers = new List <ControllerSkeleton>(); int strParseInt; while (idx < param.Length && int.TryParse(param[idx++], out strParseInt)) { if (strParseInt < 0 || strParseInt > Input.Controllers.Count) { Console.Write("Invalid controller specified: "); Console.WriteLine(strParseInt); } else { playControllers.Add(Input.Controllers[strParseInt]); } } if (playControllers.Count < 2) { Console.WriteLine("A match must include a minimum of two controllers."); return; } try { var newMatch = new MatchCore(); MatchRun.CurrentMatch = newMatch; if (Configuration.Global.GetValue <bool>("mbc_console_create_events")) { Input.RunCommand("event enable MatchBeginEvent"); Input.RunCommand("event enable MatchEndEvent"); Input.RunCommand("event enable PlayerShotEvent"); Input.RunCommand("event enable PlayerWonEvent"); } Console.WriteLine("Match created with:"); foreach (var controller in playControllers) { newMatch.PlayerCreate(controller); Console.WriteLine(controller); } } catch (Exception e) { Console.WriteLine(e.Message); } }
/// <summary> /// Replaces the <see cref="MatchRun.CurrentMatch"/> with a new <see cref="Match"/> with specific indexes /// given for <see cref="Shared.Controller"/>s. /// </summary> /// <param name="idx">The current index of the parameter stream.</param> /// <param name="param">The string of parameters made by the user.</param> public static void Match(int idx, params string[] param) { var playControllers = new List<ControllerSkeleton>(); int strParseInt; while (idx < param.Length && int.TryParse(param[idx++], out strParseInt)) { if (strParseInt < 0 || strParseInt > Input.Controllers.Count) { Console.Write("Invalid controller specified: "); Console.WriteLine(strParseInt); } else { playControllers.Add(Input.Controllers[strParseInt]); } } if (playControllers.Count < 2) { Console.WriteLine("A match must include a minimum of two controllers."); return; } try { var newMatch = new MatchCore(); MatchRun.CurrentMatch = newMatch; if (Configuration.Global.GetValue<bool>("mbc_console_create_events")) { Input.RunCommand("event enable MatchBeginEvent"); Input.RunCommand("event enable MatchEndEvent"); Input.RunCommand("event enable PlayerShotEvent"); Input.RunCommand("event enable PlayerWonEvent"); } Console.WriteLine("Match created with:"); foreach (var controller in playControllers) { newMatch.PlayerCreate(controller); Console.WriteLine(controller); } } catch (Exception e) { Console.WriteLine(e.Message); } }