Skip to content

Commit 6f4fd9a

Browse files
author
Bianca Marina Stana
committed
Merge branch 'unite2025/lsp-uitk' into unite2025/screen-reader-improvements
2 parents db6f1ee + 9501ca3 commit 6f4fd9a

File tree

10 files changed

+138
-20
lines changed

10 files changed

+138
-20
lines changed

Assets/Localization/String Tables/Game Text Shared Data.asset

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ MonoBehaviour:
211211
m_Key: FONT_SCALE_LABEL
212212
m_Metadata:
213213
m_Items: []
214+
- m_Id: 3064538126606336
215+
m_Key: CORRECT_LABEL
216+
m_Metadata:
217+
m_Items: []
214218
m_Metadata:
215219
m_Items: []
216220
m_KeyGenerator:

Assets/Localization/String Tables/Game Text_ar.asset

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ MonoBehaviour:
7373
m_Metadata:
7474
m_Items: []
7575
- m_Id: 3801748762624
76-
m_Localized: "\u0633\u0647\u0644"
76+
m_Localized: "\u0633\u0647\u0644,\u0635\u0639\u0628"
7777
m_Metadata:
7878
m_Items: []
7979
- m_Id: 17127719464960
@@ -229,6 +229,10 @@ MonoBehaviour:
229229
m_Localized: "\u062D\u062C\u0645 \u0627\u0644\u062E\u0637"
230230
m_Metadata:
231231
m_Items: []
232+
- m_Id: 3064538126606336
233+
m_Localized: "\u0635\u062D\u064A\u062D"
234+
m_Metadata:
235+
m_Items: []
232236
references:
233237
version: 2
234238
RefIds:

Assets/Localization/String Tables/Game Text_en.asset

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ MonoBehaviour:
219219
m_Localized: Font Scale
220220
m_Metadata:
221221
m_Items: []
222+
- m_Id: 3064538126606336
223+
m_Localized: Correct
224+
m_Metadata:
225+
m_Items: []
222226
references:
223227
version: 2
224228
RefIds:

Assets/Localization/String Tables/Game Text_es.asset

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,10 @@ MonoBehaviour:
218218
m_Localized: "Tama\xF1o de fuente"
219219
m_Metadata:
220220
m_Items: []
221+
- m_Id: 3064538126606336
222+
m_Localized: Correcto
223+
m_Metadata:
224+
m_Items: []
221225
references:
222226
version: 2
223227
RefIds:

Assets/Localization/String Tables/Game Text_ja.asset

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@ MonoBehaviour:
217217
m_Localized: "\u30D5\u30A9\u30F3\u30C8\u30B5\u30A4\u30BA"
218218
m_Metadata:
219219
m_Items: []
220+
- m_Id: 3064538126606336
221+
m_Localized: "\u6B63\u3057\u3044"
222+
m_Metadata:
223+
m_Items: []
220224
references:
221225
version: 2
222226
RefIds:

Assets/Resources/UITk/MainView.uxml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</ui:VisualElement>
1414
<ui:VisualElement name="loginView" style="flex-grow: 1; align-items: center; justify-content: center;">
1515
<ui:VisualElement name="logo" class="lsp-logo"/>
16-
<ui:TextField placeholder-text="Enter your name" name="loginNameField" label="What is your name?" style="min-width: 252px; width: 949px;">
16+
<ui:TextField placeholder-text="Enter your name" name="loginNameField" label="What is your name?" language-direction="LTR" style="min-width: 252px; width: 949px;">
1717
<Bindings>
1818
<ui:DataBinding property="value" data-source-path="userName" binding-mode="TwoWay"/>
1919
<UnityEngine.Localization.LocalizedString property="placeholderText" table="GUID:cc1d194facb1d9d4380a9ea2032c10ca" entry="Id(775025750016)"/>
@@ -51,13 +51,17 @@
5151
</ui:Button>
5252
</ui:VisualElement>
5353
</ui:VisualElement>
54-
<ui:VisualElement name="gameView" style="flex-grow: 1; background-color: rgb(11, 163, 109);">
54+
<ui:VisualElement name="gameView" style="flex-grow: 1; background-color: rgb(2, 197, 132);">
5555
<ui:VisualElement name="logo" class="lsp-logo"/>
5656
<ui:VisualElement name="clueContainer">
5757
<ui:Label text="#clue" name="clueLabel" class="title-text" style="-unity-text-align: middle-center;"/>
5858
<ui:VisualElement name="successPill">
5959
<ui:VisualElement name="successPillCheckmark"/>
60-
<ui:Label text="Correct" class="success-pill__label"/>
60+
<ui:Label class="success-pill__label">
61+
<Bindings>
62+
<UnityEngine.Localization.LocalizedString property="text" table="GUID:cc1d194facb1d9d4380a9ea2032c10ca" entry="Id(3064538126606336)"/>
63+
</Bindings>
64+
</ui:Label>
6165
</ui:VisualElement>
6266
</ui:VisualElement>
6367
<Unity.Samples.LetterSpell.CardListView name="letterCardContainer" style="flex-grow: 1;"/>
@@ -97,7 +101,7 @@
97101
<UnityEngine.Localization.LocalizedString property="text" table="GUID:cc1d194facb1d9d4380a9ea2032c10ca" entry="Id(3051354222592)"/>
98102
</Bindings>
99103
</ui:Label>
100-
<ui:TextField label="Username" placeholder-text="Enter your name" name="settingsUserNameField">
104+
<ui:TextField label="Username" placeholder-text="Enter your name" name="settingsUserNameField" language-direction="LTR">
101105
<Bindings>
102106
<ui:DataBinding property="value" data-source-path="userName" binding-mode="TwoWay"/>
103107
<UnityEngine.Localization.LocalizedString property="label" table="GUID:cc1d194facb1d9d4380a9ea2032c10ca" entry="Id(3183403495424)"/>
@@ -111,7 +115,7 @@
111115
<UnityEngine.Localization.LocalizedStringList property="choices" table="GUID:cc1d194facb1d9d4380a9ea2032c10ca" entry="Id(3801748762624)"/>
112116
</Bindings>
113117
</lsp:ButtonStripField>
114-
<ui:VisualElement name="settingsNumberOfWords" class="unity-base-field" style="flex-direction: row;">
118+
<ui:VisualElement name="settingsNumberOfWords" class="unity-base-field">
115119
<ui:Label name="Label" class="unity-base-field__label">
116120
<Bindings>
117121
<UnityEngine.Localization.LocalizedString property="text" table="GUID:cc1d194facb1d9d4380a9ea2032c10ca" entry="Id(17127719464960)"/>

Assets/Resources/UITk/Themes/GreenStyle/GreenStyle.tss

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,30 @@
44

55
:root {
66
font-size: 64px;
7+
-unity-text-generator: advanced
78
}
89

10+
:root {
11+
--lsp-row: row;
12+
--lsp-row-reverse: row-reverse;
13+
--lsp-left: left;
14+
--lsp-middle-left: middle-left;
15+
--lsp-right: right;
16+
--lsp-middle-right: middle-right;
17+
}
918

1019
:root.bold-text {
11-
-unity-font-style: bold
20+
-unity-font-style: bold;
21+
}
22+
23+
:root.lsp-dir-rtl {
24+
--lsp-row: row-reverse;
25+
--lsp-row-reverse: row;
26+
--lsp-left: right;
27+
--lsp-middle-left: middle-right;
28+
--lsp-right: left;
29+
--lsp-middle-right: middle-left;
30+
-unity-text-align: right;
1231
}
1332

1433
/* Dropdown */

Assets/Resources/UITk/Themes/LetterSpellTheme.uss

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,11 @@
217217
padding-left: 70px;
218218
}
219219

220+
.unity-label,
221+
.unity-base-field__label {
222+
-unity-text-align: var(--lsp-middle-left);
223+
}
224+
220225
.unity-base-field__label {
221226
min-width: 680px;
222227
}
@@ -230,7 +235,6 @@
230235
}
231236

232237
.unity-base-field__label {
233-
-unity-text-align: middle-left;
234238
margin-right: 30px;
235239
}
236240

@@ -272,6 +276,9 @@
272276
background-color: rgb(161, 116, 244);
273277
}
274278

279+
.unity-toggle__input {
280+
flex-direction: var(--lsp-row);
281+
}
275282
.unity-toggle__checkmark {
276283
background-color: rgba(0, 0, 0, 0);
277284
border-left-color: rgb(0, 0, 0);
@@ -290,6 +297,7 @@
290297
width: 50px;
291298
height: 50px;
292299
margin-right: 30px;
300+
margin-left: 30px;
293301
}
294302

295303
.unity-base-slider__tracker {
@@ -340,6 +348,11 @@
340348
border-bottom-left-radius: 30px;
341349
padding-top: 30px;
342350
padding-bottom: 30px;
351+
flex-direction: var(--lsp-row);
352+
}
353+
354+
.unity-base-popup-field__text {
355+
-unity-text-align: var(--lsp-middle-left);
343356
}
344357

345358
.unity-base-text-field__input--placeholder {
@@ -433,8 +446,12 @@
433446
margin-bottom: 30px;
434447
}
435448

449+
.unity-base-field {
450+
flex-direction: var(--lsp-row);
451+
}
452+
436453
.lsp-button-strip-field__button-container {
437-
flex-direction: row;
454+
flex-direction: var(--lsp-row);
438455
}
439456

440457
.lsp-button-strip-field__button {
@@ -450,20 +467,34 @@
450467
background-color: rgb(116, 45, 243);
451468
}
452469

453-
.lsp-button-strip-field__button--left {
470+
.lsp-dir-ltr .lsp-button-strip-field__button--left {
454471
margin-right: 0;
455472
border-right-width: 5px;
456473
border-top-right-radius: 0;
457474
border-bottom-right-radius: 0;
458475
}
459476

460-
.lsp-button-strip-field__button--right {
477+
.lsp-dir-rtl .lsp-button-strip-field__button--left{
478+
margin-left: 0;
479+
border-left-width: 5px;
480+
border-top-left-radius: 0;
481+
border-bottom-left-radius: 0;
482+
}
483+
484+
.lsp-dir-ltr .lsp-button-strip-field__button--right {
461485
border-top-left-radius: 0;
462486
border-bottom-left-radius: 0;
463487
border-left-width: 5px;
464488
margin-left: 0;
465489
}
466490

491+
.lsp-dir-rtl .lsp-button-strip-field__button--right {
492+
margin-right: 0;
493+
border-right-width: 5px;
494+
border-top-right-radius: 0;
495+
border-bottom-right-radius: 0;
496+
}
497+
467498
.lsp-button-strip-field__button:checked {
468499
background-color: rgb(116, 45, 243);
469500
}
@@ -475,7 +506,7 @@
475506
}
476507

477508
.unity-radio-button {
478-
flex-direction: row-reverse;
509+
flex-direction: var(--lsp-row-reverse);
479510
margin-top: 0;
480511
margin-bottom: 0;
481512
}
@@ -488,13 +519,14 @@
488519
width: 50px;
489520
height: 50px;
490521
margin-right: 30px;
522+
margin-left: 30px;
491523
background-image: url("project://database/Assets/UI/Images/Dropdown-Arrow.png?fileID=2800000&guid=29e091d0e13ce4d928a786bc1ff99351&type=3#Dropdown-Arrow");
492524
margin-top: 14px;
493525
margin-bottom: 14px;
494526
}
495527

496528
.row {
497-
flex-direction: row;
529+
flex-direction: var(--lsp-row);
498530
}
499531

500532
#closeSettingsButton {
@@ -554,7 +586,7 @@
554586
padding-top: 4px;
555587
padding-bottom: 4px;
556588
-unity-font-definition: url("project://database/Assets/UI/Fonts/Inter-SemiBold.ttf?fileID=12800000&guid=3b458681b475c476ea29f3244c5c85da&type=3#Inter-SemiBold");
557-
flex-direction: row;
589+
flex-direction: var(--lsp-row);
558590
justify-content: center;
559591
align-items: center;
560592
}

Assets/Scripts/Gameplay/Gameplay.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ public enum DifficultyLevel
3535

3636
public static Gameplay instance;
3737

38+
/// <summary>
39+
/// Indicates whether the game is played right to left (for example for Arabic or Hebrew).
40+
/// </summary>
41+
public bool rightToLeft { get; set; }
42+
3843
/// <summary>
3944
/// The database of words.
4045
/// </summary>
@@ -358,7 +363,22 @@ IEnumerator DelayStartGame()
358363
/// </summary>
359364
public bool IsWordComplete()
360365
{
361-
return m_Words[m_CurrentWordIndex].word.SequenceEqual(m_CurrentWordState);
366+
var word = currentWord.word;
367+
368+
if (word.Length != this.m_CurrentWordState.Length)
369+
{
370+
return false;
371+
}
372+
373+
for (var i = 0; i < word.Length; i++)
374+
{
375+
if (word[rightToLeft ? word.Length - 1 - i : i] != m_CurrentWordState[i])
376+
{
377+
return false;
378+
}
379+
}
380+
381+
return true;
362382
}
363383

364384
/// <summary>

Assets/Scripts/UITk/MainView.cs

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ public float musicVolume
131131
}
132132

133133
PlayerPrefs.SetFloat(k_MusicPref, value);
134+
135+
if (AudioManager.instance != null)
136+
{
137+
AudioManager.instance.SetMusicVolume(value);
138+
}
134139
Notify();
135140
}
136141
}
@@ -217,6 +222,8 @@ class MainView : MonoBehaviour
217222
Button m_InGameSettingsButton;
218223
VisualElement m_LastView;
219224
LetterCardListModel m_Model = new();
225+
226+
// Label m_AnswerLabel;
220227

221228
Gameplay.DifficultyLevel m_SelectedDifficultyLevel = Gameplay.DifficultyLevel.Hard;
222229

@@ -436,14 +443,29 @@ void SetupUI()
436443
m_PlayerSettings.Notify("boldTextEnabledText");
437444
m_PlayerSettings.Notify("closedCaptionsEnabledText");
438445

439-
// Update text direction
440-
if (loc.Identifier.CultureInfo.TextInfo.IsRightToLeft)
441-
root.languageDirection = LanguageDirection.RTL;
442-
else
443-
root.languageDirection = LanguageDirection.LTR;
446+
UpdateLangDirection(root);
444447
};
445448

449+
UpdateLangDirection(root);
446450
ShowSplash();
451+
452+
//root.Add(m_AnswerLabel = new Label());
453+
//m_AnswerLabel.style.position = Position.Absolute;
454+
455+
}
456+
457+
void UpdateLangDirection(VisualElement root)
458+
{
459+
if (root.panel == null)
460+
return;
461+
462+
bool isRightToLeft = LocalizationSettings.SelectedLocale?.Identifier.CultureInfo.TextInfo.IsRightToLeft ?? false;
463+
464+
// Update text direction
465+
root.languageDirection = isRightToLeft ? LanguageDirection.RTL : LanguageDirection.LTR;
466+
root.panel.visualTree.EnableInClassList("lsp-dir-ltr", !isRightToLeft);
467+
root.panel.visualTree.EnableInClassList("lsp-dir-rtl", isRightToLeft);
468+
gameplay.rightToLeft = isRightToLeft;
447469
}
448470

449471
void OnEnable()
@@ -520,6 +542,7 @@ public void ShowNextWord()
520542
DelayStateTheLetters();
521543
}
522544

545+
//m_AnswerLabel.text = gameplay.currentWord.word;
523546
AccessibilityManager.GetService<UITkAccessibilityService>()?.RebuildHierarchy();
524547
}
525548

0 commit comments

Comments
 (0)