MVVM and UI

The PulseSkillMVVM module has view models for the UMG View Model system. They listen to the events of the component and work the same on the server and on clients. Ready-made CommonUI widgets that use them are in the PulseSkillUI module, see UI widgets; or build your own and bind them.

View models

UMVVMPulseSkillComponent

Call SetSkillComponent (e.g. with Get Skill Component of the owning player).

Field Description
SkillComponent The component.
AvailablePoints, SpentPoints Points of the default pool. Use GetSkillPoints(PointTag) for other pools.
Trees One UMVVMPulseSkillTree per tree of the component.
Progressions One UMVVMPulseSkillProgression per progression of the component.
DefaultProgression View model of the default progression, e.g. for the main experience bar. Null if there is none.
LastFailureMessage Message of the last failed request, e.g. for a toast.

FindTree(TreeTag) returns the view model of a tree, FindProgression(ProgressionTag) the one of a progression.

UMVVMPulseSkillProgression

Field Description
Progression, ProgressionTag, DisplayName The progression; the name comes from the stat register (the progression registers its experience there), else from the asset.
Level, Experience Current level and total experience.
ExperienceForCurrentLevel, ExperienceForNextLevel Total experience the current and the next level need (next is MAX_int32 at the highest level).
LevelProgress 0 to 1 between the current and the next level, e.g. for a progress bar. 1 at the highest level.
bIsMaxLevel No more levels can be gained.

GetNextLevelRewardDescriptions() returns the texts of the rewards of the next level.

UMVVMPulseSkillTree

Field Description
Tree, TreeTag, DisplayName The tree.
PointsSpent Points of the default pool spent in the tree.
Nodes One UMVVMPulseSkillNode per skill, in node order.

FindNode(SkillTag) returns a node, RequestReset asks for a reset of the tree.

UMVVMPulseSkillNode

Field Description
SkillTag, Skill, DisplayName, Description, Icon The skill.
Rank, MaxRank Current and highest rank.
State Locked, Available, Unlocked, Maxed.
bCanUnlock, bCanRefund Result of CanUnlockSkill / CanRefundSkill.
FailureMessage Why the next rank cannot be unlocked.
RankDescription Description of the next rank (or the last one when maxed).
CostText, RequirementText, RewardText Lines of the costs, conditions and rewards of the next rank, one per line.
Position EditorPosition of the tree node, for a canvas layout.
Prerequisites Tags of the needed skills, to draw connections.

RequestUnlock and RequestRefund call TryUnlockSkill / TryRefundSkill.

The tree and node view models are reused as long as the tree and its nodes stay the same, so widgets can stay bound to them.

In C++ every field also has a getter (GetRank(), GetState(), GetNodes(), GetTrees(), …).

Example layout

This is what UPulseSkillTreeWidget does; follow it for a fully custom UI.

  1. A skill tree widget gets a UMVVMPulseSkillTree and creates one node widget per entry of Nodes, placed at Position on a canvas.
  2. The node widget binds its icon, rank text (Rank / MaxRank) and style (State) to its UMVVMPulseSkillNode, shows CostText, RequirementText, RewardText and FailureMessage in a tooltip, and calls RequestUnlock on click.
  3. Lines between nodes come from Prerequisites and FindNode.

Without view models

Listen to OnSkillStateChanged of the component and read GetSkillRank, CanUnlockSkill, GetSkillPoints and the definitions directly. UPulseSkillLibrary::GetRankCostDescriptions, GetRankConditionDescriptions and GetRankRewardDescriptions return the lines of a rank.


This site uses Just the Docs, a documentation theme for Jekyll.