Hex Terrains Framework
Search Results for

    Show / Hide Table of Contents

    Class StampUserToolStateBase<TBrushTarget, TCellData>

    Provides a base class for user tool states that support stamping operations on terrain or grid-based targets, allowing users to read and apply cell data using configurable origin coordinates and input keys. Stamping means copying data from a specified origin cell to other cells based on brush operations.

    Inheritance
    object
    SmState
    UserToolStateBase
    HexTerrainUserToolStateBase
    BrushUserToolState<TBrushTarget>
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource>
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen>
    StampUserToolStateBase<TBrushTarget, TCellData>
    Implements
    ISmState
    Inherited Members
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen>.SettingsScreen
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen>.PrepareToRun()
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen>.PrepareToStop()
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen>.GetSettingsScreen()
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen>.UpdateSettingsScreen()
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource>.DataSource
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource>.SettingsPlayerPrefsKeyName
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource>.PrepareToRun()
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource>.InitSettings()
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource>.InitDefaultSettings()
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource>.PrepareToStop()
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource>.LoadSettings()
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource>.SaveSettings()
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource>.SaveSettingsValue<TValue>(string, TValue)
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource>.LoadSettingsValue<TValue>(string, TValue)
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource>.TryLoadSettingsValue<TValue>(string, out TValue)
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource>.LoadSettingsValueOrDefault<TValue>(string, TValue)
    BrushUserToolState<TBrushTarget>.PrevChangeTimeStamp
    BrushUserToolState<TBrushTarget>.TimeTreshold
    BrushUserToolState<TBrushTarget>.CanChangeBrushSize
    BrushUserToolState<TBrushTarget>.AllowRightMouseButton
    BrushUserToolState<TBrushTarget>.CursorColor
    BrushUserToolState<TBrushTarget>.ChangeModeKey
    BrushUserToolState<TBrushTarget>.ChangeBrushSizeKey
    BrushUserToolState<TBrushTarget>.ChangeOpacityKey
    BrushUserToolState<TBrushTarget>.IncreaseBrushSizeKey
    BrushUserToolState<TBrushTarget>.IncreaseBrushSizeKey2
    BrushUserToolState<TBrushTarget>.DecreaseBrushSizeKey
    BrushUserToolState<TBrushTarget>.DecreaseBrushSizeKey2
    BrushUserToolState<TBrushTarget>.IsTimeTresholdPassed
    BrushUserToolState<TBrushTarget>.BrushSize
    BrushUserToolState<TBrushTarget>.BrushOpacity
    BrushUserToolState<TBrushTarget>.ChangeOpacityMultiplier
    BrushUserToolState<TBrushTarget>.SetNewTimestamp()
    BrushUserToolState<TBrushTarget>.PrepareToStop()
    BrushUserToolState<TBrushTarget>.Tick()
    BrushUserToolState<TBrushTarget>.TryApplyBrush()
    BrushUserToolState<TBrushTarget>.ApplyToSingleCell(int, int2, int, TBrushTarget, int)
    BrushUserToolState<TBrushTarget>.ApplyBrushToAllCells(int, HexTerrainSettings, TBrushTarget, int)
    BrushUserToolState<TBrushTarget>.ApplyBrushToAllBrushPoints(int, int2, int, HexTerrainSettings, TBrushTarget, int)
    BrushUserToolState<TBrushTarget>.CanBeAppliedToManyPoints(int)
    BrushUserToolState<TBrushTarget>.IsAppliedToEveryCellOnMap(int)
    BrushUserToolState<TBrushTarget>.GetBrushTarget()
    HexTerrainUserToolStateBase.TerrainAPI
    HexTerrainUserToolStateBase.HexTerrainUserToolSettings
    HexTerrainUserToolStateBase.PreviousViewMode
    HexTerrainUserToolStateBase.Init(HexTerrainUserToolStateSettings)
    HexTerrainUserToolStateBase.Init(IHexTerrainAPI)
    HexTerrainUserToolStateBase.Init<TInitArgs>(IHexTerrainAPI, TInitArgs)
    HexTerrainUserToolStateBase.ShowSettingsScreen<TViewData, TScreen>(TViewData)
    HexTerrainUserToolStateBase.GetUIScreen<TScreen>()
    HexTerrainUserToolStateBase.HideSettingsScreen<TScreen>()
    HexTerrainUserToolStateBase.SetupTerrainCursor(bool, int)
    HexTerrainUserToolStateBase.SetupTerrainCursor(bool, int, Color32)
    HexTerrainUserToolStateBase.SetupTerrainCursor(bool, int, Color32, bool)
    HexTerrainUserToolStateBase.SetupTerrainCursor(bool)
    HexTerrainUserToolStateBase.GetTerrainLayer<TLayerGroup, TLayer>(HexTerrainLayerReference)
    HexTerrainUserToolStateBase.TrySetViewMode()
    HexTerrainUserToolStateBase.SetViewMode(SetViewModeRequest)
    HexTerrainUserToolStateBase.TryRestoreViewMode()
    UserToolStateBase.Settings
    UserToolStateBase.Parent
    UserToolStateBase.ParentStateMachine
    UserToolStateBase.UserToolType
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Fwt.HexTerrains.UserTools.SM.States
    Assembly: fwt.hexterrains.dll
    Syntax
    public abstract class StampUserToolStateBase<TBrushTarget, TCellData> : BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen>, ISmState where TBrushTarget : class
    Type Parameters
    Name Description
    TBrushTarget

    The type of the brush target that the stamping operations will be applied to. Must be a reference type.

    TCellData

    The type of cell data that is read from the origin cell and applied to the target.

    Remarks

    This class manages the origin coordinates for stamping operations and supports reading cell data from a specified origin cell using a configurable key. It is intended to be subclassed to implement specific logic for reading and applying cell data. The origin coordinates are clamped between 0 and 255 by default. The class integrates with terrain APIs to determine cell indices and coordinates, and provides overridable methods for customizing cell data handling.

    Constructors

    StampUserToolStateBase(ISmState)

    Declaration
    protected StampUserToolStateBase(ISmState parent)
    Parameters
    Type Name Description
    ISmState parent

    Properties

    OriginCellIndex

    The index of the origin cell based on the origin coordinates.

    Declaration
    public virtual int? OriginCellIndex { get; }
    Property Value
    Type Description
    int?

    OriginCoordinate

    The origin coordinate as an int2 structure.

    Declaration
    public virtual int2 OriginCoordinate { get; set; }
    Property Value
    Type Description
    int2

    OriginXCoord

    The X-coordinate of the origin point.

    Declaration
    public virtual int OriginXCoord { get; set; }
    Property Value
    Type Description
    int

    OriginYCoord

    The Y-coordinate of the origin point in the data source.

    Declaration
    public virtual int OriginYCoord { get; set; }
    Property Value
    Type Description
    int

    ReadCellKey

    When this key is pressed, the tool changes the origin cell to the cell under the cursor.

    Declaration
    public virtual KeyCode ReadCellKey { get; set; }
    Property Value
    Type Description
    KeyCode

    StartPaintCellCoord

    The starting cell coordinate when painting begins.

    Declaration
    protected virtual int2? StartPaintCellCoord { get; set; }
    Property Value
    Type Description
    int2?

    Methods

    ApplyBrush(int, int2, int, TBrushTarget, int)

    Applies brush to the brushView. Returns true if changes were applied

    Declaration
    public override bool ApplyBrush(int brushMode, int2 cellCoord, int cellIndex, TBrushTarget brushTarget, int mouseButton)
    Parameters
    Type Name Description
    int brushMode
    int2 cellCoord
    int cellIndex
    TBrushTarget brushTarget
    int mouseButton
    Returns
    Type Description
    bool
    Overrides
    BrushUserToolState<TBrushTarget>.ApplyBrush(int, int2, int, TBrushTarget, int)

    Init(UserToolStateSettings)

    Initializes the tool state with the specified settings.

    Declaration
    public override void Init(UserToolStateSettings settings)
    Parameters
    Type Name Description
    UserToolStateSettings settings

    The settings to apply to the tool state. Cannot be null.

    Overrides
    UserToolStateBase.Init(UserToolStateSettings)

    InitDefaultSettings()

    Initializes the default settings for the current instance. This method is intended to be overridden in derived classes to configure initial values or options as needed.

    Declaration
    protected override void InitDefaultSettings()
    Overrides
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource>.InitDefaultSettings()
    Remarks

    Override this method in a subclass to provide custom initialization logic for default settings. The base implementation does not perform any actions.

    Init<TInitArgs>(TInitArgs)

    Initializes the tool using the specified initialization arguments.

    Declaration
    public override void Init<TInitArgs>(TInitArgs args)
    Parameters
    Type Name Description
    TInitArgs args

    The initialization arguments used to configure the tool. If the argument implements IUserToolStateConfig, its ToolSettings are used; otherwise, default settings are applied.

    Type Parameters
    Name Description
    TInitArgs

    The type of the initialization arguments used to configure the tool. If the type implements IUserToolStateConfig, its ToolSettings will be used; otherwise, default settings are applied.

    Overrides
    BrushUserToolState<TBrushTarget>.Init<TInitArgs>(TInitArgs)

    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
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen>.PrepareToRun()
    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.

    ReadOriginCellData(int, out TCellData)

    Attempts to read the original data for the specified cell index.

    Declaration
    public abstract bool ReadOriginCellData(int cellIndex, out TCellData cellData)
    Parameters
    Type Name Description
    int cellIndex

    The zero-based index of the cell whose data is to be read. Must be within the valid range of available cells.

    TCellData cellData

    When this method returns, contains the data of the cell at the specified index if the read operation succeeds; otherwise, contains the default value for TCellData.

    Returns
    Type Description
    bool

    true if the cell data was successfully read; otherwise, false.

    SetCellDataToTarget(int, TCellData)

    Sets the data for the specified cell in the target object.

    Declaration
    public abstract bool SetCellDataToTarget(int cellIndex, TCellData cellData)
    Parameters
    Type Name Description
    int cellIndex

    The zero-based index of the cell to update. Must be within the valid range of cell indices for the target.

    TCellData cellData

    The data to assign to the specified cell. The type and constraints of this value depend on the implementation.

    Returns
    Type Description
    bool

    true if the cell data was successfully set; otherwise, false.

    UpdateBrush()

    Updates the terrain brush's appearance and behavior based on the current input state and configuration. This includes setting brush visibility, color, size, and opacity according to user interactions and allowed changes.

    Declaration
    protected override void UpdateBrush()
    Overrides
    BrushUserToolState<TBrushTarget>.UpdateBrush()
    Remarks

    This method responds to user input to adjust the brush size or opacity, depending on the active mode and configuration flags. It is typically called to synchronize the brush's properties with the user's actions in real time. Override this method to customize how brush updates are handled in derived classes.

    Implements

    ISmState

    Extension Methods

    HashExtensions.GetHashCode_RefType<TValue>(TValue, int)
    Extensions_UnityObject.SmartDestroy(object)
    Extensions_UnityObject.SmartGetComponent<TComponent>(object)
    Extensions_UnityObject.SmartGetGameGameObject(object)
    In this article
    Back to top Generated by DocFX