Exemple #1
0
 public PlayerMessageHandleArgs(IConnection connection  = null, Socket socket = null,
                                PlayerSettings settings = null, AgentCommandLineOptions options = null, PlayerClient playerClient = null)
 {
     Options      = options;
     Connection   = connection;
     Socket       = socket;
     Settings     = settings;
     PlayerClient = playerClient;
 }
        static void Main(string[] args)
        {
            AgentCommandLineOptions options  = CommandLineParser.ParseArgs <AgentCommandLineOptions>(args, new AgentCommandLineOptions());
            GameMasterSettings      settings = Configuration.FromFile <GameMasterSettings>(options.Conf);
            GameMasterClient        client   = new GameMasterClient(new Connection(options.Address, options.Port), settings,
                                                                    new Logger(UniqueNameGenerator.GetUniqueName(settings.GameDefinition.GameName)), new Game(), new Ranking());

            client.Connect();
            client.Disconnect();
        }
Exemple #3
0
 public PlayerClient(IConnection connection, PlayerSettings settings, AgentCommandLineOptions options, IGame game)
 {
     this.connection = connection;
     this.Settings = settings;
     this.Options = options;
     connection.OnConnection += OnConnection;
     connection.OnMessageRecieve += OnMessageReceive;
     connection.OnMessageSend += OnMessageSend;
     messageHandler = new MessageHandler(this);
     this.game = game;
 }
Exemple #4
0
        public static void Main(string[] args)
        {
            AgentCommandLineOptions options = CommandLineParser.ParseArgs <AgentCommandLineOptions>(args, new AgentCommandLineOptions());

            PlayerSettings settings = Configuration.FromFile <PlayerSettings>(options.Conf);

            PlayerClient client           = new PlayerClient(new Connection(options.Address, options.Port), settings, options, new Game());
            IController  playerController = new Controller().Possess(client);

            client.Connect();
            client.Disconnect();
        }
        public void ParseArgsTest()
        {
            AgentCommandLineOptions expectedOptions = new AgentCommandLineOptions
            {
                Address = "172.16.254.1",
                Port    = 666
            };

            //"17-PL-01",
            string[] args = new[] { "--address", "172.16.254.1", "--port", "666" };
            // ICommandLineOptions commandLineOptions = ;
            AgentCommandLineOptions options = CommandLineParser.ParseArgs <AgentCommandLineOptions>(args, new AgentCommandLineOptions());

            Assert.AreEqual(expectedOptions.Address, options.Address);
            Assert.AreEqual(expectedOptions.Port, options.Port);
        }