protected override ReceptionistConfig GetReceptionistConfig(string workerType) { if (Application.isEditor) { return(new ReceptionistConfig { ReceptionistHost = RuntimeConfigDefaults.ReceptionistHost, ReceptionistPort = RuntimeConfigDefaults.ReceptionistPort, WorkerId = CreateNewWorkerId(workerType) }); } var commandLineArguments = Environment.GetCommandLineArgs(); var commandLineArgs = CommandLineUtility.ParseCommandLineArgs(commandLineArguments); return(new ReceptionistConfig { ReceptionistHost = CommandLineUtility.GetCommandLineValue( commandLineArgs, RuntimeConfigNames.ReceptionistHost, RuntimeConfigDefaults.ReceptionistHost), ReceptionistPort = CommandLineUtility.GetCommandLineValue( commandLineArgs, RuntimeConfigNames.ReceptionistPort, RuntimeConfigDefaults.ReceptionistPort), WorkerId = CommandLineUtility.GetCommandLineValue( commandLineArgs, RuntimeConfigNames.WorkerId, CreateNewWorkerId(workerType)), }); }
protected override LocatorConfig GetLocatorConfig() { var commandLineArguments = Environment.GetCommandLineArgs(); var commandLineArgs = CommandLineUtility.ParseCommandLineArgs(commandLineArguments); var projectName = CommandLineUtility.GetCommandLineValue( commandLineArgs, RuntimeConfigNames.ProjectName, string.Empty); if (string.IsNullOrEmpty(projectName)) { throw new ConnectionFailedException("Project name is not set. Can't connect via the Locator.", ConnectionErrorReason.InvalidConfig); } var loginToken = CommandLineUtility.GetCommandLineValue( commandLineArgs, RuntimeConfigNames.LoginToken, string.Empty); var steamDeploymentTag = CommandLineUtility.GetCommandLineValue( commandLineArgs, RuntimeConfigNames.SteamDeploymentTag, string.Empty); var steamTicket = CommandLineUtility.GetCommandLineValue( commandLineArgs, RuntimeConfigNames.SteamTicket, string.Empty); LocatorCredentialsType credentialType; if (!string.IsNullOrEmpty(loginToken)) { credentialType = LocatorCredentialsType.LoginToken; } else if (!string.IsNullOrEmpty(steamDeploymentTag) && !string.IsNullOrEmpty(steamTicket)) { credentialType = LocatorCredentialsType.Steam; } else { throw new ConnectionFailedException("Neither steam credentials nor login token is set. Can't connect via the Locator.", ConnectionErrorReason.InvalidConfig); } return(new LocatorConfig { DeploymentListCallback = SelectDeploymentName, LocatorHost = CommandLineUtility.GetCommandLineValue( commandLineArgs, RuntimeConfigNames.LocatorHost, RuntimeConfigDefaults.LocatorHost), LocatorParameters = new LocatorParameters { CredentialsType = credentialType, LoginToken = new LoginTokenCredentials { Token = loginToken, }, Steam = new SteamCredentials { DeploymentTag = steamDeploymentTag, Ticket = steamTicket, }, ProjectName = projectName, } }); }
public static ReceptionistConfig CreateConnectionConfigFromCommandLine(Dictionary <string, string> parsedArgs) { var config = new ReceptionistConfig(); config.ReceptionistHost = CommandLineUtility.GetCommandLineValue( parsedArgs, RuntimeConfigNames.ReceptionistHost, RuntimeConfigDefaults.ReceptionistHost); config.ReceptionistPort = CommandLineUtility.GetCommandLineValue( parsedArgs, RuntimeConfigNames.ReceptionistPort, RuntimeConfigDefaults.ReceptionistPort); config.LinkProtocol = CommandLineUtility.GetCommandLineValue( parsedArgs, RuntimeConfigNames.LinkProtocol, RuntimeConfigDefaults.LinkProtocol); return(config); }
public static LocatorConfig CreateConnectionConfigFromCommandLine(Dictionary <string, string> parsedArgs) { var config = new LocatorConfig(); var loginToken = CommandLineUtility.GetCommandLineValue( parsedArgs, RuntimeConfigNames.LoginToken, string.Empty); var projectName = CommandLineUtility.GetCommandLineValue( parsedArgs, RuntimeConfigNames.ProjectName, string.Empty); config.SetLoginToken(loginToken); config.SetProjectName(projectName); config.LocatorHost = CommandLineUtility.GetCommandLineValue( parsedArgs, RuntimeConfigNames.LocatorHost, RuntimeConfigDefaults.LocatorHost); config.LinkProtocol = CommandLineUtility.GetCommandLineValue( parsedArgs, RuntimeConfigNames.LinkProtocol, RuntimeConfigDefaults.LinkProtocol); return(config); }
/// <summary> /// Creates a <see cref="ReceptionistConfig"/> instance from a set of command line arguments. /// </summary> /// <param name="parsedArgs">A dictionary of command line argument to command line value.</param> /// <returns>A <see cref="ReceptionistConfig"/> instance.</returns> public static ReceptionistConfig CreateConnectionConfigFromCommandLine(Dictionary <string, string> parsedArgs) { var config = new ReceptionistConfig { ReceptionistHost = CommandLineUtility.GetCommandLineValue( parsedArgs, RuntimeConfigNames.ReceptionistHost, RuntimeConfigDefaults.ReceptionistHost), ReceptionistPort = CommandLineUtility.GetCommandLineValue( parsedArgs, RuntimeConfigNames.ReceptionistPort, RuntimeConfigDefaults.ReceptionistPort), LinkProtocol = CommandLineUtility.GetCommandLineValue( parsedArgs, RuntimeConfigNames.LinkProtocol, RuntimeConfigDefaults.LinkProtocol), WorkerId = CommandLineUtility.GetCommandLineValue( parsedArgs, RuntimeConfigNames.WorkerId, string.Empty), WorkerType = CommandLineUtility.GetCommandLineValue( parsedArgs, RuntimeConfigNames.WorkerType, string.Empty) }; return(config); }
protected override AlphaLocatorConfig GetAlphaLocatorConfig(string workerType) { var commandLineArguments = Environment.GetCommandLineArgs(); var commandLineArgs = CommandLineUtility.ParseCommandLineArgs(commandLineArguments); return(new AlphaLocatorConfig { LocatorHost = CommandLineUtility.GetCommandLineValue( commandLineArgs, RuntimeConfigNames.LocatorHost, RuntimeConfigDefaults.LocatorHost), LocatorParameters = new Alpha.LocatorParameters { PlayerIdentity = new Alpha.PlayerIdentityCredentials { PlayerIdentityToken = CommandLineUtility.GetCommandLineValue( commandLineArgs, RuntimeConfigNames.PlayerIdentityToken, string.Empty), LoginToken = CommandLineUtility.GetCommandLineValue( commandLineArgs, RuntimeConfigNames.LoginToken, string.Empty) }, }, }); }
protected override ConnectionParameters GetConnectionParameters(string workerType, ConnectionService service) { // UseExternalIp needs to be true when using the locator var useExternalIp = service == ConnectionService.Locator || service == ConnectionService.AlphaLocator || UseExternalIp; if (Application.isEditor) { return(new ConnectionParameters { WorkerType = workerType, Network = { ConnectionType = RuntimeConfigDefaults.LinkProtocol, UseExternalIp = useExternalIp, }, EnableProtocolLoggingAtStartup = false, DefaultComponentVtable = new ComponentVtable(), }); } var commandLineArguments = Environment.GetCommandLineArgs(); var commandLineArgs = CommandLineUtility.ParseCommandLineArgs(commandLineArguments); var linkProtocol = CommandLineUtility.GetCommandLineValue( commandLineArgs, RuntimeConfigNames.LinkProtocol, RuntimeConfigDefaults.LinkProtocol); return(new ConnectionParameters { WorkerType = CommandLineUtility.GetCommandLineValue( commandLineArgs, RuntimeConfigNames.WorkerType, workerType), Network = { ConnectionType = linkProtocol, UseExternalIp = useExternalIp, }, EnableProtocolLoggingAtStartup = false, DefaultComponentVtable = new ComponentVtable() }); }
/// <summary> /// Creates a <see cref="LocatorConfig"/> instance from a set of command line arguments. /// </summary> /// <param name="parsedArgs">A dictionary of command line argument to command line value.</param> /// <returns>A <see cref="LocatorConfig"/> instance.</returns> public static LocatorConfig CreateConnectionConfigFromCommandLine(Dictionary <string, string> parsedArgs) { var config = new LocatorConfig(); var projectName = CommandLineUtility.GetCommandLineValue( parsedArgs, RuntimeConfigNames.ProjectName, string.Empty); config.SetProjectName(projectName); var loginToken = CommandLineUtility.GetCommandLineValue( parsedArgs, RuntimeConfigNames.LoginToken, string.Empty); if (!string.IsNullOrEmpty(loginToken)) { config.SetLoginToken(loginToken); } var steamDeploymentTag = CommandLineUtility.GetCommandLineValue( parsedArgs, RuntimeConfigNames.SteamDeploymentTag, string.Empty); var steamTicket = CommandLineUtility.GetCommandLineValue( parsedArgs, RuntimeConfigNames.SteamTicket, string.Empty); if (!string.IsNullOrEmpty(steamDeploymentTag) && !string.IsNullOrEmpty(steamTicket)) { config.SetSteamCredentials(steamDeploymentTag, steamTicket); } config.LocatorHost = CommandLineUtility.GetCommandLineValue( parsedArgs, RuntimeConfigNames.LocatorHost, RuntimeConfigDefaults.LocatorHost); config.LinkProtocol = CommandLineUtility.GetCommandLineValue( parsedArgs, RuntimeConfigNames.LinkProtocol, RuntimeConfigDefaults.LinkProtocol); config.WorkerId = CommandLineUtility.GetCommandLineValue( parsedArgs, RuntimeConfigNames.WorkerId, string.Empty); config.WorkerType = CommandLineUtility.GetCommandLineValue( parsedArgs, RuntimeConfigNames.WorkerType, string.Empty); return(config); }