Game.CinematicCameraAsset
Assembly: Assembly-CSharp (inferred)
Namespace: Game.Assets
Type: public class
Base: Metadata
Summary:
Represents an asset wrapper for cinematic camera sequences. This class exposes metadata (via the Metadata
Fields
-
public const string kExtension
".CinematicCamera" — file extension used for cinematic camera asset files. -
public static readonly System.Func<string> kPersistentLocation
Returns the persistent location path for cinematic camera assets. The func concatenates "CinematicCamera/" with the current PlatformManager.instance.userSpecificPath, e.g. "CinematicCamera/". This is intended for constructing paths where user-specific cinematic camera data is stored. -
private static readonly string kCloudTargetProperty
"cloudTarget" — JSON property name used when writing the asset's cloud target to the IJsonWriter. -
private static readonly string kReadOnlyProperty
"isReadOnly" — JSON property name used when writing whether the asset is read-only (belongs to another user) to the IJsonWriter.
Properties
This class declares no public properties of its own. It relies on inherited members from Metadata
Constructors
public CinematicCameraAsset()
No explicit constructor is declared in source; the class uses the default parameterless constructor provided by the runtime. Any initialization is expected to be handled by the base class (Metadata) or elsewhere.
Methods
public void Write(IJsonWriter writer)
Implements IJsonWritable.Write. Serializes a compact JSON object describing this cinematic camera asset. Implementation details:- Obtains the asset source meta using GetMeta() (inherited from Metadata
), which provides fields such as remoteStorageSourceName and belongsToCurrentUser. - Writes a JSON object with:
- Type name: "CinematicCameraAsset"
- Property "name": the asset name (inherited member)
- Property "guid": the asset GUID (base.id.guid)
- Property "identifier": the asset identifier (base.identifier)
- Property "cloudTarget": a sanitized cloud target name obtained via MenuHelpers.GetSanitizedCloudTarget(meta.remoteStorageSourceName).name
- Property "isReadOnly": a boolean set to !meta.belongsToCurrentUser (true if the asset does NOT belong to the current user)
- The JSON keys for cloud target and read-only use the private constants kCloudTargetProperty and kReadOnlyProperty.
Parameters: - writer: IJsonWriter instance used to emit JSON tokens. The writer is expected to support TypeBegin/TypeEnd and Write methods for strings and booleans.
Notes: - The method assumes GetMeta() returns a valid SourceMeta. If GetMeta() can return null in some contexts, callers should ensure proper lifecycle before calling Write. - The cloud target value is sanitized by MenuHelpers.GetSanitizedCloudTarget to ensure stable/valid names are emitted.
Usage Example
// Obtain the CinematicCameraAsset instance from your asset database or created context.
// The following is a conceptual example — creation/lookup depends on the modding APIs.
CinematicCameraAsset asset = /* get asset from AssetDatabase or context */;
// Prepare an IJsonWriter (concrete implementation depends on the game's JSON utilities).
IJsonWriter writer = new JsonStringWriter(); // placeholder type — use the game's implementation
// Write a compact JSON summary of the asset
asset.Write(writer);
// Retrieve JSON text (depends on writer implementation)
string json = writer.ToString();
// Example output structure:
// {
// "type":"CinematicCameraAsset",
// "name":"MyCinematicSequence",
// "guid":"01234567-89ab-cdef-0123-456789abcdef",
// "identifier":"my_cinematic_sequence_id",
// "cloudTarget":"SomeCloudTargetName",
// "isReadOnly":false
// }
{{ Additional details: - Typical use: used by UI/asset database code to present asset summaries (e.g., in import/export dialogs or cloud sync listings). - Persistence: use CinematicCameraAsset.kExtension when saving to disk and CinematicCameraAsset.kPersistentLocation() to get the folder path for user-specific persistent storage. - Security: the isReadOnly flag is derived from SourceMeta.belongsToCurrentUser; this is only a hint for UI and workflow (don't rely on it for security-critical checks). }}