浏览代码

Get everything compiling again

/main
Thomas Coldwell 3 年前
当前提交
c5af4590
共有 9 个文件被更改,包括 94 次插入82 次删除
  1. 13
      Assets/Scripts/Auth/SubIdentity_Authentication.cs
  2. 2
      Assets/Scripts/Entities/GameStateManager.cs
  3. 2
      Assets/Scripts/Relay/RelayInterface.cs
  4. 4
      Assets/Scripts/Rooms/RoomsContentHeartbeat.cs
  5. 12
      Assets/Scripts/Rooms/RoomsInterface.cs
  6. 49
      Assets/Scripts/Rooms/RoomsQuery.cs
  7. 10
      Packages/manifest.json
  8. 78
      Packages/packages-lock.json
  9. 6
      .vsconfig

13
Assets/Scripts/Auth/SubIdentity_Authentication.cs


/// </summary>
public SubIdentity_Authentication(Action onSigninComplete = null)
{
Authentication.SetLogLevel(Unity.Services.Authentication.Utilities.LogLevel.Verbose);
Authentication.SignedIn += OnSignInChange;
Authentication.SignedOut += OnSignInChange;
AuthenticationService.Instance.SignedIn += OnSignInChange;
AuthenticationService.Instance.SignedOut += OnSignInChange;
DoSignIn(onSigninComplete);
}
~SubIdentity_Authentication()

{
if (!m_hasDisposed)
{
Authentication.SignedIn -= OnSignInChange;
Authentication.SignedOut -= OnSignInChange;
AuthenticationService.Instance.SignedIn -= OnSignInChange;
AuthenticationService.Instance.SignedOut -= OnSignInChange;
m_hasDisposed = true;
}
}

await UnityServices.Initialize();
await Authentication.SignInAnonymously();
await AuthenticationService.Instance.SignInAnonymouslyAsync();
// Authentication.SignOut(); // TODO: I think we want to sign out at *some* point? But then the UAS anonymous token changes, so they can't access any outstanding rooms they've created.
onSigninComplete?.Invoke();
}

SetContent("id", Authentication.PlayerId);
SetContent("id", AuthenticationService.Instance.PlayerId);
}
}
}

2
Assets/Scripts/Entities/GameStateManager.cs


Dictionary<string, string> displayNameData = new Dictionary<string, string>();
displayNameData.Add("DisplayName", m_localUser.DisplayName);
RoomsQuery.Instance.RetrieveRoomAsync(m_lobbyData.RoomID, (r) => {
RoomsQuery.Instance.UpdatePlayerDataAsync(r, displayNameData, null);
RoomsQuery.Instance.UpdatePlayerDataAsync(r, m_localUser.ID, displayNameData, null);
});
}

2
Assets/Scripts/Relay/RelayInterface.cs


/// </summary>
public static void SetPath(string path = "https://relay-allocations.cloud.unity3d.com")
{
Configuration.BasePath = path;
RelayService.Configuration.BasePath = path;
}
/// <summary>

4
Assets/Scripts/Rooms/RoomsContentHeartbeat.cs


RoomsQuery.Instance.RetrieveRoomAsync(m_lobbyData.RoomID, OnRetrieve);
m_shouldPushData = false;
RoomsQuery.Instance.UpdatePlayerDataAsync(room, Rooms.ToLobbyData.RetrieveUserData(m_localUser), () => { m_isAwaitingQuery = false; });
RoomsQuery.Instance.UpdatePlayerDataAsync(room, m_localUser.ID, Rooms.ToLobbyData.RetrieveUserData(m_localUser), () => { m_isAwaitingQuery = false; });
}
void OnRetrieve(Unity.Services.Rooms.Models.Room room)

12
Assets/Scripts/Rooms/RoomsInterface.cs


/// </summary>
public static void SetPath(string path = "https://rooms.cloud.unity3d.com/v1")
{
Configuration.BasePath = path;
RoomsService.Configuration.BasePath = path;
}
private const int k_maxRoomsToShow = 64;

new InProgressRequest<Response<Room>>(task, onComplete);
}
public static void UpdatePlayerAsync(string roomId, string playerId, Dictionary<string, DataObject> data, Action<Response<Room>> onComplete)
public static void UpdatePlayerAsync(string roomId, string playerId, Dictionary<string, PlayerDataObject> data, Action<Response<Room>> onComplete)
UpdatePlayerRequest updateRequest = new UpdatePlayerRequest(roomId, playerId, new PlayerUpdateRequest(
data: data
));
UpdatePlayerRequest updateRequest = new UpdatePlayerRequest(
roomId,
playerId,
new PlayerUpdateRequest(data: data));
var task = RoomsService.RoomsApiClient.UpdatePlayerAsync(updateRequest);
new InProgressRequest<Response<Room>>(task, onComplete);
}

49
Assets/Scripts/Rooms/RoomsQuery.cs


using LobbyRooms.Rooms;
using System;
using System.Collections.Generic;
using System.Linq;
using Unity.Services.Authentication;
using Unity.Services.Rooms;
using Unity.Services.Rooms.Models;

/// </summary>
public void CreateRoomAsync(string roomName, int maxPlayers, Action<Room> onSuccess, Action onFailure)
{
string uasId = Authentication.PlayerId;
string uasId = AuthenticationService.Instance.PlayerId;
RoomsInterface.CreateRoomAsync(uasId, roomName, maxPlayers, OnRoomCreated);
void OnRoomCreated(Response<Room> response)

/// <summary>Attempt to join an existing room. ID xor code can be null.</summary>
public void JoinRoomAsync(string roomId, string roomCode, Action<Room> onSuccess, Action onFailure)
{
string uasId = Authentication.PlayerId;
string uasId = AuthenticationService.Instance.PlayerId;
RoomsInterface.JoinRoomAsync(uasId, roomId, roomCode, OnRoomJoined);
void OnRoomJoined(Response<Room> response)

/// <param name="onListRetrieved">If called with null, retrieval was unsuccessful. Else, this will be given a list of contents to display, as pairs of a room code and a display string for that room.</param>
public void RetrieveRoomListAsync(Action<QueryResponse> onListRetrieved)
{
string uasId = Authentication.PlayerId;
string uasId = AuthenticationService.Instance.PlayerId;
RoomsInterface.QueryAllRoomsAsync(OnRoomListRetrieved);
void OnRoomListRetrieved(Response<QueryResponse> response)

/// <param name="onComplete">Called once the request completes, regardless of success or failure.</param>
public void LeaveRoomAsync(string roomId, Action onComplete)
{
string uasId = Authentication.PlayerId;
string uasId = AuthenticationService.Instance.PlayerId;
RoomsInterface.LeaveRoomAsync(uasId, roomId, OnLeftRoom);
void OnLeftRoom(Response response)

/// <param name="room">Pass in the room from a RetrieveRoomAsync. (This prevents a 429 Too Many Requests if updating both player and room data, by using one retrieval.)</param>
/// <param name="data">Key-value pairs, which will overwrite any existing data for these keys. Presumed to be available to all room members but not publicly.</param>
public void UpdatePlayerDataAsync(Room room, Dictionary<string, string> data, Action onComplete)
{ UpdateDataAsync(room, data, onComplete, false);
public void UpdatePlayerDataAsync(Room room, string userId, Dictionary<string, string> data, Action onComplete)
{
var existingPlayerData = room.Players.First(p => p.Id.Equals(userId)).Data;
var dataCurr = existingPlayerData ?? new Dictionary<string, PlayerDataObject>();
foreach (var dataNew in data)
{
var dataObj = new PlayerDataObject(
visibility: PlayerDataObject.VisibilityOptions.Member,
value: dataNew.Value);
if (dataCurr.ContainsKey(dataNew.Key))
dataCurr[dataNew.Key] = dataObj;
else
dataCurr.Add(dataNew.Key, dataObj);
}
RoomsInterface.UpdatePlayerAsync(
roomId: room.Id,
playerId: Locator.Get.Identity.GetSubIdentity(Auth.IIdentityType.Auth).GetContent("id"),
data: dataCurr,
onComplete: (r) => { onComplete?.Invoke(); });
{ UpdateDataAsync(room, data, onComplete, true);
}
private void UpdateDataAsync(Room room, Dictionary<string, string> data, Action onComplete, bool isRoom)
DataObject dataObj = new DataObject(visibility: "Member", value: dataNew.Value);
DataObject dataObj = new DataObject(visibility: DataObject.VisibilityOptions.Member, value: dataNew.Value);
if (dataCurr.ContainsKey(dataNew.Key))
dataCurr[dataNew.Key] = dataObj;
else

if (isRoom)
RoomsInterface.UpdateRoomAsync(room.Id, dataCurr, (r) => { onComplete?.Invoke(); });
else
RoomsInterface.UpdatePlayerAsync(room.Id, Locator.Get.Identity.GetSubIdentity(Auth.IIdentityType.Auth).GetContent("id"), dataCurr, (r) => { onComplete?.Invoke(); });
RoomsInterface.UpdateRoomAsync(
roomId: room.Id,
data: dataCurr,
onComplete: (r) => { onComplete?.Invoke(); });
}
}
}

10
Packages/manifest.json


"com.unity.2d.sprite": "1.0.0",
"com.unity.2d.spriteshape": "6.0.0",
"com.unity.2d.tilemap": "1.0.0",
"com.unity.collab-proxy": "1.3.9",
"com.unity.ide.rider": "3.0.5",
"com.unity.collab-proxy": "1.5.7",
"com.unity.ide.rider": "3.0.6",
"com.unity.services.authentication": "0.3.0-preview",
"com.unity.services.authentication": "0.5.0-preview",
"com.unity.services.relay": "0.0.1-preview.3",
"com.unity.services.rooms": "0.1.3",
"com.unity.services.relay": "0.0.1-preview.5",
"com.unity.services.rooms": "0.1.5",
"com.unity.sysroot.linux-x86_64": "0.1.15-preview",
"com.unity.test-framework": "1.1.24",
"com.unity.textmeshpro": "3.0.4",

78
Packages/packages-lock.json


"com.unity.modules.animation": "1.0.0",
"com.unity.modules.uielements": "1.0.0"
},
"url": "https://packages-v2-staging.unity.com"
"url": "https://packages.unity.com"
},
"com.unity.2d.common": {
"version": "5.0.0",

"com.unity.2d.sprite": "1.0.0",
"com.unity.modules.uielements": "1.0.0"
},
"url": "https://packages-v2-staging.unity.com"
"url": "https://packages.unity.com"
},
"com.unity.2d.path": {
"version": "5.0.0",

"url": "https://packages-v2-staging.unity.com"
"url": "https://packages.unity.com"
},
"com.unity.2d.pixel-perfect": {
"version": "5.0.0",

"url": "https://packages-v2-staging.unity.com"
"url": "https://packages.unity.com"
},
"com.unity.2d.psdimporter": {
"version": "5.0.1",

"com.unity.2d.animation": "6.0.1",
"com.unity.2d.sprite": "1.0.0"
},
"url": "https://packages-v2-staging.unity.com"
"url": "https://packages.unity.com"
},
"com.unity.2d.sprite": {
"version": "1.0.0",

"com.unity.2d.path": "5.0.0",
"com.unity.modules.physics2d": "1.0.0"
},
"url": "https://packages-v2-staging.unity.com"
"url": "https://packages.unity.com"
},
"com.unity.2d.tilemap": {
"version": "1.0.0",

},
"com.unity.collab-proxy": {
"version": "1.3.9",
"version": "1.5.7",
"dependencies": {},
"url": "https://packages-v2-staging.unity.com"
"dependencies": {
"com.unity.nuget.newtonsoft-json": "2.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.ext.nunit": {
"version": "1.0.6",

"url": "https://packages-v2-staging.unity.com"
"url": "https://packages.unity.com"
"version": "3.0.5",
"version": "3.0.6",
"dependencies": {},
"url": "https://packages-v2-staging.unity.com"
"dependencies": {
"com.unity.ext.nunit": "1.0.6"
},
"url": "https://packages.unity.com"
},
"com.unity.ide.visualstudio": {
"version": "2.0.7",

"com.unity.test-framework": "1.1.9"
},
"url": "https://packages-v2-staging.unity.com"
"url": "https://packages.unity.com"
},
"com.unity.ide.vscode": {
"version": "1.2.3",

"url": "https://packages-v2-staging.unity.com"
"url": "https://packages.unity.com"
},
"com.unity.mathematics": {
"version": "1.2.1",

"url": "https://packages-v2-staging.unity.com"
"url": "https://packages.unity.com"
},
"com.unity.nuget.newtonsoft-json": {
"version": "2.0.0",

"url": "https://packages-v2-staging.unity.com"
"url": "https://packages.unity.com"
"version": "0.3.0-preview",
"version": "0.5.0-preview",
"nuget.moq": "1.0.0",
"com.unity.services.core": "0.1.0-preview",
"com.unity.services.core": "1.1.0-pre.2",
"version": "0.3.0-preview",
"depth": 0,
"version": "1.1.0-pre.2",
"depth": 1,
"nuget.moq": "1.0.0",
"com.unity.modules.unitywebrequest": "1.0.0",
"com.unity.nuget.newtonsoft-json": "2.0.0"
},

"version": "0.0.1-preview.3",
"version": "0.0.1-preview.5",
"com.unity.services.core": "0.2.0-preview",
"com.unity.services.core": "1.1.0-pre.2",
"com.unity.modules.unitywebrequest": "1.0.0",
"com.unity.modules.unitywebrequestassetbundle": "1.0.0",
"com.unity.modules.unitywebrequestaudio": "1.0.0",

"url": "https://artifactory.prd.it.unity3d.com/artifactory/api/npm/upm-candidates"
},
"com.unity.services.rooms": {
"version": "0.1.3",
"version": "0.1.5",
"com.unity.services.core": "0.2.0-preview",
"com.unity.services.core": "1.1.0-pre.2",
"com.unity.modules.unitywebrequest": "1.0.0",
"com.unity.modules.unitywebrequestassetbundle": "1.0.0",
"com.unity.modules.unitywebrequestaudio": "1.0.0",

"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0"
},
"url": "https://packages-v2-staging.unity.com"
"url": "https://packages.unity.com"
},
"com.unity.textmeshpro": {
"version": "3.0.4",

"com.unity.ugui": "1.0.0"
},
"url": "https://packages-v2-staging.unity.com"
"url": "https://packages.unity.com"
},
"com.unity.timeline": {
"version": "1.6.0-pre.3",

"com.unity.modules.audio": "1.0.0",
"com.unity.modules.particlesystem": "1.0.0"
},
"url": "https://packages-v2-staging.unity.com"
"url": "https://packages.unity.com"
},
"com.unity.toolchain.win-x86_64-linux-x86_64": {
"version": "0.1.20-preview",

"com.unity.modules.ui": "1.0.0",
"com.unity.modules.imgui": "1.0.0"
}
},
"nuget.castle-core": {
"version": "1.0.1",
"depth": 2,
"source": "registry",
"dependencies": {},
"url": "https://packages-v2-staging.unity.com"
},
"nuget.moq": {
"version": "1.0.0",
"depth": 1,
"source": "registry",
"dependencies": {
"nuget.castle-core": "1.0.1"
},
"url": "https://packages-v2-staging.unity.com"
},
"com.unity.modules.ai": {
"version": "1.0.0",

6
.vsconfig


{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Workload.ManagedGame"
]
}
正在加载...
取消
保存