Class SelectorElements
Utility class for creating elements in custom mapper types.
Access this via the Elements
property in the CustomSelector
subclass.
Namespace: Modding.Mapper
Assembly: Assembly-CSharp.dll
Syntax
public class SelectorElements
Methods
AddButton(Transform)
Adds button behaviour to an object. Adds a UIButton component and a BoxCollider if there is not already. The returned UIButton has a Click event that can be used.
Declaration
public UIButton AddButton(Transform t)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Transform | t | Object to add the button behviour to |
Returns
Type | Description |
---|---|
UIButton | The UIButton behaviour |
MakeBox(Vector3, Vector2, Material)
Creates a rectangle with rounded corners, using the specified material. Useful for making backgrounds for buttons or other elements.
Use this with materials that have a shader that respect the mask/stencil setup of the block mapper, to avoid elements showing outside the scrolling area. This includes all materials returned by the Materials property.
Declaration
public Transform MakeBox(Vector3 position, Vector2 size, Material material)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Vector3 | position | Position of the center of the box |
UnityEngine.Vector2 | size | Size of the box |
UnityEngine.Material | material | Material to use, see the Materials property |
Returns
Type | Description |
---|---|
UnityEngine.Transform | A reference to the created object |
MakeText(Vector3, String, Single)
Displays text at the given position.
Declaration
public DynamicText MakeText(Vector3 position, string content, float fontSize = 0.175F)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Vector3 | position | Where to display the text |
String | content | Initial text to display |
Single | fontSize | Text size |
Returns
Type | Description |
---|---|
DynamicText | A DynamicText object that can be used to modify the text. |
MakeTexture(Vector3, Vector2, ModTexture)
Displays a texture in the interface.
Declaration
public MeshRenderer MakeTexture(Vector3 position, Vector2 size, ModTexture texture)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Vector3 | position | Position of the center of the texture |
UnityEngine.Vector2 | size | Size of the texture in the interface |
ModTexture | texture | Texture to display |
Returns
Type | Description |
---|---|
UnityEngine.MeshRenderer | Renderer that renders the texture |
MakeTexture(Vector3, Vector2, Texture)
Displays a texture in the interface.
Declaration
public MeshRenderer MakeTexture(Vector3 position, Vector2 size, Texture texture)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Vector3 | position | Position of the center of the texture |
UnityEngine.Vector2 | size | Size of the texture in the interface |
UnityEngine.Texture | texture | Texture to display |
Returns
Type | Description |
---|---|
UnityEngine.MeshRenderer | Renderer that renders the texture |
ScaleOnMouse(Transform, Transform)
Adds ScaleOnMouseOver behaviour to an object. This will make the toScale object scale appropriately when the mouse hovers over or clicks on the hover object, making it behave like other buttons in the game.
Declaration
public void ScaleOnMouse(Transform hover, Transform toScale)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Transform | hover | |
UnityEngine.Transform | toScale |