Class ItemProperty<T extends ItemPropertyValue>
java.lang.Object
group24.escaperoom.entities.properties.ItemProperty<T>
- All Implemented Interfaces:
com.badlogic.gdx.utils.Json.Serializable
- Direct Known Subclasses:
BooleanProperty,ConditionalProperty,ContainsItemProperty,LockedProperty,PhantomProperty,ReadableProperty,Stylable,ViewableProperty
public abstract class ItemProperty<T extends ItemPropertyValue>
extends Object
implements com.badlogic.gdx.utils.Json.Serializable
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidItemProperty<? extends ItemPropertyValue>cloneProperty(Item newOwner) voiddefaultConfiguration(Item owner) com.badlogic.gdx.utils.Array<PlayerAction>getActions(GameContext ctx) protected abstract com.badlogic.gdx.utils.Array<PlayerAction>com.badlogic.gdx.utils.Array<T>Get aPropertyConfigurationthat contains all fields necessary to configure this property in theItemEditorabstract PropertyDescriptionabstract Stringabstract ItemProperty.MenuTypegetOwner()<CC extends com.badlogic.gdx.scenes.scene2d.Actor & ConfigurationMenu.HandlesMenuClose>
ConfigurationMenu<CC>getPopOut(Menu.MenuEntry parent) If this property specifiesItemProperty.MenuType.PopOutThis function will be called to get the Menu which should be displayed when this property is selected.abstract com.badlogic.gdx.utils.Array<T>abstract PropertyTypegetType()voidSet the value of this property to value It is the responsibility of the caller to only pass values that are recieved fromgetPotentialValues()voidSet the value of this property to value It is the responsibility of the caller to only pass values that are recieved fromgetPotentialValues()voidvoidunsafeSet(com.badlogic.gdx.utils.Array<ItemPropertyValue> value) Unsafely set this item.voidunsafeSet(ItemPropertyValue value) Unsafely set this item This should only be used when the compile time class of the expected property class cannot be determined.voidUpdates the owner's texture based on the property.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.badlogic.gdx.utils.Json.Serializable
read, write
-
Field Details
-
owner
-
-
Constructor Details
-
ItemProperty
public ItemProperty()
-
-
Method Details
-
setOwner
-
getOwner
-
getValueClass
- Returns:
- the class of the
ItemPropertyValuefor this property
-
getPotentialValues
- Returns:
- all possible values for this property
-
getDisplayName
- Returns:
- name of this property, used as a display string in menus
-
defaultConfiguration
- Parameters:
owner- create a default configuration of this property for the given owner
-
apply
- Parameters:
owner- apply this property to this item
-
getDescription
- Returns:
- the
PropertyDescriptionof this Property
-
getType
- Returns:
PropertyTypeof this property. This allows us to get the property of an item from it's property map- See Also:
-
set
Set the value of this property to value It is the responsibility of the caller to only pass values that are recieved fromgetPotentialValues()- Parameters:
values- to set
-
set
Set the value of this property to value It is the responsibility of the caller to only pass values that are recieved fromgetPotentialValues()- Parameters:
value- to set
-
unsafeSet
Unsafely set this item. This should only be used when the compile time class of the expected property type cannot be determined. The caller must ensure that the value class is the same asgetValueClass()- Parameters:
value- to set
-
unsafeSet
Unsafely set this item This should only be used when the compile time class of the expected property class cannot be determined. The caller must ensure that the value class is the same asgetValueClass()- Parameters:
value- to set
-
getInputType
- Returns:
- the
ItemProperty.MenuTypethat should be used to recieve and display theItemPropertyValueassociated with this property - adding a new input type requires updatingItemMenuto support it
-
getPopOut
public <CC extends com.badlogic.gdx.scenes.scene2d.Actor & ConfigurationMenu.HandlesMenuClose> ConfigurationMenu<CC> getPopOut(Menu.MenuEntry parent) If this property specifiesItemProperty.MenuType.PopOutThis function will be called to get the Menu which should be displayed when this property is selected.- Type Parameters:
CC- theConfigurationMenurequires an actor type implementingConfigurationMenu.HandlesMenuClose- Parameters:
parent-Menu.MenuEntryspawning this menu- Returns:
- the menu to display
-
getCustomItemConfigurationMenu
Get aPropertyConfigurationthat contains all fields necessary to configure this property in theItemEditor- Returns:
- Some(
PropertyConfiguration) should this property need configuration
-
getCurrentValues
- Returns:
- an array containing the current values of this property
-
getCurrentValue
- Returns:
- the current value of this property
-
getAvailableActions
- Returns:
- all available
PlayerAction
-
getActions
-
cloneProperty
- Parameters:
newOwner- the new owner of this property- Returns:
- a clone of this item property (along with state and values) for a new item
-
updateTexture
public void updateTexture()Updates the owner's texture based on the property. Properties which do not change the texture should not override this function. Typically used when reloading textures on already placed items.
-