Add service speech command

This commit is contained in:
Santiago Lo Coco 2024-11-03 16:17:35 +01:00
parent 2b80596cba
commit a1f5323758
2 changed files with 15 additions and 1 deletions

View File

@ -38,7 +38,7 @@ MonoBehaviour:
description: None
axisConstraint: 0
- localizationKey:
keyword: Hello
keyword: Service
keyCode: 0
action:
id: 0

View File

@ -16,6 +16,8 @@ public class ServicesListPopulator : MonoBehaviour
[SerializeField]
private GridObjectCollection gridObjectCollection;
private bool isVisible = true;
public void AddItemFromService(MdnsService service, Action action)
{
GameObject itemInstance = Instantiate(dynamicItem, gridObjectCollection.transform);
@ -29,8 +31,20 @@ public class ServicesListPopulator : MonoBehaviour
{
Debug.Log($"Clicked on service: {service.Host}");
action.Invoke();
ToggleVisibility();
});
gridObjectCollection.UpdateCollection();
scrollView.UpdateContent();
}
public void ToggleVisibility()
{
isVisible = !isVisible;
foreach (Renderer renderer in GetComponentsInChildren<Renderer>())
{
renderer.enabled = isVisible;
}
}
}