Main/System/UIBase/UIBase.cs
@@ -115,21 +115,34 @@
    protected virtual void Awake()
    {
        //  防止有人不写base.InitComponent引发错误 所以拆分
        InitComponentInternal();
        // 在Awake中进行基本初始化
        InitComponent();
        try
        {
            InitComponentInternal();
        }
        catch (Exception e)
        {
            Debug.LogError($"{uiName}界面的InitComponentInternal报错: {e.Message}");
        }
        try
        {
            InitComponent();
        }
        catch (Exception e)
        {
            Debug.LogError($"{uiName}界面的InitComponent报错: {e.Message}");
        }
        // 保存原始值用于动画
        if (_rectTransform != null)
        {
            originalPosition = _rectTransform.anchoredPosition;;
            originalPosition = _rectTransform.anchoredPosition;
        }
        if (screenMask != null)
            screenMask.transform.SetAsFirstSibling();
        InitClickEmptySpaceBtn();
    }
    protected virtual void Start()
@@ -266,27 +279,49 @@
            return;
        }
        OnPreOpen();
        // 如果正在播放动画,先停止
        try
        {
            OnPreOpen();
        }
        catch (Exception e)
        {
            Debug.LogError($"{uiName}界面的OnPreOpen报错: {e.Message}");
        }
        StopCurrentAnimation();
        // 重置关闭标记
        isClosing = false;
        gameObject.SetActive(true);
        isActive = true;
        // 根据动画类型播放打开动画
        PlayOpenAnimation();
        // // 如果后续需要统一处理刘海或者小游戏的界面适配问题
        // _rectTransform.offsetMin = new Vector2(0, 10);  //下方
        // _rectTransform.offsetMax = new Vector2(0, -50); //上方
        OnOpen();
        try
        {
            OnOpen();
        }
        catch (Exception e)
        {
            Debug.LogError($"{uiName}界面的OnOpen报错: {e.Message}");
        }
        ApplyClickEmptySpaceClose();
        ExecuteNextFrame(NextFrameAfterOpen);
        ExecuteNextFrame(() =>
        {
            try
            {
                NextFrameAfterOpen();
            }
            catch (Exception e)
            {
                Debug.LogError($"{uiName}界面的NextFrameAfterOpen报错: {e.Message}");
            }
        });
    }
    protected virtual void NextFrameAfterOpen()
@@ -303,31 +338,46 @@
        if (clickEmptySpaceClose)
            btnClickEmptyClose.enabled = false;
        OnPreClose();
        // 如果正在播放动画,先停止
        try
        {
            OnPreClose();
        }
        catch (Exception e)
        {
            Debug.LogError($"{uiName}界面的OnPreClose报错: {e.Message}");
        }
        StopCurrentAnimation();
        // 设置关闭标记
        isClosing = true;
        isActive = false;
        // 禁用交互但保持可见
        if (canvasGroup != null)
        {
            canvasGroup.blocksRaycasts = false;
        }
        // 根据动画类型播放关闭动画
        PlayCloseAnimation();
        // 调用关闭回调
        OnClose();
        // 如果没有关闭动画,直接禁用游戏对象
        try
        {
            OnClose();
        }
        catch (Exception e)
        {
            Debug.LogError($"{uiName}界面的OnClose报错: {e.Message}");
        }
        if (closeAnimationType == UIAnimationType.None)
        {
            CompleteClose();
            try
            {
                CompleteClose();
            }
            catch (Exception e)
            {
                Debug.LogError($"{uiName}界面的CompleteClose报错: {e.Message}");
            }
        }
        // 否则在动画完成后禁用游戏对象(在PlayCloseAnimation中处理)
    }
@@ -693,11 +743,16 @@
            currentAnimation.OnComplete(() =>
            {
                isAnimating = false;
                // 动画完成后,完成关闭过程
                if (isClosing)
                {
                    CompleteClose();
                    try
                    {
                        CompleteClose();
                    }
                    catch (Exception e)
                    {
                        Debug.LogError($"{uiName}界面的CompleteClose报错: {e.Message}");
                    }
                }
            });