static void Main(string[] args) { CommandLineParser commandLineParser = new CommandLineParser(); commandLineParser.Parse(args); int port = 4805; if (!int.TryParse(commandLineParser.GetValueForArgument("-Port"), out port)) { port = 4805; } InitializeSerializer(); if (commandLineParser.IsArgumentSet("-Server")) { m_serverUpdateThread = new Thread(new ThreadStart(() => { ServerThread(port); })); m_serverUpdateThread.Start(); } if (commandLineParser.IsArgumentSet("-Client")) { var clPacketHandler = new Networking.Client.ClientPacketHandler(); string ip = commandLineParser.GetValueForArgument("-Ip"); if (string.IsNullOrEmpty(ip)) { ip = "127.0.0.1"; } var clControllers = new Implementations.SSBBClientControllers(new Implementations.SSBBRenderPipeline(), clPacketHandler, ip, port); clPacketHandler.SetControllers(clControllers); var aiType = i_getAiType(commandLineParser); string titleAppendix = ""; if (aiType != GameObjects.Client.Ai.AiFactory.AiType.AT_None) { titleAppendix = " " + aiType.ToString(); } using (ShootyShootyBangBangEngine.SSBBE engine = new ShootyShootyBangBangEngine.SSBBE(new ShootyShootyBangBangClientGame(clControllers, aiType), 800, 600, "ShootyShootyBangBang" + titleAppendix)) { i_parseWindowPosition(engine, commandLineParser); if (commandLineParser.IsArgumentSet("-AllBots")) { i_createAllBots(engine.GetWindowXPos(), engine.GetWindowYPos(), 20, 20); } engine.Run(60.0); } if (m_serverGame != null) { m_serverGame.Stop(); } } }
static void i_parseWindowPosition(ShootyShootyBangBangEngine.SSBBE engine, CommandLineParser commandLineParser) { var xLocStr = commandLineParser.GetValueForArgument("-WndXPos"); var yLocStr = commandLineParser.GetValueForArgument("-WndYPos"); int xPos = engine.GetWindowXPos(); int yPos = engine.GetWindowYPos(); if (xLocStr != null && int.TryParse(xLocStr, out int xPosParsed)) { xPos = xPosParsed; } if (yLocStr != null && int.TryParse(yLocStr, out int yPosParsed)) { yPos = yPosParsed; } engine.SetWindowLocation(xPos, yPos); }