Skip to main content

IProjectVCharacterScreen interface

The Character screen contract: observe the view, call commands, redraw on change. Loading, syncing, retries and double-tap protection are handled for you. Commands run one at a time, and a second tap on a running command returns the same result.

Namespace: SilverTiger.ProjectV.Unity.Presentation.Character

public interface IProjectVCharacterScreen

Propertiesโ€‹

PropertyTypeDescription
CurrentProjectVCharacterViewThe view right now, built from the last confirmed data; never null.

Methodsโ€‹

Observe(Action<ProjectVCharacterView> render)โ€‹

Calls render with the current view, then again only when the data changes. Loads the data if it is not loaded yet, and syncs by itself when an upgrade left it out of date.

IDisposable Observe(Action<ProjectVCharacterView> render);

Parameters

NameTypeDescription
renderAction<ProjectVCharacterView>Draws the page; always called on the Unity main thread, never while a request is in flight.

Returns

IDisposable: The observation; dispose it when the page closes.

Exceptions

ExceptionWhen
ArgumentNullExceptionrender is null.

SelectCharacterAsync(string slotId, string characterId)โ€‹

Puts a character in a loadout slot. The view updates through Observe.

Task<ProjectVResult> SelectCharacterAsync(string slotId, string characterId);

Parameters

NameTypeDescription
slotIdstringThe slot ID, as in ProjectVCharacterLoadoutSlot.SlotId.Value.
characterIdstringAn owned character's ID, as in ProjectVCharacterEntry.Id.Value.

Returns

Task<ProjectVResult>: ProjectVResult.IsSuccess is true when the server confirmed the change. Otherwise ProjectVResult.Message is the reason to show.

LevelUpAsync(string characterId, IReadOnlyList<ProjectVCharacterXpItemSelection> items)โ€‹

Levels the character with these EXP items, taking every level the EXP and the wallet cover. Syncs first when the data is out of date. If a level-up or level reset is pending (ProjectVCharacterView.PendingUpgrade), it is finished instead and the arguments are not used.

Task<ProjectVResult> LevelUpAsync(string characterId, IReadOnlyList<ProjectVCharacterXpItemSelection> items);

Parameters

NameTypeDescription
characterIdstringThe character's ID, as in ProjectVCharacterEntry.Id.Value.
itemsIReadOnlyList<ProjectVCharacterXpItemSelection>The EXP items and quantities to spend; at most 16 lines, each item once. May be empty to level with the EXP the character already has. ProjectVCharacterLevelPolicy.SelectForNextLevel can pick them.

Returns

Task<ProjectVResult>: ProjectVResult.IsSuccess is true when the server confirmed it. Otherwise ProjectVResult.Message is the reason to show, for example "Select enough EXP for the next level."

Exceptions

ExceptionWhen
ArgumentExceptioncharacterId is null, empty or whitespace, or items has a null line, more than 16 lines or the same item twice.
ArgumentNullExceptionitems is null.

UpgradeSkillAsync(string characterId, string skillId)โ€‹

Buys the next rank of a skill. Check ProjectVCharacterData.GetSkillUpgradeDetails first.

Task<ProjectVResult> UpgradeSkillAsync(string characterId, string skillId);

Parameters

NameTypeDescription
characterIdstringThe character's ID, as in ProjectVCharacterEntry.Id.Value.
skillIdstringThe skill's ID, as in ProjectVCharacterSkill.Id.Value.

Returns

Task<ProjectVResult>: ProjectVResult.IsSuccess is true when the server confirmed the rank. Otherwise ProjectVResult.Message is the reason to show.

UpgradeCastSkillAsync(string characterId, ProjectVCharacterCastSkillSlot slot)โ€‹

Upgrades a cast skill one level. Check ProjectVCharacterData.GetCastSkillUpgradeDetails first.

Task<ProjectVResult> UpgradeCastSkillAsync(string characterId, ProjectVCharacterCastSkillSlot slot);

Parameters

NameTypeDescription
characterIdstringThe character's ID, as in ProjectVCharacterEntry.Id.Value.
slotProjectVCharacterCastSkillSlotThe cast skill slot; not ProjectVCharacterCastSkillSlot.Unknown.

Returns

Task<ProjectVResult>: ProjectVResult.IsSuccess is true when the server confirmed the upgrade. Otherwise ProjectVResult.Message is the reason to show, such as the missing resources.

ResetSkillsAsync(string characterId)โ€‹

Resets a character's skill tree, removing every rank.

Task<ProjectVResult> ResetSkillsAsync(string characterId);

Parameters

NameTypeDescription
characterIdstringThe character's ID, as in ProjectVCharacterEntry.Id.Value.

Returns

Task<ProjectVResult>: ProjectVResult.IsSuccess is true when the server confirmed the reset. Fails with "There are no skill ranks to reset." when no skill has a rank, without contacting the server.

Exceptions

ExceptionWhen
ArgumentExceptioncharacterId is null, empty or whitespace.

ResetLevelAsync(string characterId)โ€‹

Puts the character or ally at level 1 and refunds the EXP items it spent, when the server allows it. Check ProjectVCharacterLevelPolicy.ResetPreview first.

Task<ProjectVResult> ResetLevelAsync(string characterId);

Parameters

NameTypeDescription
characterIdstringThe character's ID, as in ProjectVCharacterEntry.Id.Value.

Returns

Task<ProjectVResult>: ProjectVResult.IsSuccess is true when the server confirmed the reset. Otherwise ProjectVResult.Message is the reason to show.