Class AchievementPlatformAssetAuthoring
Validates and writes the UnityAchievementPlatformDefinition assets a creation run enables. Split out of AchievementSettingsCreator because it answers a different question: the creator decides what the module's configuration is, this decides what one storefront needs to be reachable.
Inherited Members
Namespace: Serenity.Achievements.Infrastructure.Editor.Builder
Assembly: Serenity.UnityAchievements.Infrastructure.Editor.dll
Syntax
public static class AchievementPlatformAssetAuthoring
Remarks
Reuse is by Id, never by path. Each definition carries the Id
{settings id}.{kind} (see Serenity.Achievements.Infrastructure.Editor.Builder.AchievementPlatformAssetAuthoring.ComposePlatformId(System.String,Serenity.Achievements.Application.Authoring.AchievementPlatformKind)), and a rerun that finds that Id in the
target folder RECONFIGURES that asset rather than writing a second one — so re-running the wizard to
change a Steam App Id edits the definition the settings asset already points at, wherever in the folder
tree it was moved to. A definition sitting at the conventional path under a DIFFERENT Id is therefore not
a reuse candidate, and overwriting it would destroy a configuration that belongs to something else:
ValidateAssetPath(AchievementPlatformKind, string, string, SerenityCreationValidationResult) reports that as an error instead, matching the creator's backend policy
(an occupied path is refused, never silently worked around).
Methods
Author(AchievementPlatformKind, AchievementPlatformFields, string, string, SerenityAssetCreationTransaction, out string)
Writes (or reconfigures) the definition asset for kind under
folderPath and returns it, tracking a freshly created one on
transaction so a later failure deletes it again.
Declaration
public static UnityAchievementPlatformDefinition Author(AchievementPlatformKind kind, AchievementPlatformFields fields, string settingsId, string folderPath, SerenityAssetCreationTransaction transaction, out string assetPath)
Parameters
| Type | Name | Description |
|---|---|---|
| AchievementPlatformKind | kind | The storefront to author. |
| AchievementPlatformFields | fields | The per-kind values the asset is filled from. |
| string | settingsId | Id of the settings asset these platforms belong to — the stem of each definition's own Id. |
| string | folderPath | Folder the definition assets live in. |
| SerenityAssetCreationTransaction | transaction | The run's asset transaction. |
| string | assetPath | Path of the definition, whether it was reused or created. |
Returns
| Type | Description |
|---|---|
| UnityAchievementPlatformDefinition | The definition asset, already marked dirty. |
ComposeAssetPath(AchievementPlatformKind, string)
The path a freshly created definition of kind is written to.
Declaration
public static string ComposeAssetPath(AchievementPlatformKind kind, string folderPath)
Parameters
| Type | Name | Description |
|---|---|---|
| AchievementPlatformKind | kind | |
| string | folderPath |
Returns
| Type | Description |
|---|---|
| string |
ValidateAssetPath(AchievementPlatformKind, string, string, SerenityCreationValidationResult)
Refuses a conventional platform asset path that is already occupied by something this run may not overwrite — an asset carrying a different Id, or a different asset type at the same name. The asset the run would legitimately reuse (same Id, same path) passes, and so does a reuse candidate that lives elsewhere in the folder, since the run edits it in place and never touches this path.
Declaration
public static void ValidateAssetPath(AchievementPlatformKind kind, string settingsId, string folderPath, SerenityCreationValidationResult result)
Parameters
| Type | Name | Description |
|---|---|---|
| AchievementPlatformKind | kind | The storefront being enabled. |
| string | settingsId | Id of the settings asset these platforms belong to. |
| string | folderPath | Folder the definition assets live in. |
| SerenityCreationValidationResult | result | Receives the error when the path is occupied by a foreign asset. |
ValidateFields(AchievementPlatformKind, AchievementPlatformFields, SerenityCreationValidationResult)
Reports whatever kind cannot work without, into result.
Declaration
public static void ValidateFields(AchievementPlatformKind kind, AchievementPlatformFields fields, SerenityCreationValidationResult result)
Parameters
| Type | Name | Description |
|---|---|---|
| AchievementPlatformKind | kind | The storefront being enabled. |
| AchievementPlatformFields | fields | The per-kind values the asset would be filled from. |
| SerenityCreationValidationResult | result | Receives every finding. |