Web

🕸️ Web Class

Represents the runtime version of a WebGraph, managing skill nodes, connections, bindings, and state changes.

Namespace: Esper.SkillWeb.Graph Access: public Type: class


📦 Fields

Access
Field
Type
Description

public

graph

WebGraph

Reference to the graph used to create the runtime web.

public

skillNodes

Dictionary<int, SkillNode>

Dictionary of skill nodes keyed by node ID.

protected

revertableState

Dictionary<int, int>

Stores node ID → level for revertable state.

public

dataset

WebDataset

Associated dataset.

public

Connections

List<Connection>

List of all skill connections (from graph).

public

isReverting

bool

Flag indicating if graph is currently reverting.

public

HasUnsavedChanges

bool

True if revertable state contains changes.

protected

defaultBinding

SkillPointsBinding

Default binding used when no custom binding exists.

public

skillPointsBindings

List<SkillPointsBinding>

List of all bound skill points.

public static

onSkillsReset

UnityEvent<Web>

Invoked when all skills of a web are reset.

public static

onReverted

UnityEvent<Web>

Invoked when a web is reverted.

public static

onDanglingLevelsDetected

UnityEvent<Web, int>

Invoked when dangling skill levels are detected after graph changes.


🧰 Methods

Access
Method
Returns
Description

public

Web(WebGraph graph)

-

Constructor.

public

Web(SavableWeb savableWeb)

-

Constructor.

protected

GetBindingForNode(SkillNode skillNode)

SkillPointsBinding

Gets binding for a node; returns default if none match.

public

SkillLevelTotal()

int

Returns sum of levels of all skills.

public

ResetAllSkills()

void

Resets all skills to level 0 and invokes onSkillsReset.

public virtual

AddToRevertableState(SkillNode skillNode)

void

Adds node to revertable state if not already present.

public virtual

ConfirmChanges()

void

Confirms changes, clears revertable state.

public virtual

RevertChanges()

void

Reverts changes to previous state, applies bindings, invokes onReverted.

public

UpdateAllStates()

void

Updates state of all skill nodes.

public

GetSkillConnections(SkillNode skillNode)

List<Connection>

Returns connections for a given skill node.

public

GetNode(int id)

SkillNode

Gets skill node by node ID; logs warning if not found.

public

GetSkillNodes(int id)

List<SkillNode>

Gets all skill nodes with a given skill ID.

public

GetSkillNodes(string name)

List<SkillNode>

Gets all skill nodes with a given skill name.

public

GetSkillNode(int id)

SkillNode

Gets first skill node with given skill ID; logs warning if not found.

public

GetSkillNode(string name)

SkillNode

Gets first skill node with given skill name; logs warning if not found.

public

GetSkillNodes(params Skill.State[] states)

List<SkillNode>

Gets all skill nodes in specified states.

public

GetObtainedSkillNodes()

List<SkillNode>

Gets all obtained or maxed skill nodes.

public

IsNodeObtained(int id)

bool

Checks if node with given ID is obtained.

public

IsObtained(int id)

bool

Checks if skill with given ID is obtained.

public

IsObtained(string name)

bool

Checks if skill with given name is obtained.

public

ToSavable()

SavableWeb

Converts runtime web to savable version.

public

CanUpgradeSkillNode(SkillNode skillNode)

bool

Checks if player has enough points to upgrade node.

public

ApplyBindingReset(SkillNode skillNode)

void

Applies binding as if node was reset (refunds points).

public

ApplyBinding(SkillNode skillNode, bool upgraded)

void

Applies binding when upgrading/downgrading node.

public

Bind(...)

SkillPointsBinding

Clears existing bindings, sets new binding.

public

AddBinding(...)

SkillPointsBinding

Adds new binding without removing existing ones.

public

AddBinding(SkillPointsBinding binding)

void

Adds binding if not already present.

public

RemoveBinding(SkillPointsBinding binding)

void

Removes binding if present.


🧩 Nested Classes

public class BoundSkillPoints<T>

Skill points binder.

Access
Field
Type
Description

public

skillPointsGetter

Func<T>

A method that gets the player's skill points. This should return the numeric type.

public

skillCostGetter

Func<SkillNode, T>

A method that gets the skill cost from a skill node.

public

skillPointsSetter

Action<T>

A method that sets the player's skill points after applying the cost. The cost will be subtracted if the skill node was upgraded. If it was downgraded, it will be added. The value will not be set to a number less than 0.

Last updated