Hex Terrains Framework
Search Results for

    Show / Hide Table of Contents

    Class BrushUserToolState<TBrushTarget, TSettings, TSettingsScreen, TTerrainLayer>

    base clas for UserTool state that works with brush and TerrainLayersList component on the terrain entity. Provides an API for getting terrain layer by index or name or index and name combined.

    Inheritance
    object
    SmState
    UserToolStateBase
    HexTerrainUserToolStateBase
    BrushUserToolState<TBrushTarget>
    BrushUserToolState<TBrushTarget, TSettings>
    BrushUserToolState<TBrushTarget, TSettings, TSettingsScreen>
    BrushUserToolState<TBrushTarget, TSettings, TSettingsScreen, TTerrainLayer>
    DataLayerBrushUserToolState<TBrushTarget, TSettings, TSettingsScreen, TTerrainLayer, TDataLayer, TDataLayerValue>
    AutoPaintSurfaceUserToolStateBase<TBrushTarget, TTerrainLayer>
    PaintCellItemUserToolStateBase<TBrushTarget, TTerrainLayer, TChunkMeshLayerGroup, TChunkMeshLayer>
    SunSettingsUserToolState
    PaintCellMineralsUserToolState
    PaintRegionsUserToolStateBase<TBrushTarget, TTerrainLayer, THexSurfacesList, THexSurface>
    PaintSurfaceTransparencyUserToolStateBase<TBrushTarget, TTerrainLayer>
    SetChunkMeshVisibilityUserToolState
    StampUserToolStateBase<TBrushTarget, TTerrainLayer, TCellData>
    Implements
    ISmState
    Inherited Members
    BrushUserToolState<TBrushTarget, TSettings, TSettingsScreen>.SettingsScreen
    BrushUserToolState<TBrushTarget, TSettings, TSettingsScreen>.PrepareToRun()
    BrushUserToolState<TBrushTarget, TSettings, TSettingsScreen>.PrepareToStop()
    BrushUserToolState<TBrushTarget, TSettings, TSettingsScreen>.GetSettingsScreen()
    BrushUserToolState<TBrushTarget, TSettings, TSettingsScreen>.UpdateSettingsScreen()
    BrushUserToolState<TBrushTarget, TSettings>.DataSource
    BrushUserToolState<TBrushTarget, TSettings>.SettingsPlayerPrefsKeyName
    BrushUserToolState<TBrushTarget, TSettings>.PrepareToRun()
    BrushUserToolState<TBrushTarget, TSettings>.InitSettings()
    BrushUserToolState<TBrushTarget, TSettings>.InitDefaultSettings()
    BrushUserToolState<TBrushTarget, TSettings>.PrepareToStop()
    BrushUserToolState<TBrushTarget, TSettings>.LoadSettings()
    BrushUserToolState<TBrushTarget, TSettings>.SaveSettings()
    BrushUserToolState<TBrushTarget, TSettings>.SaveSettingsValue<TValue>(string, TValue)
    BrushUserToolState<TBrushTarget, TSettings>.LoadSettingsValue<TValue>(string, TValue)
    BrushUserToolState<TBrushTarget, TSettings>.TryLoadSettingsValue<TValue>(string, out TValue)
    BrushUserToolState<TBrushTarget, TSettings>.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>.PrepareToRun()
    BrushUserToolState<TBrushTarget>.PrepareToStop()
    BrushUserToolState<TBrushTarget>.Tick()
    BrushUserToolState<TBrushTarget>.UpdateBrush()
    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>.ApplyBrush(int, int2, int, 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.SetViewMode(SetViewModeRequest)
    HexTerrainUserToolStateBase.TryRestoreViewMode()
    UserToolStateBase.Settings
    UserToolStateBase.Parent
    UserToolStateBase.ParentStateMachine
    UserToolStateBase.UserToolType
    UserToolStateBase.Init(UserToolStateSettings)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Fwt.HexTerrains.UserTools.SM
    Assembly: fwt.hexterrains.dll
    Syntax
    public abstract class BrushUserToolState<TBrushTarget, TSettings, TSettingsScreen, TTerrainLayer> : BrushUserToolState<TBrushTarget, TSettings, TSettingsScreen>, ISmState where TBrushTarget : HexTerrainLayerGroup where TSettingsScreen : ToolSettingsScreen<TSettings> where TTerrainLayer : HexTerrainLayer
    Type Parameters
    Name Description
    TBrushTarget

    Terrain layer component (from terrain entity) this user tool works with

    TSettings

    Type of user tool settings (values that user can change like CellItemIndex, RegionIndex, etc.)

    TSettingsScreen

    Type of the UI screen used to display the settings for user, so user can change settings

    TTerrainLayer

    Type of the terrain layer to get from the terrain layer component (which is terrain layers list). Set this param to HexTerrainLayerBase if you don't want to filter the terrain layers.

    Constructors

    BrushUserToolState(ISmState)

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

    Properties

    IsGetLayerByIndex

    If true, gets terrain layer by index specified in TerrainLayerIndex property.

    Declaration
    public virtual bool IsGetLayerByIndex { get; set; }
    Property Value
    Type Description
    bool

    IsGetLayerByName

    If true, gets terrain layer by name specified in TerrainLayerName property.

    Declaration
    public virtual bool IsGetLayerByName { get; set; }
    Property Value
    Type Description
    bool

    TerrainLayerIndex

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

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

    TerrainLayerName

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

    Declaration
    public virtual string TerrainLayerName { get; set; }
    Property Value
    Type Description
    string

    ViewModeByLayerIndex

    List of view modes for each layer index. Index = layer index, value = view mode for that layer active.

    Declaration
    public virtual List<SetViewModeRequest> ViewModeByLayerIndex { get; set; }
    Property Value
    Type Description
    List<SetViewModeRequest>

    Methods

    GetTerrainLayer()

    Retrieves the terrain layer associated with the current brush target.

    Declaration
    public virtual TTerrainLayer GetTerrainLayer()
    Returns
    Type Description
    TTerrainLayer

    The terrain layer of type TTerrainLayer corresponding to the active brush target.

    GetTerrainLayer(TBrushTarget)

    Retrieves the terrain layer of type TTerrainLayer from the specified brush target

    Declaration
    public virtual TTerrainLayer GetTerrainLayer(TBrushTarget brushTarget)
    Parameters
    Type Name Description
    TBrushTarget brushTarget

    HexTerrainLayerGroup that contains the requested layer

    Returns
    Type Description
    TTerrainLayer

    GetTerrainLayer(TBrushTarget, int)

    Retrieves the terrain layer of type TTerrainLayer at the specified index from the given brush target.

    Declaration
    public virtual TTerrainLayer GetTerrainLayer(TBrushTarget brushTarget, int layerIndex)
    Parameters
    Type Name Description
    TBrushTarget brushTarget

    The brush target from which to retrieve the terrain layer. Cannot be null.

    int layerIndex

    The zero-based index of the terrain layer to retrieve.

    Returns
    Type Description
    TTerrainLayer

    The terrain layer of type TTerrainLayer at the specified index, or the default value of TTerrainLayer if brushTarget is null.

    GetTerrainLayer(TBrushTarget, int, string)

    Retrieves a terrain layer from the specified brush target by index and name.

    Declaration
    public virtual TTerrainLayer GetTerrainLayer(TBrushTarget brushTarget, int layerIndex, string layerName)
    Parameters
    Type Name Description
    TBrushTarget brushTarget

    The brush target from which to retrieve the terrain layer. If null, the method returns the default value for TTerrainLayer.

    int layerIndex

    The zero-based index of the terrain layer to retrieve.

    string layerName

    The name of the terrain layer to retrieve. Used to identify the layer within the brush target.

    Returns
    Type Description
    TTerrainLayer

    The terrain layer of type TTerrainLayer matching the specified index and name, or the default value for TTerrainLayer if brushTarget is null or the layer is not found.

    GetTerrainLayer(TBrushTarget, string)

    Retrieves the terrain layer with the specified name from the given brush target.

    Declaration
    public virtual TTerrainLayer GetTerrainLayer(TBrushTarget brushTarget, string layerName)
    Parameters
    Type Name Description
    TBrushTarget brushTarget

    The brush target from which to retrieve the terrain layer. If null, the method returns the default value for the terrain layer type.

    string layerName

    The name of the terrain layer to retrieve. This value is case-sensitive.

    Returns
    Type Description
    TTerrainLayer

    The terrain layer of type TTerrainLayer with the specified name, or the default value for TTerrainLayer if the brush target is null or the layer does not exist.

    GetViewModeByLayerIndex(int)

    Retrieves the view mode associated with the specified terrain layer index.

    Declaration
    protected virtual SetViewModeRequest GetViewModeByLayerIndex(int terrainLayerIndex)
    Parameters
    Type Name Description
    int terrainLayerIndex

    The zero-based index of the terrain layer for which to obtain the view mode. Must be within the bounds of the available terrain layers.

    Returns
    Type Description
    SetViewModeRequest

    An integer representing the view mode for the specified terrain layer index. Returns the default view mode if the index is out of range or if no view modes are defined.

    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)

    OnTerrainLayerChanged()

    Invoked when the terrain layer changes to update the view mode accordingly.

    Declaration
    protected virtual void OnTerrainLayerChanged()
    Remarks

    Derived classes can override this method to implement custom behavior when the terrain layer changes. This method is called automatically and should not be invoked directly.

    TrySetViewMode()

    Attempts to update the view mode based on the current terrain layer index if a view mode change is requested.

    Declaration
    protected override void TrySetViewMode()
    Overrides
    HexTerrainUserToolStateBase.TrySetViewMode()
    Remarks

    This method checks whether a view mode change is enabled in the user tool settings before updating the view mode. Override this method to customize how view mode changes are handled in derived classes.

    UpdateDescriptionAndErrorMessageOnDataSource()

    Updates the description and error message properties on the associated data source to reflect the current terrain layer state.

    Declaration
    protected virtual void UpdateDescriptionAndErrorMessageOnDataSource()
    Remarks

    If the data source implements IErrorAndDescriptionUserToolSettingsDataSource, this method sets the error message to indicate when no terrain layer is found at the specified index, or updates the description with the terrain layer's name when available. If the data source also implements ICommitChanges, changes are committed after updating the properties. Override this method to customize how description and error message updates are handled for different data source types.

    UpdateSettingsScreen()

    Refreshes the settings screen to reflect the current state of the data source.

    Declaration
    public override void UpdateSettingsScreen()
    Overrides
    BrushUserToolState<TBrushTarget, TSettings, TSettingsScreen>.UpdateSettingsScreen()
    Remarks

    If the data source implements ICommitChanges, any pending changes are committed before the settings screen is updated. This ensures that the settings screen displays the most up-to-date information.

    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