您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
26 行
719 B
26 行
719 B
using UnityEngine;
|
|
|
|
namespace LobbyRelaySample
|
|
{
|
|
/// <summary>
|
|
/// Keeps the lobby list updated automatically.
|
|
/// </summary>
|
|
public class LobbyListHeartbeat : MonoBehaviour
|
|
{
|
|
private const float k_refreshRate = 5;
|
|
|
|
// This is called in-editor via events.
|
|
public void SetActive(bool isActive)
|
|
{
|
|
if (isActive)
|
|
Locator.Get.UpdateSlow.Subscribe(OnUpdate, k_refreshRate);
|
|
else
|
|
Locator.Get.UpdateSlow.Unsubscribe(OnUpdate);
|
|
}
|
|
|
|
private void OnUpdate(float dt)
|
|
{
|
|
Locator.Get.Messenger.OnReceiveMessage(MessageType.QueryLobbies, null);
|
|
}
|
|
}
|
|
}
|