Class AchievementAuthoringSectionGui
The three blocks every tool that edits one achievement draws: what unlocks it, what is wrong with it, and the Play Mode unlock that proves it.
Inherited Members
Namespace: Serenity.Achievements.Infrastructure.Editor
Assembly: Serenity.UnityAchievements.Infrastructure.Editor.dll
Syntax
public static class AchievementAuthoringSectionGui
Remarks
Written once because two tools draw them — the achievement's own inspector and the Achievements Studio's detail pane — and a section drawn twice is a section that answers differently in one of them after the first edit. The same reason AchievementConditionTreeGui is one tree drawer rather than two that resemble each other.
Static and stateless: the caller owns the achievement, the UnityEditor.SerializedObject over it and the AchievementAuthoringReviewCache that remembers what the rules said, because those are the things that outlive a single pass.
Fields
BlankIdPreviewReason
Why an achievement with no id cannot be previewed.
Declaration
public const string BlankIdPreviewReason = "Give this achievement an id before previewing its unlock."
Field Value
| Type | Description |
|---|---|
| string |
ConditionPropertyName
The serialized name of the achievement's condition field.
Declaration
public const string ConditionPropertyName = "Condition"
Field Value
| Type | Description |
|---|---|
| string |
ConditionSectionTitle
The heading above the unlock condition.
Declaration
public const string ConditionSectionTitle = "Unlock Condition"
Field Value
| Type | Description |
|---|---|
| string |
PreviewConsequenceNote
What firing that button actually costs, said where the button is.
Declaration
public const string PreviewConsequenceNote = "Writes a real unlock to the active save/backend for this Play session."
Field Value
| Type | Description |
|---|---|
| string |
PreviewSectionTitle
The heading above the Play Mode unlock.
Declaration
public const string PreviewSectionTitle = "Preview"
Field Value
| Type | Description |
|---|---|
| string |
ReviewFailurePrefix
What is said in front of the reason the rules could not judge an achievement.
Declaration
public const string ReviewFailurePrefix = "The authoring rules could not judge this achievement: "
Field Value
| Type | Description |
|---|---|
| string |
SummaryLabel
The label in front of the one-line summary of what a condition demands.
Declaration
public const string SummaryLabel = "Demands"
Field Value
| Type | Description |
|---|---|
| string |
UnlockNowButtonLabel
The button that fires the unlock.
Declaration
public const string UnlockNowButtonLabel = "Unlock Now"
Field Value
| Type | Description |
|---|---|
| string |
Methods
DrawConditionSection(SerializedObject, UnityAchievementDefinition, AchievementConditionEditContext, AchievementAuthoringReviewCache)
Draws the whole unlock-condition block: what it demands in one line, every finding that is not about the tree, and the tree itself.
Declaration
public static bool DrawConditionSection(SerializedObject serializedObject, UnityAchievementDefinition definition, AchievementConditionEditContext editContext, AchievementAuthoringReviewCache review)
Parameters
| Type | Name | Description |
|---|---|---|
| SerializedObject | serializedObject | The achievement being edited. Must not be null. |
| UnityAchievementDefinition | definition | The achievement, read for its tree and judged for its findings. |
| AchievementConditionEditContext | editContext | What the drawer writes, dirties and notifies through. |
| AchievementAuthoringReviewCache | review | What the rules said about it, refreshed here when it has gone stale. |
Returns
| Type | Description |
|---|---|
| bool | True when the round trip wrote something. |
Remarks
The findings sit between the summary and the tree deliberately. The condition ones are handed to the tree drawer instead, so a complaint about a node appears beside that node; everything else — a blank id, a missing icon, an unmirrored storefront — belongs above the tree rather than below it, where an author editing a long tree would never scroll back to find it.
The tree is drawn inside its own serialized round trip, and the drawer applies its own writes on top of that, which is why the caller has to be told the tree changed through the edit context rather than by watching the return value alone.
DrawFindingsOutsideTheCondition(IReadOnlyList<AuthoringIssue>)
Draws every finding the condition tree does not draw beside itself.
Declaration
public static void DrawFindingsOutsideTheCondition(IReadOnlyList<AuthoringIssue> findings)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<AuthoringIssue> | findings | Everything the rules said about this achievement. May be null. |
DrawPreviewSection(string)
Draws the Play Mode unlock: the same preview section every tool in the toolkit uses, dispatching the achievement's own UnlockAchievementSignal through the live dispatcher so the preview exercises the real no-code path rather than a shortcut — which is also why it is not a dry run, and says so.
Declaration
public static void DrawPreviewSection(string achievementId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | achievementId | The id the preview would unlock. |
DrawReviewFailureNotice(string)
Says that nothing could be checked, where a clean list of findings would otherwise read as nothing being wrong.
Declaration
public static void DrawReviewFailureNotice(string failure)
Parameters
| Type | Name | Description |
|---|---|---|
| string | failure | Why the rules could not run, or null when they did. |
ResolvePreviewBlockedReason(string)
Why the unlock preview cannot run right now, or null when it can.
Declaration
public static string ResolvePreviewBlockedReason(string achievementId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | achievementId | The id the preview would unlock. |
Returns
| Type | Description |
|---|---|
| string | The reason, or null. |
ToMessageType(AuthoringSeverity)
The inspector box an authoring finding of this severity is drawn in.
Declaration
public static MessageType ToMessageType(AuthoringSeverity severity)
Parameters
| Type | Name | Description |
|---|---|---|
| AuthoringSeverity | severity | How serious the finding is. |
Returns
| Type | Description |
|---|---|
| MessageType | The matching message type. |
UnlockNow(string)
Fires one achievement's unlock signal through the live dispatcher.
Declaration
public static void UnlockNow(string achievementId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | achievementId | The achievement to unlock. |
Remarks
Public because the Studio's toolbar fires the same unlock without the author scrolling its detail pane down to find the preview row — one implementation, two places to reach it.