// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖 using UnityEngine; using NBC; namespace NBF { public partial class CommonTopPanel : UIPanel { protected override void OnInit() { ContentPane.sortingOrder = UIDef.UIOrder.CommonTopPanel; IsShowCursor = false; } protected override void OnShow() { Game.Input.OnUICanceled += OnUICanceled; } private void OnUICanceled(string action) { if (action == InputDef.UI.Back) { var uis = App.UI.GetAllUI(); foreach (var ui in uis) { if (ui.ContentPane.sortingOrder > 0) continue; if (ui.IsTop && !ui.IsDontBack) { App.UI.HideUI(ui.GetType()); break; // ui.Hide(); } } } } protected override void OnHide() { Game.Input.OnUICanceled -= OnUICanceled; } protected override void OnDestroy() { base.OnDestroy(); } } }