Class OnOffComponent
World object component for adding enable/disable support to a world object.
Inheritance
System.Object
OnOffComponent
Implements
System.ComponentModel.INotifyPropertyChanged
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
Properties
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
Overrides
Enabled
Determines whether the player has access to switch current state.
Declaration
public override bool Enabled { get; }
Property Value
Type |
Description |
System.Boolean |
|
Overrides
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
Methods
GetStatusNote()
Declaration
public LocString GetStatusNote()
Returns
Initialize()
Declaration
public override void Initialize()
Overrides
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
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
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
Implements
System.ComponentModel.INotifyPropertyChanged
Extension Methods