// Bind Component void Awake() { Button btn = GetComponent <Button>(); btn.onClick.AddListener(() => { if (!isOpen) { view.Open(); } else { view.Close(); } isOpen = !isOpen; }); }
public static void CloseView(ViewID key) { ViewBase view = GetView(key); if (view != null) { if (view.isOpen) { view.Close(); UINavigation.RemoveLastItem(view); } else { GameLog.LogWarning("[UIModule]界面关闭失败,已经关闭!" + key.ToString()); } } else { GameLog.LogError("[UIModule]界面关闭失败,没有找到指定界面!" + key.ToString()); } }