Show / Hide Table of Contents

Class ItemPersistentData

Contains the persistent data for each component and worldobject itself deriving IPersistentData, allowing that data to be preserved and restored as the object is placed and put down. This is stored on the WorldObjectItem when the WorldObject is picked up, and on the WorldObject itself when it's placed.

Inheritance
System.Object
ItemPersistentData
Implements
IPermanentDestroyHandler
IController
IViewController
IHasUniversalID
System.ComponentModel.INotifyPropertyChanged
IThreadSafeSubscriptions
ISubscriptions<ThreadSafeSubscriptions>
ISubscriptions
Namespace: Eco.Gameplay.Items
Assembly: Eco.Gameplay.dll
Syntax
public class ItemPersistentData : Object, IPermanentDestroyHandler, IController, IViewController, IHasUniversalID, INotifyPropertyChanged, IThreadSafeSubscriptions, ISubscriptions<ThreadSafeSubscriptions>, ISubscriptions

Constructors

ItemPersistentData()

Declaration
public ItemPersistentData()

Fields

ResetButton

Clickable tooltip section, triggers ClearOnRequest (see ResetDataTooltip).

Declaration
public TextLinkButton ResetButton
Field Value
Type Description
TextLinkButton

Properties

ControllerID

Declaration
public ref int ControllerID { get; }
Property Value
Type Description
System.Int32

Entries

Declaration
public ControllerDictionary<Type, object> Entries { get; set; }
Property Value
Type Description
ControllerDictionary<System.Type, System.Object>

PersistentControllers

Declaration
[NewTooltipChildren]
public IEnumerable<IController> PersistentControllers { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<IController>

Subscriptions

Declaration
public ref ThreadSafeSubscriptions Subscriptions { get; }
Property Value
Type Description
ThreadSafeSubscriptions

Methods

ClearOnRequest(Player)

Cleaning requested by the player. Notifies entries with IClearRequestHandler interface and removes all entries without IClearRequestHandler.

Declaration
public void ClearOnRequest(Player player)
Parameters
Type Name Description
Player player

ClearOnTrade()

Removes all entries with IClearOnTrade interface. It also will call OnPermanentDestroy() for all such entries which implements IPermanentDestroyHandler interface.

Declaration
public void ClearOnTrade()

OnPermanentDestroy()

Declaration
public void OnPermanentDestroy()

SetPersistentData<TComponent>(Object)

Sets persistent data for the component of type TComponent. If data is null then removes component data.

Declaration
public void SetPersistentData<TComponent>(object data)
    where TComponent : IPersistentData
Parameters
Type Name Description
System.Object data
Type Parameters
Name Description
TComponent

ShowResetDialog(TooltipOrigin, TooltipClickContext, User)

A dialog to be shown when the reset button is clicked.

Declaration
public void ShowResetDialog(TooltipOrigin origin, TooltipClickContext context, User user)
Parameters
Type Name Description
TooltipOrigin origin
TooltipClickContext context
User user

TryAddPersistentDataFromComponent(IPersistentData)

Tries to add PersistentData from component if it wasn't previously added.

Declaration
public bool TryAddPersistentDataFromComponent(IPersistentData component)
Parameters
Type Name Description
IPersistentData component
Returns
Type Description
System.Boolean

TryGetPersistentData<TComponent>(out Object)

Tries to obtain persistent data for TComponent if it was previously added by TryAddPersistentDataFromComponent(IPersistentData).

Declaration
public bool TryGetPersistentData<TComponent>(out object data)
    where TComponent : IPersistentData
Parameters
Type Name Description
System.Object data
Returns
Type Description
System.Boolean
Type Parameters
Name Description
TComponent

TryRestorePersistentDataToComponent(IPersistentData)

Tries to restore data to PersistentData of component if it is in . If restored successfully then corresponding entry removed.

Declaration
public bool TryRestorePersistentDataToComponent(IPersistentData component)
Parameters
Type Name Description
IPersistentData component
Returns
Type Description
System.Boolean

Events

PropertyChanged

Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
Type Description
System.ComponentModel.PropertyChangedEventHandler

Implements

IPermanentDestroyHandler
IController
IViewController
IHasUniversalID
System.ComponentModel.INotifyPropertyChanged
IThreadSafeSubscriptions
ISubscriptions<TSubscriptionsList>
ISubscriptions

Extension Methods

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