-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge XPEvo fixed/changes into main repository (#317)
Co-authored-by: Christopher F. <Chris92de@users.noreply.github.com> Co-authored-by: Alex 'Braker' R. <araszka94@gmail.com> Co-authored-by: braker <7152322+araszka@users.noreply.github.com> Co-authored-by: snixtho <snixtho@users.noreply.github.com>
- Loading branch information
1 parent
7bcb862
commit 8aec2f3
Showing
72 changed files
with
3,994 additions
and
45 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
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
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
28 changes: 28 additions & 0 deletions
28
src/Modules/RoundRankingModule/Config/IRoundRankingSettings.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,28 @@ | ||
using System.ComponentModel; | ||
using Config.Net; | ||
using EvoSC.Common.Util.Manialinks; | ||
using EvoSC.Modules.Attributes; | ||
|
||
namespace EvoSC.Modules.Official.RoundRankingModule.Config; | ||
|
||
[Settings] | ||
public interface IRoundRankingSettings | ||
{ | ||
[Option(DefaultValue = WidgetPosition.Left)] | ||
[Description("Specifies on which side the widget is displayed. Valid values are Left | Right.")] | ||
public WidgetPosition Position { get; set; } | ||
|
||
[Option(DefaultValue = 15.0), Description("Defines the Y position of the widget.")] | ||
public double Y { get; set; } | ||
|
||
[Option(DefaultValue = 8), Description("Limits the rows shown in the widget.")] | ||
public int MaxRows { get; set; } | ||
|
||
[Option(DefaultValue = false), | ||
Description("Shows the time difference to the leading player instead of individual times.")] | ||
public bool DisplayTimeDifference { get; set; } | ||
|
||
[Option(DefaultValue = true), | ||
Description("Shows the gained points once a player crosses the finish line.")] | ||
public bool DisplayGainedPoints { get; set; } | ||
} |
74 changes: 74 additions & 0 deletions
74
src/Modules/RoundRankingModule/Controllers/RoundRankingEventController.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,74 @@ | ||
using EvoSC.Common.Controllers; | ||
using EvoSC.Common.Controllers.Attributes; | ||
using EvoSC.Common.Events.Attributes; | ||
using EvoSC.Common.Interfaces.Controllers; | ||
using EvoSC.Common.Remote; | ||
using EvoSC.Common.Remote.EventArgsModels; | ||
using EvoSC.Modules.Official.RoundRankingModule.Interfaces; | ||
|
||
namespace EvoSC.Modules.Official.RoundRankingModule.Controllers; | ||
|
||
[Controller] | ||
public class RoundRankingEventController( | ||
IRoundRankingService roundRankingService, | ||
IRoundRankingStateService roundRankingStateService | ||
) | ||
: EvoScController<IEventControllerContext> | ||
{ | ||
[Subscribe(ModeScriptEvent.WayPoint)] | ||
public async Task OnWaypointAsync(object sender, WayPointEventArgs args) | ||
{ | ||
await roundRankingService.ConsumeCheckpointAsync( | ||
args.AccountId, | ||
args.CheckpointInLap, | ||
args.LapTime, | ||
args.IsEndLap, | ||
false | ||
); | ||
} | ||
|
||
[Subscribe(ModeScriptEvent.GiveUp)] | ||
public Task OnPlayerGiveUpAsync(object sender, PlayerUpdateEventArgs args) => | ||
roundRankingService.ConsumeDnfAsync(args.AccountId); | ||
|
||
[Subscribe(ModeScriptEvent.EndRoundEnd)] | ||
public Task OnEndRoundAsync(object sender, EventArgs args) => | ||
roundRankingService.ClearCheckpointDataAsync(); | ||
|
||
[Subscribe(ModeScriptEvent.WarmUpEndRound)] | ||
public Task OnWarmUpEndRoundAsync(object sender, WarmUpRoundEventArgs args) => | ||
roundRankingService.ClearCheckpointDataAsync(); | ||
|
||
[Subscribe(ModeScriptEvent.StartMatchStart)] | ||
public Task OnStartMatchAsync(object sender, MatchEventArgs args) => | ||
roundRankingService.ClearCheckpointDataAsync(); | ||
|
||
[Subscribe(ModeScriptEvent.StartLine)] | ||
public Task OnStartLineAsync(object sender, PlayerUpdateEventArgs args) => | ||
roundRankingService.RemovePlayerCheckpointDataAsync(args.AccountId); | ||
|
||
[Subscribe(ModeScriptEvent.Respawn)] | ||
public Task OnRespawnAsync(object sender, PlayerUpdateEventArgs args) => | ||
roundRankingService.RemovePlayerCheckpointDataAsync(args.AccountId); | ||
|
||
[Subscribe(ModeScriptEvent.PodiumStart)] | ||
public Task OnPodiumStartAsync(object sender, EventArgs args) => | ||
roundRankingService.HideRoundRankingWidgetAsync(); | ||
|
||
[Subscribe(GbxRemoteEvent.BeginMap)] | ||
public async Task OnStartMapAsync(object sender, EventArgs args) | ||
{ | ||
await roundRankingService.DetectAndSetIsTeamsModeAsync(); | ||
await roundRankingService.FetchAndCacheTeamInfoAsync(); | ||
await roundRankingService.LoadPointsRepartitionFromSettingsAsync(); | ||
await roundRankingService.ClearCheckpointDataAsync(); | ||
} | ||
|
||
[Subscribe(ModeScriptEvent.WarmUpStart)] | ||
public Task OnWarmUpStartAsync(object sender, EventArgs args) => | ||
roundRankingStateService.SetIsTimeAttackModeAsync(true); | ||
|
||
[Subscribe(ModeScriptEvent.WarmUpEnd)] | ||
public Task OnWarmUpEndAsync(object sender, EventArgs args) => | ||
roundRankingStateService.SetIsTimeAttackModeAsync(false); | ||
} |
Oops, something went wrong.