Class TooltipSubscriptions
Helper class to manage the subscriptions to tooltips by users. Tracks which parts are dirty, informs users of them on an interval, and clears the cache. They are recached the next time they are queried (ie, lazily).
Inheritance
Implements
Namespace: Eco.Gameplay.Systems.NewTooltip
Assembly: Eco.Gameplay.dll
Syntax
public class TooltipSubscriptions : Object, ITooltipSubscriptions
Remarks
See 'Tooltip.md' for more info.
Constructors
TooltipSubscriptions()
Declaration
public TooltipSubscriptions()
Methods
ApplyDirtyTooltips()
Go through all the dirty tooltips and tell whoever subscribes to each one that they're gonna need to refresh next time they need it. Also clear the server cache for these dirty tooltips.
Declaration
public void ApplyDirtyTooltips()
ClearCache()
Clear the cache and list of dirty things.
Declaration
public void ClearCache()
ClearCacheForUser(User)
Clears the record of parts that this user is subscribed to. Since we dont store user-specific data on the server-side cache, we dont need to remove any cached data otherwise.
Declaration
public void ClearCacheForUser(User user)
Parameters
Type | Name | Description |
---|---|---|
User | user |
MarkTooltipPartDirty(String, Type, IController, User, Boolean)
Marks tooltip part as dirty. All parameters required by this part's CacheMode must be provided.
Declaration
public void MarkTooltipPartDirty(string partName, Type type = null, IController instance = null, User user = null, bool includeDerivedTypes = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | partName | |
System.Type | type | |
IController | instance | |
User | user | |
System.Boolean | includeDerivedTypes | If set to true, all types that derive from passed type will also have this tooltip part marked as dirty. Should only be used with SubType. |
Remarks
If the tooltip is only using User then we still need to specify a type when invoking this method.
RemoveDeadEntries()
Scans entire tooltip cache for entries referencing objects that were alread ygarbage collected and removes them on server and clients by marking them as dirty.
Declaration
public void RemoveDeadEntries()
Subscribe(User, TooltipPartBase, IController)
Marks a user as having received the tooltip part, so we know to inform them if it gets invalidated.
Declaration
public void Subscribe(User user, TooltipPartBase part, IController controller)
Parameters
Type | Name | Description |
---|---|---|
User | user | |
TooltipPartBase | part | |
IController | controller |