/// <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 WrapperOnCustomCommandReceived(OneArray data) { if (CustomCommandReceived != null) { CustomCommandReceived(data); } }
private void WrapperOnMetadataReceived(OneArray metadata) { if (MetadataReceived != null) { MetadataReceived(metadata); } }
private void WrapperOnAllocatedReceived(OneArray metadata) { if (AllocatedReceived != null) { AllocatedReceived(metadata); } }
/// <summary> /// Retrieves the <see cref="OneArray"/> value from the array. Should be disposed. /// </summary> public OneArray GetArray(uint position) { var array = new OneArray(); int code = one_array_val_array(_ptr, position, array.Ptr); OneErrorValidator.Validate(code); return(array); }
/// <summary> /// Sets a <see cref="OneArray"/> key/value pair on the object. /// </summary> public void SetArray(string key, OneArray value) { int code; using (var key8 = new Utf8ByteArray(key)) { code = one_object_set_val_array(_ptr, key8, value.Ptr); } OneErrorValidator.Validate(code); }
/// <summary> /// Retrieves the <see cref="OneArray"/> value from the object. Should be disposed. /// </summary> public OneArray GetArray(string key) { var array = new OneArray(); int code; using (var key8 = new Utf8ByteArray(key)) { code = one_object_val_array(_ptr, key8, array.Ptr); } OneErrorValidator.Validate(code); return(array); }
/// <summary> /// Sets a <see cref="OneArray"/> value into a position of the array. /// </summary> public void SetArray(uint position, OneArray value) { int code = one_array_set_val_array(_ptr, position, value._ptr); OneErrorValidator.Validate(code); }
/// <summary> /// Adds a <see cref="OneArray"/> 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 PushArray(OneArray value) { int code = one_array_push_back_array(_ptr, value._ptr); OneErrorValidator.Validate(code); }
/// <summary> /// Makes a copy of the array. /// </summary> public static void Copy(OneArray source, OneArray destination) { int code = one_array_copy(source._ptr, destination._ptr); OneErrorValidator.Validate(code); }