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
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ public GameManager.Language SubtitlesLanguage
}
}

private float maxSubtitleWidth;
public float MaxSubtitleWidth
{
set
{
maxSubtitleWidth = value;
}
}

// Cache
private TMP_Text subtitleText = null;
private Image subtitleBackground = null;
Expand Down Expand Up @@ -113,7 +122,7 @@ private void UpdateSubtitleUI()
subtitleText.font = currentFont;
subtitleObject.SetActive(true);
subtitleText.text = output;
subtitleBackground.rectTransform.sizeDelta = new Vector2(subtitleText.preferredWidth, subtitleText.preferredHeight);
subtitleBackground.rectTransform.sizeDelta = new Vector2(Mathf.Min(subtitleText.preferredWidth, maxSubtitleWidth), subtitleText.preferredHeight);
}
else
{
Expand Down
6 changes: 6 additions & 0 deletions POINT-VR-Chapter-1/Assets/POINT/InputAssets/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ public struct PlayerData
public bool isControllerHighlighted;
public Language language;
public Language subtitleLanguage;
public float subtitleHeightValue;
public float subtitleSizeValue;
public float subtitleWidthValue;
}
public static GameManager Instance { get; private set; }
public enum Language { Disabled = 0, English = 1, Spanish = 2, French = 3, Mandarin = 4, Japanese = 5, Hindi = 6, Arabic = 7, Bengali = 8, Russian = 9, Portuguese = 10, Malay = 11, Urdu = 12, Telugu = 13, Korean = 14 };
Expand All @@ -31,6 +34,9 @@ private void Awake()
data.isControllerHighlighted = true;
data.language = Language.English;
data.subtitleLanguage = Language.English;
data.subtitleHeightValue = 0.5f;
data.subtitleSizeValue = 0.5f;
data.subtitleWidthValue = 0.5f;
}
if (Instance != this)
{
Expand Down
Loading