IProjectVGameplayDataPolicy interface
Helpers for the mission scene: the scene reports what happens (enemies spawned and killed, the outcome, the final health) and the SDK works out which drops count and what to send. Every call fails once the presenter is unbound.
Namespace: SilverTiger.ProjectV.Unity.Presentation.Gameplay
public interface IProjectVGameplayDataPolicy : IProjectVGameplayDataPresenter
Methodsโ
ValidateSkillCatalog(IReadOnlyList<ProjectVGameplaySkillId> skillIds)โ
Checks that your skill assets match the run's skill tree. Call it before gameplay starts.
ProjectVGameplayDataResult ValidateSkillCatalog(IReadOnlyList<ProjectVGameplaySkillId> skillIds);
Parameters
| Name | Type | Description |
|---|---|---|
skillIds | IReadOnlyList<ProjectVGameplaySkillId> | The skill IDs read from your skill assets; each must appear once and be in ProjectVGameplayStartingDataView.SkillCatalogIds. |
Returns
ProjectVGameplayDataResult: Success when they match. A failure when the list is empty, has a duplicate or unknown ID, or the run is missing an active skill; then do not start.
Exceptions
| Exception | When |
|---|---|
ArgumentNullException | skillIds is null. |
ValidateCastMapping(ProjectVGameplayDataSkillSlot slot, int level, ProjectVGameplaySkillId skillId)โ
Checks that the skill asset you picked for a slot matches the run. Call it for both slots before gameplay starts.
ProjectVGameplayDataResult ValidateCastMapping(ProjectVGameplayDataSkillSlot slot, int level, ProjectVGameplaySkillId skillId);
Parameters
| Name | Type | Description |
|---|---|---|
slot | ProjectVGameplayDataSkillSlot | The slot. |
level | int | The level of the asset you picked. |
skillId | ProjectVGameplaySkillId | The skill ID of the asset you picked. |
Returns
ProjectVGameplayDataResult: Success when the slot's skill in ProjectVGameplayStartingDataView.CastSkills has exactly this level and ID; otherwise a failure, and do not start.
RegisterDropOwner(object owner, string slotId, long activationLease, ProjectVGameplayDropRegistration registration)โ
Registers a reward enemy when it becomes active. Call it again with a new activationLease each time a pooled enemy is reused.
ProjectVGameplayDataResult RegisterDropOwner(object owner, string slotId, long activationLease, out ProjectVGameplayDropRegistration registration);
Parameters
| Name | Type | Description |
|---|---|---|
owner | object | The enemy object, such as its component; the same object each time. |
slotId | string | The slot ID placed on the enemy; must be one of ProjectVGameplayStartingDataView.Drops. |
activationLease | long | A number that changes on every activation of this enemy, such as a spawn counter. |
registration | ProjectVGameplayDropRegistration | Set on success; keep it for RecordDropDefeated and UnregisterDropOwner. Default on failure. |
Returns
ProjectVGameplayDataResult: Success when registered. A failure when the slot ID is unknown, the result is already sent, or two enemies share a slot (or one enemy uses two slots); those slots then never count.
Exceptions
| Exception | When |
|---|---|
ArgumentNullException | owner is null. |
RecordDropDefeated(ProjectVGameplayDropRegistration registration)โ
Reports that a registered reward enemy died.
ProjectVGameplayDataResult RecordDropDefeated(ProjectVGameplayDropRegistration registration);
Parameters
| Name | Type | Description |
|---|---|---|
registration | ProjectVGameplayDropRegistration | The registration from RegisterDropOwner for the current activation. |
Returns
ProjectVGameplayDataResult: Success when recorded. A failure when the registration is from an older activation, the slot is shared, the death is already recorded, or the result is already sent.
UnregisterDropOwner(ProjectVGameplayDropRegistration registration)โ
Reports that a reward enemy was deactivated, for example returned to its pool. A recorded death still counts.
ProjectVGameplayDataResult UnregisterDropOwner(ProjectVGameplayDropRegistration registration);
Parameters
| Name | Type | Description |
|---|---|---|
registration | ProjectVGameplayDropRegistration | The registration from RegisterDropOwner. |
Returns
ProjectVGameplayDataResult: Success when the registration is still current; a failure when it is from an older activation.
ObserveOutcome(ProjectVGameplayDataOutcome outcome, long? enemiesDefeated)โ
Reports how the run ended and the kill count, before CompleteObservedAsync. After this, skill uses and IProjectVGameplayDataPresenter.CancelRunAsync are refused.
ProjectVGameplayDataResult ObserveOutcome(ProjectVGameplayDataOutcome outcome, long? enemiesDefeated);
Parameters
| Name | Type | Description |
|---|---|---|
outcome | ProjectVGameplayDataOutcome | How the run ended. |
enemiesDefeated | long? | How many enemies were defeated, from 0 to 1024; null when not counted. |
Returns
ProjectVGameplayDataResult: Success when recorded. A failure when a value is invalid, or the result is already sent with a different outcome (the same outcome again succeeds).
SetClientRewards(IReadOnlyList<ProjectVGameplayClientRewardView> rewards)โ
Sets the picked-up rewards to send when trust client rewards is on. Call it before CompleteObservedAsync; a later call replaces the list. The list is copied.
ProjectVGameplayDataResult SetClientRewards(IReadOnlyList<ProjectVGameplayClientRewardView> rewards);
Parameters
| Name | Type | Description |
|---|---|---|
rewards | IReadOnlyList<ProjectVGameplayClientRewardView> | The picked-up rewards. An empty list means no rewards. |
Returns
ProjectVGameplayDataResult: Success when stored; a failure when the result is already sent.
Exceptions
| Exception | When |
|---|---|
ArgumentNullException | rewards is null. |
ArgumentException | rewards contains a null entry. |
CompleteObservedAsync(float currentHealth, int currentArmor, long rawSessionExperience, CancellationToken cancellationToken)โ
Sends the run result built from what the scene reported and waits for the server. The first call fixes the result; a retry after a failure resends it and ignores new values.
Task<ProjectVGameplayDataResult> CompleteObservedAsync(float currentHealth, int currentArmor, long rawSessionExperience, CancellationToken cancellationToken);
Parameters
| Name | Type | Description |
|---|---|---|
currentHealth | float | Health at the end; rounded and kept between 0 and the starting maximum. Must be a finite number. |
currentArmor | int | Armor at the end; kept between 0 and the starting maximum. |
rawSessionExperience | long | Experience earned in the run before any bonus; 0 or more. |
cancellationToken | CancellationToken | Stops waiting for the server. |
Returns
Task<ProjectVGameplayDataResult>: On success, show only ProjectVGameplayDataResult.Rewards and ProjectVGameplayDataResult.Stars. A failure when no outcome was reported, a value is invalid, or the server call failed; keep the result screen open with Retry.
TryGetHealthPercent(float currentHealth, float healthPercent)โ
Works out health as a percentage of the starting maximum, for the result preview.
bool TryGetHealthPercent(float currentHealth, out float healthPercent);
Parameters
| Name | Type | Description |
|---|---|---|
currentHealth | float | The current health. |
healthPercent | float | From 0 to 100; 0 when the method returns false. |
Returns
bool: False when currentHealth is not a finite number or the presenter is unbound.