48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
using System;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using XED.Util;
|
|
using XRLib.UI;
|
|
|
|
namespace XED.UI
|
|
{
|
|
public class UI_InterferedObjectButton : UIBase
|
|
{
|
|
[SerializeField]
|
|
Button Button_Object1;
|
|
[SerializeField]
|
|
Button Button_Object2;
|
|
|
|
TwinObject interferedTwinObject1;
|
|
TwinObject interferedTwinObject2;
|
|
|
|
public event Action<TwinObject> OnClickButton;
|
|
|
|
private void Awake()
|
|
{
|
|
Button_Object1.onClick.AddListener(() => OnButtonClick(interferedTwinObject1));
|
|
Button_Object2.onClick.AddListener(() => OnButtonClick(interferedTwinObject2));
|
|
|
|
OnClickButton += FindSingle<CameraManager>().MoveToTwinObjectPos;
|
|
}
|
|
|
|
public void Initialize(TwinObject obj1, TwinObject obj2)
|
|
{
|
|
interferedTwinObject1 = obj1;
|
|
interferedTwinObject2 = obj2;
|
|
|
|
string objectModelName1 = obj1.metaData.modeling.name;
|
|
string objectModelName2 = obj2.metaData.modeling.name;
|
|
|
|
Button_Object1.GetComponentInChildren<TextMeshProUGUI>().text = objectModelName1;
|
|
Button_Object2.GetComponentInChildren<TextMeshProUGUI>().text = objectModelName2;
|
|
}
|
|
|
|
void OnButtonClick(TwinObject obj)
|
|
{
|
|
OnClickButton?.Invoke(obj);
|
|
}
|
|
}
|
|
}
|