r2mods/ilspy_dump/ror2_csproj/RoR2.Achievements/BaseEndingAchievement.cs

28 lines
554 B
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
namespace RoR2.Achievements;
public abstract class BaseEndingAchievement : BaseAchievement
{
protected abstract bool ShouldGrant(RunReport runReport);
public override void OnInstall()
{
base.OnInstall();
Run.onClientGameOverGlobal += OnClientGameOverGlobal;
}
public override void OnUninstall()
{
Run.onClientGameOverGlobal -= OnClientGameOverGlobal;
base.OnUninstall();
}
protected virtual void OnClientGameOverGlobal(Run run, RunReport runReport)
{
if (ShouldGrant(runReport))
{
Grant();
}
TryToCompleteActivity();
}
}