C# Class TweakScale.TweakScale

Inheritance: PartModule, IPartCostModifier
Datei anzeigen Open project: Biotronic/TweakScale Class Usage Examples

Protected Properties

Property Type Description
ScaleFactors float[]
ScaleNodes int[]

Private Properties

Property Type Description
AutoScale void
ChainScale void
CheckForDuplicateTweakScale bool
CheckForInvalidCfg bool
GetRelativeScaling float?
MoveNode void
NodesBetween AttachNode>?.Tuple
OnTweakScaleChanged void
RescaleNode void
SetupFromConfig void
Update void
UpdateByWidth void
UpdateWindow void

Public Methods

Method Description
GetModuleCost ( float defaultCost ) : float
OnLoad ( ConfigNode node ) : void
OnSave ( ConfigNode node ) : void
OnStart ( StartState state ) : void

Protected Methods

Method Description
Setup ( ) : void

Sets up values from ScaleType, creates updaters, and sets up initial values.

Private Methods

Method Description
AutoScale ( TweakScale a, TweakScale b ) : void

Automatically scale part to match other part, if applicable.

ChainScale ( ) : void

Scale children with the part.

CheckForDuplicateTweakScale ( ) : bool

Checks if there is more than one TweakScale instance on this part.

CheckForInvalidCfg ( ) : bool

Checks if the config for this TweakScale instance is valid. If not, logs it and returns false.

GetRelativeScaling ( TweakScale a, TweakScale b ) : float?

Calculate the correct scale to use for scaling a part relative to another.

MoveNode ( AttachNode node, AttachNode baseNode, bool movePart, bool absolute ) : void

Moves node to reflect the new scale. If movePart is true, also moves attached parts.

NodesBetween ( Part a, Part b ) : AttachNode>?.Tuple

Find the Attachnode that fastens a to b and vice versa.

OnTweakScaleChanged ( ) : void

Scale has changed!

RescaleNode ( AttachNode node, AttachNode baseNode ) : void

Change the size of node to reflect the new size of the part it's attached to.

SetupFromConfig ( ScaleType scaleType ) : void

Loads settings from scaleType.

Update ( ) : void
UpdateByWidth ( bool moveParts, bool absolute ) : void

Updates properties that change linearly with scale.

UpdateWindow ( ) : void

Marks the right-click window as dirty (i.e. tells it to update).

Method Details

GetModuleCost() public method

public GetModuleCost ( float defaultCost ) : float
defaultCost float
return float

OnLoad() public method

public OnLoad ( ConfigNode node ) : void
node System.ConfigNode
return void

OnSave() public method

public OnSave ( ConfigNode node ) : void
node System.ConfigNode
return void

OnStart() public method

public OnStart ( StartState state ) : void
state StartState
return void

Setup() protected method

Sets up values from ScaleType, creates updaters, and sets up initial values.
protected Setup ( ) : void
return void

Property Details

ScaleFactors protected_oe property

The scale exponentValue array. If isFreeScale is false, the part may only be one of these scales.
protected float[] ScaleFactors
return float[]

ScaleNodes protected_oe property

The node scale array. If node scales are defined the nodes will be resized to these values.
protected int[] ScaleNodes
return int[]