Class ColorTool
A tool is a type of game mode that is currently active. Tools are split up into the PlayModeTool and BuildTools, the latter of which holds all tools that can be found in the build menu.
public class ColorTool : Tool
- Inheritance
-
ColorTool
- Inherited Members
- Extension Methods
Constructors
ColorTool()
public ColorTool()
Methods
Closed()
Called when this build tool is closed. By default, this method removes its elements from the ui.
public override void Closed()
ClosedByOverride()
Called when this build tool is opened after being closed temporarily by the RemoveTool becoming active when a player holds CTRL. By default, this method does nothing.
public override void ClosedByOverride()
GetMouseCursor()
Returns the CursorType that this tool should currently display. By default, Default is returned.
public override CursorType GetMouseCursor()
Returns
- CursorType
The cursor type
InitBuildModeUi(Panel, Panel)
Override this method to add custom content to the passed ui elements. By default, this method does nothing.
protected override void InitBuildModeUi(Panel content, Panel zoom)
Parameters
contentPanelThe main content panel. Add custom BuildModeButton(string, string, GenericCallback, DrawCallback, float, IEnumerable<TextureRegion>, string, IEnumerable<string>, float?) instances here.
zoomPanelThe zoom panel that contains ColorSelection(ColorSettings, Action<int, int>, Func<int, int, bool>, LnCategory) and object previews
SelectObject(object)
Selects the given object for color editing. By default, this object can be a Furniture or a Wall with an opening, but additional object types can be registered through the OnSelectObject and OnObjectSelected events.
public void SelectObject(object o)
Parameters
oobjectThe object to select.
Exceptions
- ArgumentOutOfRangeException
Thrown if the object type is not properly handled.
ShouldHighlightSelectedObject(object)
Whether or not the selected object should currently have a white highlight around it. This method defaults to return true if IsCursorOnUi() is false.
public override bool ShouldHighlightSelectedObject(object obj)
Parameters
Returns
- bool
Whether or not the selected object should be highlighted
Update(GameTime, bool)
This method is called every update frame for the CurrentTool. By default, this method updates the MousePos and invokes OnUpdate, and also manages the UndoRedoStack.
public override void Update(GameTime time, bool cursorOnUi)
Parameters
timeGameTimeThe game's time
cursorOnUiboolWhether the cursor is currently covering the ui.
Events
OnObjectSelected
An event that is invoked in SelectObject(object) when an object of an unknown type is selected for color editing. For custom object types, all reference parameters should be set to the appropriate values for drawing the preview, applying colors, and setting the price.
public static event ColorTool.ObjectSelectedDelegate OnObjectSelected
Event Type
OnSelectObject
An event that is invoked in Update(GameTime, bool) when a player attempts to select an object for color editing.
If a valid custom object is to be selected, the SelectObject(object) method should be called with the object to select as part of the event handler, and the success parameter should be set to true.
public static event ColorTool.SelectObjectDelegate OnSelectObject