diff --git a/CHANGELOG.md b/CHANGELOG.md index 187b1eb..c812a7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ The format is based on [keep a changelog](http://keepachangelog.com/) and this p - Add support for creating match by name - Add support for "count_multple" on "NakamaSocket.add_matchmaker_async()" and "NakamaSocket.add_matchmaker_party_async()" - Add C# support classes to better integrate the .NET client with the Mono version of Godot, allowing HTML5 exports to work +- Fixed sending and receiving of PartyData ### Fixed diff --git a/addons/com.heroiclabs.nakama/api/NakamaRTAPI.gd b/addons/com.heroiclabs.nakama/api/NakamaRTAPI.gd index 86a61ba..2fdd0aa 100644 --- a/addons/com.heroiclabs.nakama/api/NakamaRTAPI.gd +++ b/addons/com.heroiclabs.nakama/api/NakamaRTAPI.gd @@ -825,7 +825,10 @@ class PartyData extends NakamaAsyncResult: return "PartyData" % [party_id, presence, op_code, data] static func create(p_ns : GDScript, p_dict : Dictionary) -> PartyData: - return _safe_ret(NakamaSerializer.deserialize(p_ns, "PartyData", p_dict), PartyData) as PartyData + var out := _safe_ret(NakamaSerializer.deserialize(p_ns, "PartyData", p_dict), PartyData) as PartyData + if out.data: # Decode base64 received data + out.data = Marshalls.base64_to_utf8(out.data) + return out static func get_result_key() -> String: return "party_data" diff --git a/addons/com.heroiclabs.nakama/socket/NakamaSocket.gd b/addons/com.heroiclabs.nakama/socket/NakamaSocket.gd index 65ce061..ddc6a0e 100644 --- a/addons/com.heroiclabs.nakama/socket/NakamaSocket.gd +++ b/addons/com.heroiclabs.nakama/socket/NakamaSocket.gd @@ -570,5 +570,6 @@ func remove_party_member_async(p_party_id : String, p_presence : NakamaRTAPI.Use # @param p_op_code - Op code value. # @param data - Data payload, if any. # Returns a task which represents the asynchronous operation. -func send_party_data_async(p_party_id : String, p_op_code : int, p_data = null): - return _send_async(NakamaRTMessage.PartyDataSend.new(p_party_id, p_op_code, p_data)) +func send_party_data_async(p_party_id : String, p_op_code : int, p_data:String = ""): + var base64_data = null if p_data.empty() else Marshalls.utf8_to_base64(p_data) + return _send_async(NakamaRTMessage.PartyDataSend.new(p_party_id, p_op_code, base64_data))