ManipulationService2D
AUTO-GENERATED FILE – DO NOT EDIT MANUALLY
This page documents the supported public API surface only. Private, internal, benchmark, test, and implementation-detail types are intentionally omitted.
Declaration
Summary
Core service for manipulation-related business logic and state management. Follows Enhanced Service Registry pattern with dependency injection. Handles object manipulation operations like move, rotate, scale, and complex transformations.
OBSOLETE: This service is replaced by modern ECS manipulation systems. Use ManipulationSystem and related ECS systems for new development.
Metadata
Namespace: GridPlacement.Core.Services.Manipulation
Source File: cs/Core/Services/Manipulation/ManipulationService2D.cs
Assembly: GridPlacement.Core
Type: class
Implements
IDisposableIManipulationServiceIService
Constructors
ManipulationService2D
Initializes a new instance of the ManipulationService2D.
Methods
StartManipulation
Starts a new manipulation for the given mode and origin.
Parameters
| Name | Description |
|---|---|
mode | The manipulation mode to start. |
origin | The origin cell where the manipulation begins. |
Returns
The created manipulation state.
Remarks
This method validates the input parameters and checks for existing manipulations at the same origin. If successful, it creates a new ManipulationState and registers it with the service.
UpdateManipulationTarget
Updates the target cell for an active manipulation.
Parameters
| Name | Description |
|---|---|
manipulationId | The ID of the manipulation to update. |
target | The new target cell. |
Returns
True if the target was updated and the manipulation is still valid; otherwise false.
Remarks
This method checks if the manipulation is active and not completed, and then updates the target cell. It also validates the manipulation after updating the target.
CancelManipulation
Cancels an active manipulation.
Parameters
| Name | Description |
|---|---|
manipulationId | The ID of the manipulation to cancel. |
Returns
True if the manipulation was cancelled; otherwise false.
Remarks
This method checks if the manipulation is active and not completed, and then cancels it.
CompleteManipulation
Completes an active manipulation after final validation.
Parameters
| Name | Description |
|---|---|
manipulationId | The ID of the manipulation to complete. |
Returns
True if completion succeeded; otherwise false.
Remarks
This method checks if the manipulation is active and not completed, and then completes it. It also validates the manipulation before completing it.
AddConstraint
Adds a constraint to an existing manipulation.
Parameters
| Name | Description |
|---|---|
manipulationId | The ID of the manipulation. |
constraint | The constraint to add. |
Returns
True if the constraint was added; otherwise false.
Remarks
This method checks if the manipulation exists and the constraint is not null.
RemoveConstraint
Removes a constraint from an existing manipulation.
Parameters
| Name | Description |
|---|---|
manipulationId | The ID of the manipulation. |
constraintId | The ID of the constraint to remove. |
Returns
True if the constraint was removed; otherwise false.
Remarks
This method checks if the manipulation exists and the constraint is found.
AddAction
Adds an action definition to an existing manipulation.
Parameters
| Name | Description |
|---|---|
manipulationId | The ID of the manipulation. |
action | The action definition to add. |
Returns
True if the action was added; otherwise false.
Remarks
This method checks if the manipulation exists and the action is not null.
RemoveAction
Removes an action definition from an existing manipulation.
Parameters
| Name | Description |
|---|---|
manipulationId | The ID of the manipulation. |
actionId | The action identifier to remove. |
Returns
True if the action was removed; otherwise false.
Remarks
This method checks if the manipulation exists and the action is found.
SetContextData
Sets arbitrary context data on a manipulation state.
Parameters
| Name | Description |
|---|---|
manipulationId | The ID of the manipulation. |
key | The context key. |
value | The context value. |
Returns
True if the data was set; otherwise false.
Remarks
This method checks if the manipulation exists.
GetContextData
Gets typed context data from a manipulation state.
Type Parameters
| Name | Description |
|---|---|
T | The expected value type. |
Parameters
| Name | Description |
|---|---|
manipulationId | The ID of the manipulation. |
key | The context key. |
defaultValue | The fallback value when the key is missing or the manipulation does not exist. |
Returns
The stored value, or defaultValue.
Remarks
This method checks if the manipulation exists.
ApplyPreviewIntent
GetPreviewTransform
GetManipulation
Gets the manipulation state by ID.
Parameters
| Name | Description |
|---|---|
manipulationId | The manipulation identifier. |
Returns
The manipulation state if found; otherwise null.
GetActiveManipulations
Gets all manipulations that are currently active and not completed.
Returns
An enumerable of active manipulations.
GetManipulationsByMode
Gets all manipulations currently in the specified mode.
Parameters
| Name | Description |
|---|---|
mode | The mode to filter by. |
Returns
An enumerable of manipulations matching the given mode.
IsManipulationActive
Determines whether the specified manipulation is active and not completed.
Parameters
| Name | Description |
|---|---|
manipulationId | The manipulation identifier. |
Returns
True if active; otherwise false.
CanStartManipulation
Determines whether a new manipulation can be started at the given origin.
Parameters
| Name | Description |
|---|---|
mode | The requested mode. |
origin | The requested origin cell. |
Returns
True if a manipulation may be started; otherwise false.
ValidateManipulation
Validates the manipulation state and its constraints/actions.
Parameters
| Name | Description |
|---|---|
manipulationId | The manipulation identifier. |
Returns
True if the manipulation is valid; otherwise false.
ValidateManipulationState
Produces a list of validation errors for the provided manipulation.
Parameters
| Name | Description |
|---|---|
manipulation | The manipulation to validate. |
Returns
A list of validation error messages (empty when valid).
RegisterManipulation
Registers a manipulation in the service’s internal state store.
Parameters
| Name | Description |
|---|---|
manipulation | The manipulation state to register. |
UnregisterManipulation
Unregisters a manipulation by ID.
Parameters
| Name | Description |
|---|---|
manipulationId | The manipulation identifier. |
ClearAllManipulations
Clears all registered manipulations.
Dispose
Releases all resources used by the ManipulationService2D.
Events
ManipulationStarted
Raised when a manipulation is started and the new ManipulationState is registered.
Remarks
Event handlers can inspect the ManipulationStartedEvent to get details about the started manipulation.
ManipulationUpdated
Raised when an active manipulation updates its target.
Remarks
Event handlers can inspect the ManipulationUpdatedEvent to get details about the updated manipulation.
ManipulationCompleted
Raised when a manipulation successfully completes.
Remarks
Event handlers can inspect the ManipulationCompletedEvent to get details about the completed manipulation.
ManipulationCancelled
Raised when an active manipulation is cancelled.
Remarks
Event handlers can inspect the ManipulationCancelledEvent to get details about the cancelled manipulation.
ManipulationFailed
Raised when manipulation validation fails during update or completion.
Remarks
Event handlers can inspect the ManipulationFailedEvent to get details about the failed manipulation.