当前提交
ebefab4b
共有 21 个文件被更改,包括 222 次插入 和 146 次删除
-
19Assets/Prefabs/UI/CreateContent.prefab
-
24Assets/Prefabs/UI/JoinContent.prefab
-
42Assets/Prefabs/UI/JoinCreateCanvas.prefab
-
14Assets/Prefabs/UI/LobbyGameCanvas.prefab
-
12Assets/Prefabs/UI/RenamePopup.prefab
-
105Assets/Scenes/mainScene.unity
-
40Assets/Scripts/Game/GameManager.cs
-
1Assets/Scripts/Lobby/LobbyAsyncRequests.cs
-
1Assets/Scripts/Relay/RelayUtpClient.cs
-
13Assets/Scripts/Relay/RelayUtpSetup.cs
-
7Assets/Scripts/Tests/PlayMode/LobbyRoundtripTests.cs
-
2Assets/Scripts/Tests/PlayMode/RelayRoundTripTests.cs
-
1Assets/Scripts/UI/JoinCreateLobbyUI.cs
-
18Assets/Scripts/UI/JoinMenuUI.cs
-
11Assets/Scripts/UI/SpinnerUI.cs
-
2Assets/Scripts/UI/UIPanelBase.cs
-
4Packages/manifest.json
-
4Packages/packages-lock.json
-
4ProjectSettings/ProjectVersion.txt
-
33Assets/Scripts/Lobby/LobbyListHeartbeat.cs
-
11Assets/Scripts/Lobby/LobbyListHeartbeat.cs.meta
|
|||
m_EditorVersion: 2020.3.14f1 |
|||
m_EditorVersionWithRevision: 2020.3.14f1 (d0d1bb862f9d) |
|||
m_EditorVersion: 2020.3.15f2 |
|||
m_EditorVersionWithRevision: 2020.3.15f2 (6cf78cb77498) |
|
|||
using UnityEngine; |
|||
|
|||
namespace LobbyRelaySample |
|||
{ |
|||
/// <summary>
|
|||
/// Keeps the lobby list updated automatically.
|
|||
/// </summary>
|
|||
public class LobbyListHeartbeat : MonoBehaviour |
|||
{ |
|||
private const float k_refreshRate = 5; |
|||
private float m_refreshTimer = 0; |
|||
|
|||
// This is called in-editor via events.
|
|||
public void SetActive(bool isActive) |
|||
{ |
|||
if (isActive) |
|||
Locator.Get.UpdateSlow.Subscribe(OnUpdate); |
|||
else |
|||
Locator.Get.UpdateSlow.Unsubscribe(OnUpdate); |
|||
m_refreshTimer = 0; |
|||
} |
|||
|
|||
private void OnUpdate(float dt) |
|||
{ |
|||
m_refreshTimer += dt; |
|||
if (m_refreshTimer > k_refreshRate) |
|||
{ |
|||
Locator.Get.Messenger.OnReceiveMessage(MessageType.QueryLobbies, null); |
|||
m_refreshTimer = 0; |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 48ec34a3875818e4690f1bf0be69ccd9 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue