-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #259 from MrDave1999/dev
9.2.0 Release
- Loading branch information
Showing
13 changed files
with
174 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 9 additions & 1 deletion
10
src/Application/CommandLockMiddleware.cs → ...pplication/PlayerCommandLockMiddleware.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 1 addition & 13 deletions
14
...Players/GeneralCommands/PublicCommands.cs → .../GeneralCommands/Public/PublicCommands.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/Application/Players/GeneralCommands/Public/ShowCommands.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
namespace CTF.Application.Players.GeneralCommands.Public; | ||
|
||
public class ShowCommands(IDialogService dialogService) : ISystem | ||
{ | ||
[PlayerCommand("cmds")] | ||
public async void ShowFirstDialog(Player player) | ||
{ | ||
var content = Smart.Format(DetailedCommandInfo.Public1, new | ||
{ | ||
Color1 = Color.Yellow, | ||
Color2 = Color.White | ||
}); | ||
var firstDialog = new MessageDialog( | ||
caption: "Commands [1/2]", | ||
content, | ||
button1: "Next", | ||
button2: "Close" | ||
); | ||
var response = await dialogService.ShowAsync(player, firstDialog); | ||
if (response.Response == DialogResponse.LeftButton) | ||
ShowNextDialog(player); | ||
} | ||
|
||
private async void ShowNextDialog(Player player) | ||
{ | ||
var content = Smart.Format(DetailedCommandInfo.Public2, new | ||
{ | ||
Color1 = Color.Yellow, | ||
Color2 = Color.White | ||
}); | ||
var nextDialog = new MessageDialog( | ||
caption: "Commands [2/2]", | ||
content, | ||
button1: "Previous", | ||
button2: "Close" | ||
); | ||
var response = await dialogService.ShowAsync(player, nextDialog); | ||
if (response.Response == DialogResponse.LeftButton) | ||
ShowFirstDialog(player); | ||
} | ||
} |
22 changes: 19 additions & 3 deletions
22
src/Application/Players/GeneralCommands/Resources/DetailedCommandInfo.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/Application/Teams/ClassSelection/PlayerRequestSpawnMiddleware.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
namespace CTF.Application.Teams.ClassSelection; | ||
|
||
public class PlayerRequestSpawnMiddleware( | ||
IEntityManager entityManager, | ||
EventDelegate next, | ||
MapRotationService mapRotationService) | ||
{ | ||
/// <summary> | ||
/// Invokes the middleware logic to handle player spawn requests. | ||
/// </summary> | ||
/// <param name="context">Contains context information about the fired event.</param> | ||
/// <returns> | ||
/// <see langword="false"/> if any condition is met to prevent the player from spawning. | ||
/// Otherwise, it proceeds to the next middleware or action. | ||
/// </returns> | ||
public object Invoke(EventContext context) | ||
{ | ||
int playerId = (int)context.Arguments[0]; | ||
EntityId entity = SampEntities.GetPlayerId(playerId); | ||
Player player = entityManager.GetComponent<Player>(entity); | ||
if (player.IsUnauthenticated()) | ||
{ | ||
player.SendClientMessage(Color.Red, Messages.LoginOrRegisterToContinue); | ||
return false; | ||
} | ||
|
||
if (mapRotationService.IsMapLoading()) | ||
{ | ||
player.SendClientMessage(Color.Red, Messages.MapIsLoading); | ||
return false; | ||
} | ||
|
||
Team selectedTeam = player.Team == (int)TeamId.Alpha ? Team.Alpha : Team.Beta; | ||
if (selectedTeam.IsFull()) | ||
{ | ||
string gameText = selectedTeam.GetAvailabilityMessage(); | ||
player.GameText(gameText, 999999999, 3); | ||
return false; | ||
} | ||
|
||
return next(context); | ||
} | ||
} |