![]() |
TilePlus Version 5
Unity3D Tilemap Extension
|
Library of tile messaging methods. Note that it's a Service. More...


Public Member Functions | |
| override void | OnEnable () |
| OnEnable event override. | |
| override string | Status () |
| The TilePlus SysInfo window will show all SRS 'Status' strings when playing in-editor (if the 'show' checkbox is checked). This is totally optional. | |
| override bool | CanPollForDetails () |
Used by SRS inspector. If the contents of an SRS change frequently then this should be overridden to return true.
| |
| override string | Details (int length=-1) |
The SRS inspector utility will show whatever this returns.
| |
| MessagingContext? | PeekContextStack (bool unpooled=true) |
| Peek the top of the context stack and return an unpooled instance or optionally, the actual top of stack (pooled): pooled useful if you're forwarding packets. | |
| void | SendMessage< T > (TilePlusBase tile, T packet) |
| Send a message to a single tile. | |
| void | SendMessage< T > (Tilemap map, Vector3Int position, T packet) |
| Send a message to a single tile on a given map. | |
| bool | SendMessage< T > (string guid, T packet) |
| Send a message to a single tile with a GUID in string form, on a given map. –Convenience wrapper method. | |
| bool | SendMessage< T > (Guid guid, T packet) |
| Send a message to a single tile with a GUID on a given map. | |
| void | SendMessage< T > (Tilemap map, IEnumerable< Vector3Int > positions, T packet, Func< TilePlusBase, bool >? tileFilter=null) |
| Send a message to tiles on a given map with an IEnumerable of positions. | |
| int[] | SendMessage< T > (Tilemap map, string tag, T packet, Func< TilePlusBase, bool >? tileFilter=null, Func< T, TilePlusBase, bool >? packetFilter=null, RectInt? region=null) |
| send a message to one or more tagged tiles. Optional prefilter | |
| int[] | SendMessage< T > (Tilemap? map, Type typeSpec, T packet, Func< TilePlusBase, bool >? tileFilter=null, Func< T, TilePlusBase, bool >? packetFilter=null, RectInt? region=null) |
| send a message to one or more tiles of a particular type. Optional prefilter. | |
| int[] | SendMessage< T, TI > (T packet, Func< TI, TilePlusBase, bool >? interfaceAndTileFilter=null, Func< T, TilePlusBase, bool >? packetFilter=null, Func< TilePlusBase, bool >? tileFilter=null, RectInt? region=null) |
| send a message to one or more tiles with a particular interface | |
| Public Member Functions inherited from TilePlus.ScriptableRuntimeService< T > | |
| override string | ToString () |
| Customize ToString in overrides. | |
| virtual void | OnDisable () |
| Unity event method. | |
| Public Member Functions inherited from TilePlus.IScriptableService | |
| void | Update (float deltaTime) |
| Update implementation: Must override with explicit implementation. | |
| void | MessageTarget (ObjectPacket packet) |
| If Accepts messages is true, reimplement this to get messaged. | |
Static Public Member Functions | |
| static bool | RejectSameInstancePacketFilter< T > (T packet, TilePlusBase tile) |
| Basic packet filter rejects packets with same source instance. ALWAYS returns true if the packet's source instance is null. NOTE THAT IF YOU USE THIS PACKET FILTER then the tileFilter is ignored even if specified in the method call. Can't have tileFilter and PacketFilter in the same call to SendMessage. | |
Properties | |
| ulong | LastMessageID [get] |
| ID of the last or current message. | |
| int | MaxMessagedCount [get] |
| Max # of messages sent in one method call. Note can be confusing since messages can be re-sent from message handlers. | |
| int | LastMessagedCount [get] |
| ObjectPool< ObjectPacket > | ObjectPacketPool [get] |
| Pool for ObjectPackets. | |
| ObjectPool< ActionToTilePacket > | ActionToTilePacketPool [get] |
| Pool for ActionToTilePackets. | |
| ObjectPool< PositionPacket > | PositionPacketPool [get] |
| Pool for position packets. | |
| ObjectPool< StringPacket > | StringPacketPool [get] |
| Pool for String packets. | |
| Properties inherited from TilePlus.ScriptableRuntimeService< T > | |
| string | ServiceName [get] |
| A name for this service: used for profiling. Ordinarily just returns the 'name' property of the Service S.O. instance. | |
| Properties inherited from TilePlus.IScriptableService | |
| bool | PeristThruReload [get] |
| If true, this will not be deleted when the Unity scene changes. | |
| bool | WantsUpdate [get] |
| Does this SRS want an update tick? MUST override if you're providing an Update method. MUST override with explicit implementation. | |
| bool | ReadyForUpdate [get] |
| Is this SRS ready for an update? MUST Override if your SRS doesn't always need an update. MUST override with explicit implementation. | |
| string[] | AcceptableMessages [get] |
| If true, can accept ObjectPacket messages from the Service Manager with command-strings matching those returned here. | |
Additional Inherited Members | |
| Static Protected Member Functions inherited from TilePlus.ScriptableRuntimeService< T > | |
| static void | Create () |
| Create and initialize method. | |
Library of tile messaging methods. Note that it's a Service.
Null-checks are not used in certain loops to enhance speed. However, since user code is generally single-threaded, TpLib shouldn't be returning null tiles within any of these methods.
|
virtual |
Used by SRS inspector. If the contents of an SRS change frequently then this should be overridden to return true.
Reimplemented from TilePlus.ScriptableRuntimeService< T >.
|
virtual |
The SRS inspector utility will show whatever this returns.
Reimplemented from TilePlus.ScriptableRuntimeService< T >.
|
virtual |
OnEnable event override.
Reimplemented from TilePlus.ScriptableRuntimeService< T >.
| MessagingContext? TilePlus.TpMessaging.PeekContextStack | ( | bool | unpooled = true | ) |
Peek the top of the context stack and return an unpooled instance or optionally, the actual top of stack (pooled): pooled useful if you're forwarding packets.
| unpooled | if true (default) returns UNPOOLED copy of top of stack. |
You CANNOT forward an UNPOOLED copy of the stack via another messaging method. That would eventually release an unpooled copy back to the pool: error. Please set the unpooled param FALSE if you're forwarding this packet via the messaging system.
|
static |
Basic packet filter rejects packets with same source instance. ALWAYS returns true if the packet's source instance is null. NOTE THAT IF YOU USE THIS PACKET FILTER then the tileFilter is ignored even if specified in the method call. Can't have tileFilter and PacketFilter in the same call to SendMessage.
| packet | The Data packet of Type T |
| tile |
| T | MessagePacket or subclass |
| T | : | MessagePacket<T> |
| bool TilePlus.TpMessaging.SendMessage< T > | ( | Guid | guid, |
| T | packet ) |
Send a message to a single tile with a GUID on a given map.
| guid | Guid of tile |
| packet | packet to send. Get from pool if possible |
| T | MessagePacket concrete class |
| T | : | MessagePacket<T> |
| bool TilePlus.TpMessaging.SendMessage< T > | ( | string | guid, |
| T | packet ) |
Send a message to a single tile with a GUID in string form, on a given map. –Convenience wrapper method.
| guid | string form of tile GUID |
| packet | packet to send. Get from pool if possible |
| T | MessagePacket concrete class |
| T | : | MessagePacket<T> |
| void TilePlus.TpMessaging.SendMessage< T > | ( | Tilemap | map, |
| IEnumerable< Vector3Int > | positions, | ||
| T | packet, | ||
| Func< TilePlusBase, bool >? | tileFilter = null ) |
Send a message to tiles on a given map with an IEnumerable of positions.
| map | target map. Must not be null |
| positions | Ienumerable of positions |
| packet | packet to send. Get from pool if possible |
| tileFilter | Optional prefilter delegate, filter on tile Types or instance values. |
| T | MessagePacket concrete class |
| T | : | MessagePacket<T> |
| int[] TilePlus.TpMessaging.SendMessage< T > | ( | Tilemap | map, |
| string | tag, | ||
| T | packet, | ||
| Func< TilePlusBase, bool >? | tileFilter = null, | ||
| Func< T, TilePlusBase, bool >? | packetFilter = null, | ||
| RectInt? | region = null ) |
send a message to one or more tagged tiles. Optional prefilter
| T | MessagePacket concrete class |
| map | tilemap to use. If null, uses all maps. |
| tag | tag to look for |
| packet | Data to send of type MessagePacket or subclass |
| tileFilter | Optional prefilter delegate, filter on tile Types or instance values. |
| packetFilter | Optional filtering on packets. |
| region | Optional prefilter, if !null position must be contained in the RectInt. |
| T | : | MessagePacket<T> |
| void TilePlus.TpMessaging.SendMessage< T > | ( | Tilemap | map, |
| Vector3Int | position, | ||
| T | packet ) |
Send a message to a single tile on a given map.
| map | target map. Must not be null |
| position | position |
| packet | packet to send. Get from pool if possible |
| T | MessagePacket concrete class |
| T | : | MessagePacket<T> |
| int[] TilePlus.TpMessaging.SendMessage< T > | ( | Tilemap? | map, |
| Type | typeSpec, | ||
| T | packet, | ||
| Func< TilePlusBase, bool >? | tileFilter = null, | ||
| Func< T, TilePlusBase, bool >? | packetFilter = null, | ||
| RectInt? | region = null ) |
send a message to one or more tiles of a particular type. Optional prefilter.
| T | MessagePacket concrete class |
| map | tilemap to use. If null uses all maps. See GetAllTilesOfType |
| typeSpec | What Type of tile to send the message to |
| packet | Data to send of type MessagePacket or subclass |
| tileFilter | Optional tileFilter delegate. Filter on tile Types or instance values. |
| packetFilter | Optional filtering on packets. |
| region | Optional pre-tileFilter for position. If region supplied, only tiles within the region are messaged |
| T | : | MessagePacket<T> |
| void TilePlus.TpMessaging.SendMessage< T > | ( | TilePlusBase | tile, |
| T | packet ) |
Send a message to a single tile.
| tile | target TPT tile. Must not be null. |
| packet | packet to send. Get from pool if possible |
| T | MessagePacket concrete class |
| T | : | MessagePacket<T> |
| int[] TilePlus.TpMessaging.SendMessage< T, TI > | ( | T | packet, |
| Func< TI, TilePlusBase, bool >? | interfaceAndTileFilter = null, | ||
| Func< T, TilePlusBase, bool >? | packetFilter = null, | ||
| Func< TilePlusBase, bool >? | tileFilter = null, | ||
| RectInt? | region = null ) |
send a message to one or more tiles with a particular interface
| T | MessagePacket concrete class |
| TI | Interface. Note that it's implicit that the Tiles implementing this interface also must implement ITpMessaging<T> |
| packet | Data to send of type MessagePacket or subclass |
| interfaceAndTileFilter | Optional delegate for test prior to sending message: the most complex test |
| packetFilter | Optional filtering on packets. Second most complex test |
| tileFilter | Optional filtering on tiles. Simplest test. |
| region | Optional pre-filter for position. If region supplied, only tiles within the region are messaged |
If possible use the tileFilter as it's simplest. In general, only use one type of filter. However, if you use more than one: 'filter' is used first, then the packetFilter OR the Tile filter. Meaning: 'filter' and 'region' are always used. However, if packetFilter is used then tileFilter is NOT used.
| T | : | MessagePacket<T> |
|
virtual |
The TilePlus SysInfo window will show all SRS 'Status' strings when playing in-editor (if the 'show' checkbox is checked). This is totally optional.
Reimplemented from TilePlus.ScriptableRuntimeService< T >.
|
get |
Pool for ActionToTilePackets.
|
get |
|
get |
ID of the last or current message.
|
get |
Max # of messages sent in one method call. Note can be confusing since messages can be re-sent from message handlers.
|
get |
Pool for ObjectPackets.
|
get |
Pool for position packets.
|
get |
Pool for String packets.