2025-10-30 09:31:05 +09:00
|
|
|
|
using System;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.UI;
|
2025-11-19 18:38:48 +09:00
|
|
|
|
using System.Collections;
|
2025-10-30 09:31:05 +09:00
|
|
|
|
|
|
|
|
|
|
public enum PopupResponse
|
|
|
|
|
|
{
|
2025-11-06 20:14:27 +09:00
|
|
|
|
InsConfirm, // <20><><EFBFBD><EFBFBD> Ȯ<><C8AE>
|
|
|
|
|
|
ModConfirm, // <20><><EFBFBD><EFBFBD> Ȯ<><C8AE>
|
|
|
|
|
|
Move, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>̵<EFBFBD>
|
|
|
|
|
|
Delete, // <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
DelConfirm, // <20><><EFBFBD><EFBFBD> Ȯ<><C8AE>
|
|
|
|
|
|
Cancel // <20><><EFBFBD><EFBFBD>
|
2025-10-30 09:31:05 +09:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-27 19:05:25 +09:00
|
|
|
|
public class PopupView : MonoBehaviour
|
2025-10-30 09:31:05 +09:00
|
|
|
|
{
|
|
|
|
|
|
public event Action<PopupResponse> OnPopupResponse;
|
|
|
|
|
|
|
2025-11-06 20:14:27 +09:00
|
|
|
|
[SerializeField] private GameObject confirmPopupPanel;
|
|
|
|
|
|
[SerializeField] private GameObject modifyPopupPanel;
|
|
|
|
|
|
[SerializeField] private GameObject deletePopupPanel;
|
|
|
|
|
|
[SerializeField] private GameObject optionPopupPanel;
|
2025-11-19 18:38:48 +09:00
|
|
|
|
[SerializeField] private GameObject errorAlert;
|
2025-10-30 09:31:05 +09:00
|
|
|
|
|
2025-11-06 20:14:27 +09:00
|
|
|
|
[SerializeField] private Button ins_confirmButton; // '<27><><EFBFBD><EFBFBD>Ȯ<EFBFBD><C8AE>' <20><>ư
|
|
|
|
|
|
[SerializeField] private Button mod_confirmButton; // '<27><><EFBFBD><EFBFBD>Ȯ<EFBFBD><C8AE>' <20><>ư
|
|
|
|
|
|
[SerializeField] private Button moveButton; // '<27>̵<EFBFBD>' <20><>ư
|
|
|
|
|
|
[SerializeField] private Button deleteButton; // '<27><><EFBFBD><EFBFBD>' <20><>ư
|
|
|
|
|
|
[SerializeField] private Button del_confirmButton; // '<27><><EFBFBD><EFBFBD>Ȯ<EFBFBD><C8AE>' <20><>ư
|
|
|
|
|
|
[SerializeField] private Button[] cancelButton; // '<27><><EFBFBD><EFBFBD>' <20><>ư
|
2025-10-30 09:31:05 +09:00
|
|
|
|
|
2025-11-19 18:38:48 +09:00
|
|
|
|
private Coroutine autoHideCoroutine;
|
|
|
|
|
|
|
2025-10-30 09:31:05 +09:00
|
|
|
|
void Start()
|
|
|
|
|
|
{
|
2025-11-06 20:14:27 +09:00
|
|
|
|
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));
|
2025-10-30 09:31:05 +09:00
|
|
|
|
|
2025-11-06 20:14:27 +09:00
|
|
|
|
confirmPopupPanel.SetActive(false);
|
|
|
|
|
|
modifyPopupPanel.SetActive(false);
|
|
|
|
|
|
deletePopupPanel.SetActive(false);
|
|
|
|
|
|
optionPopupPanel.SetActive(false);
|
2025-10-30 09:31:05 +09:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-07 16:26:43 +09:00
|
|
|
|
public void ShowConfirmPopupFromRobot(Transform popPose)
|
2025-10-30 09:31:05 +09:00
|
|
|
|
{
|
2025-11-19 18:38:48 +09:00
|
|
|
|
//confirmPopupPanel.transform.position = popPose.position;
|
|
|
|
|
|
//confirmPopupPanel.transform.LookAt(Camera.main.transform);
|
|
|
|
|
|
//confirmPopupPanel.transform.Rotate(0, 180, 0);
|
2025-11-07 16:26:43 +09:00
|
|
|
|
confirmPopupPanel.SetActive(true);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void ShowConfirmPopupFromPoint(Vector3 popPose)
|
|
|
|
|
|
{
|
2025-11-19 18:38:48 +09:00
|
|
|
|
//confirmPopupPanel.transform.position = popPose;
|
|
|
|
|
|
//confirmPopupPanel.transform.LookAt(Camera.main.transform);
|
|
|
|
|
|
//confirmPopupPanel.transform.Rotate(0, 180, 0);
|
2025-11-06 20:14:27 +09:00
|
|
|
|
confirmPopupPanel.SetActive(true);
|
2025-10-30 09:31:05 +09:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-10 19:14:16 +09:00
|
|
|
|
public void ShowModifyPopup(Vector3 popPose)
|
2025-10-30 09:31:05 +09:00
|
|
|
|
{
|
2025-11-19 18:38:48 +09:00
|
|
|
|
//modifyPopupPanel.transform.position = popPose;
|
|
|
|
|
|
//modifyPopupPanel.transform.LookAt(Camera.main.transform);
|
|
|
|
|
|
//modifyPopupPanel.transform.Rotate(0, 180, 0);
|
2025-11-06 20:14:27 +09:00
|
|
|
|
modifyPopupPanel.SetActive(true);
|
|
|
|
|
|
}
|
2025-10-30 09:31:05 +09:00
|
|
|
|
|
2025-11-07 16:26:43 +09:00
|
|
|
|
public void ShowDeletePopup(Vector3 popPose)
|
2025-11-06 20:14:27 +09:00
|
|
|
|
{
|
2025-11-21 13:18:03 +09:00
|
|
|
|
//deletePopupPanel.transform.position = popPose;
|
|
|
|
|
|
//deletePopupPanel.transform.LookAt(Camera.main.transform);
|
|
|
|
|
|
//deletePopupPanel.transform.Rotate(0, 180, 0);
|
2025-11-06 20:14:27 +09:00
|
|
|
|
deletePopupPanel.SetActive(true);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-07 16:26:43 +09:00
|
|
|
|
public void ShowOptionPopup(Vector3 popPose)
|
2025-11-06 20:14:27 +09:00
|
|
|
|
{
|
2025-11-07 16:26:43 +09:00
|
|
|
|
optionPopupPanel.transform.position = popPose;
|
2025-11-21 13:18:03 +09:00
|
|
|
|
//optionPopupPanel.transform.LookAt(Camera.main.transform);
|
|
|
|
|
|
//optionPopupPanel.transform.Rotate(0, 180, 0);
|
2025-11-06 20:14:27 +09:00
|
|
|
|
optionPopupPanel.SetActive(true);
|
2025-10-30 09:31:05 +09:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-19 18:38:48 +09:00
|
|
|
|
public void ShowErrorAlert(bool show, float duration = 2.0f)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (autoHideCoroutine != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
StopCoroutine(autoHideCoroutine);
|
|
|
|
|
|
autoHideCoroutine = null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (errorAlert != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
errorAlert.SetActive(show);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (show && duration > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
autoHideCoroutine = StartCoroutine(AutoHideCoroutine(duration));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ð<EFBFBD> <20>ڿ<EFBFBD> <20>˾<EFBFBD><CBBE><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ڷ<EFBFBD>ƾ
|
|
|
|
|
|
private IEnumerator AutoHideCoroutine(float delay)
|
|
|
|
|
|
{
|
|
|
|
|
|
yield return new WaitForSeconds(delay);
|
|
|
|
|
|
|
|
|
|
|
|
if (errorAlert != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
errorAlert.SetActive(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
autoHideCoroutine = null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-30 09:31:05 +09:00
|
|
|
|
public void HidePopup()
|
|
|
|
|
|
{
|
2025-11-06 20:14:27 +09:00
|
|
|
|
confirmPopupPanel.SetActive(false);
|
|
|
|
|
|
modifyPopupPanel.SetActive(false);
|
|
|
|
|
|
deletePopupPanel.SetActive(false);
|
|
|
|
|
|
optionPopupPanel.SetActive(false);
|
2025-11-19 18:38:48 +09:00
|
|
|
|
errorAlert.SetActive(false);
|
2025-10-30 09:31:05 +09:00
|
|
|
|
}
|
|
|
|
|
|
}
|