diff --git a/Assets/Runtime Transform Gizmos/Scripts/Runtime Package Common/Camera/RTFocusCamera.cs b/Assets/Runtime Transform Gizmos/Scripts/Runtime Package Common/Camera/RTFocusCamera.cs index 6efa7829..0843e9d7 100644 --- a/Assets/Runtime Transform Gizmos/Scripts/Runtime Package Common/Camera/RTFocusCamera.cs +++ b/Assets/Runtime Transform Gizmos/Scripts/Runtime Package Common/Camera/RTFocusCamera.cs @@ -1,4 +1,4 @@ -using Assets.WorkSpace.R; +using Octopus.Simulator.Camera; using Octopus.Simulator.Networks; using System; using System.Collections; diff --git a/Assets/Scripts/Data.meta b/Assets/Scripts/Data.meta new file mode 100644 index 00000000..cbb641d2 --- /dev/null +++ b/Assets/Scripts/Data.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b7e51d07cc1270142aecee4dabf80814 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WorkSpace/R/CameraEntity.cs b/Assets/Scripts/Data/CameraEntity.cs similarity index 87% rename from Assets/WorkSpace/R/CameraEntity.cs rename to Assets/Scripts/Data/CameraEntity.cs index cb61251f..09bde1ee 100644 --- a/Assets/WorkSpace/R/CameraEntity.cs +++ b/Assets/Scripts/Data/CameraEntity.cs @@ -1,6 +1,6 @@ using System; -namespace Assets.WorkSpace.R +namespace Octopus.Simulator.Camera { [Serializable] public class CameraEntity diff --git a/Assets/WorkSpace/R/CameraEntity.cs.meta b/Assets/Scripts/Data/CameraEntity.cs.meta similarity index 100% rename from Assets/WorkSpace/R/CameraEntity.cs.meta rename to Assets/Scripts/Data/CameraEntity.cs.meta diff --git a/Assets/Scripts/UI/PopUp.meta b/Assets/Scripts/UI/PopUp.meta new file mode 100644 index 00000000..9c4620b0 --- /dev/null +++ b/Assets/Scripts/UI/PopUp.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 59183c92e1a4ef74bb442d38c298e859 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/UI/PopUp/AlertManager.cs b/Assets/Scripts/UI/PopUp/AlertManager.cs new file mode 100644 index 00000000..df775aee --- /dev/null +++ b/Assets/Scripts/UI/PopUp/AlertManager.cs @@ -0,0 +1,72 @@ +using Cysharp.Threading.Tasks; +using UnityEngine; + +namespace Octopus.Simulator.UI.Popup +{ + public class AlertManager : UnitySingleton + { + private GameObject prefab; + private UIAlert alert; + + + private void Create() + { + if (alert == null) + { + if (prefab == null) + { + prefab = Resources.Load("UIPrefab/UIAlert", typeof(GameObject)) as GameObject; + } + GameObject go = UnityEngine.Object.Instantiate(prefab); + alert = go.GetComponent(); + } + var canvas = FindAnyObjectByType(); + alert.transform.SetParent(canvas.transform, false); + } + + public async UniTask ShowAlert(string title, string message, string okButtonTitle = "OK") + { + Create(); + + bool isClosed = false; + + alert.Init(title: title, message: message, okButtonText: okButtonTitle, showCancelButton: false); + alert.OnOk.AddListener(() => + { + isClosed = true; + }); + alert.Open(); + await UniTask.WaitUntil(() => isClosed == true); + } + + public async UniTask ShowConfirm(string title, string message, string okButtonTitle = "OK", string cancelButtonTitle = "CANCEL") + { + Create(); + + bool isClosed = false; + bool result = false; + + alert.Init(title, message, okButtonTitle, cancelButtonTitle, true); + + alert.OnOk.AddListener(() => + { + result = true; + isClosed = true; + }); + + alert.OnCancel.AddListener(() => + { + result = false; + isClosed = true; + }); + + alert.Open(); + + + await UniTask.WaitUntil(() => isClosed == true); + + return result; + } + } + +} diff --git a/Assets/WorkSpace/R/AlertManager.cs.meta b/Assets/Scripts/UI/PopUp/AlertManager.cs.meta similarity index 100% rename from Assets/WorkSpace/R/AlertManager.cs.meta rename to Assets/Scripts/UI/PopUp/AlertManager.cs.meta diff --git a/Assets/Scripts/UI/PopUp/UIAlert.cs b/Assets/Scripts/UI/PopUp/UIAlert.cs new file mode 100644 index 00000000..141ffc7f --- /dev/null +++ b/Assets/Scripts/UI/PopUp/UIAlert.cs @@ -0,0 +1,200 @@ +using TMPro; +using UnityEngine; +using UnityEngine.Events; +using UnityEngine.EventSystems; +using UnityEngine.UI; + +namespace Octopus.Simulator.UI.Popup +{ + [RequireComponent(typeof(CanvasGroup))] + public class UIAlert : MonoBehaviour + { + private string title; + private string message; + + private string okButtonText = "확인"; + private string cancelButtonText = "취소"; + + private bool showCancelButton = false; + + public UnityEvent OnOk; + public UnityEvent OnCancel; + + private Button okButton; + private Button cancelButton; + private TextMeshProUGUI titleText; + private TextMeshProUGUI messageText; + private CanvasGroup canvasGroup; + + private bool animatting = false; + + private float target = 0; + private float duration = 0.25f; + private float alpha = 1; + + private bool useKeyboard = false; + + public void Init(string title, string message, string okButtonText = "확인", string cancelButtonText = "취소", bool showCancelButton = true) + { + + this.title = title; + this.message = message; + this.okButtonText = okButtonText; + this.cancelButtonText = cancelButtonText; + this.showCancelButton = showCancelButton; + + canvasGroup = GetComponent(); + + var okBtn = GetComponentInChildren(); + var cancelBtn = GetComponentInChildren(); + var titleTxt = GetComponentInChildren(); + var messageTxt = GetComponentInChildren(); + + + if (okButton == null) okButton = okBtn.GetComponent