50 lines
1.5 KiB
C#
50 lines
1.5 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using Studio.Manage;
|
|
using Studio.Util;
|
|
using XRLib;
|
|
using XRLib.UI;
|
|
|
|
namespace Studio.UI
|
|
{
|
|
public class Panel_InterferedObjectList : PanelBase
|
|
{
|
|
Button Button_Close;
|
|
RectTransform content;
|
|
GameObject buttonPrefab;
|
|
|
|
Dictionary<(TwinObject, TwinObject), UI_InterferedObjectButton> createdButtons = new();
|
|
|
|
CameraManager cameraManager;
|
|
|
|
public override void AfterAwake()
|
|
{
|
|
Button_Close.onClick.AddListener(OnClickClose);
|
|
content = GetComponentInChildren<ScrollRect>().content;
|
|
buttonPrefab = Resources.Load<GameObject>("Prefabs/UI/PRF_InterferedObjectButton");
|
|
|
|
cameraManager = ManagerHub.instance.Get<CameraManager>();
|
|
}
|
|
|
|
public void CreateContentButton((TwinObject, TwinObject) pair)
|
|
{
|
|
var newButton = Object.Instantiate(buttonPrefab, content).GetComponent<UI_InterferedObjectButton>();
|
|
//newButton.OnClickButton += cameraManager.MoveToTwinObjectPos;
|
|
newButton.Initialize(pair.Item1, pair.Item2);
|
|
createdButtons.Add(pair, newButton);
|
|
}
|
|
|
|
public void RemoveContentButton((TwinObject, TwinObject) pair)
|
|
{
|
|
Destroy(createdButtons[pair].gameObject);
|
|
createdButtons.Remove(pair);
|
|
}
|
|
|
|
private void OnClickClose()
|
|
{
|
|
gameObject.SetActive(false);
|
|
}
|
|
}
|
|
}
|