Exemplo n.º 1
0
        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();
                }
            }
        }
 public ShootyShootyBangBangClientGame(Implementations.SSBBClientControllers controllers, AiFactory.AiType aiType)
     : base(controllers)
 {
     m_clientControllers = controllers;
     m_aiType            = aiType;
 }