Class AchievementAuthoringReviewCache
Holds what the project-wide authoring rules last said about one achievement, and knows when that answer is out of date.
Inherited Members
Namespace: Serenity.Achievements.Infrastructure.Editor
Assembly: Serenity.UnityAchievements.Infrastructure.Editor.dll
Syntax
public sealed class AchievementAuthoringReviewCache
Remarks
The check loads every achievement asset in the project, so no tool can pay for it on every repaint. What makes the answer stale is not obvious enough to leave to each tool: the asset changed, its id changed, or the PROJECT changed — a duplicate id arrives by some other asset being created, renamed, imported or deleted, which the tool showing this achievement never sees.
The id is tracked separately from the rest because the inspector's base class writes it straight to the
object rather than through the serialized object its subclass watches; a tool that only watches its own
ApplyModifiedProperties would show findings about the previous id indefinitely.
Constructors
AchievementAuthoringReviewCache(Func<UnityAchievementDefinition, IReadOnlyList<AuthoringIssue>>)
Creates a cache over the shared project-wide review.
Declaration
public AchievementAuthoringReviewCache(Func<UnityAchievementDefinition, IReadOnlyList<AuthoringIssue>> review = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<UnityAchievementDefinition, IReadOnlyList<AuthoringIssue>> | review | What answers "what is wrong with this achievement". Defaults to Check(UnityAchievementDefinition); a test hands in its own so it does not have to write assets to disk to be asked the question. |
Properties
Failure
Declaration
public string Failure { get; }
Property Value
| Type | Description |
|---|---|
| string | Why the rules could not judge the achievement, or null when they did. |
Remarks
Separate from an empty Findings, because "nothing is wrong" and "nothing could be checked" are opposite answers and only one of them means the author can stop looking.
Findings
Declaration
public IReadOnlyList<AuthoringIssue> Findings { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<AuthoringIssue> | What the rules last said, never null and always empty when they could not be run. |
Methods
MarkStale()
Declares the held findings out of date.
Declaration
public void MarkStale()
RefreshWhenStale(UnityAchievementDefinition)
Re-runs the rules when what they last said can no longer be trusted.
Declaration
public void RefreshWhenStale(UnityAchievementDefinition definition)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityAchievementDefinition | definition | The achievement to judge. Null clears the findings. |