Synchronise Twitch Events to your Phillips Hue Lights
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Twitchue/Assets/Scripts/HueBridgeShower.cs

34 lines
904 B

4 years ago
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using TMPro;
using UnityEngine;
public class HueBridgeShower : MonoBehaviour
{
[SerializeField] private TMP_Dropdown dropdown;
private void Awake()
{
if(dropdown == null)
{
dropdown = GetComponent<TMP_Dropdown>();
}
dropdown.ClearOptions();
dropdown.AddOptions(new List<string> { "" });
}
private void LateUpdate()
{
if(GameManager.Instance.FoundBridges != null && GameManager.Instance.FoundBridges.Any())
{
dropdown.AddOptions(GameManager.Instance.FoundBridges.Select(x=>$"{x.IpAddress}: {x.BridgeId}").ToList());
this.enabled = false;
}
}
public void DropdownChanged(int index)
{
GameManager.Instance.SetCurrentBridge(GameManager.Instance.FoundBridges[index - 1]);
}
}