Show / Hide Table of Contents

Class OnOffComponent

World object component for adding enable/disable support to a world object.

Inheritance
System.Object
WorldObjectComponent
OnOffComponent
Implements
ILinkable
IOwned
IController
IViewController
IHasUniversalID
IHasSerializableID
IRPCAuthChecks
IThreadSafeSubscriptions
ISubscriptions<ThreadSafeSubscriptions>
ISubscriptions
IHasInteractions
OnOffComponent.IOnOffMessagesContainer
System.ComponentModel.INotifyPropertyChanged
IHasEnvVars
Inherited Members
WorldObjectComponent.IsRPCAuthorized(IWorldObserver, AccessType, Object[])
WorldObjectComponent.PostInitialize()
WorldObjectComponent.OnCreate()
WorldObjectComponent.Destroy()
WorldObjectComponent.Tick()
WorldObjectComponent.LateTick()
WorldObjectComponent.TryPickup(Player, InventoryChangeSet, Inventory, Boolean)
WorldObjectComponent.OnPickup(Player)
WorldObjectComponent.OnBeforeObjectMoved()
WorldObjectComponent.OnAfterObjectMoved()
WorldObjectComponent.OnLinkClicked(TooltipOrigin, TooltipClickContext, User)
WorldObjectComponent.UILinkContent()
WorldObjectComponent.Parent
WorldObjectComponent.Name
WorldObjectComponent.IconName
WorldObjectComponent.ForceActiveTab
WorldObjectComponent.ComponentPrefabName
WorldObjectComponent.ComponentTabName
WorldObjectComponent.IsDestroyed
WorldObjectComponent.ShouldRequestEverything
WorldObjectComponent.Owners
WorldObjectComponent.ControllerID
WorldObjectComponent.IOwned.Deed
WorldObjectComponent.Subscriptions
WorldObjectComponent.PropertyChanged
Namespace: Eco.Gameplay.Components
Assembly: Eco.Gameplay.dll
Syntax
[RequireComponent]
public sealed class OnOffComponent : WorldObjectComponent, ILinkable, IOwned, IController, IViewController, IHasUniversalID, IHasSerializableID, IRPCAuthChecks, IThreadSafeSubscriptions, ISubscriptions<ThreadSafeSubscriptions>, ISubscriptions, IHasInteractions, OnOffComponent.IOnOffMessagesContainer, INotifyPropertyChanged, IHasEnvVars

Constructors

OnOffComponent()

Declaration
public OnOffComponent()

Properties

AllowPopupControl

Enables support for this component instance to be turned on/off via the popup messages.

Declaration
public bool AllowPopupControl { get; set; }
Property Value
Type Description
System.Boolean

Availability

Declaration
public override WorldObjectComponentClientAvailability Availability { get; }
Property Value
Type Description
WorldObjectComponentClientAvailability
Overrides
WorldObjectComponent.Availability

Enabled

Determines whether the player has access to switch current state.

Declaration
public override bool Enabled { get; }
Property Value
Type Description
System.Boolean
Overrides
WorldObjectComponent.Enabled

On

Represents current state of the toggle.

Declaration
[EnvVar]
public bool On { get; set; }
Property Value
Type Description
System.Boolean

RequiredAuth

The required auth level to enable/disable the world object instance..

Declaration
public AccessType RequiredAuth { get; set; }
Property Value
Type Description
AccessType

Methods

GetStatusNote()

Declaration
public LocString GetStatusNote()
Returns
Type Description
LocString

Initialize()

Declaration
public override void Initialize()
Overrides
WorldObjectComponent.Initialize()

SetOnOff(User, Boolean)

Check user's auth and tries to set the on-off state of the component. Can contain additional checks and feedbacks. See how StoreComponent changes behaviour of this component. Null user bypasses auth check.

Declaration
public Result SetOnOff(User user, bool onOff)
Parameters
Type Name Description
User user
System.Boolean onOff
Returns
Type Description
Result

Setup(Func<User, Boolean, Result>, AccessType, Boolean, OnOffComponent.IOnOffMessagesContainer)

Overrides default behaviour of the component.

Declaration
public void Setup(Func<User, bool, Result> check, AccessType auth, bool allowPopups, OnOffComponent.IOnOffMessagesContainer container)
Parameters
Type Name Description
System.Func<User, System.Boolean, Result> check
AccessType auth
System.Boolean allowPopups
OnOffComponent.IOnOffMessagesContainer container

SwitchState(Player)

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

Toggle(Player, InteractionTriggerInfo, InteractionTarget)

Declaration
[Interaction]
[Interaction]
[Interaction]
public void Toggle(Player player, InteractionTriggerInfo trigger, InteractionTarget target)
Parameters
Type Name Description
Player player
InteractionTriggerInfo trigger
InteractionTarget target

Implements

ILinkable
IOwned
IController
IViewController
IHasUniversalID
IHasSerializableID
IRPCAuthChecks
IThreadSafeSubscriptions
ISubscriptions<TSubscriptionsList>
ISubscriptions
IHasInteractions
OnOffComponent.IOnOffMessagesContainer
System.ComponentModel.INotifyPropertyChanged
IHasEnvVars

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
☀
☾