Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ async UniTask<StreamableLoadingResult<ITypedArray<byte>>> CreateFileRequestAsync
try
{
IGateKeeperSceneRoom sceneRoom = roomHub.SceneRoom();
isConnectedSceneRoom = sceneRoom.CurrentState() == IConnectiveRoom.State.Running && sceneRoom.IsSceneConnected(sceneData.SceneEntityDefinition.id);
isConnectedSceneRoom = sceneRoom.IsSceneConnected(sceneData.SceneEntityDefinition.id);
room = roomHub.IslandRoom().Info.Sid ?? string.Empty;
}
catch (Exception)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class SceneRoomMetaDataSource : ISceneRoomMetaDataSource

private Vector2Int previousParcel = new (int.MaxValue, int.MaxValue);

public bool ScenesCommunicationIsIsolated => forceSceneIsolation || !realmData.ScenesAreFixed;
public bool ScenesCommunicationIsIsolated => forceSceneIsolation || !realmData.SingleScene;

public bool MetadataIsDirty
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,20 @@ GateKeeperSceneRoomOptions options
public IGateKeeperSceneRoom AsActivatable() =>
new Activatable(this);

private bool IsSceneConnected(string? sceneId) =>
!options.SceneRoomMetaDataSource.ScenesCommunicationIsIsolated || string.Equals(sceneId, currentMetaData?.sceneId, StringComparison.OrdinalIgnoreCase);
private bool IsSceneConnected(string? sceneId)
{
if (options.IsCommsOffline)
return false;

if (CurrentState() is not IConnectiveRoom.State.Running)
return false;

if (options.SceneRoomMetaDataSource.ScenesCommunicationIsIsolated
&& !string.Equals(sceneId, currentMetaData?.sceneId, StringComparison.OrdinalIgnoreCase))
return false;

return true;
}

public override async UniTask StopAsync()
{
Expand Down Expand Up @@ -102,6 +114,13 @@ protected override UniTask PrewarmAsync(CancellationToken token) =>

protected override async UniTask CycleStepAsync(CancellationToken token)
{
if (options.IsCommsOffline)
{
if (AttemptToConnectState is not AttemptToConnectState.NO_CONNECTION_REQUIRED)
SetNoConnectionRequired();
return;
}

MetaData meta = default;

try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public readonly struct GateKeeperSceneRoomOptions
{
public ISceneRoomMetaDataSource SceneRoomMetaDataSource { get; }

public bool IsCommsOffline => realmData.CommsAdapter.Contains("offline:offline");

private readonly string? overrideAdapterURL;
private readonly ILaunchMode launchMode;
private readonly IDecentralandUrlsSource decentralandUrlsSource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ protected async UniTask DisconnectCurrentRoomAsync(bool connectionIsNoLongerRequ
.Log($"{logPrefix} - Trying to disconnect current room finished");
}

protected void SetNoConnectionRequired()
{
attemptToConnectState.Set(AttemptToConnectState.NO_CONNECTION_REQUIRED);
}

protected async UniTask<RoomSelection> TryConnectToRoomAsync(string connectionString, CancellationToken token)
{
ReportHub.Log(ReportCategory.LIVEKIT, $"{logPrefix} - Trying to connect to started: {connectionString}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public bool TryFetchNewInfo()
IRoomHub roomHub = roomHubProxy.StrictObject;

IGateKeeperSceneRoom sceneRoom = roomHub.SceneRoom();
bool isConnectedToSceneRoom = sceneRoom.CurrentState() == IConnectiveRoom.State.Running && sceneRoom.IsSceneConnected(sceneData.SceneEntityDefinition.id);
bool isConnectedToSceneRoom = sceneRoom.IsSceneConnected(sceneData.SceneEntityDefinition.id);

string room = roomHub.IslandRoom().Info.Sid ?? string.Empty;

Expand Down
Loading