Class AchievementCreationPromptGui
The inline row that names a new achievement — a fresh one, or a copy of the selected one — and hands the request to AchievementDefinitionCreator.
Inherited Members
Namespace: Serenity.Achievements.Infrastructure.Editor.Studio
Assembly: Serenity.UnityAchievements.Infrastructure.Editor.dll
Syntax
public sealed class AchievementCreationPromptGui
Remarks
A row rather than a modal dialog. The id is the one field an author gets wrong (it has to be a slug, and it has to be free in a folder they may not be looking at), and a dialog can only answer that after the author has committed to it. Drawn inline, the same rules that would reject the creation are shown while the id is still being typed, and the Create button simply stays disabled until they are satisfied.
[Serializable] and held as a field on the window, so the half-typed id and the chosen folder
survive the domain reload a script compile causes mid-authoring.
Constructors
AchievementCreationPromptGui()
Declaration
public AchievementCreationPromptGui()
Fields
CopyIdSuffix
The suffix a suggested copy id carries.
Declaration
public const string CopyIdSuffix = "-copy"
Field Value
| Type | Description |
|---|---|
| string |
CreateHeader
The heading shown while naming a new achievement.
Declaration
public const string CreateHeader = "New achievement"
Field Value
| Type | Description |
|---|---|
| string |
DuplicateHeader
The heading shown while naming a copy.
Declaration
public const string DuplicateHeader = "Duplicate achievement"
Field Value
| Type | Description |
|---|---|
| string |
Properties
IsOpen
Declaration
public bool IsOpen { get; }
Property Value
| Type | Description |
|---|---|
| bool | Whether the prompt is currently asking for anything. |
Methods
Close()
Closes the prompt without creating anything.
Declaration
public void Close()
Draw(UnityAchievementDefinition)
Draws the prompt and reports the creation it committed, if it committed one.
Declaration
public AchievementDefinitionCreator.Result Draw(UnityAchievementDefinition duplicateSource)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityAchievementDefinition | duplicateSource | The achievement a copy would be made from. Ignored while creating. |
Returns
| Type | Description |
|---|---|
| AchievementDefinitionCreator.Result | The creator's outcome, or null when nothing was committed this pass. |
EnsureTargetFolder(IReadOnlyList<UnityAchievementDefinition>, IReadOnlyList<UnityAchievementSettings>)
Decides where new achievements land, unless the author already picked somewhere: beside the ones already authored, then beside the settings asset, and only then in the module's default folder.
Declaration
public void EnsureTargetFolder(IReadOnlyList<UnityAchievementDefinition> authoredAchievements, IReadOnlyList<UnityAchievementSettings> settingsAssets)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<UnityAchievementDefinition> | authoredAchievements | Every achievement already in the project. May be null or empty. |
| IReadOnlyList<UnityAchievementSettings> | settingsAssets | Every achievement settings asset. May be null or empty. |
Remarks
A project that put its achievements somewhere other than the default said where they belong by doing so, and a new one appearing in a folder nobody uses is a file the author then has to move. The picker overrides all three.
OpenForCopyOf(UnityAchievementDefinition)
Opens the prompt for a copy of an achievement, pre-filled with a free-looking id.
Declaration
public void OpenForCopyOf(UnityAchievementDefinition source)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityAchievementDefinition | source | The achievement being copied. May be null, which suggests nothing. |
OpenForNewAchievement()
Opens the prompt for a brand new achievement.
Declaration
public void OpenForNewAchievement()