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

Implements text chat settings #149

Merged
merged 3 commits into from
Jun 20, 2024
Merged

Implements text chat settings #149

merged 3 commits into from
Jun 20, 2024

Conversation

TheCodeTherapy
Copy link
Contributor

@TheCodeTherapy TheCodeTherapy commented Jun 13, 2024

This PR implements text chat settings for the 3d-web-experience.

With this change, users can easily set up the text chat to be automatically visible and pinned by default when the app starts, and also provide options for the username hash to color feature, which improves chat readability by assigning colors deterministically to each username on the text chat.

The new Networked3dWebExperienceClientConfig options are:

  • chatVisibleByDefault?: boolean (optional. defines if chat will be immediately visible and pinned when the app starts. If not provided, it will default to true);
  • userNameToColorOptions?: StringToHslOptions (optional. defines hueThresholds, saturationThresholds, and lightnessThresholds for the logic that assigns a deterministic color per username. If not provided, it will default to the values illustrated on the usage example below.

Usage example for multi-user-3d-web-experience/client/src/index.ts:

const app = new Networked3dWebExperienceClient(holder, {
  sessionToken: (window as any).SESSION_TOKEN,
  userNetworkAddress,
  chatNetworkAddress,
  chatVisibleByDefault: true,
  userNameToColorOptions: {
    hueThresholds: [[10, 350]],
    saturationThresholds: [[60, 100]],
    lightnessThresholds: [[65, 75]],
  },
  animationConfig: {
    airAnimationFileUrl,
    idleAnimationFileUrl,
    jogAnimationFileUrl,
    sprintAnimationFileUrl,
    doubleJumpAnimationFileUrl,
  },
  skyboxHdrJpgUrl: hdrJpgUrl,
  mmlDocuments: [{ url: `${protocol}//${host}/mml-documents/example-mml.html` }],
  environmentConfiguration: {},
});

The example above already shows the default values for the userNameToColorOptions. This option can also be used in a future PR to set the same color for the label that shows above the character showing its user name.

What kind of change does your PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Refactor
  • Tests
  • Other, please describe:

Does your PR fulfill the following requirements?

  • The title references the corresponding issue # (if relevant)
2024-06-13.11-51-16.mp4

@TheCodeTherapy TheCodeTherapy merged commit 26122af into main Jun 20, 2024
5 checks passed
@TheCodeTherapy TheCodeTherapy deleted the feature/chat-settings branch June 20, 2024 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants