Adventure Creator  1.79.1
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2022
AC.UISlot Class Reference

Public Member Functions

 UISlot ()
 
 UISlot (UISlot uiSlot)
 
void LinkedUiGUI (int i, MenuSource source)
 
RectTransform GetRectTransform ()
 Gets the boundary of the UI Button. More...
 
void LinkUIElements (Canvas canvas, LinkUIGraphic linkUIGraphic, Texture2D emptySlotTexture=null)
 Links the UI GameObjects to the class, based on the supplied uiButtonID. More...
 
void SetText (string _text)
 Sets the text of the UI Button. More...
 
void SetImage (Texture _texture)
 Sets the image of the UI Button using a Texture. More...
 
void SetImageAsSprite (Sprite _sprite)
 Sets the image of the UI Button using a Sprite. More...
 
void ShowUIElement (UIHideStyle uiHideStyle)
 Enables the visibility of the linked UI Button. More...
 
void ShowUIElement (UISelectableHideStyle uiHideStyle)
 
bool HideUIElement (UIHideStyle uiHideStyle)
 Disables the visibility of the linked UI Button. More...
 
bool HideUIElement (UISelectableHideStyle uiHideStyle)
 Disables the visibility of the linked UI Button. More...
 
void AddClickHandler (AC.Menu _menu, MenuElement _element, int _slot)
 Adds a UISlotClick component to the Button, which acts as a click-handler. More...
 
void SetColours (Color newNormalColour, Color newHighlightedColour)
 Changes the colours of the linked UI Button. More...
 
void RestoreColour ()
 Reverts the 'normal' colour of the linked UI Button, if it was changed using SetColour. More...
 

Public Attributes

UnityEngine.UI.Button uiButton
 
int uiButtonID
 
UnityEngine.Sprite sprite
 

Properties

bool CanOverrideHotspotLabel [get]
 
bool CanSetOriginalImage [get, set]
 

Detailed Description

A data container that links a Unity UI Button to AC's own Menu system.

Constructor & Destructor Documentation

◆ UISlot() [1/2]

AC.UISlot.UISlot ( )

The default Constructor.

◆ UISlot() [2/2]

AC.UISlot.UISlot ( UISlot  uiSlot)

A Constructor that gets its values by copying another

Member Function Documentation

◆ AddClickHandler()

void AC.UISlot.AddClickHandler ( AC.Menu  _menu,
MenuElement  _element,
int  _slot 
)

Adds a UISlotClick component to the Button, which acts as a click-handler.

Parameters
_menuThe Menu that the Button is linked to
_elementThe MenuElement within _menu that the Button is linked to
_slotThe index number of the slot within _element that the Button is linked to

◆ GetRectTransform()

RectTransform AC.UISlot.GetRectTransform ( )

Gets the boundary of the UI Button.

Returns
The boundary Rect of the UI Button

◆ HideUIElement() [1/2]

bool AC.UISlot.HideUIElement ( UIHideStyle  uiHideStyle)

Disables the visibility of the linked UI Button.

Parameters
uiHideStyleThe method by which the UI element is hidden (DisableObject, ClearContent)
Returns
True if the object being hidden is the EventSystem's currently-selected object

◆ HideUIElement() [2/2]

bool AC.UISlot.HideUIElement ( UISelectableHideStyle  uiHideStyle)

Disables the visibility of the linked UI Button.

Parameters
uiHideStyleThe method by which the UI element is hidden (DisableObject, DisableInteractability)
Returns
True if the object being hidden is the EventSystem's currently-selected object

◆ LinkUIElements()

void AC.UISlot.LinkUIElements ( Canvas  canvas,
LinkUIGraphic  linkUIGraphic,
Texture2D  emptySlotTexture = null 
)

Links the UI GameObjects to the class, based on the supplied uiButtonID.

Parameters
canvasThe Canvas that contains the UI GameObjects
linkUIGraphicWhat Image component the Element's Graphics should be linked to (ImageComponent, ButtonTargetGraphic)
emptySlotTextureIf set, the texture to use when a slot is considered empty

◆ RestoreColour()

void AC.UISlot.RestoreColour ( )

Reverts the 'normal' colour of the linked UI Button, if it was changed using SetColour.

◆ SetColours()

void AC.UISlot.SetColours ( Color  newNormalColour,
Color  newHighlightedColour 
)

Changes the colours of the linked UI Button.

Parameters
newNormalColourThe new 'normal' colour to set
  • Parameters
    newHighlightedColourThe new 'highlighted' colour to set

◆ SetImage()

void AC.UISlot.SetImage ( Texture  _texture)

Sets the image of the UI Button using a Texture.

Parameters
_textureThe texture to assign the Button

◆ SetImageAsSprite()

void AC.UISlot.SetImageAsSprite ( Sprite  _sprite)

Sets the image of the UI Button using a Sprite.

Parameters
_spriteThe sprite to assign the Button

◆ SetText()

void AC.UISlot.SetText ( string  _text)

Sets the text of the UI Button.

Parameters
_textThe text to assign the Button

◆ ShowUIElement()

void AC.UISlot.ShowUIElement ( UIHideStyle  uiHideStyle)

Enables the visibility of the linked UI Button.

Parameters
uiHideStyleThe method by which the UI element is hidden (DisableObject, ClearContent)

Member Data Documentation

◆ sprite

UnityEngine.Sprite AC.UISlot.sprite

The sprite to set in the Button's Image

◆ uiButton

UnityEngine.UI.Button AC.UISlot.uiButton

The Unity UI Button this is linked to

◆ uiButtonID

int AC.UISlot.uiButtonID

The ConstantID number of the linked Unity UI Button

Property Documentation

◆ CanOverrideHotspotLabel

bool AC.UISlot.CanOverrideHotspotLabel
get

Checks if the associated UI components can set a Hotspot label when selected