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 description: None
axisConstraint: 0 axisConstraint: 0
- localizationKey: - localizationKey:
keyword: Hello keyword: Service
keyCode: 0 keyCode: 0
action: action:
id: 0 id: 0

View File

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