Skip to content

Commit 9501ca3

Browse files
committed
Fixed the check for word completed in Arabic. Fixed the correct work.
Fixed the music settings not affected the actual sound
1 parent 8985ae7 commit 9501ca3

File tree

9 files changed

+71
-14
lines changed

9 files changed

+71
-14
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: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@
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;"/>

Assets/Resources/UITk/Themes/LetterSpellTheme.uss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@
586586
padding-top: 4px;
587587
padding-bottom: 4px;
588588
-unity-font-definition: url("project://database/Assets/UI/Fonts/Inter-SemiBold.ttf?fileID=12800000&guid=3b458681b475c476ea29f3244c5c85da&type=3#Inter-SemiBold");
589-
flex-direction: row;
589+
flex-direction: var(--lsp-row);
590590
justify-content: center;
591591
align-items: center;
592592
}

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: 23 additions & 10 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,24 +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;
444-
UpdateUSSLangDirection(root);
446+
UpdateLangDirection(root);
445447
};
446448

447-
UpdateUSSLangDirection(root);
449+
UpdateLangDirection(root);
448450
ShowSplash();
451+
452+
//root.Add(m_AnswerLabel = new Label());
453+
//m_AnswerLabel.style.position = Position.Absolute;
454+
449455
}
450456

451-
void UpdateUSSLangDirection(VisualElement root)
457+
void UpdateLangDirection(VisualElement root)
452458
{
453459
if (root.panel == null)
454460
return;
455-
root.panel.visualTree.EnableInClassList("lsp-dir-ltr", LocalizationSettings.SelectedLocale?.Identifier.CultureInfo.TextInfo.IsRightToLeft == false);
456-
root.panel.visualTree.EnableInClassList("lsp-dir-rtl", LocalizationSettings.SelectedLocale?.Identifier.CultureInfo.TextInfo.IsRightToLeft == true);
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;
457469
}
458470

459471
void OnEnable()
@@ -530,6 +542,7 @@ public void ShowNextWord()
530542
DelayStateTheLetters();
531543
}
532544

545+
//m_AnswerLabel.text = gameplay.currentWord.word;
533546
AccessibilityManager.GetService<UITkAccessibilityService>()?.RebuildHierarchy();
534547
}
535548

0 commit comments

Comments
 (0)