65 lines
1.9 KiB
C#
65 lines
1.9 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace AlicizaX.UI.Runtime
|
|
{
|
|
internal sealed partial class UIManager
|
|
{
|
|
private GameObject m_LayerBlock; //内部屏蔽对象 显示时之下的所有UI将不可操作
|
|
|
|
private int m_LastCountDownGuid; //倒计时的唯一ID
|
|
|
|
private float m_LastRecoverOptionTime; //下一次恢复操作时间
|
|
|
|
private void OnBlockDispose()
|
|
{
|
|
RemoveLastCountDown();
|
|
}
|
|
|
|
private void RemoveLastCountDown()
|
|
{
|
|
// _timerManager.Remove();
|
|
}
|
|
|
|
//初始化添加屏蔽模块
|
|
private void InitAddUIBlock()
|
|
{
|
|
m_LayerBlock = new GameObject("LayerBlock");
|
|
var rect = m_LayerBlock.AddComponent<RectTransform>();
|
|
m_LayerBlock.AddComponent<CanvasRenderer>();
|
|
m_LayerBlock.AddComponent<UIBlock>();
|
|
rect.SetParent(UICanvasRoot);
|
|
rect.SetAsLastSibling();
|
|
// rect.ResetToFullScreen();
|
|
SetLayerBlockOption(true);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 设置UI是否可以操作
|
|
/// 不能提供此API对外操作
|
|
/// 因为有人设置过后就会忘记恢复
|
|
/// 如果你确实需要你可以设置 禁止无限时间
|
|
/// 之后调用恢复操作也可以做到
|
|
/// </summary>
|
|
/// <param name="value">true = 可以操作 = 屏蔽层会被隐藏</param>
|
|
private void SetLayerBlockOption(bool value)
|
|
{
|
|
m_LayerBlock.SetActive(!value);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 强制恢复层级到可操作状态
|
|
/// 此方法会强制打断倒计时 根据需求调用
|
|
/// </summary>
|
|
private void RecoverLayerOptionAll()
|
|
{
|
|
SetLayerBlockOption(true);
|
|
m_LastRecoverOptionTime = 0;
|
|
// m_AllForeverBlockCode.Clear();
|
|
RemoveLastCountDown();
|
|
}
|
|
|
|
|
|
}
|
|
}
|