From 3f9d7f9f9dd2d61a6a625a4729ff113fcb6a11a7 Mon Sep 17 00:00:00 2001 From: alexiscatnip Date: Sun, 16 Jan 2022 10:49:39 +0800 Subject: [PATCH] add "Pop canvas" for ButtonTriggerViewTransition --- Assets/ButtonTriggerViewTransition.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Assets/ButtonTriggerViewTransition.cs b/Assets/ButtonTriggerViewTransition.cs index 564e8aa..3d5344d 100644 --- a/Assets/ButtonTriggerViewTransition.cs +++ b/Assets/ButtonTriggerViewTransition.cs @@ -6,6 +6,7 @@ using Raindrop; using Raindrop.ServiceLocator; using Raindrop.Services; using UnityEngine; +using Logger = OpenMetaverse.Logger; public class ButtonTriggerViewTransition : MonoBehaviour { @@ -13,11 +14,24 @@ public class ButtonTriggerViewTransition : MonoBehaviour public bool popCurrent; private void Start() { - this.GetComponent().OnClick.AddListener(OnClick); + try + { + this.GetComponent().OnClick.AddListener(OnClick); + } + catch (Exception e) + { + Logger.DebugLog(e.ToString()); + } } private void OnClick() { + if (canvasTypeToPush == CanvasType.NONE) + { + ServiceLocator.Instance.Get().canvasManager.PopCanvas(); + return; + } + if (popCurrent) { ServiceLocator.Instance.Get().canvasManager.PopAndPush(canvasTypeToPush);