Class ResizeTerrainUserToolStateBase<TScreen, TCallback>
Inheritance
Implements
Inherited Members
Namespace: Fwt.HexTerrains.UserTools.SM.States
Assembly: fwt.hexterrains.dll
Syntax
public abstract class ResizeTerrainUserToolStateBase<TScreen, TCallback> : HexTerrainUserToolStateBase, ISmState where TScreen : UIScreen, IViewDataReceiver<TCallback> where TCallback : ResizeTerrainCallbackDataSource, new()
Type Parameters
| Name | Description |
|---|---|
| TScreen | |
| TCallback |
Constructors
ResizeTerrainUserToolStateBase(ISmState)
Declaration
protected ResizeTerrainUserToolStateBase(ISmState parent)
Parameters
| Type | Name | Description |
|---|---|---|
| ISmState | parent |
Properties
CallbackDataSource
Gets or sets the callback data source used to provide custom data or behavior for operations.
Declaration
protected virtual TCallback CallbackDataSource { get; set; }
Property Value
| Type | Description |
|---|---|
| TCallback |
Remarks
Override this property in a derived class to supply a specific callback implementation. The value may be null if no callback data source is configured.
Screen
Gets or sets the current screen associated with a resize terrain operation.
Declaration
protected virtual TScreen Screen { get; set; }
Property Value
| Type | Description |
|---|---|
| TScreen |
UserToolType
Type identifier for the user tool. Allows state machine to change states based on tool type instead of state index.
Declaration
public override int UserToolType { get; }
Property Value
| Type | Description |
|---|---|
| int |
Overrides
Methods
CancelResizing()
Cancels the current resizing operation and resets the tool to the default pointer mode.
Declaration
public virtual void CancelResizing()
Remarks
Use this method to abort an active resize action and return the state machine to its default interaction mode. This is typically called when the user cancels a drag or resize gesture.
CreateScreenCallback()
Creates and initializes a new instance of the screen callback object with the appropriate resize and cancel handlers.
Declaration
protected virtual TCallback CreateScreenCallback()
Returns
| Type | Description |
|---|---|
| TCallback | A new instance of |
Remarks
Override this method to customize the initialization of the screen callback object or to assign different handlers as needed.
GetCallbackDataSource()
Retrieves the current callback data source, creating it if it does not already exist.
Declaration
protected virtual TCallback GetCallbackDataSource()
Returns
| Type | Description |
|---|---|
| TCallback | The callback data source instance of type |
Remarks
This method ensures that the callback data source is initialized before returning it. Derived classes can override this method to customize the initialization or retrieval logic.
GetUIScreen()
Retrieves the current UI screen instance of type TScreen. If the screen does not
exist, a new instance is created and returned.
Declaration
protected virtual TScreen GetUIScreen()
Returns
| Type | Description |
|---|---|
| TScreen | The UI screen instance of type |
Remarks
Subclasses can override this method to customize how the UI screen is retrieved or created. The returned instance is cached for subsequent calls.
HideUIScreen()
Hides the currently associated UI screen if one is present.
Declaration
protected virtual void HideUIScreen()
Remarks
Override this method to customize the behavior when hiding the UI screen. This method does nothing if no screen is associated.
PrepareToRun()
Performs any necessary initialization or setup required before executing the main operation. Called by state machine once when state becomes active. If state is disabled and then enabled again, this method will be called again.
Declaration
public override void PrepareToRun()
Overrides
Remarks
Override this method to implement preparation logic specific to the derived class. This method should be called prior to running the core functionality to ensure all prerequisites are met.
PrepareToStop()
Performs any necessary actions to prepare the object for stopping or shutdown. Called when the state is about to be deactivated.
Declaration
public override void PrepareToStop()
Overrides
Remarks
Implementations should ensure that all resources are released and any ongoing operations are safely terminated before the object is stopped. This method is typically called prior to disposing or shutting down the object to ensure a clean transition.
ResizeTerrain(int2)
Resizes the terrain to the specified dimensions.
Declaration
public virtual void ResizeTerrain(int2 terrainSize)
Parameters
| Type | Name | Description |
|---|---|---|
| int2 | terrainSize | The new size of the terrain, represented as a two-dimensional vector. Both components must be positive integers. |
Remarks
After resizing, the active user tool is reset to the pointer tool. This method may affect the current state of the parent state machine if present.
ShowUIScreen()
Displays the associated UI screen and initializes its view data using the current callback data source.
Declaration
protected virtual void ShowUIScreen()
Remarks
Override this method to customize how the UI screen is shown or how its view data is set. This method retrieves the screen instance and callback data source before displaying the screen and updating its view data. Derived classes may provide additional logic or modify the initialization process.