Skip to content

Commit 57555f7

Browse files
chore: formatting pass (#640)
* quick formatting pass over codebase * manually adding 'non-indented brace after case' rule * formatted 2 files with braces in cases
1 parent 8f44725 commit 57555f7

24 files changed

+43
-117
lines changed

.editorconfig

Lines changed: 1 addition & 76 deletions
Large diffs are not rendered by default.

Assets/BossRoom/Scripts/Game/Client/Character/ClientCharacterVisualization.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public override void OnNetworkSpawn()
9191
m_NetState.OnStopChargingUpClient += OnStoppedChargingUp;
9292
m_NetState.IsStealthy.OnValueChanged += OnStealthyChanged;
9393
m_NetState.MovementStatus.OnValueChanged += OnMovementStatusChanged;
94-
OnMovementStatusChanged(MovementStatus.Normal,m_NetState.MovementStatus.Value);
94+
OnMovementStatusChanged(MovementStatus.Normal, m_NetState.MovementStatus.Value);
9595

9696
// sync our visualization position & rotation to the most up to date version received from server
9797
transform.SetPositionAndRotation(m_PhysicsWrapper.Transform.position, m_PhysicsWrapper.Transform.rotation);

Assets/BossRoom/Scripts/Game/Client/Character/ClientInputSender.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ void FixedUpdate()
168168
}
169169

170170
m_ActionRequestCount = 0;
171-
172-
if (EventSystem.current.currentSelectedGameObject != null)
171+
172+
if (EventSystem.current.currentSelectedGameObject != null)
173173
{
174174
return;
175175
}

Assets/BossRoom/Scripts/Game/Client/ClientClickFeedback.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class ClientClickFeedback : NetworkBehaviour
1515
GameObject m_FeedbackObj;
1616

1717
ClientInputSender m_ClientSender;
18-
18+
1919
ClickFeedbackLerper m_ClickFeedbackLerper;
2020

2121

Assets/BossRoom/Scripts/Game/Client/State/ClientMainMenuState.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async void InjectDependenciesAndInitialize(AuthenticationServiceFacade authServi
4747
{
4848
if (string.IsNullOrEmpty(Application.cloudProjectId))
4949
{
50-
PopupManager.ShowPopupPanel("Unity Gaming Services ProjectID not set up" ,"Click the Readme file in the Assets Folder within the Project window in-editor to follow \"How to set up Unity Gaming Services\"");
50+
PopupManager.ShowPopupPanel("Unity Gaming Services ProjectID not set up", "Click the Readme file in the Assets Folder within the Project window in-editor to follow \"How to set up Unity Gaming Services\"");
5151
OnSignInFailed();
5252
return;
5353
}

Assets/BossRoom/Scripts/Game/Client/UI/ConnectionStatusMessageUIManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ void OnReconnectMessage(ReconnectMessage message)
7777
}
7878
else if (m_CurrentReconnectPopup != null)
7979
{
80-
m_CurrentReconnectPopup.SetupPopupPanel("Connection lost", $"Attempting to reconnect...\nAttempt {message.CurrentAttempt+1}/{message.MaxAttempt}", closeableByUser: false);
80+
m_CurrentReconnectPopup.SetupPopupPanel("Connection lost", $"Attempting to reconnect...\nAttempt {message.CurrentAttempt + 1}/{message.MaxAttempt}", closeableByUser: false);
8181
}
8282
else
8383
{
84-
m_CurrentReconnectPopup = PopupManager.ShowPopupPanel("Connection lost", $"Attempting to reconnect...\nAttempt {message.CurrentAttempt+1}/{message.MaxAttempt}", closeableByUser: false);
84+
m_CurrentReconnectPopup = PopupManager.ShowPopupPanel("Connection lost", $"Attempting to reconnect...\nAttempt {message.CurrentAttempt + 1}/{message.MaxAttempt}", closeableByUser: false);
8585
}
8686
}
8787

Assets/BossRoom/Scripts/Game/Client/UI/IPConnectionWindow.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ void OnTimeElapsed()
6363
StartCoroutine(WaitUntilUNETDisconnected(OnTimeElapsed));
6464
break;
6565
case UnityTransport unityTransport:
66-
var maxConnectAttempts= unityTransport.MaxConnectAttempts;
67-
var connectTimeoutMS= unityTransport.ConnectTimeoutMS;
66+
var maxConnectAttempts = unityTransport.MaxConnectAttempts;
67+
var connectTimeoutMS = unityTransport.ConnectTimeoutMS;
6868
StartCoroutine(DisplayUTPConnectionDuration(maxConnectAttempts, connectTimeoutMS, OnTimeElapsed));
6969
break;
7070
default:

Assets/BossRoom/Scripts/Game/Client/UI/Lobby/LobbyJoiningUI.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ void EnsureNumberOfActiveUISlots(int requiredNumber)
118118

119119
for (int i = 0; i < m_LobbyListItems.Count; i++)
120120
{
121-
m_LobbyListItems[i].gameObject.SetActive( i < requiredNumber );
121+
m_LobbyListItems[i].gameObject.SetActive(i < requiredNumber);
122122
}
123123
}
124124

Assets/BossRoom/Scripts/Game/ConnectionManagement/ClientGameNetPortal.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ private IEnumerator TryToReconnect(string lobbyCode)
217217
{
218218
ConnectClient();
219219
}
220-
yield return new WaitForSeconds(1.1f * NetworkManager.Singleton.NetworkConfig.ClientConnectionBufferTimeout + ((UnityTransport)NetworkManager.Singleton.NetworkConfig.NetworkTransport).DisconnectTimeoutMS/1000.0f); // wait a bit longer than the timeout duration to make sure we have enough time to stop this coroutine if successful
220+
yield return new WaitForSeconds(1.1f * NetworkManager.Singleton.NetworkConfig.ClientConnectionBufferTimeout + ((UnityTransport)NetworkManager.Singleton.NetworkConfig.NetworkTransport).DisconnectTimeoutMS / 1000.0f); // wait a bit longer than the timeout duration to make sure we have enough time to stop this coroutine if successful
221221
nbTries++;
222222
}
223223

@@ -282,7 +282,7 @@ async Task JoinRelayAsync(Action<string> onFailure = null)
282282
await UnityRelayUtilities.JoinRelayServerFromJoinCode(m_LocalLobby.RelayJoinCode);
283283

284284
await m_LobbyServiceFacade.UpdatePlayerRelayInfoAsync(allocationIdBytes.ToString(), m_LocalLobby.RelayJoinCode);
285-
var utp = (UnityTransport) NetworkManager.Singleton.NetworkConfig.NetworkTransport;
285+
var utp = (UnityTransport)NetworkManager.Singleton.NetworkConfig.NetworkTransport;
286286
utp.SetClientRelayData(ipv4Address, port, allocationIdBytes, key, connectionData, hostConnectionData, isSecure: true);
287287
}
288288
catch (Exception e)

Assets/BossRoom/Scripts/Game/ConnectionManagement/ServerGameNetPortal.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ void OnClientDisconnect(ulong clientId)
117117
var sessionData = SessionManager<SessionPlayerData>.Instance.GetPlayerData(playerId);
118118
if (sessionData.HasValue)
119119
{
120-
m_ConnectionEventPublisher.Publish(new ConnectionEventMessage(){ ConnectStatus = ConnectStatus.GenericDisconnect, PlayerName = sessionData.Value.PlayerName});
120+
m_ConnectionEventPublisher.Publish(new ConnectionEventMessage() { ConnectStatus = ConnectStatus.GenericDisconnect, PlayerName = sessionData.Value.PlayerName });
121121
}
122122
SessionManager<SessionPlayerData>.Instance.DisconnectClient(clientId);
123123
}
@@ -210,7 +210,7 @@ void ApprovalCheck(byte[] connectionData, ulong clientId, NetworkManager.Connect
210210
// connection approval will create a player object for you
211211
connectionApprovedCallback(true, null, true, Vector3.zero, Quaternion.identity);
212212

213-
m_ConnectionEventPublisher.Publish(new ConnectionEventMessage(){ ConnectStatus = ConnectStatus.Success, PlayerName = SessionManager<SessionPlayerData>.Instance.GetPlayerData(clientId)?.PlayerName});
213+
m_ConnectionEventPublisher.Publish(new ConnectionEventMessage() { ConnectStatus = ConnectStatus.Success, PlayerName = SessionManager<SessionPlayerData>.Instance.GetPlayerData(clientId)?.PlayerName });
214214
}
215215
else
216216
{

Assets/BossRoom/Scripts/Game/Server/Character/ServerCharacter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ void InitializeHitPoints()
113113
if (!IsNpc)
114114
{
115115
SessionPlayerData? sessionPlayerData = SessionManager<SessionPlayerData>.Instance.GetPlayerData(OwnerClientId);
116-
if (sessionPlayerData is {HasCharacterSpawned: true})
116+
if (sessionPlayerData is { HasCharacterSpawned: true })
117117
{
118118
NetState.HitPoints = sessionPlayerData.Value.CurrentHitPoints;
119119
if (NetState.HitPoints <= 0)

Assets/BossRoom/Scripts/Game/Server/Entity/PublishMessageOnLifeChange.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void OnLifeStateChanged(LifeState previousState, LifeState newState)
4848
{
4949
m_Publisher.Publish(new LifeStateChangedEventMessage()
5050
{
51-
CharacterName = m_NameState != null ? m_NameState.Name.Value : (FixedPlayerName) m_CharacterName,
51+
CharacterName = m_NameState != null ? m_NameState.Name.Value : (FixedPlayerName)m_CharacterName,
5252
CharacterType = m_CharacterClass.CharacterClass.CharacterType,
5353
NewLifeState = newState
5454
});

Assets/BossRoom/Scripts/Infrastructure/DIScope.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public T Resolve<T>() where T : class
108108
//if we have this type as lazy-bound instance - we are going to instantiate it now
109109
if (m_LazyBindDescriptors.TryGetValue(type, out var lazyBindDescriptor))
110110
{
111-
var instance = (T) InstantiateLazyBoundObject(lazyBindDescriptor);
111+
var instance = (T)InstantiateLazyBoundObject(lazyBindDescriptor);
112112
m_LazyBindDescriptors.Remove(type);
113113
foreach (var interfaceType in lazyBindDescriptor.InterfaceTypes)
114114
{
@@ -127,7 +127,7 @@ public T Resolve<T>() where T : class
127127
throw new NoInstanceToInjectException($"Injection of type {type} failed.");
128128
}
129129

130-
return (T) value;
130+
return (T)value;
131131
}
132132

133133
public void InjectIn(object obj)
@@ -159,7 +159,7 @@ public void InjectIn(object obj)
159159

160160
public void InjectIn(GameObject go)
161161
{
162-
var components = go.GetComponentsInChildren<Component>(includeInactive:true);
162+
var components = go.GetComponentsInChildren<Component>(includeInactive: true);
163163

164164
foreach (var component in components)
165165
{

Assets/BossRoom/Scripts/Infrastructure/PubSub/MessageChannel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public virtual void Publish(T message)
4242
public virtual IDisposable Subscribe(Action<T> handler)
4343
{
4444
Assert.IsTrue(!m_MessageHandlers.Contains(handler), "Attempting to subscribe with the same handler more than once");
45-
// so we don't modify the handler list while iterating on it (which could happen if the handler unsubscribes). With this, we'd unsubscribe on next publish.
45+
// so we don't modify the handler list while iterating on it (which could happen if the handler unsubscribes). With this, we'd unsubscribe on next publish.
4646
m_PendingHandlers.Enqueue(() => { DoSubscribe(handler); });
4747

4848
var subscription = new DisposableSubscription<T>(this, handler);

Assets/BossRoom/Scripts/Infrastructure/UpdateRunner.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using UnityEngine;
44

@@ -56,7 +56,7 @@ public void Subscribe(Action<float> onUpdate, float updatePeriod)
5656
{
5757
if (m_Subscribers.Add(onUpdate))
5858
{
59-
m_SubscriberData.Add(onUpdate, new SubscriberData() {Period = updatePeriod, NextCallTime = 0});
59+
m_SubscriberData.Add(onUpdate, new SubscriberData() { Period = updatePeriod, NextCallTime = 0 });
6060
}
6161
});
6262
}
@@ -71,7 +71,7 @@ public void Unsubscribe(Action<float> onUpdate)
7171
{
7272
m_Subscribers.Remove(onUpdate);
7373
m_SubscriberData.Remove(onUpdate);
74-
} );
74+
});
7575
}
7676

7777
/// <summary>

Assets/BossRoom/Scripts/UnityServices/Lobbies/JoinedLobbyContentHeartbeat.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure;
1+
using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure;
22

33
namespace Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Lobbies
44
{

Assets/BossRoom/Scripts/UnityServices/Lobbies/LobbyAPIInterface.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Threading.Tasks;
44
using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure;
@@ -120,7 +120,7 @@ public async Task RemovePlayerFromLobby(string requesterUasId, string lobbyId)
120120
await ExceptionHandling(Lobbies.Instance.RemovePlayerAsync(lobbyId, requesterUasId));
121121
}
122122
catch (LobbyServiceException e)
123-
when (e is {Reason: LobbyExceptionReason.PlayerNotFound})
123+
when (e is { Reason: LobbyExceptionReason.PlayerNotFound })
124124
{
125125
// If Player is not found, they have already left the lobby or have been kicked out. No need to throw here
126126
}
@@ -145,7 +145,7 @@ public async Task<Lobby> GetLobby(string lobbyId)
145145

146146
public async Task<Lobby> UpdateLobby(string lobbyId, Dictionary<string, DataObject> data, bool shouldLock)
147147
{
148-
UpdateLobbyOptions updateOptions = new UpdateLobbyOptions { Data = data , IsLocked = shouldLock};
148+
UpdateLobbyOptions updateOptions = new UpdateLobbyOptions { Data = data, IsLocked = shouldLock };
149149
return await ExceptionHandling(Lobbies.Instance.UpdateLobbyAsync(lobbyId, updateOptions));
150150
}
151151

Assets/BossRoom/Scripts/UnityServices/Lobbies/LobbyServiceFacade.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Net.Http;
44
using System.Runtime.CompilerServices;
@@ -83,7 +83,7 @@ public void SetRemoteLobby(Lobby lobby)
8383

8484
public void BeginTracking()
8585
{
86-
if(!m_IsTracking)
86+
if (!m_IsTracking)
8787
{
8888
m_IsTracking = true;
8989
// 2s update cadence is arbitrary and is here to demonstrate the fact that this update can be rather infrequent
@@ -144,7 +144,7 @@ async void UpdateLobby(float unused)
144144
return;
145145
}
146146
}
147-
m_UnityServiceErrorMessagePub.Publish(new UnityServiceErrorMessage("Host left the lobby","Disconnecting.", UnityServiceErrorMessage.Service.Lobby));
147+
m_UnityServiceErrorMessagePub.Publish(new UnityServiceErrorMessage("Host left the lobby", "Disconnecting.", UnityServiceErrorMessage.Service.Lobby));
148148
await EndTracking();
149149
// no need to disconnect Netcode, it should already be handled by Netcode's callback to disconnect
150150
}
@@ -201,8 +201,8 @@ async void UpdateLobby(float unused)
201201
{
202202
if (!string.IsNullOrEmpty(lobbyCode))
203203
{
204-
var lobby = await m_LobbyApiInterface.JoinLobbyByCode(AuthenticationService.Instance.PlayerId, lobbyCode, m_LocalUser.GetDataForUnityServices());
205-
return (true, lobby);
204+
var lobby = await m_LobbyApiInterface.JoinLobbyByCode(AuthenticationService.Instance.PlayerId, lobbyCode, m_LocalUser.GetDataForUnityServices());
205+
return (true, lobby);
206206
}
207207
else
208208
{
@@ -320,7 +320,8 @@ public async Task UpdatePlayerDataAsync(Dictionary<string, PlayerDataObject> dat
320320
{
321321
var result = await m_LobbyApiInterface.UpdatePlayer(CurrentUnityLobby.Id, AuthenticationService.Instance.PlayerId, data, null, null);
322322

323-
if (result != null) {
323+
if (result != null)
324+
{
324325
CurrentUnityLobby = result; // Store the most up-to-date lobby now since we have it, instead of waiting for the next heartbeat.
325326
}
326327
}

Assets/BossRoom/Scripts/UnityServices/Lobbies/LocalLobbyUser.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ public void CopyDataFrom(LocalLobbyUser lobby)
9898
{
9999
var data = lobby.m_UserData;
100100
int lastChanged = // Set flags just for the members that will be changed.
101-
(m_UserData.IsHost == data.IsHost ? 0 : (int) UserMembers.IsHost) |
102-
(m_UserData.DisplayName == data.DisplayName ? 0 : (int) UserMembers.DisplayName) |
103-
(m_UserData.ID == data.ID ? 0 : (int) UserMembers.ID);
101+
(m_UserData.IsHost == data.IsHost ? 0 : (int)UserMembers.IsHost) |
102+
(m_UserData.DisplayName == data.DisplayName ? 0 : (int)UserMembers.DisplayName) |
103+
(m_UserData.ID == data.ID ? 0 : (int)UserMembers.ID);
104104

105105
if (lastChanged == 0) // Ensure something actually changed.
106106
{

Assets/BossRoom/Scripts/UnityServices/Lobbies/Messages/LobbyListFetchedMessage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace Unity.Multiplayer.Samples.BossRoom.Shared.Net.UnityServices.Lobbies
55
public struct LobbyListFetchedMessage
66
{
77
public readonly IReadOnlyList<LocalLobby> LocalLobbies;
8-
8+
99
public LobbyListFetchedMessage(List<LocalLobby> localLobbies)
1010
{
1111
LocalLobbies = localLobbies;

Packages/com.unity.multiplayer.samples.coop/Utilities/Net/SessionManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ void ClearDisconnectedPlayersData()
242242
foreach (var id in m_ClientIDToPlayerId.Keys)
243243
{
244244
var data = GetPlayerData(id);
245-
if (data is {IsConnected: false})
245+
if (data is { IsConnected: false })
246246
{
247247
idsToClear.Add(id);
248248
}

Packages/com.unity.multiplayer.samples.coop/Utilities/SceneManagement/ClientLoadingScreen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ IEnumerator FadeOutCoroutine()
166166
float currentTime = 0;
167167
while (currentTime < m_FadeOutDuration)
168168
{
169-
m_CanvasGroup.alpha = Mathf.Lerp(1, 0, currentTime/ m_FadeOutDuration);
169+
m_CanvasGroup.alpha = Mathf.Lerp(1, 0, currentTime / m_FadeOutDuration);
170170
yield return null;
171171
currentTime += Time.deltaTime;
172172
}

Packages/com.unity.multiplayer.samples.coop/Utilities/SceneManagement/NetworkedLoadingProgressTracker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace Unity.Multiplayer.Samples.Utilities
55
/// <summary>
66
/// Simple object that keeps track of the scene loading progress of a specific instance.
77
/// </summary>
8-
public class NetworkedLoadingProgressTracker: NetworkBehaviour
8+
public class NetworkedLoadingProgressTracker : NetworkBehaviour
99
{
1010
/// <summary>
1111
/// The current loading progress associated with the owner of this NetworkBehavior

Packages/com.unity.multiplayer.samples.coop/Utilities/SceneManagement/SceneLoaderWrapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ void OnSceneEvent(SceneEvent sceneEvent)
155155
if (NetworkManager.IsServer)
156156
{
157157
// Send client RPC to make sure the client stops the loading screen after the server handles what it needs to after the client finished synchronizing, for example character spawning done server side should still be hidden by loading screen.
158-
StopLoadingScreenClientRpc(new ClientRpcParams {Send = new ClientRpcSendParams {TargetClientIds = new[] {sceneEvent.ClientId}}});
158+
StopLoadingScreenClientRpc(new ClientRpcParams { Send = new ClientRpcSendParams { TargetClientIds = new[] { sceneEvent.ClientId } } });
159159
}
160160
break;
161161
}

0 commit comments

Comments
 (0)