Skip to content

Commit c919ba8

Browse files
committed
feat: rename lobby to session in char selection prefab
1 parent 9416fb2 commit c919ba8

File tree

4 files changed

+96
-96
lines changed

4 files changed

+96
-96
lines changed

Assets/Scenes/CharSelect.unity

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:fe57cffed60d9bfe7f42257a90c3d6a2240755dcaa4e10ae0c745f6fb4aecd66
3-
size 45820
2+
oid sha256:d8d33954123e1f21d88d8267ebc8097362995bab0f724e32de5226bc7c941054
3+
size 49148

Assets/Scripts/Gameplay/GameState/ClientCharSelectState.cs

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ public class ClientCharSelectState : GameStateBehaviour
3838
[Tooltip("This is triggered when the player presses the \"Ready\" button")]
3939
string m_AnimationTriggerOnCharChosen = "BeginRevive";
4040

41-
[Header("Lobby Seats")]
41+
[Header("Session Seats")]
4242
[SerializeField]
43-
[Tooltip("Collection of 8 portrait-boxes, one for each potential lobby member")]
43+
[Tooltip("Collection of 8 portrait-boxes, one for each potential session member")]
4444
List<UICharSelectPlayerSeat> m_PlayerSeats;
4545

4646
[System.Serializable]
@@ -60,18 +60,18 @@ public class ColorAndIndicator
6060
[Tooltip("Text element for the Ready button")]
6161
TextMeshProUGUI m_ReadyButtonText;
6262

63-
[Header("UI Elements for different lobby modes")]
63+
[Header("UI Elements for different session modes")]
6464
[SerializeField]
6565
[Tooltip("UI elements to turn on when the player hasn't chosen their seat yet. Turned off otherwise!")]
6666
List<GameObject> m_UIElementsForNoSeatChosen;
6767

6868
[SerializeField]
6969
[Tooltip("UI elements to turn on when the player has locked in their seat choice (and is now waiting for other players to do the same). Turned off otherwise!")]
7070
List<GameObject> m_UIElementsForSeatChosen;
71-
71+
7272
[SerializeField]
73-
[Tooltip("UI elements to turn on when the lobby is closed (and game is about to start). Turned off otherwise!")]
74-
List<GameObject> m_UIElementsForLobbyEnding;
73+
[Tooltip("UI elements to turn on when the session is closed (and game is about to start). Turned off otherwise!")]
74+
List<GameObject> m_UIElementsForSessionEnding;
7575

7676
[SerializeField]
7777
[Tooltip("UI elements to turn on when there's been a fatal error (and the client cannot proceed). Turned off otherwise!")]
@@ -95,20 +95,20 @@ public class ColorAndIndicator
9595
Dictionary<Guid, GameObject> m_SpawnedCharacterGraphics = new Dictionary<Guid, GameObject>();
9696

9797
/// <summary>
98-
/// Conceptual modes or stages that the lobby can be in. We don't actually
99-
/// bother to keep track of what LobbyMode we're in at any given time; it's just
98+
/// Conceptual modes or stages that the session can be in. We don't actually
99+
/// bother to keep track of what SessionMode we're in at any given time; it's just
100100
/// an abstraction that makes it easier to configure which UI elements should
101-
/// be enabled/disabled in each stage of the lobby.
101+
/// be enabled/disabled in each stage of the session.
102102
/// </summary>
103-
enum LobbyMode
103+
enum SessionMode
104104
{
105105
ChooseSeat, // "Choose your seat!" stage
106106
SeatChosen, // "Waiting for other players!" stage
107-
LobbyEnding, // "Get ready! Game is starting!" stage
107+
SessionEnding, // "Get ready! Game is starting!" stage
108108
FatalError, // "Fatal Error" stage
109109
}
110110

111-
Dictionary<LobbyMode, List<GameObject>> m_LobbyUIElementsByMode;
111+
Dictionary<SessionMode, List<GameObject>> m_SessionUIElementsByMode;
112112

113113
[Inject]
114114
ConnectionManager m_ConnectionManager;
@@ -121,12 +121,12 @@ protected override void Awake()
121121
m_NetcodeHooks.OnNetworkSpawnHook += OnNetworkSpawn;
122122
m_NetcodeHooks.OnNetworkDespawnHook += OnNetworkDespawn;
123123

124-
m_LobbyUIElementsByMode = new Dictionary<LobbyMode, List<GameObject>>()
124+
m_SessionUIElementsByMode = new Dictionary<SessionMode, List<GameObject>>()
125125
{
126-
{ LobbyMode.ChooseSeat, m_UIElementsForNoSeatChosen },
127-
{ LobbyMode.SeatChosen, m_UIElementsForSeatChosen },
128-
{ LobbyMode.LobbyEnding, m_UIElementsForLobbyEnding },
129-
{ LobbyMode.FatalError, m_UIElementsForFatalError },
126+
{ SessionMode.ChooseSeat, m_UIElementsForNoSeatChosen },
127+
{ SessionMode.SeatChosen, m_UIElementsForSeatChosen },
128+
{ SessionMode.SessionEnding, m_UIElementsForSessionEnding },
129+
{ SessionMode.FatalError, m_UIElementsForFatalError },
130130
};
131131
}
132132

@@ -148,16 +148,16 @@ protected override void Start()
148148
m_PlayerSeats[i].Initialize(i);
149149
}
150150

151-
ConfigureUIForLobbyMode(LobbyMode.ChooseSeat);
151+
ConfigureUIForSessionMode(SessionMode.ChooseSeat);
152152
UpdateCharacterSelection(NetworkCharSelection.SeatState.Inactive);
153153
}
154154

155155
void OnNetworkDespawn()
156156
{
157157
if (m_NetworkCharSelection)
158158
{
159-
m_NetworkCharSelection.IsLobbyClosed.OnValueChanged -= OnLobbyClosedChanged;
160-
m_NetworkCharSelection.LobbyPlayers.OnListChanged -= OnLobbyPlayerStateChanged;
159+
m_NetworkCharSelection.IsSessionClosed.OnValueChanged -= OnSessionClosedChanged;
160+
m_NetworkCharSelection.sessionPlayers.OnListChanged -= OnSessionPlayerStateChanged;
161161
}
162162
}
163163

@@ -169,8 +169,8 @@ void OnNetworkSpawn()
169169
}
170170
else
171171
{
172-
m_NetworkCharSelection.IsLobbyClosed.OnValueChanged += OnLobbyClosedChanged;
173-
m_NetworkCharSelection.LobbyPlayers.OnListChanged += OnLobbyPlayerStateChanged;
172+
m_NetworkCharSelection.IsSessionClosed.OnValueChanged += OnSessionClosedChanged;
173+
m_NetworkCharSelection.sessionPlayers.OnListChanged += OnSessionPlayerStateChanged;
174174
}
175175
}
176176

@@ -185,24 +185,24 @@ void OnAssignedPlayerNumber(int playerNum)
185185

186186
void UpdatePlayerCount()
187187
{
188-
int count = m_NetworkCharSelection.LobbyPlayers.Count;
188+
int count = m_NetworkCharSelection.sessionPlayers.Count;
189189
var pstr = (count > 1) ? "players" : "player";
190190
m_NumPlayersText.text = "<b>" + count + "</b> " + pstr + " connected";
191191
}
192192

193193
/// <summary>
194-
/// Called by the server when any of the seats in the lobby have changed. (Including ours!)
194+
/// Called by the server when any of the seats in the session have changed. (Including ours!)
195195
/// </summary>
196-
void OnLobbyPlayerStateChanged(NetworkListEvent<NetworkCharSelection.LobbyPlayerState> changeEvent)
196+
void OnSessionPlayerStateChanged(NetworkListEvent<NetworkCharSelection.SessionPlayerState> changeEvent)
197197
{
198198
UpdateSeats();
199199
UpdatePlayerCount();
200200

201201
// now let's find our local player in the list and update the character/info box appropriately
202202
int localPlayerIdx = -1;
203-
for (int i = 0; i < m_NetworkCharSelection.LobbyPlayers.Count; ++i)
203+
for (int i = 0; i < m_NetworkCharSelection.sessionPlayers.Count; ++i)
204204
{
205-
if (m_NetworkCharSelection.LobbyPlayers[i].ClientId == NetworkManager.Singleton.LocalClientId)
205+
if (m_NetworkCharSelection.sessionPlayers[i].ClientId == NetworkManager.Singleton.LocalClientId)
206206
{
207207
localPlayerIdx = i;
208208
break;
@@ -211,27 +211,27 @@ void OnLobbyPlayerStateChanged(NetworkListEvent<NetworkCharSelection.LobbyPlayer
211211

212212
if (localPlayerIdx == -1)
213213
{
214-
// we aren't currently participating in the lobby!
215-
// this can happen for various reasons, such as the lobby being full and us not getting a seat.
214+
// we aren't currently participating in the session!
215+
// this can happen for various reasons, such as the session being full and us not getting a seat.
216216
UpdateCharacterSelection(NetworkCharSelection.SeatState.Inactive);
217217
}
218-
else if (m_NetworkCharSelection.LobbyPlayers[localPlayerIdx].SeatState == NetworkCharSelection.SeatState.Inactive)
218+
else if (m_NetworkCharSelection.sessionPlayers[localPlayerIdx].SeatState == NetworkCharSelection.SeatState.Inactive)
219219
{
220220
// we haven't chosen a seat yet (or were kicked out of our seat by someone else)
221221
UpdateCharacterSelection(NetworkCharSelection.SeatState.Inactive);
222-
// make sure our player num is properly set in Lobby UI
223-
OnAssignedPlayerNumber(m_NetworkCharSelection.LobbyPlayers[localPlayerIdx].PlayerNumber);
222+
// make sure our player num is properly set in Session UI
223+
OnAssignedPlayerNumber(m_NetworkCharSelection.sessionPlayers[localPlayerIdx].PlayerNumber);
224224
}
225225
else
226226
{
227-
// we have a seat! Note that if our seat is LockedIn, this function will also switch the lobby mode
228-
UpdateCharacterSelection(m_NetworkCharSelection.LobbyPlayers[localPlayerIdx].SeatState, m_NetworkCharSelection.LobbyPlayers[localPlayerIdx].SeatIdx);
227+
// we have a seat! Note that if our seat is LockedIn, this function will also switch the session mode
228+
UpdateCharacterSelection(m_NetworkCharSelection.sessionPlayers[localPlayerIdx].SeatState, m_NetworkCharSelection.sessionPlayers[localPlayerIdx].SeatIdx);
229229
}
230230
}
231231

232232
/// <summary>
233233
/// Internal utility that sets the character-graphics and class-info box based on
234-
/// our chosen seat. It also triggers a LobbyMode change when it notices that our seat-state
234+
/// our chosen seat. It also triggers a SessionMode change when it notices that our seat-state
235235
/// is LockedIn.
236236
/// </summary>
237237
/// <param name="state">Our current seat state</param>
@@ -276,15 +276,15 @@ void UpdateCharacterSelection(NetworkCharSelection.SeatState state, int seatIdx
276276
// the local player has locked in their seat choice! Rearrange the UI appropriately
277277
// the character should act excited
278278
m_CurrentCharacterGraphicsAnimator.SetTrigger(m_AnimationTriggerOnCharChosen);
279-
ConfigureUIForLobbyMode(m_NetworkCharSelection.IsLobbyClosed.Value ? LobbyMode.LobbyEnding : LobbyMode.SeatChosen);
279+
ConfigureUIForSessionMode(m_NetworkCharSelection.IsSessionClosed.Value ? SessionMode.SessionEnding : SessionMode.SeatChosen);
280280
m_HasLocalPlayerLockedIn = true;
281281
}
282282
else if (m_HasLocalPlayerLockedIn && state == NetworkCharSelection.SeatState.Active)
283283
{
284284
// reset character seats if locked in choice was unselected
285285
if (m_HasLocalPlayerLockedIn)
286286
{
287-
ConfigureUIForLobbyMode(LobbyMode.ChooseSeat);
287+
ConfigureUIForSessionMode(SessionMode.ChooseSeat);
288288
m_ClassInfoBox.SetLockedIn(false);
289289
m_HasLocalPlayerLockedIn = false;
290290
}
@@ -297,16 +297,16 @@ void UpdateCharacterSelection(NetworkCharSelection.SeatState state, int seatIdx
297297
}
298298

299299
/// <summary>
300-
/// Internal utility that sets the graphics for the eight lobby-seats (based on their current networked state)
300+
/// Internal utility that sets the graphics for the eight session-seats (based on their current networked state)
301301
/// </summary>
302302
void UpdateSeats()
303303
{
304304
// Players can hop between seats -- and can even SHARE seats -- while they're choosing a class.
305305
// Once they have chosen their class (by "locking in" their seat), other players in that seat are kicked out.
306306
// But until a seat is locked in, we need to display each seat as being used by the latest player to choose it.
307307
// So we go through all players and figure out who should visually be shown as sitting in that seat.
308-
NetworkCharSelection.LobbyPlayerState[] curSeats = new NetworkCharSelection.LobbyPlayerState[m_PlayerSeats.Count];
309-
foreach (NetworkCharSelection.LobbyPlayerState playerState in m_NetworkCharSelection.LobbyPlayers)
308+
NetworkCharSelection.SessionPlayerState[] curSeats = new NetworkCharSelection.SessionPlayerState[m_PlayerSeats.Count];
309+
foreach (NetworkCharSelection.SessionPlayerState playerState in m_NetworkCharSelection.sessionPlayers)
310310
{
311311
if (playerState.SeatIdx == -1 || playerState.SeatState == NetworkCharSelection.SeatState.Inactive)
312312
continue; // this player isn't seated at all!
@@ -326,54 +326,54 @@ void UpdateSeats()
326326
}
327327

328328
/// <summary>
329-
/// Called by the server when the lobby closes (because all players are seated and locked in)
329+
/// Called by the server when the session closes (because all players are seated and locked in)
330330
/// </summary>
331-
void OnLobbyClosedChanged(bool wasLobbyClosed, bool isLobbyClosed)
331+
void OnSessionClosedChanged(bool wasSessionClosed, bool isSessionClosed)
332332
{
333-
if (isLobbyClosed)
333+
if (isSessionClosed)
334334
{
335-
ConfigureUIForLobbyMode(LobbyMode.LobbyEnding);
335+
ConfigureUIForSessionMode(SessionMode.SessionEnding);
336336
}
337337
else
338338
{
339339
if (m_LastSeatSelected == -1)
340340
{
341-
ConfigureUIForLobbyMode(LobbyMode.ChooseSeat);
341+
ConfigureUIForSessionMode(SessionMode.ChooseSeat);
342342
}
343343
else
344344
{
345-
ConfigureUIForLobbyMode(LobbyMode.SeatChosen);
345+
ConfigureUIForSessionMode(SessionMode.SeatChosen);
346346
m_ClassInfoBox.ConfigureForClass(m_NetworkCharSelection.AvatarConfiguration[m_LastSeatSelected].CharacterClass);
347347
}
348348
}
349349
}
350350

351351
/// <summary>
352-
/// Turns on the UI elements for a specified "lobby mode", and turns off UI elements for all other modes.
353-
/// It can also disable/enable the lobby seats and the "Ready" button if they are inappropriate for the
352+
/// Turns on the UI elements for a specified "session mode", and turns off UI elements for all other modes.
353+
/// It can also disable/enable the session seats and the "Ready" button if they are inappropriate for the
354354
/// given mode.
355355
/// </summary>
356-
void ConfigureUIForLobbyMode(LobbyMode mode)
356+
void ConfigureUIForSessionMode(SessionMode mode)
357357
{
358358
// first the easy bit: turn off all the inappropriate ui elements, and turn the appropriate ones on!
359-
foreach (var list in m_LobbyUIElementsByMode.Values)
359+
foreach (var list in m_SessionUIElementsByMode.Values)
360360
{
361361
foreach (var uiElement in list)
362362
{
363363
uiElement.SetActive(false);
364364
}
365365
}
366366

367-
foreach (var uiElement in m_LobbyUIElementsByMode[mode])
367+
foreach (var uiElement in m_SessionUIElementsByMode[mode])
368368
{
369369
uiElement.SetActive(true);
370370
}
371371

372-
// that finishes the easy bit. Next, each lobby mode might also need to configure the lobby seats and class-info box.
372+
// that finishes the easy bit. Next, each session mode might also need to configure the session seats and class-info box.
373373
bool isSeatsDisabledInThisMode = false;
374374
switch (mode)
375375
{
376-
case LobbyMode.ChooseSeat:
376+
case SessionMode.ChooseSeat:
377377
if (m_LastSeatSelected == -1)
378378
{
379379
if (m_CurrentCharacterGraphics)
@@ -384,16 +384,16 @@ void ConfigureUIForLobbyMode(LobbyMode mode)
384384
}
385385
m_ReadyButtonText.text = "READY!";
386386
break;
387-
case LobbyMode.SeatChosen:
387+
case SessionMode.SeatChosen:
388388
isSeatsDisabledInThisMode = true;
389389
m_ClassInfoBox.SetLockedIn(true);
390390
m_ReadyButtonText.text = "UNREADY";
391391
break;
392-
case LobbyMode.FatalError:
392+
case SessionMode.FatalError:
393393
isSeatsDisabledInThisMode = true;
394394
m_ClassInfoBox.ConfigureForNoSelection();
395395
break;
396-
case LobbyMode.LobbyEnding:
396+
case SessionMode.SessionEnding:
397397
isSeatsDisabledInThisMode = true;
398398
m_ClassInfoBox.ConfigureForNoSelection();
399399
break;

0 commit comments

Comments
 (0)