Exemplo n.º 1
0
        /// <summary>
        ///     Creates a Receptionist configuration.
        /// </summary>
        /// <remarks>
        ///     If in a standalone build, will use the command line arguments.
        /// </remarks>
        /// <remarks>
        ///    A worker ID is auto-generated if in the Unity Editor or if one is not provided over the command line.
        /// </remarks>
        /// <param name="workerType">The type of the worker to create.</param>
        /// <returns>The Receptionist connection configuration</returns>
        protected virtual ReceptionistConfig GetReceptionistConfig(string workerType)
        {
            ReceptionistConfig config;

            if (Application.isEditor)
            {
                config = new ReceptionistConfig
                {
                    WorkerType    = workerType,
                    WorkerId      = CreateNewWorkerId(workerType),
                    UseExternalIp = UseExternalIp
                };
            }
            else
            {
                var commandLineArguments = Environment.GetCommandLineArgs();
                var commandLineArgs      = CommandLineUtility.ParseCommandLineArgs(commandLineArguments);
                config               = ReceptionistConfig.CreateConnectionConfigFromCommandLine(commandLineArgs);
                config.WorkerType    = workerType;
                config.UseExternalIp = UseExternalIp;
                if (!commandLineArgs.ContainsKey(RuntimeConfigNames.WorkerId))
                {
                    config.WorkerId = CreateNewWorkerId(workerType);
                }
            }

            return(config);
        }
Exemplo n.º 2
0
 public static ConnectionConfig CreateConnectionConfigFromCommandLine(Dictionary <string, string> parsedArgs)
 {
     if (parsedArgs.ContainsKey(RuntimeConfigNames.LoginToken))
     {
         return(LocatorConfig.CreateConnectionConfigFromCommandLine(parsedArgs));
     }
     else
     {
         return(ReceptionistConfig.CreateConnectionConfigFromCommandLine(parsedArgs));
     }
 }