앱 설정 모달
This commit is contained in:
39
Assets/NewStudioPGD/Scripts/UI/Element/UI_AppSettingItem.cs
Normal file
39
Assets/NewStudioPGD/Scripts/UI/Element/UI_AppSettingItem.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine.UI;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace XED.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a3bb371cc7ac46f4ea9d3afec9ab2a6e
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XRLib.UI;
|
||||
|
||||
@@ -12,22 +13,23 @@ namespace XED.UI
|
||||
public TMP_Dropdown Dropdown;
|
||||
public Button Button_Remove;
|
||||
|
||||
public enum EType
|
||||
{
|
||||
String,
|
||||
Int,
|
||||
Boolean,
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
InputField = transform.Find(nameof(InputField)).GetComponent<TMP_InputField>();
|
||||
Dropdown = transform.Find (nameof(Dropdown)).GetComponent<TMP_Dropdown>();
|
||||
Button_Remove = transform.Find(nameof(Button_Remove)).GetComponent<Button>();
|
||||
Button_Remove.onClick.AddListener(OnClickRemove);
|
||||
Button_Remove.onClick.AddListener(() => Destroy(gameObject));
|
||||
|
||||
List<string> options = new List<string> { "String", "Int", "Boolean" };
|
||||
List<string> options = Enum.GetNames(typeof(EType)).ToList();
|
||||
Dropdown.ClearOptions();
|
||||
Dropdown.AddOptions(options);
|
||||
}
|
||||
|
||||
private void OnClickRemove()
|
||||
{
|
||||
print("remove");
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user