A Scene Manager component for Tilemaps when used with the templating system (TileFabLib/TpZoneManager/TpZoneLayout).
More...
|
| bool | Initialize (int initialSceneIndex=0, string initialSceneName="", bool sceneNameIsGuid=false) |
| | Init this component.
|
| bool | SetSceneFromSceneNameOrGuid (string tileSceneNameOrGuid, bool isGuid) |
| | Set Scene using name of 'TScene' or its GUID.
|
| bool | SetScene (int tileSceneIndex, bool clearPrevious=true, Func< TSceneList.TSceneSpec, TpZoneLayout, object?, object >? callback=null) |
| | Set Scene using index of 'Scene'.
|
| bool | ClearScene (bool clearCaches=true) |
| | Use before changing a Unity scene: deletes all zones placed via Layout.
|
| HashSet< string?> | GetUsedSceneLayoutNames (TSceneList.TScene tScene) |
| | Get all ZoneLayout names with no duplicates. Note all names changed to lowercase.
|
| TpZoneLayout? | GetNamedZoneLayout (string zoneLayoutName) |
| | Get a ZoneLayout for a given ZoneLayout name as found in a TSceneSpec.
|
| TSceneList.? TSceneSpec | GetSceneSpecWithLayoutName (string layoutName) |
| | Get the SceneSpec for a named layout in the current TScene.
|
|
| TSceneList? | m_TSceneList |
| | A reference to a Project asset that contains a list of TileScenes. Each Tile Scene is an instance of a TScene class. Each TScene class has a list of TSceneSpec class instances. Each TSceneSpec instance has a ChunkTemplateSelector (the content to load) and a ZoneLayout component name. The name is used to lookup the ZoneLayout component REFERENCE, which is the connection to the TpZoneLayout component and its underlying TpZoneManager. When a new scene is loaded, one or more TpZoneLayout has their ChunkSelector references set to the ChunkTemplateSelector from the TSceneSpec specifically connected to the TpZoneLayout. What a mouthful.
|
| List< TpZoneLayout > | m_ZoneLayouts = new() |
| | This list can have any non-local (ie not on the same GO) ZoneLayouts. Optional.
|
|
| Action< TpChunkedSceneManager, TSceneList.TScene?>? | OnBeforeTSceneChange |
| | Invoked when SetScene is entered. TileScene passed to Action is the CURRENT TileScene (the one active before SetScene is called). NOTE that on first use the TileScene will be NULL since there isn't an active one at that point in time.
|
| Action< TpChunkedSceneManager, TSceneList.TScene >? | OnAfterTSceneChange |
| | Invoked when SetScene is complete. TileScene passed to Action is the NEW TileScene.
|
| Action< TpChunkedSceneManager, TSceneList.TScene >? | OnNewTSceneChosen |
| | Invoked when a new TileScene has been sucessfully selected. Subsriber should save this somewhere.
|
| Action< TpChunkedSceneManager, TSceneList.TScene?, TpZoneManager, ZoneReg >? | OnZoneRegAddedForLayout |
| | Invoked when an active ZoneManager for a TSceneLyout issues OnZoneRegAdded. Note that one can get the ZoneManager's controlling TpZoneLayout from a property in the ZoneManager.
|
| Action< TpChunkedSceneManager, TSceneList.TScene?, TpZoneManager, ZoneReg >? | OnZoneRegDeletedForLayout |
| | Invoked when an active ZoneManager for a TSceneLyout issues OnZoneRegDeleted. Note that one can get the ZoneManager's controlling TpZoneLayout from a property in the ZoneManager.
|
| Action< TpChunkedSceneManager, Tilemap, List< TilePlusBase > >? | OnTptTilesWillBeDeletedForLayout |
| | Invoked when an active ZoneManager for a TSceneLyout issues OnTptTilesWillBeDeleted.
|
A Scene Manager component for Tilemaps when used with the templating system (TileFabLib/TpZoneManager/TpZoneLayout).
◆ ClearScene()
| bool TilePlus.TpChunkedSceneManager.ClearScene |
( |
bool | clearCaches = true | ) |
|
Use before changing a Unity scene: deletes all zones placed via Layout.
- Parameters
-
| clearCaches | Clear all bundle caches if true (default) |
- Returns
- false for no current scene or any error
◆ GetNamedZoneLayout()
| TpZoneLayout? TilePlus.TpChunkedSceneManager.GetNamedZoneLayout |
( |
string | zoneLayoutName | ) |
|
Get a ZoneLayout for a given ZoneLayout name as found in a TSceneSpec.
- Parameters
-
- Returns
- null if not found
◆ GetSceneSpecWithLayoutName()
| TSceneList.? TSceneSpec TilePlus.TpChunkedSceneManager.GetSceneSpecWithLayoutName |
( |
string | layoutName | ) |
|
Get the SceneSpec for a named layout in the current TScene.
- Parameters
-
| layoutName | The name of a Zone layout in the CURRENT SCENE |
- Returns
- the Scene Spec or NULL if not found. Note that not all Scenes use all layouts!
◆ GetUsedSceneLayoutNames()
| HashSet< string?> TilePlus.TpChunkedSceneManager.GetUsedSceneLayoutNames |
( |
TSceneList.TScene | tScene | ) |
|
Get all ZoneLayout names with no duplicates. Note all names changed to lowercase.
- Parameters
-
- Returns
- HashSet of ZoneLayout names
◆ Initialize()
| bool TilePlus.TpChunkedSceneManager.Initialize |
( |
int | initialSceneIndex = 0, |
|
|
string | initialSceneName = "", |
|
|
bool | sceneNameIsGuid = false ) |
Init this component.
- Parameters
-
| initialSceneIndex | Initial Scene index from the list of Scenes. Note: if this is <0 then the initial scene isn't loaded EVEN IF an initial scene name or GUID is provided! |
| initialSceneName | default=empty string. If this isn't empty, the string provided is used to look for a TileScene in the list of TileScenes and the initialSceneIndex value is ignored. Note that this string can be a scene name or the GUID of a scene |
| sceneNameIsGuid | Set this true if the initialSceneName is a GUID |
- Returns
- false for error, eg: the ZoneLayout component LayoutName fields are not unique.
The ZoneLayout components must all be on the same GameObject as this component. Any others not on the same GameObject are ignored unless manually added to the m_ZoneLayout. Also: set up the several SceneChange callbacks before calling this if you want its handler invoked.
◆ SetScene()
| bool TilePlus.TpChunkedSceneManager.SetScene |
( |
int | tileSceneIndex, |
|
|
bool | clearPrevious = true, |
|
|
Func< TSceneList.TSceneSpec, TpZoneLayout, object?, object >? | callback = null ) |
Set Scene using index of 'Scene'.
- Parameters
-
| tileSceneIndex | Index of selector asset |
| clearPrevious | Clear all zones if true (default) |
| callback | A Func that gets a SceneSpec, a SceneLayout, and an object, returning an object. See remarks |
- Returns
- false for error
Here is where LoadFlag overrides are applied. However, they can be modified in the Layout.Updateick callbacks. The Func is used when any TSceneInitializers are evaluated. It's passed to the Initializer when its Exec method is invoked. It gets the SceneSpec and SceneLayout information for that initializer, and any arbitrary data that's desirable, and returns any arbitrary data that's desirable. The idea is to have most handling of init related to a specific scene be handled by initializers. If that doesn't work then you can handle the various callbacks from ZoneManagers and this component in your own code; and you can certaintly do both as needed to handle special situations.
◆ SetSceneFromSceneNameOrGuid()
| bool TilePlus.TpChunkedSceneManager.SetSceneFromSceneNameOrGuid |
( |
string | tileSceneNameOrGuid, |
|
|
bool | isGuid ) |
Set Scene using name of 'TScene' or its GUID.
- Parameters
-
| tileSceneNameOrGuid | Name or GUID of TScene. if isGuid is FALSE, then tries to parse as integer >= 0, if that fails then do a lookup of the scene name. |
| isGuid | set TRUE if the input string is a GUID |
- Returns
- false for error
if isGuid == true the string is tested to see if it really is a guid. If not, we try to parse the string as an integer and use that as a TScene index, ie an index into the list of TScenes in the TSceneList asset.
◆ m_TSceneList
| TSceneList? TilePlus.TpChunkedSceneManager.m_TSceneList |
A reference to a Project asset that contains a list of TileScenes. Each Tile Scene is an instance of a TScene class. Each TScene class has a list of TSceneSpec class instances. Each TSceneSpec instance has a ChunkTemplateSelector (the content to load) and a ZoneLayout component name. The name is used to lookup the ZoneLayout component REFERENCE, which is the connection to the TpZoneLayout component and its underlying TpZoneManager. When a new scene is loaded, one or more TpZoneLayout has their ChunkSelector references set to the ChunkTemplateSelector from the TSceneSpec specifically connected to the TpZoneLayout. What a mouthful.
◆ m_ZoneLayouts
| List<TpZoneLayout> TilePlus.TpChunkedSceneManager.m_ZoneLayouts = new() |
This list can have any non-local (ie not on the same GO) ZoneLayouts. Optional.
◆ CurrentActiveLayouts
| HashSet<TpZoneLayout> TilePlus.TpChunkedSceneManager.CurrentActiveLayouts = new() |
|
get |
Get the currently-active TpZoneLayouts. Valid when OnNewTsceneChosen callback.
◆ CurrentScene
| TSceneList.? TScene TilePlus.TpChunkedSceneManager.CurrentScene |
|
get |
◆ CurrentSceneIndex
| int TilePlus.TpChunkedSceneManager.CurrentSceneIndex |
|
get |
◆ LargestSelectorBounds
| BoundsInt TilePlus.TpChunkedSceneManager.LargestSelectorBounds |
|
get |
BoundsInt representing the largest BoundsInt of a Selector.
◆ LastScene
| TSceneList.? TScene TilePlus.TpChunkedSceneManager.LastScene |
|
get |
The previous TScene (or null).
◆ PreviousSceneIndex
| int TilePlus.TpChunkedSceneManager.PreviousSceneIndex |
|
get |
◆ SceneChangeInProgress
| bool TilePlus.TpChunkedSceneManager.SceneChangeInProgress |
|
get |
Indicates if a scene change is in progress. Note: static property.
◆ TotalNumLayouts
| int TilePlus.TpChunkedSceneManager.TotalNumLayouts |
|
get |
The total number of TpZoneLayouts found during init.
◆ OnAfterTSceneChange
Invoked when SetScene is complete. TileScene passed to Action is the NEW TileScene.
◆ OnBeforeTSceneChange
Invoked when SetScene is entered. TileScene passed to Action is the CURRENT TileScene (the one active before SetScene is called). NOTE that on first use the TileScene will be NULL since there isn't an active one at that point in time.
◆ OnNewTSceneChosen
Invoked when a new TileScene has been sucessfully selected. Subsriber should save this somewhere.
◆ OnTptTilesWillBeDeletedForLayout
Invoked when an active ZoneManager for a TSceneLyout issues OnTptTilesWillBeDeleted.
◆ OnZoneRegAddedForLayout
Invoked when an active ZoneManager for a TSceneLyout issues OnZoneRegAdded. Note that one can get the ZoneManager's controlling TpZoneLayout from a property in the ZoneManager.
◆ OnZoneRegDeletedForLayout
Invoked when an active ZoneManager for a TSceneLyout issues OnZoneRegDeleted. Note that one can get the ZoneManager's controlling TpZoneLayout from a property in the ZoneManager.
The documentation for this class was generated from the following file: