Skip to content
Open
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
10 changes: 10 additions & 0 deletions Assets/Scripts/Bootstrap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,14 @@ public void Cleanup()

previewLoader.Cleanup();
}

public void EnableSound()
{
previewLoader.EnableSound();
}

public void DisableSound()
{
previewLoader.DisableSound();
}
}
6 changes: 6 additions & 0 deletions Assets/Scripts/JSBridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ public void SetUrns(string value) =>
[UsedImplicitly]
public void TakeScreenshot() => StartCoroutine(TakeScreenshotCoroutine());

[UsedImplicitly]
public void EnableSound() => bootstrap.EnableSound();

[UsedImplicitly]
public void DisableSound() => bootstrap.DisableSound();

private static async Awaitable TakeScreenshotCoroutine()
{
await Awaitable.EndOfFrameAsync();
Expand Down
22 changes: 22 additions & 0 deletions Assets/Scripts/PreviewLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,28 @@ public void PlayAnimation(bool play)
}
}

/// <summary>
/// Enables sound playback by setting audio source volume to 1.
/// </summary>
public void EnableSound()
{
if (audioSource != null)
{
audioSource.volume = 1f;
}
}

/// <summary>
/// Disables sound playback by setting audio source volume to 0.
/// </summary>
public void DisableSound()
{
if (audioSource != null)
{
audioSource.volume = 0f;
}
}

private async Task LoadWearable(string category, WearableDefinition wd, AvatarColors avatarColors)
{
Debug.Log($"Loading wearable({category}): {wd.Pointer}");
Expand Down