/// <summary> /// Initializes a new instance of the <see cref="MultiProcessGameModeClient" /> class. /// </summary> /// <param name="startBehaviour">The start method.</param> /// <param name="gameModeProvider">The game mode provider.</param> /// <param name="encoding">The encoding to use when en/decoding text messages sent to/from the server.</param> public HostedGameModeClient(GameModeStartBehaviour startBehaviour, IGameModeProvider gameModeProvider, Encoding encoding) { Encoding = encoding; _startBehaviour = startBehaviour; _gameModeProvider = gameModeProvider ?? throw new ArgumentNullException(nameof(gameModeProvider)); NativeLoader = new NativeLoader(this); }
/// <summary> /// Initializes a new instance of the <see cref="MultiProcessGameModeClient" /> class. /// </summary> /// <param name="communicationClient">The communication client to be used by the game mode client.</param> /// <param name="startBehaviour">The start method.</param> /// <param name="gameModeProvider">The game mode provider.</param> /// <param name="encoding">The encoding to use when en/decoding text messages sent to/from the server.</param> public MultiProcessGameModeClient(ICommunicationClient communicationClient, GameModeStartBehaviour startBehaviour, IGameModeProvider gameModeProvider, Encoding encoding) { Encoding = encoding; _startBehaviour = startBehaviour; _gameModeProvider = gameModeProvider ?? throw new ArgumentNullException(nameof(gameModeProvider)); CommunicationClient = communicationClient ?? throw new ArgumentNullException(nameof(communicationClient)); NativeLoader = new NativeLoader(this); }
/// <summary> /// Initializes a new instance of the <see cref="MultiProcessGameModeClient" /> class. /// </summary> /// <param name="gameModeProvider">The game mode provider.</param> /// <param name="encoding">The encoding to use when en/decoding text messages sent to/from the server.</param> public HostedGameModeClient(IGameModeProvider gameModeProvider, Encoding encoding) { Encoding = encoding; _gameModeProvider = gameModeProvider ?? throw new ArgumentNullException(nameof(gameModeProvider)); NativeLoader = new NativeLoader(this); _buffer = Marshal.AllocHGlobal(_txBufferLength = 1024 * 6); _buffer1K = Marshal.AllocHGlobal(1024); ServerPath = AppContext.BaseDirectory; }
/// <summary> /// Initializes a new instance of the <see cref="MultiProcessGameModeClient" /> class. /// </summary> /// <param name="communicationClient">The communication client to be used by the game mode client.</param> /// <param name="startBehaviour">The start method.</param> /// <param name="gameModeProvider">The game mode provider.</param> /// <param name="encoding">The encoding to use when en/decoding text messages sent to/from the server.</param> public MultiProcessGameModeClient(ICommunicationClient communicationClient, GameModeStartBehaviour startBehaviour, IGameModeProvider gameModeProvider, Encoding encoding) { Encoding = encoding; _startBehaviour = startBehaviour; _gameModeProvider = gameModeProvider ?? throw new ArgumentNullException(nameof(gameModeProvider)); CommunicationClient = communicationClient ?? throw new ArgumentNullException(nameof(communicationClient)); NativeLoader = new NativeLoader(this); _console = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = true }; }
/// <summary> /// Use the specified game mode. /// </summary> /// <param name="gameMode">The game mode to use.</param> /// <returns>The updated game mode configuration builder.</returns> public GameModeBuilder Use(IGameModeProvider gameMode) { _gameModeProvider = gameMode ?? throw new ArgumentNullException(nameof(gameMode)); return(this); }