Empeld plugin documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
essentials.action.ItemFramework.ItemBase Class Reference
Inheritance diagram for essentials.action.ItemFramework.ItemBase:
pluginbase.Objects.Syncable.SyncableObject essentials.action.ItemFramework.IItem pluginbase.Objects.Syncable.SyncableBase< T > pluginbase.Objects.Syncable.INetSyncable pluginbase.Objects.Syncable.INetSyncable pluginbase.Objects.Syncable.INetWatcher pluginbase.Objects.Syncable.INetWatcher essentials.action.ItemFramework.BlockItem essentials.action.ItemFramework.Interactive.Bases.UseableItemBase essentials.action.ItemFramework.ItemBundle essentials.action.ItemFramework.BlockStackItem essentials.action.ItemFramework.Interactive.Bases.DeterioratingItemBase essentials.action.ItemFramework.Interactive.Bases.Simple.MagicWand essentials.action.ItemFramework.Interactive.UseableBlockItem essentials.action.ItemFramework.Interactive.Bases.WorldModifyingItemBase essentials.action.ItemFramework.Interactive.Bases.Simple.Shovel

Public Member Functions

 ItemBase ()
override string ToString ()
- Public Member Functions inherited from pluginbase.Objects.Syncable.SyncableObject
 SyncableObject ()
 Initializes a new instance of the pluginbase.Objects.Syncable.SyncableObject class. More...

Protected Member Functions

virtual Bitmap LoadIcon ()
 Loads the bitmap representing the image of the item More...
virtual IReadonlyModel LoadModel ()
 Loads the mesh representing the model in-world More...
- Protected Member Functions inherited from pluginbase.Objects.Syncable.SyncableObject
sealed override void ResetWatch ()
 Reset variables watched status More...
sealed override void TouchRecurse ()
 Touch self, including all children of this syncable object More...
sealed override void EncodeTo (BinaryWriter writer, EncodeContext context)
 Encode changes to binary data More...
sealed override void DecodeFrom (BinaryReader reader, DecodeContext context)
 Decode changes from binary data More...
sealed override void Persist (IPersistObject obj)
 Build up a persistant object for this syncable, including all sync children and persist objects More...
sealed override void Load (IReadPersistObject obj)
 Load a given persistent object back into this instance More...
- Protected Member Functions inherited from pluginbase.Objects.Syncable.SyncableBase< T >
void Touch ()
 Touch the instance, notifying something has changed More...
virtual void OnChanged ()
 Raises the changed event. More...

Protected Attributes

readonly IModelFactory ModelFactory
readonly IPluginLogger Logger


abstract string Icon [get]
 Gets the path to the icon More...
abstract string Name [get]
 Gets the name of the item More...
virtual string IconLabel [get]
virtual string Description [get]
virtual string MeshResource [get]
virtual string ModelImage [get]
virtual int MeshalizerResolution [get]
virtual float MeshalizerDepth [get]
virtual float ModelSize [get]
virtual ItemRenderMode ItemRenderMode [get]
virtual string ModelCacheKey [get]
virtual bool ShowNameplate [get]
virtual bool Bounce [get]
virtual bool AutoDespawn [get]
virtual TimeSpan AutoDespawnDelay [get]
virtual bool HasGravity [get]
virtual double ViewDistance [get]
- Properties inherited from pluginbase.Objects.Syncable.SyncableObject
virtual ushort NetOwnerId [get]
 Gets the network owner of this object (user id) More...
- Properties inherited from pluginbase.Objects.Syncable.INetSyncable
INetWatcher Watcher [get, set]
 Who is watching (who to inform of a change) More...
bool Modified [get]
 Gets a value indicating whether this pluginbase.Objects.Syncable.INetSyncable is modified. More...
- Properties inherited from essentials.action.ItemFramework.IItem
string Name [get]
 The human-readable name of the item More...
string IconLabel [get]
 Gets the wording that can appear over a icon More...
bool ShowNameplate [get]
 Whether or not to show the nameplate above the item More...
bool Bounce [get]
 Whether or not the item should bounce in the world More...
bool AutoDespawn [get]
 Whether or not the item should be subject to auto-despawn More...
TimeSpan AutoDespawnDelay [get]
 The amount of time the auto despawn will take, if set (Overrides global default) More...
bool HasGravity [get]
 Whether or not gravity affects the item More...
double ViewDistance [get]
 The distance from which the dropped item can be viewed More...

Additional Inherited Members

- Events inherited from pluginbase.Objects.Syncable.SyncableBase< T >
Action< T > Changed
 Event triggered when any change occurs on this object, either locally or over the network More...
Action< T > NetUpdate
 Event triggered when a change occurs resulting from a change over the network More...
Action< T > Touched
 Event occurs only when an object is first touched. Usually the first instance of a local-change More...

Constructor & Destructor Documentation

essentials.action.ItemFramework.ItemBase.ItemBase ( )
28  {
29  this.InjectDependencies();
30  }

Member Function Documentation

virtual Bitmap essentials.action.ItemFramework.ItemBase.LoadIcon ( )

Loads the bitmap representing the image of the item

The icon.

Implements essentials.action.ItemFramework.IItem.

Reimplemented in essentials.action.ItemFramework.ItemBundle, and essentials.action.ItemFramework.BlockItem.

104  {
105  if (!string.IsNullOrEmpty(this.Icon))
106  {
107  using (var stream = _resourceResolver.OpenRead(this.Icon))
108  {
109  return new Bitmap(stream);
110  }
111  }
112  return null;
113  }
abstract string Icon
Gets the path to the icon
Definition: ItemBase.cs:39
Stream OpenRead(string module, string resource)
Opens a file for reading
virtual IReadonlyModel essentials.action.ItemFramework.ItemBase.LoadModel ( )

Loads the mesh representing the model in-world

The model.

Implements essentials.action.ItemFramework.IItem.

Reimplemented in essentials.action.ItemFramework.ItemBundle, and essentials.action.ItemFramework.BlockStackItem.

116  {
117  Logger.LogDebug("Loading item model for '{0}'...", this.Name);
119  if (!string.IsNullOrWhiteSpace(this.MeshResource))
120  {
121  return this.ModelFactory.LoadModel(this.MeshResource);
122  }
124  if (!string.IsNullOrEmpty(this.ModelImage))
125  {
126  if (this.ItemRenderMode == ItemRenderMode.Meshalizer)
127  {
128  return CreateBitmapMesh();
129  }
130  else if(this.ItemRenderMode == ItemRenderMode.Flat)
131  {
132  return CreateFlatMesh();
133  }
134  else if(this.ItemRenderMode == ItemRenderMode.Cube)
135  {
136  return CreateCubeMesh();
137  }
138  }
139  return null;
140  }
readonly IPluginLogger Logger
Definition: ItemBase.cs:22
virtual ItemRenderMode ItemRenderMode
Definition: ItemBase.cs:86
void LogDebug(string msg, params object[] args)
virtual string MeshResource
Definition: ItemBase.cs:58
virtual string ModelImage
Definition: ItemBase.cs:63
readonly IModelFactory ModelFactory
Definition: ItemBase.cs:19
abstract string Name
Gets the name of the item
Definition: ItemBase.cs:45
IReadonlyModel LoadModel(string resource)
Load a model to a readonly model instance
override string essentials.action.ItemFramework.ItemBase.ToString ( )
276  {
277  return string.Format("[Item: {0}]", Name ?? "Unknown");
278  }
abstract string Name
Gets the name of the item
Definition: ItemBase.cs:45

Member Data Documentation

readonly IPluginLogger essentials.action.ItemFramework.ItemBase.Logger

Attribute: Dependency

readonly IModelFactory essentials.action.ItemFramework.ItemBase.ModelFactory

Attribute: Dependency(Optional = true)

Property Documentation

virtual bool essentials.action.ItemFramework.ItemBase.AutoDespawn
virtual TimeSpan essentials.action.ItemFramework.ItemBase.AutoDespawnDelay
virtual bool essentials.action.ItemFramework.ItemBase.Bounce
virtual string essentials.action.ItemFramework.ItemBase.Description
virtual bool essentials.action.ItemFramework.ItemBase.HasGravity
abstract string essentials.action.ItemFramework.ItemBase.Icon

Gets the path to the icon

The icon.

virtual string essentials.action.ItemFramework.ItemBase.IconLabel
virtual ItemRenderMode essentials.action.ItemFramework.ItemBase.ItemRenderMode
virtual float essentials.action.ItemFramework.ItemBase.MeshalizerDepth
virtual int essentials.action.ItemFramework.ItemBase.MeshalizerResolution
virtual string essentials.action.ItemFramework.ItemBase.MeshResource
virtual string essentials.action.ItemFramework.ItemBase.ModelCacheKey
virtual string essentials.action.ItemFramework.ItemBase.ModelImage
virtual float essentials.action.ItemFramework.ItemBase.ModelSize
abstract string essentials.action.ItemFramework.ItemBase.Name

Gets the name of the item

The name.

virtual bool essentials.action.ItemFramework.ItemBase.ShowNameplate
virtual double essentials.action.ItemFramework.ItemBase.ViewDistance

The documentation for this class was generated from the following file: