Skip to content

Commit

Permalink
Merge pull request #94 from vrchat-community/quake-cre-587-add-langua…
Browse files Browse the repository at this point in the history
…ge-method-stubs

CRE-587 Add Language Method Stubs
  • Loading branch information
RazzyMcSnazzy committed Jul 25, 2023
2 parents 6984bc4 + d5d3b54 commit 476a98b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public class ClientSimSettingsWindow : EditorWindow
private readonly GUIContent _showTooltipsGuiContent = new GUIContent("Show Tooltips", "If enabled, hovering over an interactable object or pickup will display a tooltip above the object.");
private readonly GUIContent _invertMouseLookGuiContent = new GUIContent("Invert Mouse Look", "If enabled, moving the mouse up or down will invert the direction the player will look up and down.");
private readonly GUIContent _playerHeightGuiContent = new GUIContent("Player Height", "How tall should the player be in meters. Default height is 1.9. Note that the player's collision capsule is 1.6 and never changes.");
private readonly GUIContent _currentLanguageGuiContent = new GUIContent("Current Language", "The language the player is currently using. Available languages include English, French, German, Italian, Japanese, Korean, and Spanish.");
private int selectedLanguageIndex;

// Player settings
private readonly GUIContent _playerButtonsFoldoutGuiContent = new GUIContent("Player Settings", "");
Expand Down Expand Up @@ -382,6 +384,8 @@ private void DrawPlayerControllerSettings()
_settings.invertMouseLook = EditorGUILayout.Toggle(_invertMouseLookGuiContent, _settings.invertMouseLook);
_settings.playerHeight = EditorGUILayout.FloatField(_playerHeightGuiContent, _settings.playerHeight);
_settings.playerHeight = Mathf.Clamp(_settings.playerHeight, 0.2f, 80f); // TODO make consts for these.
selectedLanguageIndex = EditorGUILayout.Popup(_currentLanguageGuiContent, selectedLanguageIndex, _settings.availableLanguages);
_settings.currentLanguage = _settings.availableLanguages[selectedLanguageIndex];

EditorGUI.EndDisabledGroup();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public static ClientSimSettings Instance
public bool showTooltips = true;
public bool invertMouseLook = false;
public float playerHeight = ClientSimTrackingProviderBase.AVATAR_HEIGHT; // Default avatar height is 1.9 units tall
public string currentLanguage = "English";
public readonly string[] availableLanguages =
{ "English", "French", "German", "Italian", "Japanese", "Korean", "Spanish" };

#if UNITY_EDITOR
private static ClientSimSettings LoadSettings()
Expand Down
3 changes: 3 additions & 0 deletions Packages/com.vrchat.ClientSim/Runtime/System/ClientSimMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,9 @@ private void SetupSDKLinks()
VRCPlayerApi._SetVoiceDistanceFar += ClientSimPlayerManager.SetVoiceDistanceFar;
VRCPlayerApi._SetVoiceDistanceNear += ClientSimPlayerManager.SetVoiceDistanceNear;
VRCPlayerApi._SetVoiceGain += ClientSimPlayerManager.SetVoiceGain;

VRCPlayerApi._GetCurrentLanguage += ClientSimPlayerManager.GetCurrentLanguage;
VRCPlayerApi._GetAvailableLanguages += ClientSimPlayerManager.GetAvailableLanguages;

VRC_SpatialAudioSource.Initialize += ClientSimSpatialAudioHelper.InitializeAudio;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,16 @@ public static void SetVoiceGain(VRCPlayerApi player, float value)
{
player.GetClientSimPlayer().audioData.SetVoiceGain(value);
}

public static string GetCurrentLanguage()
{
return ClientSimSettings.Instance.currentLanguage;
}

public static string[] GetAvailableLanguages()
{
return ClientSimSettings.Instance.availableLanguages;
}

#endregion
}
Expand Down

0 comments on commit 476a98b

Please sign in to comment.