Class ForSaleComponent
A component that allows purchase + pickup of a world object.
Inheritance
System.Object
ForSaleComponent
Implements
System.ComponentModel.INotifyPropertyChanged
Assembly: Eco.Gameplay.dll
Syntax
public class ForSaleComponent : WorldObjectComponent, ILinkable, IOwned, IController, IViewController, IHasUniversalID, IHasSerializableID, IRPCAuthChecks, INotifyPropertyChanged, IThreadSafeSubscriptions, ISubscriptions<ThreadSafeSubscriptions>, ISubscriptions, IHasInteractions, IHasEnvVars, IPersistentData
Constructors
ForSaleComponent()
Declaration
public ForSaleComponent()
Fields
SellEvents
Declaration
public ThreadSafeList<Func<Result>> SellEvents
Field Value
SoldEvent
Declaration
public ThreadSafeAction<User, Currency, float, LocString> SoldEvent
Field Value
Properties
Currency
Declaration
public Currency Currency { get; set; }
Property Value
ForSale
Declaration
public bool ForSale { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
PersistentData
Declaration
public object PersistentData { get; set; }
Property Value
Type |
Description |
System.Object |
|
Price
Declaration
public float Price { get; set; }
Property Value
Type |
Description |
System.Single |
|
SaleData
Declaration
public ForSaleData SaleData { get; set; }
Property Value
SalePriceString
Declaration
[EnvVar]
public string SalePriceString { get; }
Property Value
Type |
Description |
System.String |
|
SellersAccount
Declaration
public BankAccount SellersAccount { get; set; }
Property Value
Title
Declaration
public LocString Title { get; set; }
Property Value
Methods
Buy(User)
Declaration
public Task Buy(User user)
Parameters
Type |
Name |
Description |
User |
user |
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
BuyInteraction(Player, InteractionTriggerInfo, InteractionTarget)
Declaration
[Interaction]
public void BuyInteraction(Player player, InteractionTriggerInfo trigger, InteractionTarget target)
Parameters
CanBuy(User)
Can only buy it if its for sale, has valid props, and user isnt already an owner (unless force enabled)
Declaration
[EnvVar]
public bool CanBuy(User user)
Parameters
Type |
Name |
Description |
User |
user |
|
Returns
Type |
Description |
System.Boolean |
|
Initialize()
Declaration
public override void Initialize()
Overrides
SetConfig(ForSaleComponent.SaleTypes, Func<LocString>, Func<Item>)
Config how this for-sale component works.
Declaration
public void SetConfig(ForSaleComponent.SaleTypes saleType, Func<LocString> customDescription = null, Func<Item> itemPickedUp = null)
Parameters
Implements
System.ComponentModel.INotifyPropertyChanged
Extension Methods