Files
Studio/Assets/NewStudioPGD/Scripts/UI/Element/UI_AppSettingItem.cs

40 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using TMPro;
using UnityEngine.UI;
using XRLib.UI;
namespace Studio.UI
{
public class UI_AppSettingItem : UIBase
{
public TMP_InputField InputField_Type;
public TMP_InputField InputField_Value;
public TMP_Dropdown Dropdown;
public Button Button_Remove;
public enum EType
{
APIDomain,
APIPort,
API,
MQTTDomain,
MQTTPort
}
private void Awake()
{
InputField_Type = transform.GetComponentsInChildren<TMP_InputField>().FirstOrDefault(x => x.name == nameof(InputField_Type));
InputField_Value = transform.GetComponentsInChildren<TMP_InputField>().FirstOrDefault(x => x.name == nameof(InputField_Value));
Dropdown = transform.GetComponentInChildren<TMP_Dropdown>();
Button_Remove = transform.GetComponentInChildren<Button>();
Button_Remove.onClick.AddListener(() => Destroy(gameObject));
List<string> options = Enum.GetNames(typeof(EType)).ToList();
Dropdown.ClearOptions();
Dropdown.AddOptions(options);
}
}
}