Hex Terrains Framework
Search Results for

    Show / Hide Table of Contents

    Class StampUserToolStateBase<TBrushTarget, TTerrainLayer, TCellData>

    Provides a base class for stamp-style terrain editing user tool states, enabling cell data to be read from an origin cell and applied to other cells within a hex terrain layer group.

    Inheritance
    object
    SmState
    UserToolStateBase
    HexTerrainUserToolStateBase
    BrushUserToolState<TBrushTarget>
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource>
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen>
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen, TTerrainLayer>
    StampUserToolStateBase<TBrushTarget, TTerrainLayer, TCellData>
    StampCellItemUserToolState<TBrushTarget, TTerrainLayer, TChunkMeshLayerGroup, TChunkMeshLayer>
    StampCellMineralsUserToolState
    StampDataLayerUserToolStateBase<TBrushTarget, TTerrainLayer, TDataLayer, TCellData>
    StampRegionsUserToolStateBase<TBrushTarget, TTerrainLayer>
    Implements
    ISmState
    Inherited Members
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen, TTerrainLayer>.IsGetLayerByIndex
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen, TTerrainLayer>.TerrainLayerIndex
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen, TTerrainLayer>.IsGetLayerByName
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen, TTerrainLayer>.TerrainLayerName
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen, TTerrainLayer>.ViewModeByLayerIndex
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen, TTerrainLayer>.Init<TInitArgs>(TInitArgs)
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen, TTerrainLayer>.UpdateSettingsScreen()
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen, TTerrainLayer>.OnTerrainLayerChanged()
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen, TTerrainLayer>.UpdateDescriptionAndErrorMessageOnDataSource()
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen, TTerrainLayer>.TrySetViewMode()
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen, TTerrainLayer>.GetViewModeByLayerIndex(int)
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen, TTerrainLayer>.GetTerrainLayer()
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen, TTerrainLayer>.GetTerrainLayer(TBrushTarget)
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen, TTerrainLayer>.GetTerrainLayer(TBrushTarget, int, string)
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen, TTerrainLayer>.GetTerrainLayer(TBrushTarget, int)
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen, TTerrainLayer>.GetTerrainLayer(TBrushTarget, string)
    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, TTerrainLayer, TCellData> : BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen, TTerrainLayer>, ISmState where TBrushTarget : HexTerrainLayerGroup where TTerrainLayer : HexTerrainLayer
    Type Parameters
    Name Description
    TBrushTarget

    The type of the terrain layer group that the brush operates on. Must be a HexTerrainLayerGroup.

    TTerrainLayer

    The type of terrain layer being edited. Must be a HexTerrainLayer.

    TCellData

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

    Remarks

    This class manages the origin cell coordinates and index, and facilitates reading and applying cell data between terrain layers. It supports configuration of the key used to read cell data and provides mechanisms for saving and loading tool settings. Derived classes must implement logic for reading cell data from the origin and applying it to the target cell. Thread safety is not guaranteed.

    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?

    TerrainLayerIndex

    If IsGetLayerByIndex is true, this index is used to get terrain layer from terrain layers list."/>

    Declaration
    public override int TerrainLayerIndex { get; set; }
    Property Value
    Type Description
    int
    Overrides
    BrushUserToolState<TBrushTarget, UserToolSettingsDataSource, UniversalToolSettingsScreen, TTerrainLayer>.TerrainLayerIndex

    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, UserToolSettingsDataSource, UniversalToolSettingsScreen, TTerrainLayer>.Init<TInitArgs>(TInitArgs)

    LoadSettings()

    Loads configuration settings for the current instance. Derived classes override this method to implement custom settings initialization.

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

    Override this method in a subclass to provide specific logic for loading or initializing settings. This method is called during the setup or initialization phase and does not perform any actions in the base implementation.

    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(TTerrainLayer, int, out TCellData)

    Attempts to read the original cell data for the specified terrain layer and cell index.

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

    The terrain layer from which to retrieve cell data. Cannot be null.

    int cellIndex

    The zero-based index of the cell within the terrain layer whose data is to be read. Must be within the valid range of cell indices for the specified layer.

    TCellData cellData

    When this method returns, contains the cell data associated with the specified cell index if the operation succeeds; otherwise, contains the default value for the cell data type.

    Returns
    Type Description
    bool

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

    SaveSettings()

    Saves the current settings to the underlying storage or configuration source.

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

    Override this method in a derived class to implement custom logic for persisting settings. This method does not perform any action in the base implementation.

    SetCellDataToTarget(TTerrainLayer, int, TCellData)

    Attempts to set the specified cell data on the target terrain layer at the given cell index.

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

    The terrain layer on which to set the cell data. Cannot be null.

    int cellIndex

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

    TCellData cellData

    The cell data to assign to the specified cell. Cannot be null.

    Returns
    Type Description
    bool

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

    Remarks

    This method does not modify the terrain layer if the cell index is out of range or if the cell data is invalid. Implementations may impose additional constraints on valid cell data or indices.

    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