C# Класс XnaFlixel.FlxButton

A simple button class that calls a function when clicked by the mouse. Supports labels, highlight states, and parallax scrolling.
Наследование: FlxGroup
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
_callback FlxButtonClick
_initialized bool
_off FlxSprite
_offT FlxText
_on FlxSprite
_onT FlxText
_onToggle bool
_pressed bool
_sf Microsoft.Xna.Framework.Vector2

Открытые методы

Метод Описание
Destroy ( ) : void

Called by the game state when state is changed (if this object belongs to the state)

FlxButton ( int x, int y, FlxButtonClick callback ) : Microsoft.Xna.Framework

Creates a new FlxButton object with a gray background and a callback function on the UI thread.

LoadGraphic ( FlxSprite image, FlxSprite imageHighlight ) : FlxButton

Set your own image as the button background.

LoadText ( FlxText text, FlxText textHighlight ) : FlxButton

Add a text label to the button.

Render ( SpriteBatch spriteBatch ) : void
Update ( ) : void

Called by the game loop automatically, handles mouseover and click detection.

Защищенные методы

Метод Описание
visibility ( bool on ) : void

Internal function for handling the visibility of the off and on graphics.

Приватные методы

Метод Описание
OnMouseUp ( object sender, FlxMouseEvent mouseEvent ) : void

Internal function for handling the actual callback call (for UI thread dependent calls like FlxU.openURL()).

Описание методов

Destroy() публичный Метод

Called by the game state when state is changed (if this object belongs to the state)
public Destroy ( ) : void
Результат void

FlxButton() публичный Метод

Creates a new FlxButton object with a gray background and a callback function on the UI thread.
public FlxButton ( int x, int y, FlxButtonClick callback ) : Microsoft.Xna.Framework
x int The X position of the button.
y int The Y position of the button.
callback FlxButtonClick The function to call whenever the button is clicked.
Результат Microsoft.Xna.Framework

LoadGraphic() публичный Метод

Set your own image as the button background.
public LoadGraphic ( FlxSprite image, FlxSprite imageHighlight ) : FlxButton
image FlxSprite A FlxSprite object to use for the button background.
imageHighlight FlxSprite A FlxSprite object to use for the button background when highlighted (optional).
Результат FlxButton

LoadText() публичный Метод

Add a text label to the button.
public LoadText ( FlxText text, FlxText textHighlight ) : FlxButton
text FlxText A FlxText object to use to display text on this button (optional).
textHighlight FlxText A FlxText object that is used when the button is highlighted (optional).
Результат FlxButton

Render() публичный Метод

public Render ( SpriteBatch spriteBatch ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch
Результат void

Update() публичный Метод

Called by the game loop automatically, handles mouseover and click detection.
public Update ( ) : void
Результат void

visibility() защищенный Метод

Internal function for handling the visibility of the off and on graphics.
protected visibility ( bool on ) : void
on bool Whether the button should be on or off.
Результат void

Описание свойств

_callback защищенное свойство

This function is called when the button is clicked.
protected FlxButtonClick _callback
Результат FlxButtonClick

_initialized защищенное свойство

Whether or not the button has initialized itself yet.
protected bool _initialized
Результат bool

_off защищенное свойство

Stores the 'off' or normal button state graphic.
protected FlxSprite _off
Результат FlxSprite

_offT защищенное свойство

Stores the 'off' or normal button state label.
protected FlxText _offT
Результат FlxText

_on защищенное свойство

Stores the 'on' or highlighted button state graphic.
protected FlxSprite _on
Результат FlxSprite

_onT защищенное свойство

Stores the 'on' or highlighted button state label.
protected FlxText _onT
Результат FlxText

_onToggle защищенное свойство

Used for checkbox-style behavior.
protected bool _onToggle
Результат bool

_pressed защищенное свойство

Tracks whether or not the button is currently pressed.
protected bool _pressed
Результат bool

_sf защищенное свойство

Helper variable for correcting its members' scrollFactor objects.
protected Vector2,Microsoft.Xna.Framework _sf
Результат Microsoft.Xna.Framework.Vector2