Skip to content

Commit b35204c

Browse files
committed
add leaving reason to OnChannelLeft event
1 parent faa6dfc commit b35204c

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

Assets/Talo Game Services/Talo/Runtime/APIs/ChannelsAPI.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,17 @@ public class CreateChannelOptions
4747
public bool temporaryMembership = false;
4848
}
4949

50+
public enum ChannelLeavingReason
51+
{
52+
Default,
53+
TemporaryMembership
54+
}
55+
5056
public class ChannelsAPI : BaseAPI
5157
{
5258
public event Action<Channel, PlayerAlias, string> OnMessageReceived;
5359
public event Action<Channel, PlayerAlias> OnChannelJoined;
54-
public event Action<Channel, PlayerAlias> OnChannelLeft;
60+
public event Action<Channel, PlayerAlias, ChannelLeavingReason> OnChannelLeft;
5561
public event Action<Channel, PlayerAlias> OnOwnershipTransferred;
5662
public event Action<Channel> OnChannelDeleted;
5763
public event Action<Channel, string[]> OnChannelUpdated;
@@ -73,7 +79,7 @@ public ChannelsAPI() : base("v1/game-channels")
7379
else if (response.GetResponseType() == "v1.channels.left")
7480
{
7581
var data = response.GetData<ChannelLeftResponse>();
76-
OnChannelLeft?.Invoke(data.channel, data.playerAlias);
82+
OnChannelLeft?.Invoke(data.channel, data.playerAlias, data.meta.reason);
7783
}
7884
else if (response.GetResponseType() == "v1.channels.ownership-transferred")
7985
{

Assets/Talo Game Services/Talo/Runtime/SocketResponses/ChannelLeftResponse.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,12 @@ public class ChannelLeftResponse
55
{
66
public Channel channel;
77
public PlayerAlias playerAlias;
8+
public ChannelLeftResponseMetadata meta;
9+
}
10+
11+
[System.Serializable]
12+
public class ChannelLeftResponseMetadata
13+
{
14+
public ChannelLeavingReason reason;
815
}
916
}

0 commit comments

Comments
 (0)