浏览代码
Removed LobbyAPIInterface completely.
Removed LobbyAPIInterface completely.
Re-hooked up polling loop to LobbyContentUpdater/main/staging/2021_Upgrade/Async_Refactor
当前提交
abc179d2
共有 6 个文件被更改,包括 19 次插入 和 119 次删除
-
2Assets/Scripts/GameLobby/Game/GameManager.cs
-
11Assets/Scripts/GameLobby/Lobby/LobbyContentUpdater.cs
-
2Assets/Scripts/GameLobby/NGO/SetupInGame.cs
-
28Assets/Scripts/GameLobby/Tests/PlayMode/LobbyRoundtripTests.cs
-
11Assets/Scripts/GameLobby/Lobby/LobbyAPIInterface.cs.meta
-
84Assets/Scripts/GameLobby/Lobby/LobbyAPIInterface.cs
|
|||
fileFormatVersion: 2 |
|||
guid: 03c4b466cb7c8c64fb37b8b7e7007305 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using Unity.Services.Lobbies; |
|||
|
|||
namespace LobbyRelaySample.lobby |
|||
{ |
|||
/// <summary>
|
|||
/// Wrapper for all the interactions with the Lobby API.
|
|||
/// </summary>
|
|||
public static class LobbyAPIInterface |
|||
{ |
|||
/* TODO Delete LobbyAPIInterface |
|||
public static void CreateLobbyAsync(string requesterUASId, string lobbyName, int maxPlayers, bool isPrivate, Dictionary<string, PlayerDataObject> localUserData, Action<Lobby> onComplete) |
|||
{ |
|||
CreateLobbyOptions createOptions = new CreateLobbyOptions |
|||
{ |
|||
IsPrivate = isPrivate, |
|||
Player = new Player(id: requesterUASId, data: localUserData) |
|||
}; |
|||
var task = LobbyService.Instance.CreateLobbyAsync(lobbyName, maxPlayers, createOptions); |
|||
AsyncRequestLobby.Instance.DoRequest(task, onComplete); |
|||
} |
|||
|
|||
public static void DeleteLobbyAsync(string lobbyId, Action onComplete) |
|||
{ |
|||
var task = LobbyService.Instance.DeleteLobbyAsync(lobbyId); |
|||
AsyncRequestLobby.Instance.DoRequest(task, onComplete); |
|||
} |
|||
|
|||
public static void JoinLobbyAsync_ByCode(string requesterUASId, string lobbyCode, Dictionary<string, PlayerDataObject> localUserData, Action<Lobby> onComplete) |
|||
{ |
|||
JoinLobbyByCodeOptions joinOptions = new JoinLobbyByCodeOptions { Player = new Player(id: requesterUASId, data: localUserData) }; |
|||
var task = LobbyService.Instance.JoinLobbyByCodeAsync(lobbyCode, joinOptions); |
|||
AsyncRequestLobby.Instance.DoRequest(task, onComplete); |
|||
} |
|||
|
|||
public static void JoinLobbyAsync_ById(string requesterUASId, string lobbyId, Dictionary<string, PlayerDataObject> localUserData, Action<Lobby> onComplete) |
|||
{ |
|||
JoinLobbyByIdOptions joinOptions = new JoinLobbyByIdOptions { Player = new Player(id: requesterUASId, data: localUserData) }; |
|||
var task = LobbyService.Instance.JoinLobbyByIdAsync(lobbyId, joinOptions); |
|||
AsyncRequestLobby.Instance.DoRequest(task, onComplete); |
|||
} |
|||
|
|||
public static void QuickJoinLobbyAsync(string requesterUASId, List<QueryFilter> filters, Dictionary<string, PlayerDataObject> localUserData, Action<Lobby> onComplete) |
|||
{ |
|||
var joinRequest = new QuickJoinLobbyOptions |
|||
{ |
|||
Filter = filters, |
|||
Player = new Player(id: requesterUASId, data: localUserData) |
|||
}; |
|||
|
|||
var task = LobbyService.Instance.QuickJoinLobbyAsync(joinRequest); |
|||
AsyncRequestLobby.Instance.DoRequest(task, onComplete); |
|||
} |
|||
|
|||
public static void LeaveLobbyAsync(string requesterUASId, string lobbyId, Action onComplete) |
|||
{ |
|||
var task = LobbyService.Instance.RemovePlayerAsync(lobbyId, requesterUASId); |
|||
AsyncRequestLobby.Instance.DoRequest(task, onComplete); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Uupdates custom data to the lobby, for all to see.
|
|||
/// </summary>
|
|||
public static void UpdateLobbyAsync(string lobbyId, Dictionary<string, DataObject> data, bool shouldLock, Action<Lobby> onComplete) |
|||
{ |
|||
UpdateLobbyOptions updateOptions = new UpdateLobbyOptions { Data = data, IsLocked = shouldLock }; |
|||
var task = LobbyService.Instance.UpdateLobbyAsync(lobbyId, updateOptions); |
|||
AsyncRequestLobby.Instance.DoRequest(task, onComplete); |
|||
} |
|||
|
|||
public static void UpdatePlayerAsync(string lobbyId, string playerId, Dictionary<string, PlayerDataObject> data, Action<Lobby> onComplete, string allocationId, string connectionInfo) |
|||
{ |
|||
UpdatePlayerOptions updateOptions = new UpdatePlayerOptions |
|||
{ |
|||
Data = data, |
|||
AllocationId = allocationId, |
|||
ConnectionInfo = connectionInfo |
|||
}; |
|||
var task = LobbyService.Instance.UpdatePlayerAsync(lobbyId, playerId, updateOptions); |
|||
AsyncRequestLobby.Instance.DoRequest(task, onComplete); |
|||
}*/ |
|||
|
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue