C# Class RAGENativeUI.UIMenu

Base class for RAGENativeUI. Calls the next events: OnIndexChange, OnListChanged, OnCheckboxChange, OnItemSelect, OnMenuClose, OnMenuchange.
Datei anzeigen Open project: alexguirre/RAGENativeUI Class Usage Examples

Public Properties

Property Type Description
AUDIO_BACK string
AUDIO_ERROR string
AUDIO_LEFTRIGHT string
AUDIO_LIBRARY string
AUDIO_SELECT string
AUDIO_UPDOWN string
AllowCameraMovement bool
ControlDisablingEnabled bool
FormatDescriptions bool
HoldTimeBeforeScroll uint
MenuItems List
MouseControlsEnabled bool
MouseEdgeEnabled bool
ResetCursorOnOpen bool

Public Methods

Method Description
AddInstructionalButton ( InstructionalButton button ) : void
AddItem ( UIMenuItem item ) : void

Add an item to the menu.

BindMenuToItem ( UIMenu menuToBind, UIMenuItem itemToBindTo ) : void

Bind a menu to a button. When the button is clicked that menu will open.

Clear ( ) : void

Remove all items from the menu.

DisEnableControls ( bool enable ) : void

Enable or disable all controls but the necessary to operate a menu.

DisableInstructionalButtons ( bool disable ) : void

Enable or disable the instructional buttons.

Draw ( ) : void

Draw the menu and all of it's components.

DrawBanner ( Rage g ) : void

Draw your custom banner.

To prevent flickering call it inside a Game.RawFrameRender event handler.

GetSafezoneBounds ( ) : Point

Returns the safezone bounds in pixel, relative to the 1080pixel based system.

GetScreenResolutionMantainRatio ( ) : SizeF

Returns the 1080pixels-based screen resolution while mantaining current aspect ratio.

GoBack ( ) : void

Close or go back in a menu chain.

GoDown ( ) : void

Go up the menu if the number of items is less than or equal to the maximum items on screen.

GoDownOverflow ( ) : void

Go down the menu if the number of items is more than maximum items on screen.

GoLeft ( ) : void

Go left on a MenuListItem.

GoRight ( ) : void

Go right on a MenuListItem.

GoUp ( ) : void

Go up the menu if the number of items is less than or equal to the maximum items on screen.

GoUpOverflow ( ) : void

Go up the menu if the number of items is more than maximum items on screen.

HasControlJustBeenPressed ( Common control, Keys key = Keys.None ) : bool

Check whether a menucontrol has been pressed.

HasControlJustBeenReleaseed ( Common control, Keys key = Keys.None ) : bool

Check whether a menucontrol has been released.

IsControlBeingPressed ( Common control, Keys key = Keys.None ) : bool

Checks whether a menucontrol is being pressed and if selected item is UIListItem, uses UIListItem variables

IsMouseInBounds ( Point topLeft, Size boxSize ) : bool

Chech whether the mouse is inside the specified rectangle.

IsMouseInListItemArrows ( UIMenuListItem item, Point topLeft, Point safezone ) : int

Function to get whether the cursor is in an arrow space, or in label of an MenuListItem.

ProcessControl ( Keys key = Keys.None ) : void

Process control-stroke. Call this in the Game.FrameRender event or in a loop.

ProcessKey ( Keys key ) : void

Process keystroke. Call this in the Game.FrameRender event or in a loop.

ProcessMouse ( ) : void

Process the mouse's position and check if it's hovering over any Element. Call this in Game.FrameRender or in a loop.

RefreshIndex ( ) : void

Reset the current selected item to 0. Use this after you add or remove items dynamically.

ReleaseMenuFromItem ( UIMenuItem releaseFrom ) : bool

Remove menu binding from button.

RemoveInstructionalButton ( InstructionalButton button ) : void
RemoveItemAt ( int index ) : void

Remove an item at index n.

Reset ( bool resetLists, bool resetCheckboxes ) : void

Sets the index of all lists to 0 and unchecks all the checkboxes.

ResetKey ( Common control ) : void

Remove all controls on a control.

SelectItem ( ) : void

Activate the current selected item.

SetBannerType ( RAGENativeUI.Elements.ResRectangle rectangle ) : void

Set the banner to your own Rectangle.

SetBannerType ( Sprite spriteBanner ) : void

Set the banner to your own Sprite object.

SetBannerType ( Texture texture ) : void

Set the banner to your own custom texture. Set it to null if you want to restore the banner.

SetKey ( Common control, GameControl gtaControl ) : void

Set a Rage.GameControl to control a menu. Can be multiple controls. This applies it to all indexes.

SetKey ( Common control, GameControl gtaControl, int controlIndex ) : void

Set a Rage.GameControl to control a menu only on a specific index.

SetKey ( Common control, Keys keyToSet ) : void

Set a key to control a menu. Can be multiple keys for each control.

SetMenuWidthOffset ( int widthOffset ) : void

Change the menu's width. The width is calculated as DefaultWidth + WidthOffset, so a width offset of 10 would enlarge the menu by 10 pixels.

UIMenu ( string title, string subtitle ) : System

Basic Menu constructor.

UIMenu ( string title, string subtitle, Point offset ) : System

Basic Menu constructor with an offset.

UIMenu ( string title, string subtitle, Point offset, Texture customBanner ) : System

Initialise a menu with a custom texture banner.

UIMenu ( string title, string subtitle, Point offset, string spriteLibrary, string spriteName ) : System

Advanced Menu constructor that allows custom title banner.

UpdateScaleform ( ) : void

Manually update the instructional buttons scaleform.

Protected Methods

Method Description
CheckboxChange ( RAGENativeUI.Elements.UIMenuCheckboxItem sender, bool Checked ) : void
IndexChange ( int newindex ) : void
ItemSelect ( UIMenuItem selecteditem, int index ) : void
ListChange ( UIMenuListItem sender, int newindex ) : void
MenuChangeEv ( UIMenu newmenu, bool forward ) : void
MenuCloseEv ( ) : void

Private Methods

Method Description
DrawBanner ( GraphicsEventArgs e ) : void
EnableCameraMovement ( ) : void
FormatDescription ( string input ) : string

Formats the input string so it doesn't go out of bounds of the description box.

RecaulculateDescriptionPosition ( ) : void

Method Details

AddInstructionalButton() public method

public AddInstructionalButton ( InstructionalButton button ) : void
button InstructionalButton
return void

AddItem() public method

Add an item to the menu.
public AddItem ( UIMenuItem item ) : void
item RAGENativeUI.Elements.UIMenuItem Item object to be added. Can be normal item, checkbox or list item.
return void

BindMenuToItem() public method

Bind a menu to a button. When the button is clicked that menu will open.
public BindMenuToItem ( UIMenu menuToBind, UIMenuItem itemToBindTo ) : void
menuToBind UIMenu
itemToBindTo RAGENativeUI.Elements.UIMenuItem
return void

CheckboxChange() protected method

protected CheckboxChange ( RAGENativeUI.Elements.UIMenuCheckboxItem sender, bool Checked ) : void
sender RAGENativeUI.Elements.UIMenuCheckboxItem
Checked bool
return void

Clear() public method

Remove all items from the menu.
public Clear ( ) : void
return void

DisEnableControls() public static method

Enable or disable all controls but the necessary to operate a menu.
public static DisEnableControls ( bool enable ) : void
enable bool
return void

DisableInstructionalButtons() public method

Enable or disable the instructional buttons.
public DisableInstructionalButtons ( bool disable ) : void
disable bool
return void

Draw() public method

Draw the menu and all of it's components.
public Draw ( ) : void
return void

DrawBanner() public method

Draw your custom banner.

To prevent flickering call it inside a Game.RawFrameRender event handler.

public DrawBanner ( Rage g ) : void
g Rage The to draw on.
return void

GetSafezoneBounds() public static method

Returns the safezone bounds in pixel, relative to the 1080pixel based system.
public static GetSafezoneBounds ( ) : Point
return Point

GetScreenResolutionMantainRatio() public static method

Returns the 1080pixels-based screen resolution while mantaining current aspect ratio.
public static GetScreenResolutionMantainRatio ( ) : SizeF
return System.Drawing.SizeF

GoBack() public method

Close or go back in a menu chain.
public GoBack ( ) : void
return void

GoDown() public method

Go up the menu if the number of items is less than or equal to the maximum items on screen.
public GoDown ( ) : void
return void

GoDownOverflow() public method

Go down the menu if the number of items is more than maximum items on screen.
public GoDownOverflow ( ) : void
return void

GoLeft() public method

Go left on a MenuListItem.
public GoLeft ( ) : void
return void

GoRight() public method

Go right on a MenuListItem.
public GoRight ( ) : void
return void

GoUp() public method

Go up the menu if the number of items is less than or equal to the maximum items on screen.
public GoUp ( ) : void
return void

GoUpOverflow() public method

Go up the menu if the number of items is more than maximum items on screen.
public GoUpOverflow ( ) : void
return void

HasControlJustBeenPressed() public method

Check whether a menucontrol has been pressed.
public HasControlJustBeenPressed ( Common control, Keys key = Keys.None ) : bool
control Common Control to check for.
key Keys Key if you're using keys.
return bool

HasControlJustBeenReleaseed() public method

Check whether a menucontrol has been released.
public HasControlJustBeenReleaseed ( Common control, Keys key = Keys.None ) : bool
control Common Control to check for.
key Keys Key if you're using keys.
return bool

IndexChange() protected method

protected IndexChange ( int newindex ) : void
newindex int
return void

IsControlBeingPressed() public method

Checks whether a menucontrol is being pressed and if selected item is UIListItem, uses UIListItem variables
public IsControlBeingPressed ( Common control, Keys key = Keys.None ) : bool
control Common
key Keys
return bool

IsMouseInBounds() public static method

Chech whether the mouse is inside the specified rectangle.
public static IsMouseInBounds ( Point topLeft, Size boxSize ) : bool
topLeft Point top left point of your rectangle.
boxSize System.Drawing.Size size of your rectangle.
return bool

IsMouseInListItemArrows() public method

Function to get whether the cursor is in an arrow space, or in label of an MenuListItem.
public IsMouseInListItemArrows ( UIMenuListItem item, Point topLeft, Point safezone ) : int
item RAGENativeUI.Elements.UIMenuListItem What item to check
topLeft Point top left point of the item.
safezone Point safezone size.
return int

ItemSelect() protected method

protected ItemSelect ( UIMenuItem selecteditem, int index ) : void
selecteditem RAGENativeUI.Elements.UIMenuItem
index int
return void

ListChange() protected method

protected ListChange ( UIMenuListItem sender, int newindex ) : void
sender RAGENativeUI.Elements.UIMenuListItem
newindex int
return void

MenuChangeEv() protected method

protected MenuChangeEv ( UIMenu newmenu, bool forward ) : void
newmenu UIMenu
forward bool
return void

MenuCloseEv() protected method

protected MenuCloseEv ( ) : void
return void

ProcessControl() public method

Process control-stroke. Call this in the Game.FrameRender event or in a loop.
public ProcessControl ( Keys key = Keys.None ) : void
key Keys
return void

ProcessKey() public method

Process keystroke. Call this in the Game.FrameRender event or in a loop.
public ProcessKey ( Keys key ) : void
key Keys
return void

ProcessMouse() public method

Process the mouse's position and check if it's hovering over any Element. Call this in Game.FrameRender or in a loop.
public ProcessMouse ( ) : void
return void

RefreshIndex() public method

Reset the current selected item to 0. Use this after you add or remove items dynamically.
public RefreshIndex ( ) : void
return void

ReleaseMenuFromItem() public method

Remove menu binding from button.
public ReleaseMenuFromItem ( UIMenuItem releaseFrom ) : bool
releaseFrom RAGENativeUI.Elements.UIMenuItem Button to release from.
return bool

RemoveInstructionalButton() public method

public RemoveInstructionalButton ( InstructionalButton button ) : void
button InstructionalButton
return void

RemoveItemAt() public method

Remove an item at index n.
public RemoveItemAt ( int index ) : void
index int Index to remove the item at.
return void

Reset() public method

Sets the index of all lists to 0 and unchecks all the checkboxes.
public Reset ( bool resetLists, bool resetCheckboxes ) : void
resetLists bool If true the index of all lists will be set to 0.
resetCheckboxes bool If true all the checkboxes will be unchecked.
return void

ResetKey() public method

Remove all controls on a control.
public ResetKey ( Common control ) : void
control Common
return void

SelectItem() public method

Activate the current selected item.
public SelectItem ( ) : void
return void

SetBannerType() public method

Set the banner to your own Rectangle.
public SetBannerType ( RAGENativeUI.Elements.ResRectangle rectangle ) : void
rectangle RAGENativeUI.Elements.ResRectangle UIResRectangle object. Position and size does not matter.
return void

SetBannerType() public method

Set the banner to your own Sprite object.
public SetBannerType ( Sprite spriteBanner ) : void
spriteBanner RAGENativeUI.Elements.Sprite Sprite object. The position and size does not matter.
return void

SetBannerType() public method

Set the banner to your own custom texture. Set it to null if you want to restore the banner.
public SetBannerType ( Texture texture ) : void
texture Texture Rage.Texture object
return void

SetKey() public method

Set a Rage.GameControl to control a menu. Can be multiple controls. This applies it to all indexes.
public SetKey ( Common control, GameControl gtaControl ) : void
control Common
gtaControl GameControl
return void

SetKey() public method

Set a Rage.GameControl to control a menu only on a specific index.
public SetKey ( Common control, GameControl gtaControl, int controlIndex ) : void
control Common
gtaControl GameControl
controlIndex int
return void

SetKey() public method

Set a key to control a menu. Can be multiple keys for each control.
public SetKey ( Common control, Keys keyToSet ) : void
control Common
keyToSet Keys
return void

SetMenuWidthOffset() public method

Change the menu's width. The width is calculated as DefaultWidth + WidthOffset, so a width offset of 10 would enlarge the menu by 10 pixels.
public SetMenuWidthOffset ( int widthOffset ) : void
widthOffset int New width offset.
return void

UIMenu() public method

Basic Menu constructor.
public UIMenu ( string title, string subtitle ) : System
title string Title that appears on the big banner.
subtitle string Subtitle that appears in capital letters in a small black bar.
return System

UIMenu() public method

Basic Menu constructor with an offset.
public UIMenu ( string title, string subtitle, Point offset ) : System
title string Title that appears on the big banner.
subtitle string Subtitle that appears in capital letters in a small black bar. Set to "" if you dont want a subtitle.
offset Point Point object with X and Y data for offsets. Applied to all menu elements.
return System

UIMenu() public method

Initialise a menu with a custom texture banner.
public UIMenu ( string title, string subtitle, Point offset, Texture customBanner ) : System
title string Title that appears on the big banner. Set to "" if you don't want a title.
subtitle string Subtitle that appears in capital letters in a small black bar. Set to "" if you dont want a subtitle.
offset Point Point object with X and Y data for offsets. Applied to all menu elements.
customBanner Texture Your custom Rage.Texture.
return System

UIMenu() public method

Advanced Menu constructor that allows custom title banner.
public UIMenu ( string title, string subtitle, Point offset, string spriteLibrary, string spriteName ) : System
title string Title that appears on the big banner. Set to "" if you are using a custom banner.
subtitle string Subtitle that appears in capital letters in a small black bar.
offset Point Point object with X and Y data for offsets. Applied to all menu elements.
spriteLibrary string Sprite library name for the banner.
spriteName string Sprite name for the banner.
return System

UpdateScaleform() public method

Manually update the instructional buttons scaleform.
public UpdateScaleform ( ) : void
return void

Property Details

AUDIO_BACK public_oe property

public string AUDIO_BACK
return string

AUDIO_ERROR public_oe property

public string AUDIO_ERROR
return string

AUDIO_LEFTRIGHT public_oe property

public string AUDIO_LEFTRIGHT
return string

AUDIO_LIBRARY public_oe property

public string AUDIO_LIBRARY
return string

AUDIO_SELECT public_oe property

public string AUDIO_SELECT
return string

AUDIO_UPDOWN public_oe property

public string AUDIO_UPDOWN
return string

AllowCameraMovement public_oe property

public bool AllowCameraMovement
return bool

ControlDisablingEnabled public_oe property

public bool ControlDisablingEnabled
return bool

FormatDescriptions public_oe property

public bool FormatDescriptions
return bool

HoldTimeBeforeScroll public_oe property

public uint HoldTimeBeforeScroll
return uint

MenuItems public_oe property

public List MenuItems
return List

MouseControlsEnabled public_oe property

public bool MouseControlsEnabled
return bool

MouseEdgeEnabled public_oe property

public bool MouseEdgeEnabled
return bool

ResetCursorOnOpen public_oe property

public bool ResetCursorOnOpen
return bool