1212namespace Unity . BossRoom . Gameplay . GameState
1313{
1414 /// <summary>
15- /// Client specialization of the Character Select game state. Mainly controls the UI during character-select.
15+ /// Client specialization of the Character Select game state. Mainly controls the UI during character-select.
1616 /// </summary>
1717 [ RequireComponent ( typeof ( NetcodeHooks ) ) ]
1818 public class ClientCharSelectState : GameStateBehaviour
1919 {
2020 /// <summary>
21- /// Reference to the scene's state object so that UI can access state
21+ /// Reference to the scene's state object so that UI can access state
2222 /// </summary>
2323 public static ClientCharSelectState Instance { get ; private set ; }
2424
2525 [ SerializeField ]
2626 NetcodeHooks m_NetcodeHooks ;
2727
28- public override GameState ActiveState { get { return GameState . CharSelect ; } }
28+ public override GameState ActiveState
29+ {
30+ get { return GameState . CharSelect ; }
31+ }
2932
3033 [ SerializeField ]
3134 NetworkCharSelection m_NetworkCharSelection ;
@@ -49,6 +52,7 @@ public class ColorAndIndicator
4952 public Sprite Indicator ;
5053 public Color Color ;
5154 }
55+
5256 [ Tooltip ( "Representational information for each player" ) ]
5357 public ColorAndIndicator [ ] m_IdentifiersForEachPlayerNumber ;
5458
@@ -68,7 +72,7 @@ public class ColorAndIndicator
6872 [ SerializeField ]
6973 [ 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!" ) ]
7074 List < GameObject > m_UIElementsForSeatChosen ;
71-
75+
7276 [ SerializeField ]
7377 [ Tooltip ( "UI elements to turn on when the session is closed (and game is about to start). Turned off otherwise!" ) ]
7478 List < GameObject > m_UIElementsForSessionEnding ;
@@ -95,10 +99,10 @@ public class ColorAndIndicator
9599 Dictionary < Guid , GameObject > m_SpawnedCharacterGraphics = new Dictionary < Guid , GameObject > ( ) ;
96100
97101 /// <summary>
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
100- /// an abstraction that makes it easier to configure which UI elements should
101- /// be enabled/disabled in each stage of the session.
102+ /// Conceptual modes or stages that the session can be in. We don't actually
103+ /// bother to keep track of what SessionMode we're in at any given time; it's just
104+ /// an abstraction that makes it easier to configure which UI elements should
105+ /// be enabled/disabled in each stage of the session.
102106 /// </summary>
103107 enum SessionMode
104108 {
@@ -175,7 +179,7 @@ void OnNetworkSpawn()
175179 }
176180
177181 /// <summary>
178- /// Called when our PlayerNumber (e.g. P1, P2, etc.) has been assigned by the server
182+ /// Called when our PlayerNumber (e.g. P1, P2, etc.) has been assigned by the server
179183 /// </summary>
180184 /// <param name="playerNum"></param>
181185 void OnAssignedPlayerNumber ( int playerNum )
@@ -191,7 +195,7 @@ void UpdatePlayerCount()
191195 }
192196
193197 /// <summary>
194- /// Called by the server when any of the seats in the session have changed. (Including ours!)
198+ /// Called by the server when any of the seats in the session have changed. (Including ours!)
195199 /// </summary>
196200 void OnSessionPlayerStateChanged ( NetworkListEvent < NetworkCharSelection . SessionPlayerState > changeEvent )
197201 {
@@ -219,6 +223,7 @@ void OnSessionPlayerStateChanged(NetworkListEvent<NetworkCharSelection.SessionPl
219223 {
220224 // we haven't chosen a seat yet (or were kicked out of our seat by someone else)
221225 UpdateCharacterSelection ( NetworkCharSelection . SeatState . Inactive ) ;
226+
222227 // make sure our player num is properly set in Session UI
223228 OnAssignedPlayerNumber ( m_NetworkCharSelection . sessionPlayers [ localPlayerIdx ] . PlayerNumber ) ;
224229 }
@@ -230,9 +235,9 @@ void OnSessionPlayerStateChanged(NetworkListEvent<NetworkCharSelection.SessionPl
230235 }
231236
232237 /// <summary>
233- /// Internal utility that sets the character-graphics and class-info box based on
234- /// our chosen seat. It also triggers a SessionMode change when it notices that our seat-state
235- /// is LockedIn.
238+ /// Internal utility that sets the character-graphics and class-info box based on
239+ /// our chosen seat. It also triggers a SessionMode change when it notices that our seat-state
240+ /// is LockedIn.
236241 /// </summary>
237242 /// <param name="state">Our current seat state</param>
238243 /// <param name="seatIdx">Which seat we're sitting in, or -1 if SeatState is Inactive</param>
@@ -271,6 +276,7 @@ void UpdateCharacterSelection(NetworkCharSelection.SeatState state, int seatIdx
271276 m_ClassInfoBox . ConfigureForClass ( m_NetworkCharSelection . AvatarConfiguration [ seatIdx ] . CharacterClass ) ;
272277 }
273278 }
279+
274280 if ( state == NetworkCharSelection . SeatState . LockedIn && ! m_HasLocalPlayerLockedIn )
275281 {
276282 // the local player has locked in their seat choice! Rearrange the UI appropriately
@@ -297,7 +303,7 @@ void UpdateCharacterSelection(NetworkCharSelection.SeatState state, int seatIdx
297303 }
298304
299305 /// <summary>
300- /// Internal utility that sets the graphics for the eight session-seats (based on their current networked state)
306+ /// Internal utility that sets the graphics for the eight session-seats (based on their current networked state)
301307 /// </summary>
302308 void UpdateSeats ( )
303309 {
@@ -326,7 +332,7 @@ void UpdateSeats()
326332 }
327333
328334 /// <summary>
329- /// Called by the server when the session closes (because all players are seated and locked in)
335+ /// Called by the server when the session closes (because all players are seated and locked in)
330336 /// </summary>
331337 void OnSessionClosedChanged ( bool wasSessionClosed , bool isSessionClosed )
332338 {
@@ -349,9 +355,9 @@ void OnSessionClosedChanged(bool wasSessionClosed, bool isSessionClosed)
349355 }
350356
351357 /// <summary>
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
354- /// given mode.
358+ /// Turns on the UI elements for a specified "session mode", and turns off UI elements for all other modes.
359+ /// It can also disable/enable the session seats and the "Ready" button if they are inappropriate for the
360+ /// given mode.
355361 /// </summary>
356362 void ConfigureUIForSessionMode ( SessionMode mode )
357363 {
@@ -380,8 +386,10 @@ void ConfigureUIForSessionMode(SessionMode mode)
380386 {
381387 m_CurrentCharacterGraphics . gameObject . SetActive ( false ) ;
382388 }
389+
383390 m_ClassInfoBox . ConfigureForNoSelection ( ) ;
384391 }
392+
385393 m_ReadyButtonText . text = "READY!" ;
386394 break ;
387395 case SessionMode . SeatChosen :
@@ -405,11 +413,10 @@ void ConfigureUIForSessionMode(SessionMode mode)
405413 // disable interaction if seat is already locked or all seats disabled
406414 seat . SetDisableInteraction ( seat . IsLocked ( ) || isSeatsDisabledInThisMode ) ;
407415 }
408-
409416 }
410417
411418 /// <summary>
412- /// Called directly by UI elements!
419+ /// Called directly by UI elements!
413420 /// </summary>
414421 /// <param name="seatIdx"></param>
415422 public void OnPlayerClickedSeat ( int seatIdx )
@@ -421,7 +428,7 @@ public void OnPlayerClickedSeat(int seatIdx)
421428 }
422429
423430 /// <summary>
424- /// Called directly by UI elements!
431+ /// Called directly by UI elements!
425432 /// </summary>
426433 public void OnPlayerClickedReady ( )
427434 {
@@ -442,6 +449,5 @@ GameObject GetCharacterGraphics(Avatar avatar)
442449
443450 return characterGraphics ;
444451 }
445-
446452 }
447453}
0 commit comments