Files
2026-01-12 19:07:37 +07:00

168 lines
2.7 KiB
C#

/*
* FILE: CECManager.cs
*
* DESCRIPTION: Base manager class for Element Client
* Element Client的管理器基类
*
* CREATED BY: Duyuxin, 2004/8/30
* CONVERTED TO C#: 2025
*
* HISTORY:
*
* Copyright (c) 2004 Archosaur Studio, All Rights Reserved.
*/
using UnityEngine;
namespace BrewMonster.Managers
{
/// <summary>
/// Base manager class for Element Client
/// Element Client的管理器基类
/// </summary>
public class CECManager
{
protected CECGameRun m_pGameRun; // 游戏运行对象 / Game run object
protected uint m_dwCurTickTime; // 当前tick时间 / Current tick time
protected int m_iManagerID; // 管理器ID / Manager ID
/// <summary>
/// Constructor
/// 构造函数
/// </summary>
/// <param name="pGameRun">游戏运行对象 / Game run object</param>
public CECManager(CECGameRun pGameRun)
{
m_pGameRun = pGameRun;
m_dwCurTickTime = 0;
m_iManagerID = 0;
}
/// <summary>
/// Begin recording tick time
/// 开始记录tick时间
/// </summary>
public void BeginTickTime()
{
m_dwCurTickTime = GetTime();
}
/// <summary>
/// End recording tick time
/// 结束记录tick时间
/// </summary>
public void EndTickTime()
{
m_dwCurTickTime = GetTime() - m_dwCurTickTime;
}
/// <summary>
/// Get current time in milliseconds
/// 获取当前时间(毫秒)
/// </summary>
/// <returns>Time in milliseconds / 时间(毫秒)</returns>
protected virtual uint GetTime()
{
return (uint)(Time.realtimeSinceStartup * 1000.0f);
}
/// <summary>
/// Get the game run object
/// 获取游戏运行对象
/// </summary>
public CECGameRun GetGameRun()
{
return m_pGameRun;
}
/// <summary>
/// Get the current tick time
/// 获取当前tick时间
/// </summary>
public uint GetCurTickTime()
{
return m_dwCurTickTime;
}
/// <summary>
/// Get the manager ID
/// 获取管理器ID
/// </summary>
public int GetManagerID()
{
return m_iManagerID;
}
/// <summary>
/// Set the manager ID
/// 设置管理器ID
/// </summary>
public void SetManagerID(int id)
{
m_iManagerID = id;
}
}
}