Files
Studio/Assets/NewStudioPGD/Scripts/UI/Panel/Panel_AppSetting.cs

52 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using XRLib.UI;
namespace Studio.UI
{
public class Panel_AppSetting : PanelBase
{
private GameObject itemPrefab;
private List<GameObject> items = new();
private RectTransform Info;
public Button Button_Add;
public Button Button_Save;
public Action onRemove;
public override void AfterAwake()
{
itemPrefab = Resources.Load<GameObject>("Prefabs/UI/PRF_AppSettingItem");
Button_Add.onClick.AddListener(AddItem);
Button_Save.onClick.AddListener(OnClickSave);
AddItem();
}
private void AddItem()
{
GameObject item = Instantiate(itemPrefab, Info);
item.transform.SetSiblingIndex(Info.childCount - 2);
items.Add(item);
}
private void Init()
{
foreach (GameObject item in items)
{
Destroy(item);
}
items.Clear();
}
private void OnClickSave()
{
}
}
}