public virtual void ReadConfigs(string[] args) { botCount = EnvironmentArgsUtils.ReadArgsInt(args, BotCountKey, defaultBotCount); matchTime = EnvironmentArgsUtils.ReadArgsInt(args, MatchTimeKey, defaultMatchTime); matchKill = EnvironmentArgsUtils.ReadArgsInt(args, MatchKillKey, defaultMatchKill); matchScore = EnvironmentArgsUtils.ReadArgsInt(args, MatchScoreKey, defaultMatchScore); }
protected virtual void Start() { var args = System.Environment.GetCommandLineArgs(); // Android fix if (args == null) { args = new string[0]; } // Set manager instance var manager = SimpleLanNetworkManager.Singleton as BaseNetworkGameManager; // If game running in batch mode, run as server if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Null || EnvironmentArgsUtils.IsArgsProvided(args, ARG_SERVER_START)) { Application.targetFrameRate = 30; Debug.Log("Running as server in batch mode"); var serverPort = manager.networkPort; manager.networkPort = EnvironmentArgsUtils.ReadArgsInt(args, ARG_SERVER_PORT, serverPort); var maxConnections = manager.maxConnections; manager.maxConnections = EnvironmentArgsUtils.ReadArgsInt(args, ARG_SERVER_MAX_CONNECTIONS, maxConnections); var onlineScene = manager.Assets.onlineScene.SceneName; manager.Assets.onlineScene.SceneName = EnvironmentArgsUtils.ReadArgs(args, ARG_SERVER_GAME_ONLINE_SCENE, onlineScene); if (GameRules.Count > 0) { var allGameRules = new List <BaseNetworkGameRule>(GameRules.Values); var gameRule = allGameRules[0]; var gameRuleName = EnvironmentArgsUtils.ReadArgs(args, ARG_SERVER_GAME_RULE); if (!string.IsNullOrEmpty(gameRuleName) && GameRules.ContainsKey(gameRuleName)) { gameRule = GameRules[gameRuleName]; } manager.gameRule = gameRule; } if (manager.gameRule != null) { manager.gameRule.ReadConfigs(args); } manager.StartDedicateServer(); } }