Skip to content

Commit 6a16041

Browse files
author
Bianca Marina Stana
committed
Cleaned up code
1 parent a249936 commit 6a16041

File tree

5 files changed

+12
-39
lines changed

5 files changed

+12
-39
lines changed

Assets/Resources/UITk/MainView.uxml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<ui:VisualElement name="logo" class="lsp-logo"/>
1616
<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>
18-
<ui:DataBinding property="value" data-source-path="userName" binding-mode="TwoWay"/>
18+
<ui:DataBinding property="value" data-source-path="username" binding-mode="TwoWay"/>
1919
<UnityEngine.Localization.LocalizedString property="placeholderText" table="GUID:cc1d194facb1d9d4380a9ea2032c10ca" entry="Id(775025750016)"/>
2020
<UnityEngine.Localization.LocalizedString property="label" table="GUID:cc1d194facb1d9d4380a9ea2032c10ca" entry="Id(405763420160)"/>
2121
</Bindings>
@@ -103,7 +103,7 @@
103103
</ui:Label>
104104
<ui:TextField label="Username" placeholder-text="Enter your name" name="settingsUserNameField" language-direction="LTR">
105105
<Bindings>
106-
<ui:DataBinding property="value" data-source-path="userName" binding-mode="TwoWay"/>
106+
<ui:DataBinding property="value" data-source-path="username" binding-mode="TwoWay"/>
107107
<UnityEngine.Localization.LocalizedString property="label" table="GUID:cc1d194facb1d9d4380a9ea2032c10ca" entry="Id(3183403495424)"/>
108108
<UnityEngine.Localization.LocalizedString property="placeholderText" table="GUID:cc1d194facb1d9d4380a9ea2032c10ca" entry="Id(775025750016)"/>
109109
</Bindings>
@@ -121,13 +121,13 @@
121121
<UnityEngine.Localization.LocalizedString property="text" table="GUID:cc1d194facb1d9d4380a9ea2032c10ca" entry="Id(17127719464960)"/>
122122
</Bindings>
123123
</ui:Label>
124-
<ui:RadioButton label="3" name="settingsThreeWordsButton" value="true">
124+
<ui:RadioButton label="Three" name="settingsThreeWordsButton" value="true">
125125
<Bindings>
126126
<ui:DataBinding property="value" data-source-path="isThreeWords" binding-mode="TwoWay"/>
127127
<UnityEngine.Localization.LocalizedString property="label" table="GUID:cc1d194facb1d9d4380a9ea2032c10ca" entry="Id(17263564582912)"/>
128128
</Bindings>
129129
</ui:RadioButton>
130-
<ui:RadioButton label="6" name="settingsSixWordsButton">
130+
<ui:RadioButton label="Six" name="settingsSixWordsButton">
131131
<Bindings>
132132
<ui:DataBinding property="value" data-source-path="isSixWords" binding-mode="TwoWay"/>
133133
<UnityEngine.Localization.LocalizedString property="label" table="GUID:cc1d194facb1d9d4380a9ea2032c10ca" entry="Id(17369965686784)"/>
@@ -136,7 +136,7 @@
136136
</ui:VisualElement>
137137
<ui:Toggle label="Show Spelling Clues" name="settingsShowSpellingClues">
138138
<Bindings>
139-
<ui:DataBinding property="value" data-source-path="showsSpellingClues" binding-mode="TwoWay"/>
139+
<ui:DataBinding property="value" data-source-path="showSpellingClues" binding-mode="TwoWay"/>
140140
<UnityEngine.Localization.LocalizedString property="label" table="GUID:cc1d194facb1d9d4380a9ea2032c10ca" entry="Id(17491977990144)"/>
141141
<UnityEngine.Localization.LocalizedString property="text" table="GUID:cc1d194facb1d9d4380a9ea2032c10ca" entry="Id(1784705072656384)"/>
142142
</Bindings>

Assets/Scripts/Gameplay/GameViewController.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ class GameViewController : MonoBehaviour
4545
/// </summary>
4646
LetterCard m_AccessibilitySelectedCard;
4747

48-
/// <summary>
49-
/// Keeps track of whether the hierarchy was refreshed using AccessibilityManager.RefreshHierarchy();
50-
/// </summary>
51-
bool m_WasHierarchyRefreshed;
52-
5348
void OnEnable()
5449
{
5550
m_Model.letterCardsChanged += OnLetterCardsChanged;
@@ -264,13 +259,6 @@ void MoveSelectedCard()
264259
return;
265260
}
266261

267-
// Don't move the card if the focus change occurred because of a hierarchy rebuild.
268-
if (m_WasHierarchyRefreshed)
269-
{
270-
m_WasHierarchyRefreshed = false;
271-
return;
272-
}
273-
274262
// If we reach this code, it means we're dragging the card.
275263
var selectedCardIndex = m_AccessibilitySelectedCard.transform.GetSiblingIndex();
276264
var focusedCardIndex = m_AccessibilityFocusedCard.transform.GetSiblingIndex();

Assets/Scripts/Screen Reader/UITk/Handlers/BasePopupFieldHandler.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ protected override void UnbindFromElement(VisualElement element)
5151
void OnNavigationSubmit(NavigationSubmitEvent evt)
5252
{
5353
OnScreenDebug.Log("Submit event received by " + ownerElement.name);
54+
5455
ScheduledCheckForOpenedPopupMenu();
5556
}
5657

Assets/Scripts/Screen Reader/UITk/Handlers/VisualElementAccessibilityHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public bool isActive
7373
{
7474
if (m_OwnerElement != null)
7575
{
76-
// If the node is disabled or hidden then it is set as inactive regardless of
76+
// If the node is disabled or hidden, then it is set as inactive regardless of
7777
// AccessibilityProperties.isActive.
7878
if (IsElementVisible(m_OwnerElement))
7979
{

Assets/Scripts/UITk/MainView.cs

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ class PlayerSettingsData : INotifyBindablePropertyChanged
2525
const string k_DisplaySizePref = "DisplaySize";
2626

2727
[CreateProperty]
28-
public string userName
28+
public string username
2929
{
3030
get => PlayerPrefs.GetString(k_UsernamePref);
3131
set
3232
{
33-
if (userName == value)
33+
if (username == value)
3434
{
3535
return;
3636
}
@@ -88,12 +88,12 @@ public int wordsCount
8888
}
8989

9090
[CreateProperty]
91-
public bool showsSpellingClues
91+
public bool showSpellingClues
9292
{
9393
get => PlayerPrefs.GetInt(k_CluePref, 0) == 1;
9494
set
9595
{
96-
if (showsSpellingClues == value)
96+
if (showSpellingClues == value)
9797
{
9898
return;
9999
}
@@ -291,11 +291,6 @@ UITkLetterCard accessibilityFocusedCard
291291
}
292292
}
293293

294-
/// <summary>
295-
/// Keeps track of whether the hierarchy was refreshed using AccessibilityManager.RefreshHierarchy();
296-
/// </summary>
297-
bool m_WasHierarchyRefreshed;
298-
299294
public readonly float splashScreenDuration = 8; // 4000;
300295

301296
/// <summary>
@@ -625,7 +620,7 @@ public void OnCurrentWordIndexChanged(int index)
625620

626621
void ShowOrHideClue()
627622
{
628-
m_ClueLabel.style.visibility = m_PlayerSettings.showsSpellingClues ?
623+
m_ClueLabel.style.visibility = m_PlayerSettings.showSpellingClues ?
629624
Visibility.Visible : Visibility.Hidden;
630625
}
631626

@@ -667,10 +662,6 @@ void UpdateSearchField()
667662
field.parent.style.display = DisplayStyle.None;
668663
}
669664
}
670-
671-
// Refresh the hierarchy to ensure the screen reader is aware of the changes.
672-
//AccessibilityManager.GetService<UITkAccessibilityService>()?.RebuildHierarchy();
673-
//m_WasHierarchyRefreshed = true;
674665
}
675666

676667
/// <summary>
@@ -766,13 +757,6 @@ void MoveSelectedCardOnAssistedFocus()
766757
return;
767758
}
768759

769-
// Don't move the card if the focus change occurred because of a hierarchy rebuild.
770-
if (m_WasHierarchyRefreshed)
771-
{
772-
m_WasHierarchyRefreshed = false;
773-
return;
774-
}
775-
776760
// If we reach this code, it means we're dragging the card.
777761
var selectedCardIndex = m_LetterCardContainer.IndexOf(m_LetterCardContainer.selectedCard);
778762
var focusedCardIndex = m_LetterCardContainer.IndexOf(accessibilityFocusedCard);

0 commit comments

Comments
 (0)