Skip to content

Commit

Permalink
feat: Play intro music in class selection (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDave1999 authored Sep 19, 2024
1 parent fbeaf55 commit 857f65c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Application/Common/ServerSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ public class ServerSettings
public string GameModeText { get; init; } = string.Empty;
public string MapName { get; init; } = string.Empty;
public string WebUrl { get; init; } = string.Empty;
public string IntroAudioUrl { get; init; } = string.Empty;
}
5 changes: 4 additions & 1 deletion src/Application/Teams/ClassSelection/ClassSelectionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
public class ClassSelectionSystem(
ClassSelectionTextDrawRenderer classSelectionTextDrawRenderer,
TeamTextDrawRenderer teamTextDrawRenderer,
MapRotationService mapRotationService) : ISystem
MapRotationService mapRotationService,
ServerSettings serverSettings) : ISystem
{
[Event]
public void OnGameModeInit(IServerService serverService)
Expand All @@ -18,6 +19,7 @@ public void OnPlayerConnect(Player player)
player.Color = Team.None.ColorHex;
player.AddComponent<ClassSelectionComponent>();
player.RemoveAttachedObject(0);
player.PlayAudioStream(serverSettings.IntroAudioUrl);
classSelectionTextDrawRenderer.Show(player);
}

Expand Down Expand Up @@ -74,6 +76,7 @@ public bool OnPlayerRequestSpawn(Player player)
player.DisableClassSelection();
player.GameText("_", 1000, 4);
player.GetInfo().SetTeam(selectedTeam.Id);
player.StopAudioStream();
selectedTeam.Members.Add(player);
classSelectionTextDrawRenderer.Hide(player);
teamTextDrawRenderer.UpdateTeamMembers(selectedTeam);
Expand Down

0 comments on commit 857f65c

Please sign in to comment.