C# Class NGUIText, swip3

Afficher le fichier Open project: unit9/swip3 Class Usage Examples

Méthodes publiques

Свойство Type Description
alignment TextAlignment
baseline float
bitmapFont UIFont,
dynamicFont Font
encoding bool
finalLineHeight float
finalSize int
finalSpacingX float
fontScale float
fontSize int
fontStyle FontStyle,
glyph GlyphInfo
gradient bool
gradientBottom Color
gradientTop Color
maxLines int
pixelDensity float
premultiply bool
rectHeight int
rectWidth int
spacingX float
spacingY float
symbolStyle SymbolStyle
tint Color
useSymbols bool

Méthodes publiques

Méthode Description
Align ( BetterList verts, int indexOffset, float offset ) : void

Align the vertices to be right or center-aligned given the line width specified by NGUIText.lineWidth.

CalculateOffsetToFit ( string text ) : int

Calculate the character index offset required to print the end of the specified text.

CalculatePrintedSize ( string text ) : Vector2

Get the printed size of the specified string. The returned value is in pixels.

EncodeColor ( Color c ) : string

The reverse of ParseColor -- encodes a color in RrGgBb format.

EndLine ( StringBuilder &s ) : void

Convenience function that ends the line by either appending a new line character or replacing a space with one.

GetClosestCharacter ( BetterList verts, Vector2 pos ) : int

Get the index of the closest character within the provided list of values. This function first sorts by Y, and only then by X.

GetEndOfLineThatFits ( string text ) : string

Get the end of line that would fit into a field of given width.

GetGlyph ( int ch, int prev ) : GlyphInfo

Get the specified glyph.

GetGlyphWidth ( int ch, int prev ) : float

Get the width of the specified glyph. Returns zero if the glyph could not be retrieved.

GetSymbol ( string text, int index, int textLength ) : BMSymbol,

Get the specified symbol.

ParseColor ( string text, int offset ) : Color

Parse a RrGgBb color encoded in the string.

ParseSymbol ( string text, int &index ) : bool

Parse an embedded symbol, such as [FFAA00] (set color) or [-] (undo color change). Returns whether the index was adjusted.

ParseSymbol ( string text, int &index, BetterList colors, bool premultiply, int &sub, bool &bold, bool &italic, bool &underline, bool &strike ) : bool

Parse the symbol, if possible. Returns 'true' if the 'index' was adjusted. Advanced symbol support contributed by Rudy Pangestu.

Prepare ( string text ) : void

Prepare to use the specified text.

Print ( string text, BetterList verts, BetterList uvs, BetterList cols ) : void

Print the specified text into the buffers.

PrintCaretAndSelection ( string text, int start, int end, BetterList caret, BetterList highlight ) : void

Print the caret and selection vertices. Note that it's expected that 'text' has been stripped clean of symbols.

PrintCharacterPositions ( string text, BetterList verts, BetterList indices ) : void

Print character positions and indices into the specified buffer. Meant to be used with the "find closest vertex" calculations.

RequestCharactersInTexture ( Font font, string text ) : void

Ensure that we have the requested characters present.

StripSymbols ( string text ) : string

Runs through the specified string and removes all color-encoding symbols.

Update ( ) : void

Recalculate the 'final' values.

Update ( bool request ) : void

Recalculate the 'final' values.

WrapText ( string text, string &finalText ) : bool

Text wrapping functionality. The 'width' and 'height' should be in pixels.

WrapText ( string text, string &finalText, bool keepCharCount ) : bool

Text wrapping functionality. The 'width' and 'height' should be in pixels.

Private Methods

Méthode Description
ReplaceSpaceWithNewline ( StringBuilder &s ) : void

Convenience function that ends the line by replacing a space with a newline character.

Method Details

Align() static public méthode

Align the vertices to be right or center-aligned given the line width specified by NGUIText.lineWidth.
static public Align ( BetterList verts, int indexOffset, float offset ) : void
verts BetterList
indexOffset int
offset float
Résultat void

CalculateOffsetToFit() static public méthode

Calculate the character index offset required to print the end of the specified text.
static public CalculateOffsetToFit ( string text ) : int
text string
Résultat int

CalculatePrintedSize() static public méthode

Get the printed size of the specified string. The returned value is in pixels.
static public CalculatePrintedSize ( string text ) : Vector2
text string
Résultat Vector2

EncodeColor() static public méthode

The reverse of ParseColor -- encodes a color in RrGgBb format.
static public EncodeColor ( Color c ) : string
c Color
Résultat string

EndLine() static public méthode

Convenience function that ends the line by either appending a new line character or replacing a space with one.
static public EndLine ( StringBuilder &s ) : void
s StringBuilder
Résultat void

GetClosestCharacter() static public méthode

Get the index of the closest character within the provided list of values. This function first sorts by Y, and only then by X.
static public GetClosestCharacter ( BetterList verts, Vector2 pos ) : int
verts BetterList
pos Vector2
Résultat int

GetEndOfLineThatFits() static public méthode

Get the end of line that would fit into a field of given width.
static public GetEndOfLineThatFits ( string text ) : string
text string
Résultat string

GetGlyph() static public méthode

Get the specified glyph.
static public GetGlyph ( int ch, int prev ) : GlyphInfo
ch int
prev int
Résultat GlyphInfo

GetGlyphWidth() static public méthode

Get the width of the specified glyph. Returns zero if the glyph could not be retrieved.
static public GetGlyphWidth ( int ch, int prev ) : float
ch int
prev int
Résultat float

GetSymbol() static public méthode

Get the specified symbol.
static public GetSymbol ( string text, int index, int textLength ) : BMSymbol,
text string
index int
textLength int
Résultat BMSymbol,

ParseColor() static public méthode

Parse a RrGgBb color encoded in the string.
static public ParseColor ( string text, int offset ) : Color
text string
offset int
Résultat Color

ParseSymbol() static public méthode

Parse an embedded symbol, such as [FFAA00] (set color) or [-] (undo color change). Returns whether the index was adjusted.
static public ParseSymbol ( string text, int &index ) : bool
text string
index int
Résultat bool

ParseSymbol() static public méthode

Parse the symbol, if possible. Returns 'true' if the 'index' was adjusted. Advanced symbol support contributed by Rudy Pangestu.
static public ParseSymbol ( string text, int &index, BetterList colors, bool premultiply, int &sub, bool &bold, bool &italic, bool &underline, bool &strike ) : bool
text string
index int
colors BetterList
premultiply bool
sub int
bold bool
italic bool
underline bool
strike bool
Résultat bool

Prepare() static public méthode

Prepare to use the specified text.
static public Prepare ( string text ) : void
text string
Résultat void

Print() static public méthode

Print the specified text into the buffers.
static public Print ( string text, BetterList verts, BetterList uvs, BetterList cols ) : void
text string
verts BetterList
uvs BetterList
cols BetterList
Résultat void

PrintCaretAndSelection() static public méthode

Print the caret and selection vertices. Note that it's expected that 'text' has been stripped clean of symbols.
static public PrintCaretAndSelection ( string text, int start, int end, BetterList caret, BetterList highlight ) : void
text string
start int
end int
caret BetterList
highlight BetterList
Résultat void

PrintCharacterPositions() static public méthode

Print character positions and indices into the specified buffer. Meant to be used with the "find closest vertex" calculations.
static public PrintCharacterPositions ( string text, BetterList verts, BetterList indices ) : void
text string
verts BetterList
indices BetterList
Résultat void

RequestCharactersInTexture() static public méthode

Ensure that we have the requested characters present.
static public RequestCharactersInTexture ( Font font, string text ) : void
font Font
text string
Résultat void

StripSymbols() static public méthode

Runs through the specified string and removes all color-encoding symbols.
static public StripSymbols ( string text ) : string
text string
Résultat string

Update() static public méthode

Recalculate the 'final' values.
static public Update ( ) : void
Résultat void

Update() static public méthode

Recalculate the 'final' values.
static public Update ( bool request ) : void
request bool
Résultat void

WrapText() static public méthode

Text wrapping functionality. The 'width' and 'height' should be in pixels.
static public WrapText ( string text, string &finalText ) : bool
text string
finalText string
Résultat bool

WrapText() static public méthode

Text wrapping functionality. The 'width' and 'height' should be in pixels.
static public WrapText ( string text, string &finalText, bool keepCharCount ) : bool
text string
finalText string
keepCharCount bool
Résultat bool

Property Details

alignment static_oe public_oe property

static public TextAlignment alignment
Résultat TextAlignment

baseline static_oe public_oe property

static public float baseline
Résultat float

bitmapFont static_oe public_oe property

When printing text, a lot of additional data must be passed in. In order to save allocations, this data is not passed at all, but is rather set in a single place before calling the functions that use it.
static public UIFont, bitmapFont
Résultat UIFont,

dynamicFont static_oe public_oe property

static public Font dynamicFont
Résultat Font

encoding static_oe public_oe property

static public bool encoding
Résultat bool

finalLineHeight static_oe public_oe property

static public float finalLineHeight
Résultat float

finalSize static_oe public_oe property

static public int finalSize
Résultat int

finalSpacingX static_oe public_oe property

static public float finalSpacingX
Résultat float

fontScale static_oe public_oe property

static public float fontScale
Résultat float

fontSize static_oe public_oe property

static public int fontSize
Résultat int

fontStyle static_oe public_oe property

static public FontStyle, fontStyle
Résultat FontStyle,

glyph static_oe public_oe property

static public GlyphInfo glyph
Résultat GlyphInfo

gradient static_oe public_oe property

static public bool gradient
Résultat bool

gradientBottom static_oe public_oe property

static public Color gradientBottom
Résultat Color

gradientTop static_oe public_oe property

static public Color gradientTop
Résultat Color

maxLines static_oe public_oe property

static public int maxLines
Résultat int

pixelDensity static_oe public_oe property

static public float pixelDensity
Résultat float

premultiply static_oe public_oe property

static public bool premultiply
Résultat bool

rectHeight static_oe public_oe property

static public int rectHeight
Résultat int

rectWidth static_oe public_oe property

static public int rectWidth
Résultat int

spacingX static_oe public_oe property

static public float spacingX
Résultat float

spacingY static_oe public_oe property

static public float spacingY
Résultat float

symbolStyle static_oe public_oe property

static public SymbolStyle symbolStyle
Résultat SymbolStyle

tint static_oe public_oe property

static public Color tint
Résultat Color

useSymbols static_oe public_oe property

static public bool useSymbols
Résultat bool