Empeld
Empeld plugin documentation.
pluginbase.Objects.Syncable.SyncableBase< T > Class Template Referenceabstract

The base class for any syncable More...

Inheritance diagram for pluginbase.Objects.Syncable.SyncableBase< T >:
pluginbase.Objects.Syncable.INetSyncable pluginbase.Objects.Syncable.INetWatcher

Protected Member Functions

void Touch ()
 Touch the instance, notifying something has changed More...
 
virtual void TouchRecurse ()
 Touch the instance More...
 
virtual void ResetWatch ()
 Reset the touched state More...
 
virtual void OnChanged ()
 Raises the changed event. More...
 
abstract void EncodeTo (BinaryWriter writer, EncodeContext context)
 Encode changes to binary data More...
 
abstract void DecodeFrom (BinaryReader reader, DecodeContext context)
 Decode changes from binary data More...
 
abstract void Persist (IPersistObject obj)
 Persist the instance to a persist object More...
 
abstract void Load (IReadPersistObject obj)
 Load the instance from a persist object More...
 

Events

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...
 

Additional Inherited Members

- 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...
 

Detailed Description

The base class for any syncable

Type Constraints
T :SyncableBase<T> 

Member Function Documentation

◆ DecodeFrom()

abstract void pluginbase.Objects.Syncable.SyncableBase< T >.DecodeFrom ( BinaryReader  reader,
DecodeContext  context 
)
protectedpure virtual

Decode changes from binary data

Parameters
readerReader.
contextContext.

Implements pluginbase.Objects.Syncable.INetSyncable.

Implemented in pluginbase.Objects.Syncable.SyncableObject.

◆ EncodeTo()

abstract void pluginbase.Objects.Syncable.SyncableBase< T >.EncodeTo ( BinaryWriter  writer,
EncodeContext  context 
)
protectedpure virtual

Encode changes to binary data

Parameters
writerWriter.
contextContext.

Implements pluginbase.Objects.Syncable.INetSyncable.

Implemented in pluginbase.Objects.Syncable.SyncableObject.

◆ Load()

abstract void pluginbase.Objects.Syncable.SyncableBase< T >.Load ( IReadPersistObject  obj)
protectedpure virtual

Load the instance from a persist object

Parameters
objObject.

Implements pluginbase.Objects.Syncable.INetSyncable.

◆ OnChanged()

virtual void pluginbase.Objects.Syncable.SyncableBase< T >.OnChanged ( )
protectedvirtual

Raises the changed event.

130  {
131  if (Changed != null)
132  {
133  Changed((T)this);
134  }
135  }
Action< T > Changed
Event triggered when any change occurs on this object, either locally or over the network ...
Definition: SyncableBase.cs:23

◆ Persist()

abstract void pluginbase.Objects.Syncable.SyncableBase< T >.Persist ( IPersistObject  obj)
protectedpure virtual

Persist the instance to a persist object

Parameters
objObject.

Implements pluginbase.Objects.Syncable.INetSyncable.

◆ ResetWatch()

virtual void pluginbase.Objects.Syncable.SyncableBase< T >.ResetWatch ( )
protectedvirtual

Reset the touched state

Implements pluginbase.Objects.Syncable.INetSyncable.

Reimplemented in pluginbase.Objects.Syncable.SyncableObject.

101  {
102  _modified = false;
103  }

◆ Touch()

void pluginbase.Objects.Syncable.SyncableBase< T >.Touch ( )
protected

Touch the instance, notifying something has changed

Implements pluginbase.Objects.Syncable.INetWatcher.

66  {
67  //If we're already touched, no need to touch again, as the touch-chain
68  //could be long, and unnecessary
69  if (!_modified)
70  {
71  _modified = true;
72  if (_watcher != null)
73  _watcher.Touch();
74  OnTouched();
75  }
76  OnChanged();
77  }
void Touch()
Touch the class, signalling that a change ocurred
virtual void OnChanged()
Raises the changed event.
Definition: SyncableBase.cs:129

◆ TouchRecurse()

virtual void pluginbase.Objects.Syncable.SyncableBase< T >.TouchRecurse ( )
protectedvirtual

Touch the instance

Implements pluginbase.Objects.Syncable.INetWatcher.

Reimplemented in pluginbase.Objects.Syncable.SyncableObject.

88  {
89  this.Touch();
90  }
void Touch()
Touch the instance, notifying something has changed
Definition: SyncableBase.cs:65

Event Documentation

◆ Changed

Event triggered when any change occurs on this object, either locally or over the network

◆ NetUpdate

Action<T> pluginbase.Objects.Syncable.SyncableBase< T >.NetUpdate

Event triggered when a change occurs resulting from a change over the network

◆ Touched

Event occurs only when an object is first touched. Usually the first instance of a local-change


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