/// <summary> /// Send the reverse metadata from game server to the agent. This should be called when the game wants to update the metadata. Thread-safe. /// </summary> /// <param name="map">Current map.</param> /// <param name="mode">Current mode.</param> /// <param name="type">Current type.</param> public void SendReverseMetadata(string map, string mode, string type) { int code; using (var data = new OneArray()) using (var mapObject = new OneObject()) using (var modeObject = new OneObject()) using (var typeObject = new OneObject()) using (var map1 = new Utf8ByteArray(map)) using (var mode1 = new Utf8ByteArray(mode)) using (var type1 = new Utf8ByteArray(type)) { mapObject.SetString("key", "map"); mapObject.SetString("value", map1.ToString()); modeObject.SetString("key", "mode"); modeObject.SetString("value", mode1.ToString()); typeObject.SetString("key", "type"); typeObject.SetString("value", type1.ToString()); data.PushObject(mapObject); data.PushObject(modeObject); data.PushObject(typeObject); code = one_server_send_reverse_metadata(_ptr, data.Ptr); } OneErrorValidator.Validate(code); }
private void WrapperOnApplicationInstanceInformationReceived(OneObject payload) { if (ApplicationInstanceInformationReceived != null) { ApplicationInstanceInformationReceived(payload); } }
private void WrapperOnHostInformationReceived(OneObject payload) { if (HostInformationReceived != null) { HostInformationReceived(payload); } }
/// <summary> /// Retrieves the <see cref="OneObject"/> value from the array. Should be disposed. /// </summary> public OneObject GetObject(uint position) { var obj = new OneObject(); int code = one_array_val_object(_ptr, position, obj.Ptr); OneErrorValidator.Validate(code); return(obj); }
/// <summary> /// Sets a <see cref="OneObject"/> key/value pair on the object. /// </summary> public void SetObject(string key, OneObject value) { int code; using (var key8 = new Utf8ByteArray(key)) { code = one_object_set_val_object(_ptr, key8, value._ptr); } OneErrorValidator.Validate(code); }
/// <summary> /// Retrieves the <see cref="OneObject"/> value from the object. Should be disposed. /// </summary> public OneObject GetObject(string key) { var obj = new OneObject(); int code; using (var key8 = new Utf8ByteArray(key)) { code = one_object_val_object(_ptr, key8, obj.Ptr); } OneErrorValidator.Validate(code); return(obj); }
/// <summary> /// Set the live game state information about the game server. This should be called at the least when /// the state changes, but it is safe to call more often if it is more convenient to do so - /// data is only sent out if there are changes from the previous call. Thread-safe. /// </summary> /// <param name="players">Current player count.</param> /// <param name="maxPlayers">Max player count allowed in current match.</param> /// <param name="serverName">Friendly server name.</param> /// <param name="map">Actively hosted map.</param> /// <param name="gameMode">Actively hosted game mode.</param> /// <param name="version">The version of the game software.</param> /// <param name="additionalData">Any key/value pairs set on this object will be added.</param> public void SetLiveState(int players, int maxPlayers, string serverName, string map, string gameMode, string version, OneObject additionalData) { if (!IsOneEnabled()) { return; } if (_wrapper == null) { throw new InvalidOperationException("SDK wrapper is null. This component should be enabled in order to make this call."); } _wrapper.SetLiveState(players, maxPlayers, serverName, map, gameMode, version, additionalData); }
/// <summary> /// Set the live game state information about the game server. This should be called at the least when /// the state changes, but it is safe to call more often if it is more convenient to do so - /// data is only sent out if there are changes from the previous call. Thread-safe. /// </summary> /// <param name="players">Current player count.</param> /// <param name="maxPlayers">Max player count allowed in current match.</param> /// <param name="name">Friendly server name.</param> /// <param name="map">Actively hosted map.</param> /// <param name="mode">Actively hosted game mode.</param> /// <param name="version">The version of the game software.</param> /// <param name="additionalData">Any key/value pairs set on this object will be added.</param> public void SetLiveState(int players, int maxPlayers, string name, string map, string mode, string version, OneObject additionalData) { int code; using (var name8 = new Utf8ByteArray(name)) using (var map8 = new Utf8ByteArray(map)) using (var mode8 = new Utf8ByteArray(mode)) using (var version8 = new Utf8ByteArray(version)) { code = one_server_set_live_state(_ptr, players, maxPlayers, name8, map8, mode8, version8, additionalData != null ? additionalData.Ptr : IntPtr.Zero); } OneErrorValidator.Validate(code); }
/// <summary> /// Sets a <see cref="OneObject"/> value into a position of the array. /// </summary> public void SetObject(uint position, OneObject value) { int code = one_array_set_val_object(_ptr, position, value.Ptr); OneErrorValidator.Validate(code); }
/// <summary> /// Adds a <see cref="OneObject"/> element value to the back of the array. The array /// must have sufficient free space, that is the capacity must be greater than /// the size. /// </summary> public void PushObject(OneObject value) { int code = one_array_push_back_object(_ptr, value.Ptr); OneErrorValidator.Validate(code); }