mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-26 14:00:17 +00:00
allow selection of game mode via command line
This commit is contained in:
parent
805eaefea7
commit
f7eeaa379e
1 changed files with 13 additions and 0 deletions
|
@ -1,4 +1,6 @@
|
|||
using System.Collections;
|
||||
using System.Linq;
|
||||
using SanAndreasUnity.GameModes;
|
||||
using UnityEngine;
|
||||
using SanAndreasUnity.Utilities;
|
||||
|
||||
|
@ -30,6 +32,17 @@ namespace SanAndreasUnity.Net
|
|||
string serverIp = "127.0.0.1";
|
||||
CmdLineUtils.GetArgument("serverIp", ref serverIp);
|
||||
|
||||
string gameModeName = null;
|
||||
CmdLineUtils.GetArgument("gameMode", ref gameModeName);
|
||||
if (!string.IsNullOrWhiteSpace(gameModeName))
|
||||
{
|
||||
var gameModeInfo = GameModeManager.Instance.GameModes.FirstOrDefault(gm => gm.Name == gameModeName);
|
||||
if (gameModeInfo != null)
|
||||
GameModeManager.Instance.SelectGameMode(gameModeInfo);
|
||||
else
|
||||
Debug.LogError($"Game mode with name '{gameModeName}' not found");
|
||||
}
|
||||
|
||||
if (CmdLineUtils.HasArgument("startServer"))
|
||||
{
|
||||
Debug.LogFormat("Starting server in headless mode, params: {0}, {1}, {2}", portNum, sceneName, maxNumPlayers);
|
||||
|
|
Loading…
Reference in a new issue