85 lines
2.9 KiB
C#
85 lines
2.9 KiB
C#
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using TMPro;
|
|
using Unity.XR.CoreUtils;
|
|
|
|
public enum PopupResponse
|
|
{
|
|
InsConfirm, // 기록 확정
|
|
ModConfirm, // 수정 확정
|
|
Move, // 여기로 이동
|
|
Delete, // 삭제
|
|
DelConfirm, // 삭제 확정
|
|
Cancel // 취소
|
|
}
|
|
|
|
public interface IPopupView
|
|
{
|
|
}
|
|
|
|
public class PopupView : MonoBehaviour, IPopupView
|
|
{
|
|
public event Action<PopupResponse> OnPopupResponse;
|
|
|
|
[SerializeField] private GameObject confirmPopupPanel;
|
|
[SerializeField] private GameObject modifyPopupPanel;
|
|
[SerializeField] private GameObject deletePopupPanel;
|
|
[SerializeField] private GameObject optionPopupPanel;
|
|
|
|
[SerializeField] private Button ins_confirmButton; // '기록확정' 버튼
|
|
[SerializeField] private Button mod_confirmButton; // '수정확정' 버튼
|
|
[SerializeField] private Button moveButton; // '이동' 버튼
|
|
[SerializeField] private Button deleteButton; // '삭제' 버튼
|
|
[SerializeField] private Button del_confirmButton; // '삭제확정' 버튼
|
|
[SerializeField] private Button[] cancelButton; // '취소' 버튼
|
|
|
|
void Start()
|
|
{
|
|
ins_confirmButton.onClick.AddListener(() => OnPopupResponse?.Invoke(PopupResponse.InsConfirm));
|
|
mod_confirmButton.onClick.AddListener(() => OnPopupResponse?.Invoke(PopupResponse.ModConfirm));
|
|
moveButton.onClick.AddListener(() => OnPopupResponse?.Invoke(PopupResponse.Move));
|
|
deleteButton.onClick.AddListener(() => OnPopupResponse?.Invoke(PopupResponse.Delete));
|
|
del_confirmButton.onClick.AddListener(() => OnPopupResponse?.Invoke(PopupResponse.DelConfirm));
|
|
for (int i = 0; i < cancelButton.Length; i++)
|
|
cancelButton[i].onClick.AddListener(() => OnPopupResponse?.Invoke(PopupResponse.Cancel));
|
|
|
|
confirmPopupPanel.SetActive(false);
|
|
modifyPopupPanel.SetActive(false);
|
|
deletePopupPanel.SetActive(false);
|
|
optionPopupPanel.SetActive(false);
|
|
}
|
|
|
|
public void ShowConfirmPopup(Transform popPose)
|
|
{
|
|
confirmPopupPanel.transform.SetPositionAndRotation(popPose.position, Quaternion.identity);
|
|
confirmPopupPanel.SetActive(true);
|
|
}
|
|
|
|
public void ShowModifyPopup(Transform popPose)
|
|
{
|
|
modifyPopupPanel.transform.SetPositionAndRotation(popPose.position, Quaternion.identity);
|
|
modifyPopupPanel.SetActive(true);
|
|
}
|
|
|
|
public void ShowDeletePopup(Transform popPose)
|
|
{
|
|
deletePopupPanel.transform.SetPositionAndRotation(popPose.position, Quaternion.identity);
|
|
deletePopupPanel.SetActive(true);
|
|
}
|
|
|
|
public void ShowOptionPopup(Transform popPose)
|
|
{
|
|
optionPopupPanel.transform.SetPositionAndRotation(popPose.position, Quaternion.identity);
|
|
optionPopupPanel.SetActive(true);
|
|
}
|
|
|
|
public void HidePopup()
|
|
{
|
|
confirmPopupPanel.SetActive(false);
|
|
modifyPopupPanel.SetActive(false);
|
|
deletePopupPanel.SetActive(false);
|
|
optionPopupPanel.SetActive(false);
|
|
}
|
|
}
|