1
0
mirror of synced 2024-12-18 17:25:54 +01:00
WACVR/Assets/Script/Essential/DropdownPopulateList.cs

44 lines
1.3 KiB
C#
Raw Normal View History

2022-11-05 01:32:17 +01:00
using System.Linq;
using System.Collections.Generic;
using System;
using UnityEngine;
using TMPro;
using WindowsInput.Native;
public class DropdownPopulateList : MonoBehaviour
{
TMP_Dropdown Dropdown;
public CEnum.listType ListType = CEnum.listType.VirtualKeyCode;
[ExecuteAlways]
void Awake()
{
PopulateList();
}
void PopulateList()
{
Dropdown = GetComponent<TMP_Dropdown>();
2022-11-05 01:32:17 +01:00
Dropdown.ClearOptions();
List<string> keyNames = new List<string>();
switch (ListType)
{
case CEnum.listType.VirtualKeyCode:
keyNames = Enum.GetNames(typeof(VirtualKeyCode)).ToList();
break;
case CEnum.listType.captureMode:
keyNames = Enum.GetNames(typeof(CEnum.captureMode)).ToList();
break;
case CEnum.listType.spectatorMode:
keyNames = Enum.GetNames(typeof(CEnum.spectatorMode)).ToList();
break;
case CEnum.listType.FPS:
keyNames = Enum.GetNames(typeof(CEnum.FPS)).ToList();
break;
case CEnum.listType.handStabilization:
keyNames = Enum.GetNames(typeof(CEnum.handStabilization)).ToList();
break;
}
Dropdown.AddOptions(keyNames);
}
}