Skip to content

Commit

Permalink
Make static texts not focusable, fix layout, apply AriaLive to the in…
Browse files Browse the repository at this point in the history
…tro texts
  • Loading branch information
DataTriny committed Jul 30, 2022
1 parent 78fe8d0 commit 217c41e
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 1 deletion.
Binary file modified Assets/Plugins/accesskit_unity_plugin.dll
Binary file not shown.
Binary file modified Assets/Prefabs/Content.prefab
Binary file not shown.
Binary file modified Assets/Scenes/Demo.unity
Binary file not shown.
2 changes: 1 addition & 1 deletion Assets/Scripts/AccessKit/AccessibleNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class AccessibleNode : MonoBehaviour
public DefaultActionVerb defaultActionVerb;
public bool canBeFocused
{
get { return focusable && !invisible && (role != AccessibleRole.staticText); }
get { return focusable && !invisible; }
}
public AriaLive live;

Expand Down
11 changes: 11 additions & 0 deletions Assets/Scripts/AccessKit/AriaLive.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;

namespace AccessKit
{
public enum AriaLive
{
off,
polite,
assertive
}
}
12 changes: 12 additions & 0 deletions Assets/Scripts/AccessKit/AriaLive.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions Assets/Scripts/Main/States/Intro/IntroTypedText.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using AccessKit;

[RequireComponent(typeof(Text))]
public class IntroTypedText : UIMonoBehaviour {
Expand All @@ -12,6 +13,10 @@ private Text text {
return GetComponent<Text>();
}
}
AccessibleNode accessibleNode
{
get { return GetComponent<AccessibleNode>(); }
}

private void OnEnable () {
TypedText.TypedTextSettings typedTextSettings = new TypedText.TypedTextSettings();
Expand All @@ -20,6 +25,7 @@ private void OnEnable () {

typedText = new TypedText();
typedText.TypeText(content, typedTextSettings);
typedText.OnCompleteTyping += CompleteTyping;
typedText.OnTypeText += OnTypeText;
text.text = "";

Expand All @@ -42,6 +48,11 @@ void OnTypeText (string newText) {
if(newText != " ")
AudioClipDatabase.Instance.PlayKeySound();
}
void CompleteTyping()
{
accessibleNode.live = AriaLive.polite;
}


private void Update () {
typedText.Loop();
Expand Down

0 comments on commit 217c41e

Please sign in to comment.