Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

入室した部屋の接続情報を必要に応じて調整できるように #83

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions wsnet2-unity/Assets/WSNet2/Scripts/Core/WSNet2Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ public class WSNet2Client
/// 例外が発生した時は tcs.TrySetException(exceptin) とします。
public Action<string, IReadOnlyDictionary<string, string>, byte[], TaskCompletionSource<(int, byte[])>> HttpPost { private get; set; }

/// <summary>
/// Task AdjustJoinedRoomInfo(joinedRoom): 接続前に入室した部屋の情報を必要に応じて調整する
/// </summary>
/// 別スレッドで呼び出されるので注意
public Func<JoinedRoom, Task> AdjustJoinedRoomInfo { private get; set; }

/// <summary>
/// コンストラクタ
/// </summary>
Expand Down Expand Up @@ -489,6 +495,11 @@ private async Task connectToRoom(
throw new RoomFullException(res.msg);
}

if (AdjustJoinedRoomInfo != null)
{
await AdjustJoinedRoomInfo(res.room);
}

var logger = prepareLogger(roomLogger);
var hmac = new HMACSHA1(Encoding.ASCII.GetBytes(authData.MACKey));
var room = new Room(res.room, userId, hmac, logger);
Expand Down
Loading