Show / Hide Table of Contents

Class MappedLinkedIdTranslator<T>

ObjectLinkIdTranslator<T> implementation with mapping between link id and object implementing IHasUniversalID for not-entity objects (without own identity). This mapping required for ensuring that link id is always mapped to same object for tooltip caching. I.e. Vector3Tooltip may be created from link id string and doesn't have own identity, fully defined by content in the link id, but client may want to cache the tooltip by universal id. So instead of creating new Vector3Tooltip object every time it will create it on demand (if not yet exists) and then just return same object with same universal id every time when same link id requested.

Inheritance
System.Object
ObjectLinkIdTranslator<T>
MappedLinkedIdTranslator<T>
TypeTranslator
Vector2LinkIdTranslator
Vector3LinkIdTranslator
Implements
IObjectLinkIdTranslator
Inherited Members
ObjectLinkIdTranslator<T>.Priority
ObjectLinkIdTranslator<T>.HandlesTarget(ILinkable)
ObjectLinkIdTranslator<T>.HandlesId(String)
ObjectLinkIdTranslator<T>.GetLinkId(ILinkable)
ObjectLinkIdTranslator<T>.GetTypedLinkId(T)
ObjectLinkIdTranslator<T>.GetLinkTarget(String)
Namespace: Eco.Gameplay.Systems.TextLinks
Assembly: Eco.Gameplay.dll
Syntax
public abstract class MappedLinkedIdTranslator<T> : ObjectLinkIdTranslator<T>, IObjectLinkIdTranslator where T : ILinkable, IHasUniversalID
Type Parameters
Name Description
T
Remarks

This mapping will never clear once mapped objects, because those may be remembered on client. Also the objects will be saved in UniversalIDs mapping anyway. It may lead to memory leaks, but as it only creates mapping on demand which starts as empty on every server restart and we assuming daily restart for big servers it shouldn't become an issue. There potential optimizations which may be applied if problem starts being serious:

  • Server may make regular clean ups for Mapping, removing oldest records, clients will be notified about released IDs and will just invalidate cache and re-request by link id if required;
  • Don't use universal IDs for such objects and add support for tooltips for custom link ids. But until we have real issue we decided to use simplest approach.

Constructors

MappedLinkedIdTranslator()

Declaration
protected MappedLinkedIdTranslator()

Methods

CreateTypedLinkTarget(String)

Creates new T object by content of linkId.

Declaration
protected abstract T CreateTypedLinkTarget(string linkId)
Parameters
Type Name Description
System.String linkId
Returns
Type Description
T

GetTypedLinkTarget(String)

Returns mapped IHasUniversalID for linkId or creates new if not yet mapped.

Declaration
protected sealed override T GetTypedLinkTarget(string linkId)
Parameters
Type Name Description
System.String linkId
Returns
Type Description
T
Overrides
Eco.Gameplay.Systems.TextLinks.ObjectLinkIdTranslator<T>.GetTypedLinkTarget(System.String)

Implements

IObjectLinkIdTranslator

Extension Methods

TagUtils.TagNames(Object, Boolean)
TagUtils.TagDisplayNames(Object, Boolean)
ClientSetViewExtensions.SetClassOfProperty(Object, Player, String, String, Int32)
TypeTooltipExtensions.UILinkGeneric(Object)
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾