NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/FunctionLock/FunctionLockManager.cs

49 lines
1.2 KiB
C#
Raw Normal View History

2025-04-10 15:19:01 +08:00
using Gameplay.Net;
using NLDPB;
2025-04-10 13:36:39 +08:00
using PhxhSDK;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Gameplay.FunctionLock
{
/// <summary>
/// 功能锁管理器
/// </summary>
public sealed class FunctionLockManager : Singlenton<FunctionLockManager>
{
2025-04-10 15:19:01 +08:00
/// <summary>
/// 服务器功能锁id(按位存)
/// </summary>
private int ServerFunctionLockId;
/// <summary>
/// 初始化功能锁
/// </summary>
public void InitFunctionLock()
{
ServerFunctionLockId = (int)Actor.Instance.Logic.GetCount((uint)LogicID.LockStatus);
}
2025-04-10 13:36:39 +08:00
/// <summary>
/// 是否解锁
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public bool IsUnlock(int id)
{
2025-04-10 15:19:01 +08:00
return (id & ServerFunctionLockId) == id;
}
/// <summary>
/// 保存服务器
/// </summary>
/// <param name="flag"></param>
public void SaveServer(int flag)
{
int savaId = 1 << (flag - 1);
ServerFunctionLockId |= savaId;
NetHelper.SaveFunctionLock(ServerFunctionLockId);
2025-04-10 13:36:39 +08:00
}
}
}