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
| Property | Type | Description |
|---|---|---|
Current | ProjectVCharacterView | The 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
| Name | Type | Description |
|---|---|---|
render | Action<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
| Exception | When |
|---|---|
ArgumentNullException | render 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
| Name | Type | Description |
|---|---|---|
slotId | string | The slot ID, as in ProjectVCharacterLoadoutSlot.SlotId.Value. |
characterId | string | An 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
| Name | Type | Description |
|---|---|---|
characterId | string | The character's ID, as in ProjectVCharacterEntry.Id.Value. |
items | IReadOnlyList<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
| Exception | When |
|---|---|
ArgumentException | characterId is null, empty or whitespace, or items has a null line, more than 16 lines or the same item twice. |
ArgumentNullException | items 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
| Name | Type | Description |
|---|---|---|
characterId | string | The character's ID, as in ProjectVCharacterEntry.Id.Value. |
skillId | string | The 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. Syncs first when the data is out of date.
Task<ProjectVResult> UpgradeCastSkillAsync(string characterId, ProjectVCharacterCastSkillSlot slot);
Parameters
| Name | Type | Description |
|---|---|---|
characterId | string | The character's ID, as in ProjectVCharacterEntry.Id.Value. |
slot | ProjectVCharacterCastSkillSlot | The 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
| Name | Type | Description |
|---|---|---|
characterId | string | The 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
| Exception | When |
|---|---|
ArgumentException | characterId 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. Syncs first when the data is out of date.
Task<ProjectVResult> ResetLevelAsync(string characterId);
Parameters
| Name | Type | Description |
|---|---|---|
characterId | string | The 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.