Beispiel #1
0
 public static void SetDefaultParameters()
 {
     serverIP   = IPAddress.Parse("127.0.0.1");
     serverPort = Int32.Parse("5678");
     colour     = Messages.TeamColour.blue;
     role       = Messages.PlayerRole.member;
     settings   = LoadSettingsFromFile("PlayerSettings.xml");
 }
Beispiel #2
0
        public static void AssignParameterValue(string option, string arg)
        {
            switch (option)
            {
            case "--address":
                serverIP = IPAddress.Parse(arg);
                break;

            case "--port":
                serverPort = Int32.Parse(arg);
                break;

            case "--conf":
                settings = LoadSettingsFromFile(arg);
                ConsoleWriter.Show("Loading settings from file: " + arg);
                var settingsErrors = settings == null ? null : Validator.ValidateSettings(settings);
                if (settings == null || (settingsErrors != null && settingsErrors != ""))
                {
                    ConsoleWriter.Error("Failed to load settings from file. Verify file and try again.\n Closing Agent.");
                    settings = LoadSettingsFromFile("PlayerSettings.xml");
                }
                break;

            case "--game":
                gameName = arg;
                break;

            case "--team":
                colour = StringToTeamColour(arg);
                break;

            case "--role":
                role = StringToRole(arg);
                break;
            }
        }
Beispiel #3
0
        /// <summary>
        /// Method for integration tests
        /// </summary>
        /// <param name="ip"></param>
        /// <param name="port"></param>
        /// <param name="settings"></param>
        /// <param name="colour"></param>
        /// <param name="PController"></param>
        /// <param name="role"></param>
        /// <returns></returns>
        public static bool TestStartPlayer(IPAddress ip, Int32 port, PlayerSettingsConfiguration settings, Messages.TeamColour colour, out PlayerController PController, Messages.PlayerRole role = Messages.PlayerRole.member)
        {
            var player = new Player(colour, role, settings);

            PController       = new PlayerController(player);
            player.Controller = PController;
            return(PController.ConnectToServer(ip, port));
        }
Beispiel #4
0
 public static bool StartPlayerController(IPAddress ip, Int32 port, PlayerSettingsConfiguration settings, Messages.TeamColour colour, Messages.PlayerRole role)
 {
     PController = new PlayerController(colour, role, settings, gameName);
     return(PController.ConnectToServer(ip, port));
 }