-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
721 additions
and
815 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using EvoSC.Common.Util.EnumIdentifier; | ||
|
||
namespace EvoSC.Common.Util.Manialinks; | ||
|
||
public enum WidgetPosition | ||
{ | ||
[Identifier(Name = "left", NoPrefix = true)] | ||
Left, | ||
|
||
[Identifier(Name = "right", NoPrefix = true)] | ||
Right, | ||
|
||
[Identifier(Name = "center", NoPrefix = true)] | ||
Center, | ||
|
||
[Identifier(Name = "", NoPrefix = true)] | ||
Undefined, | ||
} |
22 changes: 22 additions & 0 deletions
22
src/Modules/LiveRankingModule/Config/ILiveRankingSettings.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,22 @@ | ||
using System.ComponentModel; | ||
using Config.Net; | ||
using EvoSC.Common.Util.Manialinks; | ||
using EvoSC.Modules.Attributes; | ||
|
||
namespace EvoSC.Modules.Official.LiveRankingModule.Config; | ||
|
||
[Settings] | ||
public interface ILiveRankingSettings | ||
{ | ||
[Option(DefaultValue = 10), Description("Max of rows to show in the live ranking widget.")] | ||
public int MaxWidgetRows { get; set; } | ||
|
||
[Option(DefaultValue = 63.0), Description("Specifies the Y position of the widget.")] | ||
public double Y { get; set; } | ||
|
||
[Option(DefaultValue = 36.0), Description("Specifies the width of the widget.")] | ||
public double Width { get; set; } | ||
|
||
[Option(DefaultValue = "right"), Description("Specifies on which side the widget is displayed.")] | ||
public WidgetPosition Position { get; set; } | ||
} |
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
76 changes: 22 additions & 54 deletions
76
src/Modules/LiveRankingModule/Interfaces/ILiveRankingService.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 |
---|---|---|
@@ -1,92 +1,60 @@ | ||
using EvoSC.Common.Remote.EventArgsModels; | ||
using EvoSC.Common.Models.Callbacks; | ||
using EvoSC.Common.Remote.EventArgsModels; | ||
using EvoSC.Modules.Official.LiveRankingModule.Models; | ||
using GbxRemoteNet.Events; | ||
|
||
namespace EvoSC.Modules.Official.LiveRankingModule.Interfaces; | ||
|
||
public interface ILiveRankingService | ||
{ | ||
/// <summary> | ||
/// Called on when module is enabled | ||
/// Determines if current mode is points based and requests scores. | ||
/// </summary> | ||
/// <returns></returns> | ||
Task OnEnableAsync(); | ||
public Task DetectModeAndRequestScoreAsync(); | ||
|
||
/// <summary> | ||
/// Called on when module is disabled | ||
/// Requests scores from the game mode. | ||
/// </summary> | ||
/// <returns></returns> | ||
Task OnDisableAsync(); | ||
public Task RequestScoresAsync(); | ||
|
||
/// <summary> | ||
/// Called when a player passes a checkpoint. | ||
/// Maps the scores and displays the widget. | ||
/// </summary> | ||
/// <param name="scores"></param> | ||
/// <returns></returns> | ||
Task OnPlayerWaypointAsync(WayPointEventArgs args); | ||
public Task MapScoresAndSendWidgetAsync(ScoresEventArgs scores); | ||
|
||
/// <summary> | ||
/// Called when a player retires from the current round. | ||
/// Maps the given ScoresEventArgs to LiveRankingPositions. | ||
/// </summary> | ||
/// <param name="scores"></param> | ||
/// <returns></returns> | ||
Task OnPlayerGiveupAsync(PlayerUpdateEventArgs args); | ||
public Task<IEnumerable<LiveRankingPosition>> MapScoresAsync(ScoresEventArgs scores); | ||
|
||
/// <summary> | ||
/// Called when a new map starts. | ||
/// Hides the live ranking widget for everyone. | ||
/// </summary> | ||
/// <returns></returns> | ||
Task OnBeginMapAsync(MapEventArgs args); | ||
public Task HideWidgetAsync(); | ||
|
||
/// <summary> | ||
/// Called when a map ends. | ||
/// Returns whether the current mode is points based. | ||
/// </summary> | ||
/// <returns></returns> | ||
Task OnEndMapAsync(MapEventArgs args); | ||
public Task<bool> CurrentModeIsPointsBasedAsync(); | ||
|
||
/// <summary> | ||
/// Called when a round ends. | ||
/// Determines whether a score should be displayed in the widget. | ||
/// </summary> | ||
/// <param name="score"></param> | ||
/// <returns></returns> | ||
Task OnEndRoundAsync(RoundEventArgs args); | ||
public bool ScoreShouldBeDisplayed(PlayerScore score); | ||
|
||
/// <summary> | ||
/// Called when a new round starts. | ||
/// Converts a PlayerScore to a LiveRankingPosition object. | ||
/// </summary> | ||
/// <param name="score"></param> | ||
/// <returns></returns> | ||
Task OnStartRoundAsync(RoundEventArgs args); | ||
|
||
/// <summary> | ||
/// Called when the podium sequence starts. | ||
/// </summary> | ||
/// <returns></returns> | ||
Task OnPodiumStartAsync(PodiumEventArgs args); | ||
|
||
/// <summary> | ||
/// Sends a manialink. | ||
/// </summary> | ||
/// <returns></returns> | ||
Task SendManialinkAsync(); | ||
|
||
/// <summary> | ||
/// Called when a new match starts. | ||
/// </summary> | ||
/// <returns></returns> | ||
Task OnBeginMatchAsync(); | ||
|
||
/// <summary> | ||
/// Called when a match ends. | ||
/// </summary> | ||
/// <returns></returns> | ||
Task OnEndMatchAsync(EndMatchGbxEventArgs args); | ||
|
||
/// <summary> | ||
/// Calculates and sets the diffs of given live ranking positions. | ||
/// </summary> | ||
/// <returns></returns> | ||
Task CalculateDiffsAsync(List<ExpandedLiveRankingPosition> rankings); | ||
|
||
/// <summary> | ||
/// Resets the live ranking data. | ||
/// </summary> | ||
/// <returns></returns> | ||
Task ResetLiveRankingAsync(); | ||
public LiveRankingPosition PlayerScoreToLiveRankingPosition(PlayerScore score); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<root> | ||
<xsd:schema xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root"> | ||
<xsd:element name="root" msdata:IsDataSet="true"> | ||
</xsd:element> | ||
</xsd:schema> | ||
<resheader name="resmimetype"> | ||
<value>text/microsoft-resx</value> | ||
</resheader> | ||
<resheader name="version"> | ||
<value>1.3</value> | ||
</resheader> | ||
<resheader name="reader"> | ||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
<resheader name="writer"> | ||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
</root> |
36 changes: 0 additions & 36 deletions
36
src/Modules/LiveRankingModule/Models/ExpandedLiveRankingPosition.cs
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,3 @@ | ||
namespace EvoSC.Modules.Official.LiveRankingModule.Models; | ||
|
||
/// <summary> | ||
/// The live ranking position of a player. | ||
/// </summary> | ||
/// <param name="AccountId">Account Id of the player.</param> | ||
/// <param name="CpTime">The checkpoint time of the player.</param> | ||
/// <param name="CpIndex">The checkpoint index that was driven through.</param> | ||
/// <param name="IsDnf">Whether the player has given up or not.</param> | ||
/// <param name="IsFinish">Whether the player has finished.</param> | ||
public record LiveRankingPosition(string AccountId, int CpTime, int CpIndex, bool IsDnf, bool IsFinish); | ||
public record LiveRankingPosition(string AccountId, string Name, int Position, int Time, int Points); |
Oops, something went wrong.